aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/cpuidle.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
index 1cfeac1483d6..4696a0d61e2e 100644
--- a/arch/arm/mach-at91/cpuidle.c
+++ b/arch/arm/mach-at91/cpuidle.c
@@ -33,7 +33,7 @@ static struct cpuidle_driver at91_idle_driver = {
33 33
34/* Actual code that puts the SoC in different idle states */ 34/* Actual code that puts the SoC in different idle states */
35static int at91_enter_idle(struct cpuidle_device *dev, 35static int at91_enter_idle(struct cpuidle_device *dev,
36 struct cpuidle_state *state) 36 int index)
37{ 37{
38 struct timeval before, after; 38 struct timeval before, after;
39 int idle_time; 39 int idle_time;
@@ -41,10 +41,10 @@ static int at91_enter_idle(struct cpuidle_device *dev,
41 41
42 local_irq_disable(); 42 local_irq_disable();
43 do_gettimeofday(&before); 43 do_gettimeofday(&before);
44 if (state == &dev->states[0]) 44 if (index == 0)
45 /* Wait for interrupt state */ 45 /* Wait for interrupt state */
46 cpu_do_idle(); 46 cpu_do_idle();
47 else if (state == &dev->states[1]) { 47 else if (index == 1) {
48 asm("b 1f; .align 5; 1:"); 48 asm("b 1f; .align 5; 1:");
49 asm("mcr p15, 0, r0, c7, c10, 4"); /* drain write buffer */ 49 asm("mcr p15, 0, r0, c7, c10, 4"); /* drain write buffer */
50 saved_lpr = sdram_selfrefresh_enable(); 50 saved_lpr = sdram_selfrefresh_enable();
@@ -55,7 +55,9 @@ static int at91_enter_idle(struct cpuidle_device *dev,
55 local_irq_enable(); 55 local_irq_enable();
56 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + 56 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
57 (after.tv_usec - before.tv_usec); 57 (after.tv_usec - before.tv_usec);
58 return idle_time; 58
59 dev->last_residency = idle_time;
60 return index;
59} 61}
60 62
61/* Initialize CPU idle by registering the idle states */ 63/* Initialize CPU idle by registering the idle states */