=============
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(-)
@@ -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);