ARM: OMAP3: CPUidle: Make use of CPU PM notifiers
authorSantosh Shilimkar <santosh.shilimkar@ti.com>
Sat, 3 Sep 2011 17:08:27 +0000 (22:38 +0530)
committerKevin Hilman <khilman@ti.com>
Thu, 8 Dec 2011 19:29:02 +0000 (11:29 -0800)
Save VFP CPU context using CPU PM notifier chain. VFP context
is lost when CPU hits OFF state.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-by: Vishwanath BS <vishwanath.bs@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
arch/arm/mach-omap2/cpuidle34xx.c

index e20332f4abdc57e891231bb39503b4dcb4d1aa18..1f71ebb6c12cc649a7243d07780ddb962bb20ae7 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>
@@ -124,9 +125,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);