From: Daniel Lezcano <daniel.lezcano@linaro.org> To: kgene.kim@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, t.figa@samsung.com, linaro-kernel@lists.linaro.org, rjw@rjwysocki.net Subject: [PATCH V2 07/17] ARM: exynos: cpuidle: Use the cpu_pm notifier Date: Fri, 4 Apr 2014 15:42:59 +0200 [thread overview] Message-ID: <1396618989-2897-8-git-send-email-daniel.lezcano@linaro.org> (raw) In-Reply-To: <1396618989-2897-1-git-send-email-daniel.lezcano@linaro.org> Use the cpu_pm_enter/exit notifier to group some pm code inside the pm file. The save and restore code is duplicated across pm.c and cpuidle.c. By using the cpu_pm notifier, we can factor out the routine. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> --- arch/arm/mach-exynos/cpuidle.c | 24 ------------------------ arch/arm/mach-exynos/pm.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index 6663349..7f1f4ef 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -65,26 +65,6 @@ static void exynos_set_wakeupmask(void) __raw_writel(0x0000ff3e, S5P_WAKEUP_MASK); } -static unsigned int g_pwr_ctrl, g_diag_reg; - -static void save_cpu_arch_register(void) -{ - /*read power control register*/ - asm("mrc p15, 0, %0, c15, c0, 0" : "=r"(g_pwr_ctrl) : : "cc"); - /*read diagnostic register*/ - asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc"); - return; -} - -static void restore_cpu_arch_register(void) -{ - /*write power control register*/ - asm("mcr p15, 0, %0, c15, c0, 0" : : "r"(g_pwr_ctrl) : "cc"); - /*write diagnostic register*/ - asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc"); - return; -} - static int idle_finisher(unsigned long flags) { exynos_set_wakeupmask(); @@ -106,8 +86,6 @@ static int exynos_enter_core0_aftr(struct cpuidle_device *dev, { unsigned long tmp; - save_cpu_arch_register(); - /* Setting Central Sequence Register for power down mode */ tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); tmp &= ~S5P_CENTRAL_LOWPWR_CFG; @@ -122,8 +100,6 @@ static int exynos_enter_core0_aftr(struct cpuidle_device *dev, #endif cpu_pm_exit(); - restore_cpu_arch_register(); - /* * If PMU failed while entering sleep mode, WFI will be * ignored by PMU and then exiting cpu_do_idle(). diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index adfdf4b..67d75fe 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -16,6 +16,7 @@ #include <linux/init.h> #include <linux/suspend.h> #include <linux/syscore_ops.h> +#include <linux/cpu_pm.h> #include <linux/io.h> #include <linux/irqchip/arm-gic.h> #include <linux/err.h> @@ -321,10 +322,38 @@ static const struct platform_suspend_ops exynos_suspend_ops = { .valid = suspend_valid_only_mem, }; +static int exynos_cpu_pm_notifier(struct notifier_block *self, + unsigned long cmd, void *v) +{ + int cpu = smp_processor_id(); + + switch (cmd) { + case CPU_PM_ENTER: + if (cpu == 0) { + exynos_cpu_save_register(); + } + break; + + case CPU_PM_EXIT: + if (cpu == 0) { + exynos_cpu_restore_register(); + } + break; + } + + return NOTIFY_OK; +} + +static struct notifier_block exynos_cpu_pm_notifier_block = { + .notifier_call = exynos_cpu_pm_notifier, +}; + void __init exynos_pm_init(void) { u32 tmp; + cpu_pm_register_notifier(&exynos_cpu_pm_notifier_block); + /* Platform-specific GIC callback */ gic_arch_extn.irq_set_wake = exynos_irq_set_wake; -- 1.7.9.5
WARNING: multiple messages have this Message-ID (diff)
From: daniel.lezcano@linaro.org (Daniel Lezcano) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH V2 07/17] ARM: exynos: cpuidle: Use the cpu_pm notifier Date: Fri, 4 Apr 2014 15:42:59 +0200 [thread overview] Message-ID: <1396618989-2897-8-git-send-email-daniel.lezcano@linaro.org> (raw) In-Reply-To: <1396618989-2897-1-git-send-email-daniel.lezcano@linaro.org> Use the cpu_pm_enter/exit notifier to group some pm code inside the pm file. The save and restore code is duplicated across pm.c and cpuidle.c. By using the cpu_pm notifier, we can factor out the routine. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> --- arch/arm/mach-exynos/cpuidle.c | 24 ------------------------ arch/arm/mach-exynos/pm.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index 6663349..7f1f4ef 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -65,26 +65,6 @@ static void exynos_set_wakeupmask(void) __raw_writel(0x0000ff3e, S5P_WAKEUP_MASK); } -static unsigned int g_pwr_ctrl, g_diag_reg; - -static void save_cpu_arch_register(void) -{ - /*read power control register*/ - asm("mrc p15, 0, %0, c15, c0, 0" : "=r"(g_pwr_ctrl) : : "cc"); - /*read diagnostic register*/ - asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc"); - return; -} - -static void restore_cpu_arch_register(void) -{ - /*write power control register*/ - asm("mcr p15, 0, %0, c15, c0, 0" : : "r"(g_pwr_ctrl) : "cc"); - /*write diagnostic register*/ - asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc"); - return; -} - static int idle_finisher(unsigned long flags) { exynos_set_wakeupmask(); @@ -106,8 +86,6 @@ static int exynos_enter_core0_aftr(struct cpuidle_device *dev, { unsigned long tmp; - save_cpu_arch_register(); - /* Setting Central Sequence Register for power down mode */ tmp = __raw_readl(S5P_CENTRAL_SEQ_CONFIGURATION); tmp &= ~S5P_CENTRAL_LOWPWR_CFG; @@ -122,8 +100,6 @@ static int exynos_enter_core0_aftr(struct cpuidle_device *dev, #endif cpu_pm_exit(); - restore_cpu_arch_register(); - /* * If PMU failed while entering sleep mode, WFI will be * ignored by PMU and then exiting cpu_do_idle(). diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index adfdf4b..67d75fe 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -16,6 +16,7 @@ #include <linux/init.h> #include <linux/suspend.h> #include <linux/syscore_ops.h> +#include <linux/cpu_pm.h> #include <linux/io.h> #include <linux/irqchip/arm-gic.h> #include <linux/err.h> @@ -321,10 +322,38 @@ static const struct platform_suspend_ops exynos_suspend_ops = { .valid = suspend_valid_only_mem, }; +static int exynos_cpu_pm_notifier(struct notifier_block *self, + unsigned long cmd, void *v) +{ + int cpu = smp_processor_id(); + + switch (cmd) { + case CPU_PM_ENTER: + if (cpu == 0) { + exynos_cpu_save_register(); + } + break; + + case CPU_PM_EXIT: + if (cpu == 0) { + exynos_cpu_restore_register(); + } + break; + } + + return NOTIFY_OK; +} + +static struct notifier_block exynos_cpu_pm_notifier_block = { + .notifier_call = exynos_cpu_pm_notifier, +}; + void __init exynos_pm_init(void) { u32 tmp; + cpu_pm_register_notifier(&exynos_cpu_pm_notifier_block); + /* Platform-specific GIC callback */ gic_arch_extn.irq_set_wake = exynos_irq_set_wake; -- 1.7.9.5
next prev parent reply other threads:[~2014-04-04 13:43 UTC|newest] Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-04-04 13:42 [PATCH V2 00/17] ARM: exynos: cpuidle: Move the driver to drivers/cpuidle Daniel Lezcano 2014-04-04 13:42 ` Daniel Lezcano 2014-04-04 13:42 ` [PATCH V2 01/17] ARM: exynos: cpuidle: Prevent forward declaration Daniel Lezcano 2014-04-04 13:42 ` Daniel Lezcano 2014-04-04 15:24 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:24 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:42 ` [PATCH V2 02/17] ARM: exynos: cpuidle: use cpuidle_register Daniel Lezcano 2014-04-04 13:42 ` Daniel Lezcano 2014-04-04 15:28 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:28 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:42 ` [PATCH V2 03/17] ARM: exynos: cpuidle: change function name prefix Daniel Lezcano 2014-04-04 13:42 ` Daniel Lezcano 2014-04-04 15:28 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:28 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:42 ` [PATCH V2 04/17] ARM: exynos: cpuidle: encapsulate register access inside a function Daniel Lezcano 2014-04-04 13:42 ` Daniel Lezcano 2014-04-04 15:28 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:28 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:42 ` [PATCH V2 05/17] ARM: exynos: cpuidle: Move some code inside the idle_finisher Daniel Lezcano 2014-04-04 13:42 ` Daniel Lezcano 2014-04-04 15:29 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:29 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:42 ` [PATCH V2 06/17] ARM: exynos: cpuidle: Fix S5P_WAKEUP_STAT call Daniel Lezcano 2014-04-04 13:42 ` Daniel Lezcano 2014-04-04 15:29 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:29 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:42 ` Daniel Lezcano [this message] 2014-04-04 13:42 ` [PATCH V2 07/17] ARM: exynos: cpuidle: Use the cpu_pm notifier Daniel Lezcano 2014-04-04 15:30 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:30 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 08/17] ARM: exynos: cpuidle: Move scu_enable in " Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:30 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:30 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 09/17] ARM: exynos: cpuidle: Remove ifdef for scu_enable Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:31 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:31 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 10/17] ARM: exynos: cpuidle: Move exynos_set_wakeupmask in the cpu_pm notifier Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:31 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:31 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 11/17] ARM: exynos: cpuidle: Move the power sequence call " Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:31 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:31 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 12/17] ARM: exynos: cpuidle: Move S5P_CHECK_AFTR in a header Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:32 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:32 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 13/17] ARM: exynos: cpuidle: Move clock setup to pm.c Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:35 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:35 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 14/17] ARM: exynos: cpuidle: Move the boot vector in pm.c Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:35 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:35 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 15/17] ARM: exynos: cpuidle: Pass the AFTR callback to the platform_data Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:35 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:35 ` Bartlomiej Zolnierkiewicz 2014-04-04 13:43 ` [PATCH V2 16/17] ARM: exynos: cpuidle: Move the driver to drivers/cpuidle directory Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 15:36 ` Bartlomiej Zolnierkiewicz 2014-04-04 15:36 ` Bartlomiej Zolnierkiewicz 2014-04-07 9:51 ` Sachin Kamat 2014-04-07 9:51 ` Sachin Kamat 2014-04-07 11:53 ` Daniel Lezcano 2014-04-07 11:53 ` Daniel Lezcano 2014-04-04 13:43 ` [PATCH V2 17/17] ARM: exynos: config: Enable cpuidle Daniel Lezcano 2014-04-04 13:43 ` Daniel Lezcano 2014-04-04 16:09 ` Bartlomiej Zolnierkiewicz 2014-04-04 16:09 ` Bartlomiej Zolnierkiewicz 2014-04-07 9:43 ` Daniel Lezcano 2014-04-07 9:43 ` Daniel Lezcano 2014-04-07 16:19 ` Bartlomiej Zolnierkiewicz 2014-04-07 16:19 ` Bartlomiej Zolnierkiewicz 2014-04-07 16:26 ` Olof Johansson 2014-04-07 16:26 ` Olof Johansson 2014-04-07 16:28 ` Olof Johansson 2014-04-07 16:28 ` Olof Johansson 2014-04-07 17:44 ` Bartlomiej Zolnierkiewicz 2014-04-07 17:44 ` Bartlomiej Zolnierkiewicz 2014-04-07 18:33 ` Olof Johansson 2014-04-07 18:33 ` Olof Johansson 2014-04-08 3:57 ` Sachin Kamat 2014-04-08 3:57 ` Sachin Kamat 2014-04-08 9:40 ` Bartlomiej Zolnierkiewicz 2014-04-08 9:40 ` Bartlomiej Zolnierkiewicz 2014-04-08 9:26 ` Bartlomiej Zolnierkiewicz 2014-04-08 9:26 ` Bartlomiej Zolnierkiewicz
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1396618989-2897-8-git-send-email-daniel.lezcano@linaro.org \ --to=daniel.lezcano@linaro.org \ --cc=kgene.kim@samsung.com \ --cc=linaro-kernel@lists.linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=rjw@rjwysocki.net \ --cc=t.figa@samsung.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.