diff options
author | Deepthi Dharwar <deepthi@linux.vnet.ibm.com> | 2011-10-28 06:50:09 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-11-06 21:13:30 -0500 |
commit | e978aa7d7d57d04eb5f88a7507c4fb98577def77 (patch) | |
tree | d6d6dfe1dba4d4749c7eafe348351aa499c3c5eb /arch/arm/mach-at91 | |
parent | c3b92c8787367a8bb53d57d9789b558f1295cc96 (diff) |
cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state
Cpuidle governor only suggests the state to enter using the
governor->select() interface, but allows the low level driver to
override the recommended state. The actual entered state
may be different because of software or hardware demotion. Software
demotion is done by the back-end cpuidle driver and can be accounted
correctly. Current cpuidle code uses last_state field to capture the
actual state entered and based on that updates the statistics for the
state entered.
Ideally the driver enter routine should update the counters,
and it should return the state actually entered rather than the time
spent there. The generic cpuidle code should simply handle where
the counters live in the sysfs namespace, not updating the counters.
Reference:
https://lkml.org/lkml/2011/3/25/52
Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com>
Tested-by: Jean Pihet <j-pihet@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r-- | arch/arm/mach-at91/cpuidle.c | 10 |
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 */ |
35 | static int at91_enter_idle(struct cpuidle_device *dev, | 35 | static 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 */ |