Skip to content

Commit 6f3eaec

Browse files
colincrossSantosh Shilimkar
authored andcommitted
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>
1 parent ab10023 commit 6f3eaec

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎kernel/cpu_pm.c‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/module.h>
2121
#include <linux/notifier.h>
2222
#include <linux/spinlock.h>
23+
#include <linux/syscore_ops.h>
2324

2425
static DEFINE_RWLOCK(cpu_pm_notifier_lock);
2526
static RAW_NOTIFIER_HEAD(cpu_pm_notifier_chain);
@@ -198,3 +199,35 @@ int cpu_cluster_pm_exit(void)
198199
return ret;
199200
}
200201
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

0 commit comments

Comments
 (0)