diff options
author | Gregory CLEMENT <gregory.clement@free-electrons.com> | 2014-04-14 11:10:12 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-05-08 12:19:00 -0400 |
commit | d163ee165bd49a51f77bae632ebf37eda4899d0e (patch) | |
tree | 2ee0c618ff44c8d4b53517ac6a5dc83f21fb1891 /arch/arm/mach-mvebu/pmsu.c | |
parent | 0041464ceeccd4718de228141438335e2d92f91b (diff) |
ARM: mvebu: Register notifier callback for the cpuidle transition
In order to have well encapsulated code, we use notifier callbacks for
CPU_PM_ENTER and CPU_PM_EXIT inside the mvebu power management code.
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1397488214-20685-10-git-send-email-gregory.clement@free-electrons.com
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-mvebu/pmsu.c')
-rw-r--r-- | arch/arm/mach-mvebu/pmsu.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c index 78cf0279e1af..7902d21d7d68 100644 --- a/arch/arm/mach-mvebu/pmsu.c +++ b/arch/arm/mach-mvebu/pmsu.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #define pr_fmt(fmt) "mvebu-pmsu: " fmt | 19 | #define pr_fmt(fmt) "mvebu-pmsu: " fmt |
20 | 20 | ||
21 | #include <linux/cpu_pm.h> | ||
21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
22 | #include <linux/init.h> | 23 | #include <linux/init.h> |
23 | #include <linux/of_address.h> | 24 | #include <linux/of_address.h> |
@@ -240,4 +241,21 @@ static noinline void armada_370_xp_pmsu_idle_restore(void) | |||
240 | writel(reg, pmsu_mp_base + PMSU_STATUS_AND_MASK(hw_cpu)); | 241 | writel(reg, pmsu_mp_base + PMSU_STATUS_AND_MASK(hw_cpu)); |
241 | } | 242 | } |
242 | 243 | ||
244 | static int armada_370_xp_cpu_pm_notify(struct notifier_block *self, | ||
245 | unsigned long action, void *hcpu) | ||
246 | { | ||
247 | if (action == CPU_PM_ENTER) { | ||
248 | unsigned int hw_cpu = cpu_logical_map(smp_processor_id()); | ||
249 | mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_370_xp_cpu_resume); | ||
250 | } else if (action == CPU_PM_EXIT) { | ||
251 | armada_370_xp_pmsu_idle_restore(); | ||
252 | } | ||
253 | |||
254 | return NOTIFY_OK; | ||
255 | } | ||
256 | |||
257 | static struct notifier_block armada_370_xp_cpu_pm_notifier = { | ||
258 | .notifier_call = armada_370_xp_cpu_pm_notify, | ||
259 | }; | ||
260 | |||
243 | early_initcall(armada_370_xp_pmsu_init); | 261 | early_initcall(armada_370_xp_pmsu_init); |