diff options
| -rw-r--r-- | arch/arm/mach-imx/pm-imx5.c | 43 |
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 b3dcd8e50d5b..19621ed1ffa5 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 | ||
| 137 | static void imx5_pm_idle(void) | 139 | static 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 | |||
| 149 | static void imx5_pm_idle(void) | ||
| 150 | { | ||
| 151 | imx5_cpu_do_idle(); | ||
| 152 | } | ||
| 153 | |||
| 154 | static 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 | ||
| 166 | static 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 | |||
| 143 | static int __init imx5_pm_common_init(void) | 181 | static 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 | ||
