linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jean.pihet@newoldbits.com (jean.pihet at newoldbits.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 8/8] OMAP PM: early init of the pwrdms states
Date: Wed,  4 May 2011 15:35:17 +0200	[thread overview]
Message-ID: <1304516117-9334-9-git-send-email-j-pihet@ti.com> (raw)
In-Reply-To: <1304516117-9334-1-git-send-email-j-pihet@ti.com>

From: Jean Pihet <j-pihet@ti.com>

The powerdomains next states are initialized in pwrdms_setup as a
late_initcall. Because the wake-up constraint can be requested
early in the boot sequence, the power domains next states can be
overwritten by pwrdms_setup.

This patch fixes it by initializing the power domains next states
early at boot, so that the constraints can be applied.
Later in the pwrdms_setup function the currently programmed
next states are re-used as next state values.

Applies to OMAP3 and OMAP4.

Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints
on MPU, CORE and PER.

Signed-off-by: Jean Pihet <j-pihet@ti.com>
---
 arch/arm/mach-omap2/pm34xx.c      |    2 +-
 arch/arm/mach-omap2/pm44xx.c      |    2 +-
 arch/arm/mach-omap2/powerdomain.c |    5 +++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 0c5e3a4..8d202a7 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -840,7 +840,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
 	if (!pwrst)
 		return -ENOMEM;
 	pwrst->pwrdm = pwrdm;
-	pwrst->next_state = PWRDM_POWER_RET;
+	pwrst->next_state = pwrdm_read_next_pwrst(pwrdm);
 	list_add(&pwrst->node, &pwrst_list);
 
 	if (pwrdm_has_hdwr_sar(pwrdm))
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 59a870b..049efe9 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -84,7 +84,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
 	if (!pwrst)
 		return -ENOMEM;
 	pwrst->pwrdm = pwrdm;
-	pwrst->next_state = PWRDM_POWER_ON;
+	pwrdm->state = pwrdm_read_pwrst(pwrdm);
 	list_add(&pwrst->node, &pwrst_list);
 
 	return pwrdm_set_next_pwrst(pwrst->pwrdm, pwrst->next_state);
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 9860630..3294707 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -78,6 +78,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
 static int _pwrdm_register(struct powerdomain *pwrdm)
 {
 	int i;
+	int next_state = PWRDM_POWER_RET;
 
 	if (!pwrdm || !pwrdm->name)
 		return -EINVAL;
@@ -114,6 +115,10 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
 	pwrdm_wait_transition(pwrdm);
 	pwrdm->state = pwrdm_read_pwrst(pwrdm);
 	pwrdm->state_counter[pwrdm->state] = 1;
+	/* Early init of the next power state */
+	if (cpu_is_omap44xx())
+		next_state = PWRDM_POWER_ON;
+	pwrdm_set_next_pwrst(pwrdm, next_state);
 
 	pr_debug("powerdomain: registered %s\n", pwrdm->name);
 
-- 
1.7.2.5

  parent reply	other threads:[~2011-05-04 13:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 13:35 [PATCH v4 0/8] OMAP: add PM_CONSTRAINTS framework jean.pihet at newoldbits.com
2011-05-04 13:35 ` [PATCH 1/8] OMAP PM: create a PM layer plugin for per-device constraints jean.pihet at newoldbits.com
2011-05-04 13:59   ` Tony Lindgren
2011-05-04 14:36     ` Kevin Hilman
2011-05-05  6:00       ` Tony Lindgren
2011-05-06  6:20         ` Tony Lindgren
2011-05-04 13:35 ` [PATCH 2/8] OMAP2+: powerdomain: control power domains next state jean.pihet at newoldbits.com
2011-05-04 13:35 ` [PATCH 3/8] OMAP3: powerdomain data: add wake-up latency figures jean.pihet at newoldbits.com
2011-05-04 13:35 ` [PATCH 4/8] OMAP2+: omap_hwmod: manage the omap_devices the wake-up latency constraints jean.pihet at newoldbits.com
2011-05-04 13:35 ` [PATCH 5/8] OMAP: PM CONSTRAINTS: add an enum for the classes of constraint jean.pihet at newoldbits.com
2011-05-04 13:35 ` [PATCH 6/8] OMAP2+: omap_device: implement the constraints management code jean.pihet at newoldbits.com
2011-05-04 22:11   ` Todd Poynor
2011-05-04 13:35 ` [PATCH 7/8] OMAP: PM CONSTRAINTS: implement wake-up latency constraints jean.pihet at newoldbits.com
2011-05-04 13:35 ` jean.pihet at newoldbits.com [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-03-30 15:19 [PATCH v3 0/8] OMAP: add PM CONSTRAINTS framework jean.pihet at newoldbits.com
2011-03-30 15:19 ` [PATCH 8/8] OMAP PM: early init of the pwrdms states jean.pihet at newoldbits.com

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=1304516117-9334-9-git-send-email-j-pihet@ti.com \
    --to=jean.pihet@newoldbits.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).