From patchwork Sat Feb 19 10:42:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 574631 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1JAguIk032649 for ; Sat, 19 Feb 2011 10:43:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754187Ab1BSKnM (ORCPT ); Sat, 19 Feb 2011 05:43:12 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:48721 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752473Ab1BSKnB (ORCPT ); Sat, 19 Feb 2011 05:43:01 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p1JAgiU1025993 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 19 Feb 2011 04:42:46 -0600 Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p1JAghSg013970; Sat, 19 Feb 2011 16:12:43 +0530 (IST) Received: from linfarm476.india.ti.com (localhost [127.0.0.1]) by linfarm476.india.ti.com (8.12.11/8.12.11) with ESMTP id p1JAghlR028629; Sat, 19 Feb 2011 16:12:43 +0530 Received: (from a0393909@localhost) by linfarm476.india.ti.com (8.12.11/8.12.11/Submit) id p1JAggwd028627; Sat, 19 Feb 2011 16:12:42 +0530 From: Santosh Shilimkar To: linux-omap@vger.kernel.org Cc: khilman@ti.com, linux-arm-kernel@lists.infradead.org, Santosh Shilimkar Subject: [PATCH 16/17] omap4: cpuidle: Allow debugfs control through enable_off_mode Date: Sat, 19 Feb 2011 16:12:37 +0530 Message-Id: <1298112158-28469-17-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.5.6.6 In-Reply-To: <1298112158-28469-1-git-send-email-santosh.shilimkar@ti.com> References: <1298112158-28469-1-git-send-email-santosh.shilimkar@ti.com> 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.6 (demeter1.kernel.org [140.211.167.41]); Sat, 19 Feb 2011 10:43:13 +0000 (UTC) diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index e887eb5..4207862 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c @@ -170,6 +170,31 @@ static int omap4_enter_idle_bm(struct cpuidle_device *dev, } /** + * omap4_cpuidle_update_states() - Update the cpuidle states + * @mpu_deepest_state: Enable states upto and including this for mpu domain + * @core_deepest_state: Enable states upto and including this for core domain + * + * This goes through the list of states available and enables and disables the + * validity of C states based on deepest state that can be achieved for the + * variable domain + */ +void omap4_cpuidle_update_states(u32 mpu_deepest_state, u32 core_deepest_state) +{ + int i; + + for (i = OMAP4_STATE_C1; i < OMAP4_MAX_STATES; i++) { + struct omap4_processor_cx *cx = &omap4_power_states[i]; + + if ((cx->mpu_state >= mpu_deepest_state) && + (cx->core_state >= core_deepest_state)) { + cx->valid = 1; + } else { + cx->valid = 0; + } + } +} + +/** * omap4_init_power_states - Initialises the OMAP4 specific C states. * */ @@ -325,6 +350,11 @@ int __init omap4_idle_init(void) } } + if (enable_off_mode) + omap4_cpuidle_update_states(PWRDM_POWER_OFF, PWRDM_POWER_OFF); + else + omap4_cpuidle_update_states(PWRDM_POWER_RET, PWRDM_POWER_RET); + return 0; } #else diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index ce848b0..4df89d1 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -77,6 +77,7 @@ extern u32 sleep_while_idle; #if defined(CONFIG_CPU_IDLE) extern void omap3_cpuidle_update_states(u32, u32); +extern void omap4_cpuidle_update_states(u32, u32); #endif #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c index 628242d..6244ab2 100644 --- a/arch/arm/mach-omap2/pm44xx.c +++ b/arch/arm/mach-omap2/pm44xx.c @@ -183,6 +183,10 @@ void omap4_pm_off_mode_enable(int enable) else state = PWRDM_POWER_RET; +#ifdef CONFIG_CPU_IDLE + omap4_cpuidle_update_states(state, PWRDM_POWER_ON); +#endif + list_for_each_entry(pwrst, &pwrst_list, node) { /* FIXME: Remove this check when core retention is supported */ if (!strcmp(pwrst->pwrdm->name, "mpu_pwrdm")) {