When 'enable_off_mode' is 0, the target power state for MPU
and Core is locally changed to PWRDM_POWER_RET but, the
statistics are updated for idle state originally selected
by the governor.

To debug the issue and validate the fix, added variables -
mpu_state_modified and core_state_modified. Both are
incremented in omap3_enter_idle() as below:

        if (!enable_off_mode) {
                if (mpu_state < PWRDM_POWER_RET) {
                        mpu_state_modified++;
                        mpu_state = PWRDM_POWER_RET;
                }
                if (core_state < PWRDM_POWER_RET) {
                        core_state_modified++;
                        core_state = PWRDM_POWER_RET;
                }
        }

Also added a sysfs entry to track these modifications.

Before the change:

...BOOT...
[r...@omap3evm /]#
[r...@omap3evm /]# cat /sys/power/enable_off_mode
0
[r...@omap3evm /]# cat /sys/power/enable_off_mode
0
[r...@omap3evm /]# cat /sys/power/track_modifs
[mpu_state_modified, core_state_modified] = [0 , 0]
[r...@omap3evm /]#
[r...@omap3evm /]#
[r...@omap3evm /]# echo 1 > /sys/power/sleep_while_idle
[r...@omap3evm /]#
...WAIT 5 SECS...
[r...@omap3evm /]# cat /sys/power/track_modifs
[mpu_state_modified, core_state_modified] = [5 , 3]
[r...@omap3evm /]# cat /sys/devices/system/cpu/cpu0/cpuidle/state6/usage
3
...WAIT FEW MORE SECS...
[r...@omap3evm /]# cat /sys/power/track_modifs
[mpu_state_modified, core_state_modified] = [27 , 25]
[r...@omap3evm /]# cat /sys/devices/system/cpu/cpu0/cpuidle/state6/usage
25
[r...@omap3evm /]# cat /sys/power/enable_off_mode
0

After the fix:

...BOOT...
[r...@omap3evm /]#
[r...@omap3evm /]# cat /sys/power/enable_off_mode
0
[r...@omap3evm /]# cat /sys/power/enable_off_mode
0
[r...@omap3evm /]# cat /sys/power/track_modifs
[mpu_state_modified, core_state_modified] = [0 , 0]
[r...@omap3evm /]#
[r...@omap3evm /]#
[r...@omap3evm /]# echo 1 > /sys/power/sleep_while_idle
[r...@omap3evm /]#
...WAIT 5 SECS...
[r...@omap3evm /]# cat /sys/power/track_modifs
[mpu_state_modified, core_state_modified] = [0 , 0]
[r...@omap3evm /]# cat /sys/devices/system/cpu/cpu0/cpuidle/state6/usage
0
[r...@omap3evm /]# echo 1 > /sys/power/sleep_while_idle
[r...@omap3evm /]#
...WAIT APPROX 10 SECS...
[r...@omap3evm /]# cat /sys/power/track_modifs
[mpu_state_modified, core_state_modified] = [0 , 0]
[r...@omap3evm /]# cat /sys/devices/system/cpu/cpu0/cpuidle/state6/usage
2
...WAIT APPROX 30 SECS...
[r...@omap3evm /]# cat /sys/power/track_modifs
[mpu_state_modified, core_state_modified] = [0 , 0]
[r...@omap3evm /]# cat /sys/devices/system/cpu/cpu0/cpuidle/state6/usage
17
[r...@omap3evm /]#

This topic was discussed earlier; but the final fix did not find its
way back.

  [1] http://marc.info/?l=linux-omap&m=123681603821299&w=2

Sanjeev Premi (1):
  PM : cpuidle - update statistics for correct state

 arch/arm/mach-omap2/cpuidle34xx.c |   34 +++++++++++++++++++++++++++-------
 arch/arm/mach-omap2/pm.h          |    2 ++
 arch/arm/mach-omap2/pm34xx.c      |    2 ++
 3 files changed, 31 insertions(+), 7 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to