OMAP3: PM: some OFF mode hacks
authorGrazvydas Ignotas <notasas@gmail.com>
Thu, 26 May 2016 00:31:09 +0000 (03:31 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 3 Jul 2016 00:23:25 +0000 (03:23 +0300)
Set off mode by default where it works.
Allow to set off mode for everythng except core+per or just per.

arch/arm/mach-omap2/cpuidle34xx.c
arch/arm/mach-omap2/pm34xx.c

index bbb1a21..64592bb 100644 (file)
@@ -177,6 +177,10 @@ static int next_valid_state(struct cpuidle_device *dev,
                 */
                if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583))
                        core_deepest_state = PWRDM_POWER_OFF;
+
+               /* pandora hack */
+               if (enable_off_mode < 2)
+                       core_deepest_state = PWRDM_POWER_RET;
        }
 
        if (!omap_uart_can_sleep())
index 78993ef..5722025 100644 (file)
@@ -762,6 +762,9 @@ void omap3_pm_off_mode_enable(int enable)
                        pwrst->next_state = PWRDM_POWER_RET;
                        pr_warn("%s: Core OFF disabled due to errata i583\n",
                                __func__);
+               } else if (enable < 3 && pwrst->pwrdm == per_pwrdm) {
+                       /* pandora hack */
+                       pwrst->next_state = PWRDM_POWER_RET;
                } else {
                        pwrst->next_state = state;
                }
@@ -810,6 +813,29 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
        if (pwrdm_has_hdwr_sar(pwrdm))
                pwrdm_enable_hdwr_sar(pwrdm);
 
+       /* pandora OFF hacks, notes for missing:
+        * - core_pwrdm - loses GPIO state?!
+        * - per_pwrdm  - must keep RET because of GPIOs
+        * - neon_pwrdm - depends on mpu_pwrdm
+        * - mpu_pwrdm  - sometimes hangs?
+        * notes for enabled:
+        * - usbhost_pwrdm - does driver reload + reinit anyway, no runtime PM
+        * - sgx_pwrdm  - only OFF is supported
+        * - dss_pwrdm  - works, needs working context_loss counter
+        * - cam_pwrdm  - not used
+        * - iva2_pwrdm - c64_tools reprograms with direct reg hits anyway
+        */
+       if (   pwrdm == pwrdm_lookup("usbhost_pwrdm")
+           || pwrdm == pwrdm_lookup("sgx_pwrdm")
+           || pwrdm == pwrdm_lookup("cam_pwrdm")
+           || pwrdm == pwrdm_lookup("iva2_pwrdm")
+           )
+               pwrst->next_state = PWRDM_POWER_OFF;
+
+       /* on OMAP3, at least on ES2.1, DSS drains more in OFF than in RET?? */
+       else if (cpu_is_omap3630() && pwrdm == pwrdm_lookup("dss_pwrdm"))
+               pwrst->next_state = PWRDM_POWER_OFF;
+
        return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
 }