aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu_pm.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-07-22 17:57:09 -0400
committerSantosh Shilimkar <santosh.shilimkar@ti.com>2011-09-23 02:35:29 -0400
commit6f3eaec87b6b17bfa49cb3b5b8d07fa84be18512 (patch)
treeafbb36f2d94758a6b2e00cb8937e0fba7de755a7 /kernel/cpu_pm.c
parentab10023e0088d5075354afc7cb9e72304757dddd (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/cpu_pm.c')
-rw-r--r--kernel/cpu_pm.c33
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
24static DEFINE_RWLOCK(cpu_pm_notifier_lock); 25static DEFINE_RWLOCK(cpu_pm_notifier_lock);
25static RAW_NOTIFIER_HEAD(cpu_pm_notifier_chain); 26static 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}
200EXPORT_SYMBOL_GPL(cpu_cluster_pm_exit); 201EXPORT_SYMBOL_GPL(cpu_cluster_pm_exit);
202
203#ifdef CONFIG_PM
204static 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
216static void cpu_pm_resume(void)
217{
218 cpu_cluster_pm_exit();
219 cpu_pm_exit();
220}
221
222static struct syscore_ops cpu_pm_syscore_ops = {
223 .suspend = cpu_pm_suspend,
224 .resume = cpu_pm_resume,
225};
226
227static int cpu_pm_init(void)
228{
229 register_syscore_ops(&cpu_pm_syscore_ops);
230 return 0;
231}
232core_initcall(cpu_pm_init);
233#endif