From patchwork Fri Jan 4 14:01:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 1933011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id C7853DFABD for ; Fri, 4 Jan 2013 14:04:47 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tr7q0-0007Il-Ci; Fri, 04 Jan 2013 14:01:32 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tr7pw-0007IT-Dr for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2013 14:01:29 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r04E1QSg013448; Fri, 4 Jan 2013 08:01:26 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r04E1QuG005470; Fri, 4 Jan 2013 08:01:26 -0600 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Fri, 4 Jan 2013 08:01:26 -0600 Received: from [172.24.79.27] (h79-27.vpn.ti.com [172.24.79.27]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r04E1OtF029894; Fri, 4 Jan 2013 08:01:25 -0600 Subject: Re: [PATCH 06/12] ARM: OMAP44xx: PM: convert to use the functional power states API From: Tero Kristo To: Paul Walmsley In-Reply-To: <20121209175313.6933.36300.stgit@dusk.lan> References: <20121209174545.6933.59371.stgit@dusk.lan> <20121209175313.6933.36300.stgit@dusk.lan> Organization: Texas Instruments Date: Fri, 4 Jan 2013 16:01:24 +0200 Message-ID: <1357308084.2221.101.camel@sokoban> MIME-Version: 1.0 X-Mailer: Evolution 2.32.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130104_090128_606143_71499D37 X-CRM114-Status: GOOD ( 21.17 ) X-Spam-Score: -7.6 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-omap@vger.kernel.org, Jean Pihet , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: t-kristo@ti.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Hi Paul, On Sun, 2012-12-09 at 10:53 -0700, Paul Walmsley wrote: > @@ -40,20 +39,19 @@ static LIST_HEAD(pwrst_list); > static int omap4_pm_suspend(void) > { > struct power_state *pwrst; > - int state, ret = 0; > + int prev_fpwrst; > + int ret = 0; > u32 cpu_id = smp_processor_id(); > > + /* XXX Seems like these two loops could be combined into one loop? */ > + They can be combined yes. > @@ -113,10 +113,10 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) > return -ENOMEM; > > pwrst->pwrdm = pwrdm; > - pwrst->next_state = PWRDM_POWER_RET; > + pwrst->next_fpwrst = PWRDM_FUNC_PWRST_CSWR; > list_add(&pwrst->node, &pwrst_list); > > - return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); > + return WARN_ON(pwrdm_set_fpwrst(pwrst->pwrdm, pwrst->next_fpwrst)); This causes a regression on omap4, as several power domains can't idle after this anymore (they get programmed to ON state due to CSWR not being supported on them.) Following patch fixes this problem (applies on top of the whole set): return WARN_ON(pwrdm_set_fpwrst(pwrst->pwrdm, pwrst->next_fpwrst)); ============= From: Tero Kristo Date: Wed, 2 Jan 2013 18:05:42 +0200 Subject: [PATCH] ARM: OMAP4: PM: fix the power state setup After the functional power state code changes, OMAP4 PM init code programs powerdomains now to ON state if the domain does not support CSWR. This breaks suspend and should be avoided. Fixed by adding a loop to the pwrdms_setup code, that for each domain selects the next fpwrst based on following order: CSWR, OSWR, OFF, ON. This allows all the domains to enter supported low power states, instead of always selecting ON. Signed-off-by: Tero Kristo --- arch/arm/mach-omap2/pm44xx.c | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c index 8775ee5..67f05fe 100644 --- a/arch/arm/mach-omap2/pm44xx.c +++ b/arch/arm/mach-omap2/pm44xx.c @@ -88,6 +88,13 @@ static int omap4_pm_suspend(void) static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) { struct power_state *pwrst; + const u8 fpwrst_states[] = { + PWRDM_FUNC_PWRST_CSWR, + PWRDM_FUNC_PWRST_OSWR, + PWRDM_FUNC_PWRST_OFF, + PWRDM_FUNC_PWRST_ON, + }; + int i; if (!pwrdm->pwrsts) return 0; @@ -106,12 +113,17 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) pwrst->pwrdm = pwrdm; /* - * XXX This should be replaced by explicit lists of - * powerdomains with specific powerstates to set + * We attempt to program the fpwrst of a domain in the following + * order: CSWR, OSWR, OFF, ON. This is needed as some domains + * don't support retention, and instead should go to off in low + * power modes. If everything else fails, the code falls back + * to ON state. */ - pwrst->next_fpwrst = PWRDM_FUNC_PWRST_CSWR; - if (!pwrdm_supports_fpwrst(pwrdm, pwrst->next_fpwrst)) - pwrst->next_fpwrst = PWRDM_FUNC_PWRST_ON; + for (i = 0; i < ARRAY_SIZE(fpwrst_states); i++) { + pwrst->next_fpwrst = fpwrst_states[i]; + if (pwrdm_supports_fpwrst(pwrdm, pwrst->next_fpwrst)) + break; + } list_add(&pwrst->node, &pwrst_list);