Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef __SUBSYS_RESTART_H |
| 15 | #define __SUBSYS_RESTART_H |
| 16 | |
| 17 | #include <linux/spinlock.h> |
| 18 | |
| 19 | #define SUBSYS_NAME_MAX_LENGTH 40 |
| 20 | |
| 21 | enum { |
| 22 | RESET_SOC = 1, |
| 23 | RESET_SUBSYS_COUPLED, |
| 24 | RESET_SUBSYS_INDEPENDENT, |
| 25 | RESET_SUBSYS_MIXED = 25, |
| 26 | RESET_LEVEL_MAX |
| 27 | }; |
| 28 | |
| 29 | struct subsys_data { |
| 30 | const char *name; |
| 31 | int (*shutdown) (const struct subsys_data *); |
| 32 | int (*powerup) (const struct subsys_data *); |
| 33 | void (*crash_shutdown) (const struct subsys_data *); |
| 34 | int (*ramdump) (int, const struct subsys_data *); |
| 35 | |
| 36 | /* Internal use only */ |
| 37 | struct list_head list; |
| 38 | void *notif_handle; |
| 39 | |
| 40 | struct mutex shutdown_lock; |
| 41 | struct mutex powerup_lock; |
| 42 | |
| 43 | void *restart_order; |
| 44 | struct subsys_data *single_restart_list[1]; |
| 45 | }; |
| 46 | |
| 47 | #if defined(CONFIG_MSM_SUBSYSTEM_RESTART) |
| 48 | |
| 49 | int get_restart_level(void); |
| 50 | int subsystem_restart(const char *subsys_name); |
| 51 | int ssr_register_subsystem(struct subsys_data *subsys); |
| 52 | |
| 53 | #else |
| 54 | |
| 55 | static inline int get_restart_level(void) |
| 56 | { |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | static inline int subsystem_restart(const char *subsystem_name) |
| 61 | { |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | static inline int ssr_register_subsystem(struct subsys_data *subsys) |
| 66 | { |
| 67 | return 0; |
| 68 | } |
| 69 | |
| 70 | #endif /* CONFIG_MSM_SUBSYSTEM_RESTART */ |
| 71 | |
| 72 | #endif |