ARM: OMAP3: CPUidle: Make use of CPU PM notifiers
[pandora-kernel.git] / arch / arm / mach-omap2 / cpuidle34xx.c
index 1f34914..e8e8d39 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>
@@ -108,9 +109,23 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
                clkdm_deny_idle(core_pd->pwrdm_clkdms[0]);
        }
 
+       /*
+        * 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) {
                clkdm_allow_idle(mpu_pd->pwrdm_clkdms[0]);