aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorRobert Lee <rob.lee@linaro.org>2012-05-21 18:50:29 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2012-06-05 02:51:47 -0400
commitccc12b32dc8c8e88a5b35f8df34ec7c80f2e10b0 (patch)
tree66b3bd58d603df0b979790a2bd3e9b4a6c66206d /arch/arm/mach-imx
parent2da50e6284caadd92ded697e41fb200358f64261 (diff)
ARM: imx: Add imx5 cpuidle
Add cpuidle driver for imx5 platform. Signed-off-by: Robert Lee <rob.lee@linaro.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/pm-imx5.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
index b3dcd8e50d5..19621ed1ffa 100644
--- a/arch/arm/mach-imx/pm-imx5.c
+++ b/arch/arm/mach-imx/pm-imx5.c
@@ -12,10 +12,12 @@
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/export.h>
15#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
16#include <asm/system_misc.h> 17#include <asm/system_misc.h>
17#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
18#include <mach/common.h> 19#include <mach/common.h>
20#include <mach/cpuidle.h>
19#include <mach/hardware.h> 21#include <mach/hardware.h>
20#include "crm-regs-imx5.h" 22#include "crm-regs-imx5.h"
21 23
@@ -134,12 +136,48 @@ static const struct platform_suspend_ops mx5_suspend_ops = {
134 .enter = mx5_suspend_enter, 136 .enter = mx5_suspend_enter,
135}; 137};
136 138
137static void imx5_pm_idle(void) 139static inline int imx5_cpu_do_idle(void)
138{ 140{
139 if (likely(!tzic_enable_wake())) 141 int ret = tzic_enable_wake();
142
143 if (likely(!ret))
140 cpu_do_idle(); 144 cpu_do_idle();
145
146 return ret;
147}
148
149static void imx5_pm_idle(void)
150{
151 imx5_cpu_do_idle();
152}
153
154static int imx5_cpuidle_enter(struct cpuidle_device *dev,
155 struct cpuidle_driver *drv, int idx)
156{
157 int ret;
158
159 ret = imx5_cpu_do_idle();
160 if (ret < 0)
161 return ret;
162
163 return idx;
141} 164}
142 165
166static struct cpuidle_driver imx5_cpuidle_driver = {
167 .name = "imx5_cpuidle",
168 .owner = THIS_MODULE,
169 .en_core_tk_irqen = 1,
170 .states[0] = {
171 .enter = imx5_cpuidle_enter,
172 .exit_latency = 2,
173 .target_residency = 1,
174 .flags = CPUIDLE_FLAG_TIME_VALID,
175 .name = "IMX5 SRPG",
176 .desc = "CPU state retained,powered off",
177 },
178 .state_count = 1,
179};
180
143static int __init imx5_pm_common_init(void) 181static int __init imx5_pm_common_init(void)
144{ 182{
145 int ret; 183 int ret;
@@ -157,6 +195,7 @@ static int __init imx5_pm_common_init(void)
157 /* Set the registers to the default cpu idle state. */ 195 /* Set the registers to the default cpu idle state. */
158 mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE); 196 mx5_cpu_lp_set(IMX5_DEFAULT_CPU_IDLE_STATE);
159 197
198 imx_cpuidle_init(&imx5_cpuidle_driver);
160 return 0; 199 return 0;
161} 200}
162 201