aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu_pm.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-07-22 14:57:09 -0700
committerCaio Schnepper <caioschnepper@gmail.com>2015-07-01 09:02:49 -0300
commitfe86b4a1a9d1caabcb9e4a4f11338d304a7bdb2c (patch)
treecc5ddac51ba6afcbf7c393d94668db512059ee96 /kernel/cpu_pm.c
parent01983eca8da95010380dce7910fd6e0bcb8c7340 (diff)
downloadkernel_samsung_smdk4412-fe86b4a1a9d1caabcb9e4a4f11338d304a7bdb2c.zip
kernel_samsung_smdk4412-fe86b4a1a9d1caabcb9e4a4f11338d304a7bdb2c.tar.gz
kernel_samsung_smdk4412-fe86b4a1a9d1caabcb9e4a4f11338d304a7bdb2c.tar.bz2
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. Change-Id: I82b1a1e4464b8250a547f23999151c8a09ca4e22 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 4d1ff4a..249152e 100644
--- a/kernel/cpu_pm.c
+++ b/kernel/cpu_pm.c
@@ -20,6 +20,7 @@
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/spinlock.h>
+#include <linux/syscore_ops.h>
static DEFINE_RWLOCK(cpu_pm_notifier_lock);
static RAW_NOTIFIER_HEAD(cpu_pm_notifier_chain);
@@ -198,3 +199,35 @@ int cpu_cluster_pm_exit(void)
return ret;
}
EXPORT_SYMBOL_GPL(cpu_cluster_pm_exit);
+
+#ifdef CONFIG_PM
+static int cpu_pm_suspend(void)
+{
+ int ret;
+
+ ret = cpu_pm_enter();
+ if (ret)
+ return ret;
+
+ ret = cpu_cluster_pm_enter();
+ return ret;
+}
+
+static void cpu_pm_resume(void)
+{
+ cpu_cluster_pm_exit();
+ cpu_pm_exit();
+}
+
+static struct syscore_ops cpu_pm_syscore_ops = {
+ .suspend = cpu_pm_suspend,
+ .resume = cpu_pm_resume,
+};
+
+static int cpu_pm_init(void)
+{
+ register_syscore_ops(&cpu_pm_syscore_ops);
+ return 0;
+}
+core_initcall(cpu_pm_init);
+#endif