Commit 6f3eaec87b6b17bfa49cb3b5b8d07fa84be18512
Committed by
Santosh Shilimkar
1 parent
ab10023e00
Exists in
master
and in
6 other branches
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>
Showing 1 changed file with 33 additions and 0 deletions Side-by-side Diff
kernel/cpu_pm.c
... | ... | @@ -20,6 +20,7 @@ |
20 | 20 | #include <linux/module.h> |
21 | 21 | #include <linux/notifier.h> |
22 | 22 | #include <linux/spinlock.h> |
23 | +#include <linux/syscore_ops.h> | |
23 | 24 | |
24 | 25 | static DEFINE_RWLOCK(cpu_pm_notifier_lock); |
25 | 26 | static RAW_NOTIFIER_HEAD(cpu_pm_notifier_chain); |
... | ... | @@ -198,4 +199,36 @@ |
198 | 199 | return ret; |
199 | 200 | } |
200 | 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 |