linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: t-kristo@ti.com (Tero Kristo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/12] ARM: OMAP44xx: PM: convert to use the functional power states API
Date: Fri, 4 Jan 2013 16:01:24 +0200	[thread overview]
Message-ID: <1357308084.2221.101.camel@sokoban> (raw)
In-Reply-To: <20121209175313.6933.36300.stgit@dusk.lan>

Hi Paul,

On Sun, 2012-12-09 at 10:53 -0700, Paul Walmsley wrote:

<clip>

> @@ -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.

<clip>

> @@ -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):

=============

From: Tero Kristo <t-kristo@ti.com>
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 <t-kristo@ti.com>
---
 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);
 
 	return WARN_ON(pwrdm_set_fpwrst(pwrst->pwrdm, pwrst->next_fpwrst));
-- 
1.7.4.1

  parent reply	other threads:[~2013-01-04 14:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-09 17:52 [PATCH 00/12] ARM: OMAP2+: powerdomain/PM: convert to functional power states Paul Walmsley
2012-12-09 17:52 ` [PATCH 01/12] ARM: OMAP2+: powerdomain: add functions that report on powerdomain capabilities Paul Walmsley
2012-12-09 17:53 ` [PATCH 02/12] ARM: OMAP2+: PM: introduce power domains functional states Paul Walmsley
2012-12-12 10:00   ` Jean Pihet
2013-01-29 21:20     ` Paul Walmsley
2012-12-12 10:21   ` Vaibhav Hiremath
2012-12-12 10:33   ` Jean Pihet
2013-01-04 13:22     ` Tero Kristo
2012-12-26  6:06   ` Bedia, Vaibhav
2012-12-09 17:53 ` [PATCH 03/12] ARM: OMAP2+: PM debug: trace the functional power domains states Paul Walmsley
2012-12-09 17:53 ` [PATCH 04/12] ARM: OMAP2xxx: PM: convert to use the functional power states API Paul Walmsley
2012-12-09 17:53 ` [PATCH 05/12] ARM: OMAP3xxx: " Paul Walmsley
2012-12-12 10:18   ` Jean Pihet
2012-12-12 10:29   ` Jean Pihet
2013-01-04 13:45   ` Tero Kristo
2012-12-09 17:53 ` [PATCH 06/12] ARM: OMAP44xx: " Paul Walmsley
2012-12-12 10:41   ` Jean Pihet
2013-01-04 14:01   ` Tero Kristo [this message]
2012-12-09 17:53 ` [PATCH 07/12] ARM: OMAP2+: PM: use power domain functional state in stats counters Paul Walmsley
2012-12-12 10:46   ` Jean Pihet
2013-01-04 14:07   ` Tero Kristo
2012-12-09 17:53 ` [PATCH 08/12] ARM: OMAP2+: powerdomain: drop many low-level powerdomain funcs Paul Walmsley
2012-12-09 17:53 ` [PATCH 09/12] ARM: OMAP2+: powerdomain: add ability to test for supported power states Paul Walmsley
2012-12-09 17:53 ` [PATCH 10/12] ARM: OMAP2+: powerdomain/PM: only program " Paul Walmsley
2012-12-09 17:53 ` [PATCH 11/12] ARM: OMAP2+: powerdomain: program memory bank next-power-state upon init Paul Walmsley
2012-12-09 17:53 ` [PATCH 12/12] ARM: OMAP2+: powerdomain: assume memory bank power states follow powerdomain Paul Walmsley
2013-01-04 14:12 ` [PATCH 00/12] ARM: OMAP2+: powerdomain/PM: convert to functional power states Tero Kristo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357308084.2221.101.camel@sokoban \
    --to=t-kristo@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).