From: Robert Lee <rob.lee@linaro.org> To: kernel@pengutronix.de Cc: shawn.guo@linaro.org, amit.kucheria@linaro.org, daniel.lezcano@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-dev@lists.linaro.org, patches@linaro.org, jj@chaosbits.net Subject: [PATCH v2 2/3] ARM: imx: Add imx5 cpuidle driver Date: Tue, 1 May 2012 21:12:39 -0500 [thread overview] Message-ID: <1335924760-796-3-git-send-email-rob.lee@linaro.org> (raw) In-Reply-To: <1335924760-796-1-git-send-email-rob.lee@linaro.org> Add imx5 cpuidle driver. Signed-off-by: Robert Lee <rob.lee@linaro.org> --- arch/arm/mach-imx/mm-imx5.c | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c index d6b7e9f..cbd9bad 100644 --- a/arch/arm/mach-imx/mm-imx5.c +++ b/arch/arm/mach-imx/mm-imx5.c @@ -22,24 +22,59 @@ #include <mach/common.h> #include <mach/devices-common.h> #include <mach/iomux-v3.h> +#include <mach/cpuidle.h> static struct clk *gpc_dvfs_clk; -static void imx5_idle(void) +static int imx5_idle(void) { + int ret = 0; + /* gpc clock is needed for SRPG */ if (gpc_dvfs_clk == NULL) { gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs"); if (IS_ERR(gpc_dvfs_clk)) - return; + return -ENODEV; } clk_enable(gpc_dvfs_clk); mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); if (!tzic_enable_wake()) cpu_do_idle(); + else + ret = -EBUSY; clk_disable(gpc_dvfs_clk); + + return ret; +} + +static int imx5_cpuidle_enter(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int idx) +{ + int ret; + + ret = imx5_idle(); + + if (ret < 0) + return ret; + + return idx; } +static struct cpuidle_driver imx5_cpuidle_driver = { + .name = "imx5_cpuidle", + .owner = THIS_MODULE, + .en_core_tk_irqen = 1, + .states[0] = { + .enter = imx5_cpuidle_enter, + .exit_latency = 20, /* max latency at 160MHz */ + .target_residency = 1, + .flags = CPUIDLE_FLAG_TIME_VALID, + .name = "IMX5 SRPG", + .desc = "CPU state retained,powered off", + }, + .state_count = 1, +}; + /* * Define the MX50 memory map. */ @@ -103,7 +138,7 @@ void __init imx51_init_early(void) mxc_set_cpu_type(MXC_CPU_MX51); mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); - arm_pm_idle = imx5_idle; + arm_pm_idle = (void *)imx5_idle; } void __init imx53_init_early(void) @@ -238,4 +273,5 @@ void __init imx53_soc_init(void) void __init imx51_init_late(void) { mx51_neon_fixup(); + imx_cpuidle_init(&imx5_cpuidle_driver); } -- 1.7.10
WARNING: multiple messages have this Message-ID (diff)
From: rob.lee@linaro.org (Robert Lee) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/3] ARM: imx: Add imx5 cpuidle driver Date: Tue, 1 May 2012 21:12:39 -0500 [thread overview] Message-ID: <1335924760-796-3-git-send-email-rob.lee@linaro.org> (raw) In-Reply-To: <1335924760-796-1-git-send-email-rob.lee@linaro.org> Add imx5 cpuidle driver. Signed-off-by: Robert Lee <rob.lee@linaro.org> --- arch/arm/mach-imx/mm-imx5.c | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c index d6b7e9f..cbd9bad 100644 --- a/arch/arm/mach-imx/mm-imx5.c +++ b/arch/arm/mach-imx/mm-imx5.c @@ -22,24 +22,59 @@ #include <mach/common.h> #include <mach/devices-common.h> #include <mach/iomux-v3.h> +#include <mach/cpuidle.h> static struct clk *gpc_dvfs_clk; -static void imx5_idle(void) +static int imx5_idle(void) { + int ret = 0; + /* gpc clock is needed for SRPG */ if (gpc_dvfs_clk == NULL) { gpc_dvfs_clk = clk_get(NULL, "gpc_dvfs"); if (IS_ERR(gpc_dvfs_clk)) - return; + return -ENODEV; } clk_enable(gpc_dvfs_clk); mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); if (!tzic_enable_wake()) cpu_do_idle(); + else + ret = -EBUSY; clk_disable(gpc_dvfs_clk); + + return ret; +} + +static int imx5_cpuidle_enter(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int idx) +{ + int ret; + + ret = imx5_idle(); + + if (ret < 0) + return ret; + + return idx; } +static struct cpuidle_driver imx5_cpuidle_driver = { + .name = "imx5_cpuidle", + .owner = THIS_MODULE, + .en_core_tk_irqen = 1, + .states[0] = { + .enter = imx5_cpuidle_enter, + .exit_latency = 20, /* max latency@160MHz */ + .target_residency = 1, + .flags = CPUIDLE_FLAG_TIME_VALID, + .name = "IMX5 SRPG", + .desc = "CPU state retained,powered off", + }, + .state_count = 1, +}; + /* * Define the MX50 memory map. */ @@ -103,7 +138,7 @@ void __init imx51_init_early(void) mxc_set_cpu_type(MXC_CPU_MX51); mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR)); mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR)); - arm_pm_idle = imx5_idle; + arm_pm_idle = (void *)imx5_idle; } void __init imx53_init_early(void) @@ -238,4 +273,5 @@ void __init imx53_soc_init(void) void __init imx51_init_late(void) { mx51_neon_fixup(); + imx_cpuidle_init(&imx5_cpuidle_driver); } -- 1.7.10
next prev parent reply other threads:[~2012-05-02 2:12 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-05-02 2:12 [PATCH v2 0/3] Add imx cpuidle Robert Lee 2012-05-02 2:12 ` Robert Lee 2012-05-02 2:12 ` [PATCH v2 1/3] ARM: imx: Add common imx cpuidle init functionality Robert Lee 2012-05-02 2:12 ` Robert Lee 2012-05-02 3:13 ` Shawn Guo 2012-05-02 3:13 ` Shawn Guo 2012-05-02 13:59 ` Rob Lee 2012-05-02 13:59 ` Rob Lee 2012-05-02 14:07 ` Shawn Guo 2012-05-02 14:07 ` Shawn Guo 2012-05-02 14:09 ` Rob Lee 2012-05-02 14:09 ` Rob Lee 2012-05-02 7:27 ` Sascha Hauer 2012-05-02 7:27 ` Sascha Hauer 2012-05-02 19:16 ` Rob Lee 2012-05-02 19:16 ` Rob Lee 2012-05-02 20:21 ` Sascha Hauer 2012-05-02 20:21 ` Sascha Hauer 2012-05-02 2:12 ` Robert Lee [this message] 2012-05-02 2:12 ` [PATCH v2 2/3] ARM: imx: Add imx5 cpuidle driver Robert Lee 2012-05-02 7:33 ` Sascha Hauer 2012-05-02 7:33 ` Sascha Hauer 2012-05-02 20:11 ` Rob Lee 2012-05-02 20:11 ` Rob Lee 2012-05-03 6:39 ` Sascha Hauer 2012-05-03 6:39 ` Sascha Hauer 2012-05-02 2:12 ` [PATCH v2 3/3] ARM: imx: Add imx6q " Robert Lee 2012-05-02 2:12 ` Robert Lee 2012-05-02 3:23 ` Shawn Guo 2012-05-02 3:23 ` Shawn Guo 2012-05-02 13:50 ` Rob Lee 2012-05-02 13:50 ` Rob Lee 2012-05-02 13:53 ` Shawn Guo 2012-05-02 13:53 ` Shawn Guo 2012-05-02 3:03 ` [PATCH v2 0/3] Add imx cpuidle Shawn Guo 2012-05-02 3:03 ` Shawn Guo
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=1335924760-796-3-git-send-email-rob.lee@linaro.org \ --to=rob.lee@linaro.org \ --cc=amit.kucheria@linaro.org \ --cc=daniel.lezcano@linaro.org \ --cc=jj@chaosbits.net \ --cc=kernel@pengutronix.de \ --cc=linaro-dev@lists.linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=patches@linaro.org \ --cc=shawn.guo@linaro.org \ /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.