ARM: cpuidle-imx*: Report the entered state index
authorLeonard Crestez <leonard.crestez@nxp.com>
Mon, 13 Mar 2017 10:35:24 +0000 (12:35 +0200)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:10:54 +0000 (15:10 -0500)
When a cpuidle driver is called it can choose to enter a different state
that what was asked from above. When this happens it should return the
actual entered_state index for proper accounting.

This fixes the various imx cpuidle drivers which depend on low busfreq
for LOW-POWER-IDLE to correctly report that they entered WAIT instead.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
arch/arm/mach-imx/cpuidle-imx6sll.c
arch/arm/mach-imx/cpuidle-imx6sx.c
arch/arm/mach-imx/cpuidle-imx6ul.c
arch/arm/mach-imx/cpuidle-imx7d.c

index 8e06f33..65d82e5 100644 (file)
@@ -97,6 +97,7 @@ static int imx6sll_enter_wait(struct cpuidle_device *dev,
 
        imx6_set_lpm(WAIT_UNCLOCKED);
        if ((index == 1) || ((mode != BUS_FREQ_LOW) && index == 2)) {
+               index = 1;
                cpu_do_idle();
        } else {
                imx_gpc_switch_pupscr_clk(true);
index c1c7ad4..be73709 100644 (file)
@@ -109,6 +109,7 @@ static int imx6sx_enter_wait(struct cpuidle_device *dev,
 
        imx6_set_lpm(WAIT_UNCLOCKED);
        if ((index == 1) || ((mode != BUS_FREQ_LOW) && index == 2)) {
+               index = 1;
                cpu_do_idle();
        } else {
                        /* Need to notify there is a cpu pm operation. */
index 8e0fdf7..7708d87 100644 (file)
@@ -98,6 +98,7 @@ static int imx6ul_enter_wait(struct cpuidle_device *dev,
        imx6_set_lpm(WAIT_UNCLOCKED);
        if ((index == 1) || ((mode != BUS_FREQ_LOW) && index == 2)) {
                cpu_do_idle();
+               index = 1;
        } else {
                /*
                 * i.MX6UL TO1.0 ARM power up uses IPG/2048 as clock source,
index a624808..4788c8d 100644 (file)
@@ -96,6 +96,7 @@ static int imx7d_enter_low_power_idle(struct cpuidle_device *dev,
        int mode = get_bus_freq_mode();
 
        if ((index == 1) || ((mode != BUS_FREQ_LOW) && index == 2)) {
+               index = 1;
                if (atomic_inc_return(&master_wait) == num_online_cpus())
                        imx_gpcv2_set_lpm_mode(WAIT_UNCLOCKED);