Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
cpu_pm: call notifiers during suspend
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
colincross authored and Santosh Shilimkar committed Sep 23, 2011
1 parent ab10023 commit 6f3eaec
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions kernel/cpu_pm.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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

0 comments on commit 6f3eaec

Please sign in to comment.