Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f3eaec8 authored by Colin Cross's avatar Colin Cross Committed by Santosh Shilimkar
Browse files

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: default avatarColin Cross <ccross@android.com>
Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: default avatarKevin Hilman <khilman@ti.com>
Tested-and-Acked-by: default avatarShawn Guo <shawn.guo@linaro.org>
Tested-by: default avatarVishwanath BS <vishwanath.bs@ti.com>
parent ab10023e
Loading
Loading
Loading
Loading
+33 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/module.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/notifier.h>
#include <linux/spinlock.h>
#include <linux/spinlock.h>
#include <linux/syscore_ops.h>


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