From patchwork Tue Feb 2 14:52:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 76373 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o12D4W5e024245 for ; Tue, 2 Feb 2010 13:05:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755969Ab0BBNFE (ORCPT ); Tue, 2 Feb 2010 08:05:04 -0500 Received: from smtp.nokia.com ([192.100.122.233]:52494 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755955Ab0BBNFD (ORCPT ); Tue, 2 Feb 2010 08:05:03 -0500 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o12D4v5p029899 for ; Tue, 2 Feb 2010 15:05:01 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 2 Feb 2010 15:03:10 +0200 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 2 Feb 2010 15:03:09 +0200 Received: from localhost.localdomain (sokoban.nmp.nokia.com [172.22.215.13]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o12D2wJj029178 for ; Tue, 2 Feb 2010 15:03:08 +0200 From: Tero Kristo To: linux-omap@vger.kernel.org Subject: [PATCHv5 8/9] OMAP3: CPUidle: Fixed off-mode support to fall-back to proper C state Date: Tue, 2 Feb 2010 16:52:26 +0200 Message-Id: <1265122347-2233-9-git-send-email-tero.kristo@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <1265122347-2233-8-git-send-email-tero.kristo@nokia.com> References: <> <1265122347-2233-1-git-send-email-tero.kristo@nokia.com> <1265122347-2233-2-git-send-email-tero.kristo@nokia.com> <1265122347-2233-3-git-send-email-tero.kristo@nokia.com> <1265122347-2233-4-git-send-email-tero.kristo@nokia.com> <1265122347-2233-5-git-send-email-tero.kristo@nokia.com> <1265122347-2233-6-git-send-email-tero.kristo@nokia.com> <1265122347-2233-7-git-send-email-tero.kristo@nokia.com> <1265122347-2233-8-git-send-email-tero.kristo@nokia.com> X-OriginalArrivalTime: 02 Feb 2010 13:03:09.0539 (UTC) FILETIME=[1198A330:01CAA408] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 02 Feb 2010 13:05:05 +0000 (UTC) diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index 38bd70c..dbb7315 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)) @@ -221,8 +222,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); }