diff options
| author | Colin Cross <ccross@android.com> | 2011-07-22 17:57:09 -0400 |
|---|---|---|
| committer | Santosh Shilimkar <santosh.shilimkar@ti.com> | 2011-09-23 02:35:29 -0400 |
| commit | 6f3eaec87b6b17bfa49cb3b5b8d07fa84be18512 (patch) | |
| tree | afbb36f2d94758a6b2e00cb8937e0fba7de755a7 /kernel | |
| parent | ab10023e0088d5075354afc7cb9e72304757dddd (diff) | |
cpu_pm: call notifiers during suspend
Implements syscore_ops in cpu_pm to call the cpu and
cpu cluster notifiers during suspend and resume,
allowing drivers receiving the notifications to
avoid implementing syscore_ops.
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-and-Acked-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Vishwanath BS <vishwanath.bs@ti.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/cpu_pm.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/cpu_pm.c b/kernel/cpu_pm.c index 4d1ff4acd04b..249152e15308 100644 --- a/kernel/cpu_pm.c +++ b/kernel/cpu_pm.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| 21 | #include <linux/notifier.h> | 21 | #include <linux/notifier.h> |
| 22 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
| 23 | #include <linux/syscore_ops.h> | ||
| 23 | 24 | ||
| 24 | static DEFINE_RWLOCK(cpu_pm_notifier_lock); | 25 | static DEFINE_RWLOCK(cpu_pm_notifier_lock); |
| 25 | static RAW_NOTIFIER_HEAD(cpu_pm_notifier_chain); | 26 | static RAW_NOTIFIER_HEAD(cpu_pm_notifier_chain); |
| @@ -198,3 +199,35 @@ int cpu_cluster_pm_exit(void) | |||
| 198 | return ret; | 199 | return ret; |
| 199 | } | 200 | } |
| 200 | EXPORT_SYMBOL_GPL(cpu_cluster_pm_exit); | 201 | EXPORT_SYMBOL_GPL(cpu_cluster_pm_exit); |
| 202 | |||
| 203 | #ifdef CONFIG_PM | ||
| 204 | static int cpu_pm_suspend(void) | ||
| 205 | { | ||
| 206 | int ret; | ||
| 207 | |||
| 208 | ret = cpu_pm_enter(); | ||
| 209 | if (ret) | ||
| 210 | return ret; | ||
| 211 | |||
| 212 | ret = cpu_cluster_pm_enter(); | ||
| 213 | return ret; | ||
| 214 | } | ||
| 215 | |||
| 216 | static void cpu_pm_resume(void) | ||
| 217 | { | ||
| 218 | cpu_cluster_pm_exit(); | ||
| 219 | cpu_pm_exit(); | ||
| 220 | } | ||
| 221 | |||
| 222 | static struct syscore_ops cpu_pm_syscore_ops = { | ||
| 223 | .suspend = cpu_pm_suspend, | ||
| 224 | .resume = cpu_pm_resume, | ||
| 225 | }; | ||
| 226 | |||
| 227 | static int cpu_pm_init(void) | ||
| 228 | { | ||
| 229 | register_syscore_ops(&cpu_pm_syscore_ops); | ||
| 230 | return 0; | ||
| 231 | } | ||
| 232 | core_initcall(cpu_pm_init); | ||
| 233 | #endif | ||
