diff mbox

[PATCHv6,8/9] OMAP3: CPUidle: Fixed off-mode support to fall-back to proper C state

Message ID 1265999265-4363-9-git-send-email-tero.kristo@nokia.com (mailing list archive)
State Changes Requested
Delegated to: Kevin Hilman
Headers show

Commit Message

Tero Kristo Feb. 12, 2010, 6:27 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 914022f..e41019f 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -115,13 +115,6 @@  static int omap3_enter_idle(struct cpuidle_device *dev,
 	local_irq_disable();
 	local_fiq_disable();
 
-	if (!enable_off_mode) {
-		if (mpu_state < PWRDM_POWER_RET)
-			mpu_state = PWRDM_POWER_RET;
-		if (core_state < PWRDM_POWER_RET)
-			core_state = PWRDM_POWER_RET;
-	}
-
 	omap3_pwrdm_set_next_pwrst(mpu_pd, mpu_state);
 	omap3_pwrdm_set_next_pwrst(core_pd, core_state);
 
@@ -155,7 +148,7 @@  static int omap3_enter_idle_bm(struct cpuidle_device *dev,
 {
 	struct cpuidle_state *new_state = state;
 	u32 per_state = 0, saved_per_state = 0, cam_state, usb_state;
-	u32 iva2_state, sgx_state, dss_state, new_core_state;
+	u32 iva2_state, sgx_state, dss_state, new_core_state, new_mpu_state;
 	struct omap3_processor_cx *cx;
 	int ret;
 
@@ -167,6 +160,14 @@  static int omap3_enter_idle_bm(struct cpuidle_device *dev,
 		}
 		cx = cpuidle_get_statedata(state);
 		new_core_state = cx->core_state;
+		new_mpu_state = cx->mpu_state;
+
+		if (!enable_off_mode) {
+			if (new_mpu_state < PWRDM_POWER_RET)
+				new_mpu_state = PWRDM_POWER_RET;
+			if (new_core_state < PWRDM_POWER_RET)
+				new_core_state = PWRDM_POWER_RET;
+		}
 
 		/* Check if CORE is active, if yes, fallback to inactive */
 		if (!pwrdm_can_idle(core_pd))
@@ -223,8 +224,9 @@  static int omap3_enter_idle_bm(struct cpuidle_device *dev,
 				new_core_state = PWRDM_POWER_RET;
 		}
 
-		/* Fallback to new target core state */
-		while (cx->core_state < new_core_state) {
+		/* Fallback to new target core/mpu state */
+		while (cx->core_state < new_core_state ||
+		       cx->mpu_state < new_mpu_state) {
 			state--;
 			cx = cpuidle_get_statedata(state);
 		}