Matt Wagantall | f802090 | 2011-08-30 21:19:23 -0700 | [diff] [blame] | 1 | /* |
Jack Pham | ccbbfab | 2012-04-09 19:50:20 -0700 | [diff] [blame] | 2 | * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Matt Wagantall | f802090 | 2011-08-30 21:19:23 -0700 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #ifndef __MSM_SYSMON_H |
| 16 | #define __MSM_SYSMON_H |
| 17 | |
Matt Wagantall | c3d9a2f | 2012-04-13 12:39:17 -0700 | [diff] [blame] | 18 | #include <mach/msm_smd.h> |
Matt Wagantall | f802090 | 2011-08-30 21:19:23 -0700 | [diff] [blame] | 19 | #include <mach/subsystem_notif.h> |
| 20 | |
Matt Wagantall | 14080c1 | 2011-10-19 12:24:00 -0700 | [diff] [blame] | 21 | /** |
| 22 | * enum subsys_id - Destination subsystems for events. |
| 23 | */ |
Matt Wagantall | f802090 | 2011-08-30 21:19:23 -0700 | [diff] [blame] | 24 | enum subsys_id { |
Matt Wagantall | c3d9a2f | 2012-04-13 12:39:17 -0700 | [diff] [blame] | 25 | /* SMD subsystems */ |
| 26 | SYSMON_SS_MODEM = SMD_APPS_MODEM, |
| 27 | SYSMON_SS_LPASS = SMD_APPS_QDSP, |
| 28 | SYSMON_SS_WCNSS = SMD_APPS_WCNSS, |
| 29 | SYSMON_SS_DSPS = SMD_APPS_DSPS, |
| 30 | SYSMON_SS_Q6FW = SMD_APPS_Q6FW, |
| 31 | |
| 32 | /* Non-SMD subsystems */ |
| 33 | SYSMON_SS_EXT_MODEM = SMD_NUM_TYPE, |
Matt Wagantall | f802090 | 2011-08-30 21:19:23 -0700 | [diff] [blame] | 34 | SYSMON_NUM_SS |
| 35 | }; |
| 36 | |
Matt Wagantall | 14080c1 | 2011-10-19 12:24:00 -0700 | [diff] [blame] | 37 | /** |
| 38 | * sysmon_send_event() - Notify a subsystem of another's state change. |
| 39 | * @dest_ss: ID of subsystem the notification should be sent to. |
| 40 | * @event_ss: String name of the subsystem that generated the notification. |
| 41 | * @notif: ID of the notification type (ex. SUBSYS_BEFORE_SHUTDOWN) |
| 42 | * |
| 43 | * Returns 0 for success, -EINVAL for invalid destination or notification IDs, |
| 44 | * -ENODEV if the SMD channel is not open, -ETIMEDOUT if the destination |
| 45 | * subsystem does not respond, and -ENOSYS if the destination subsystem |
| 46 | * responds, but with something other than an acknowledgement. |
| 47 | * |
| 48 | * If CONFIG_MSM_SYSMON_COMM is not defined, always return success (0). |
| 49 | */ |
Matt Wagantall | f802090 | 2011-08-30 21:19:23 -0700 | [diff] [blame] | 50 | #ifdef CONFIG_MSM_SYSMON_COMM |
| 51 | int sysmon_send_event(enum subsys_id dest_ss, const char *event_ss, |
| 52 | enum subsys_notif_type notif); |
| 53 | #else |
| 54 | static inline int sysmon_send_event(enum subsys_id dest_ss, |
| 55 | const char *event_ss, |
| 56 | enum subsys_notif_type notif) |
| 57 | { |
| 58 | return 0; |
| 59 | } |
| 60 | #endif |
| 61 | |
| 62 | #endif |