Merge branch 'for_3.3/uart/runtime-pm' of git://git.kernel.org/pub/scm/linux/kernel...
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-omap2 / cpuidle34xx.c
index 3a9d2b883b345a9f3e5355b6ab7877517a91da90..464cffde58fe9ecb5c6b26af3f4409b9d34506f3 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/sched.h>
 #include <linux/cpuidle.h>
 #include <linux/export.h>
+#include <linux/cpu_pm.h>
 
 #include <plat/prcm.h>
 #include <plat/irqs.h>
@@ -123,9 +124,23 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
                pwrdm_for_each_clkdm(core_pd, _cpuidle_deny_idle);
        }
 
+       /*
+        * Call idle CPU PM enter notifier chain so that
+        * VFP context is saved.
+        */
+       if (mpu_state == PWRDM_POWER_OFF)
+               cpu_pm_enter();
+
        /* Execute ARM wfi */
        omap_sram_idle();
 
+       /*
+        * Call idle CPU PM enter notifier chain to restore
+        * VFP context.
+        */
+       if (pwrdm_read_prev_pwrst(mpu_pd) == PWRDM_POWER_OFF)
+               cpu_pm_exit();
+
        /* Re-allow idle for C1 */
        if (index == 0) {
                pwrdm_for_each_clkdm(mpu_pd, _cpuidle_allow_idle);