aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/cpuidle44xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/cpuidle44xx.c')
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index 01fc710c8181..2498ab025fa2 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -14,6 +14,7 @@
14#include <linux/cpuidle.h> 14#include <linux/cpuidle.h>
15#include <linux/cpu_pm.h> 15#include <linux/cpu_pm.h>
16#include <linux/export.h> 16#include <linux/export.h>
17#include <linux/clockchips.h>
17 18
18#include <asm/cpuidle.h> 19#include <asm/cpuidle.h>
19#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
@@ -83,6 +84,7 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
83{ 84{
84 struct idle_statedata *cx = state_ptr + index; 85 struct idle_statedata *cx = state_ptr + index;
85 u32 mpuss_can_lose_context = 0; 86 u32 mpuss_can_lose_context = 0;
87 int cpu_id = smp_processor_id();
86 88
87 /* 89 /*
88 * CPU0 has to wait and stay ON until CPU1 is OFF state. 90 * CPU0 has to wait and stay ON until CPU1 is OFF state.
@@ -110,6 +112,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
110 mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) && 112 mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) &&
111 (cx->mpu_logic_state == PWRDM_POWER_OFF); 113 (cx->mpu_logic_state == PWRDM_POWER_OFF);
112 114
115 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu_id);
116
113 /* 117 /*
114 * Call idle CPU PM enter notifier chain so that 118 * Call idle CPU PM enter notifier chain so that
115 * VFP and per CPU interrupt context is saved. 119 * VFP and per CPU interrupt context is saved.
@@ -165,6 +169,8 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,
165 if (dev->cpu == 0 && mpuss_can_lose_context) 169 if (dev->cpu == 0 && mpuss_can_lose_context)
166 cpu_cluster_pm_exit(); 170 cpu_cluster_pm_exit();
167 171
172 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id);
173
168fail: 174fail:
169 cpuidle_coupled_parallel_barrier(dev, &abort_barrier); 175 cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
170 cpu_done[dev->cpu] = false; 176 cpu_done[dev->cpu] = false;
@@ -172,6 +178,16 @@ fail:
172 return index; 178 return index;
173} 179}
174 180
181/*
182 * For each cpu, setup the broadcast timer because local timers
183 * stops for the states above C1.
184 */
185static void omap_setup_broadcast_timer(void *arg)
186{
187 int cpu = smp_processor_id();
188 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
189}
190
175static struct cpuidle_driver omap4_idle_driver = { 191static struct cpuidle_driver omap4_idle_driver = {
176 .name = "omap4_idle", 192 .name = "omap4_idle",
177 .owner = THIS_MODULE, 193 .owner = THIS_MODULE,
@@ -189,8 +205,7 @@ static struct cpuidle_driver omap4_idle_driver = {
189 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */ 205 /* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
190 .exit_latency = 328 + 440, 206 .exit_latency = 328 + 440,
191 .target_residency = 960, 207 .target_residency = 960,
192 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | 208 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED,
193 CPUIDLE_FLAG_TIMER_STOP,
194 .enter = omap_enter_idle_coupled, 209 .enter = omap_enter_idle_coupled,
195 .name = "C2", 210 .name = "C2",
196 .desc = "CPUx OFF, MPUSS CSWR", 211 .desc = "CPUx OFF, MPUSS CSWR",
@@ -199,8 +214,7 @@ static struct cpuidle_driver omap4_idle_driver = {
199 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */ 214 /* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
200 .exit_latency = 460 + 518, 215 .exit_latency = 460 + 518,
201 .target_residency = 1100, 216 .target_residency = 1100,
202 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED | 217 .flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED,
203 CPUIDLE_FLAG_TIMER_STOP,
204 .enter = omap_enter_idle_coupled, 218 .enter = omap_enter_idle_coupled,
205 .name = "C3", 219 .name = "C3",
206 .desc = "CPUx OFF, MPUSS OSWR", 220 .desc = "CPUx OFF, MPUSS OSWR",
@@ -231,5 +245,8 @@ int __init omap4_idle_init(void)
231 if (!cpu_clkdm[0] || !cpu_clkdm[1]) 245 if (!cpu_clkdm[0] || !cpu_clkdm[1])
232 return -ENODEV; 246 return -ENODEV;
233 247
248 /* Configure the broadcast timer on each cpu */
249 on_each_cpu(omap_setup_broadcast_timer, NULL, 1);
250
234 return cpuidle_register(&omap4_idle_driver, cpu_online_mask); 251 return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
235} 252}