From: Kevin Hilman <khilman@deeprootsystems.com>
To: Rajendra Nayak <rnayak@ti.com>
Cc: paul@pwsan.com, linux-omap@vger.kernel.org,
Santosh Shilimkar <santosh.shilimkar@ti.com>,
Benoit Cousson <b-cousson@ti.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/5] OMAP4: PM: Use the lowpwrstatechange feature on OMAP4
Date: Wed, 15 Dec 2010 15:40:31 -0800 [thread overview]
Message-ID: <874oaek3kg.fsf@deeprootsystems.com> (raw)
In-Reply-To: <c454400af490d75c274f19a5d0a5a655@mail.gmail.com> (Rajendra Nayak's message of "Wed, 15 Dec 2010 20:47:52 +0530")
Rajendra Nayak <rnayak@ti.com> writes:
> Hi Kevin,
>
> <snip>..
>
>> > if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
>> > + if ((pwrdm_read_pwrst(pwrdm) > state) &&
>> > + (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
>> > + ret = pwrdm_set_next_pwrst(pwrdm, state);
>> > + pwrdm_set_lowpwrstchange(pwrdm);
>> > + pwrdm_wait_transition(pwrdm);
>> > + pwrdm_state_switch(pwrdm);
>> > + return ret;
>>
>> Personally, I'd prefer if this function flowed through better instead of
>> the early return in order to emphasize the common code.
>>
>> Rather than the return here, can you just set the low-power state change
>> bit here (and put the clkdm_wakeup + sleep_switch = 1 into the else
>> clause?
>>
>> Or, does the next state have to be set before the low-power state change
>> bit?
>
> Yes, that sequencing is needed.
>
>>
>> Basically, what I'm getting at is this should be a single function with
>> common flow. The conditional code based on low-power state change
>> should be isolated instead of having a special path.
>
> I get your point. See if the below approach looks better.
> If it looks fine, I'll do some more testing (currently only tested
> on OMAP4430sdp) and repost the 2 patches.
Yes, this approach leads to better readability IMO.
Thanks,
Kevin
> From 5d206ba908071edafae6c044bd3ef6ad8a9c32e7 Mon Sep 17 00:00:00 2001
> From: Rajendra Nayak <rnayak@ti.com>
> Date: Thu, 25 Nov 2010 14:26:51 +0530
> Subject: [PATCH 1/5] OMAP4: PM: Use the low-power state change feature on
> OMAP4
>
> For pwrdm's which support LOWPOWERSTATECHANGE, do not try waking
> up the domain to put it back to deeper sleep state.
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Acked-by: Benoit Cousson <b-cousson@ti.com>
> ---
> arch/arm/mach-omap2/pm.c | 28 ++++++++++++++++++++++------
> 1 file changed, 22 insertions(+), 6 deletions(-)
>
> Index: linux/arch/arm/mach-omap2/pm.c
> ===================================================================
> --- linux.orig/arch/arm/mach-omap2/pm.c 2010-12-15 17:29:42.361228780
> +0530
> +++ linux/arch/arm/mach-omap2/pm.c 2010-12-15 20:19:48.321228780
> +0530
> @@ -89,6 +89,10 @@
> }
> }
>
> +/* Types of sleep_switch used in omap_set_pwrdm_state */
> +#define FORCEWAKEUP_SWITCH 0
> +#define LOWPOWERSTATE_SWITCH 1
> +
> /*
> * This sets pwrdm state (other than mpu & core. Currently only ON &
> * RET are supported. Function is assuming that clkdm doesn't have
> @@ -114,9 +118,14 @@
> return ret;
>
> if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
> - omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
> - sleep_switch = 1;
> - pwrdm_wait_transition(pwrdm);
> + if ((pwrdm_read_pwrst(pwrdm) > state) &&
> + (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
> + sleep_switch = LOWPOWERSTATE_SWITCH;
> + } else {
> + omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
> + pwrdm_wait_transition(pwrdm);
> + sleep_switch = FORCEWAKEUP_SWITCH;
> + }
> }
>
> ret = pwrdm_set_next_pwrst(pwrdm, state);
> @@ -126,12 +135,19 @@
> goto err;
> }
>
> - if (sleep_switch) {
> + switch (sleep_switch) {
> + case FORCEWAKEUP_SWITCH:
> omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
> - pwrdm_wait_transition(pwrdm);
> - pwrdm_state_switch(pwrdm);
> + break;
> + case LOWPOWERSTATE_SWITCH:
> + pwrdm_set_lowpwrstchange(pwrdm);
> + break;
> + default:
> + return ret;
> }
>
> + pwrdm_wait_transition(pwrdm);
> + pwrdm_state_switch(pwrdm);
> err:
> return ret;
> }
>
>
>>
>> Kevin
>>
>> > + }
>> > omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
>> > sleep_switch = 1;
>> > pwrdm_wait_transition(pwrdm);
WARNING: multiple messages have this Message-ID (diff)
From: khilman@deeprootsystems.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] OMAP4: PM: Use the lowpwrstatechange feature on OMAP4
Date: Wed, 15 Dec 2010 15:40:31 -0800 [thread overview]
Message-ID: <874oaek3kg.fsf@deeprootsystems.com> (raw)
In-Reply-To: <c454400af490d75c274f19a5d0a5a655@mail.gmail.com> (Rajendra Nayak's message of "Wed, 15 Dec 2010 20:47:52 +0530")
Rajendra Nayak <rnayak@ti.com> writes:
> Hi Kevin,
>
> <snip>..
>
>> > if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
>> > + if ((pwrdm_read_pwrst(pwrdm) > state) &&
>> > + (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
>> > + ret = pwrdm_set_next_pwrst(pwrdm, state);
>> > + pwrdm_set_lowpwrstchange(pwrdm);
>> > + pwrdm_wait_transition(pwrdm);
>> > + pwrdm_state_switch(pwrdm);
>> > + return ret;
>>
>> Personally, I'd prefer if this function flowed through better instead of
>> the early return in order to emphasize the common code.
>>
>> Rather than the return here, can you just set the low-power state change
>> bit here (and put the clkdm_wakeup + sleep_switch = 1 into the else
>> clause?
>>
>> Or, does the next state have to be set before the low-power state change
>> bit?
>
> Yes, that sequencing is needed.
>
>>
>> Basically, what I'm getting at is this should be a single function with
>> common flow. The conditional code based on low-power state change
>> should be isolated instead of having a special path.
>
> I get your point. See if the below approach looks better.
> If it looks fine, I'll do some more testing (currently only tested
> on OMAP4430sdp) and repost the 2 patches.
Yes, this approach leads to better readability IMO.
Thanks,
Kevin
> From 5d206ba908071edafae6c044bd3ef6ad8a9c32e7 Mon Sep 17 00:00:00 2001
> From: Rajendra Nayak <rnayak@ti.com>
> Date: Thu, 25 Nov 2010 14:26:51 +0530
> Subject: [PATCH 1/5] OMAP4: PM: Use the low-power state change feature on
> OMAP4
>
> For pwrdm's which support LOWPOWERSTATECHANGE, do not try waking
> up the domain to put it back to deeper sleep state.
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Acked-by: Benoit Cousson <b-cousson@ti.com>
> ---
> arch/arm/mach-omap2/pm.c | 28 ++++++++++++++++++++++------
> 1 file changed, 22 insertions(+), 6 deletions(-)
>
> Index: linux/arch/arm/mach-omap2/pm.c
> ===================================================================
> --- linux.orig/arch/arm/mach-omap2/pm.c 2010-12-15 17:29:42.361228780
> +0530
> +++ linux/arch/arm/mach-omap2/pm.c 2010-12-15 20:19:48.321228780
> +0530
> @@ -89,6 +89,10 @@
> }
> }
>
> +/* Types of sleep_switch used in omap_set_pwrdm_state */
> +#define FORCEWAKEUP_SWITCH 0
> +#define LOWPOWERSTATE_SWITCH 1
> +
> /*
> * This sets pwrdm state (other than mpu & core. Currently only ON &
> * RET are supported. Function is assuming that clkdm doesn't have
> @@ -114,9 +118,14 @@
> return ret;
>
> if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
> - omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
> - sleep_switch = 1;
> - pwrdm_wait_transition(pwrdm);
> + if ((pwrdm_read_pwrst(pwrdm) > state) &&
> + (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
> + sleep_switch = LOWPOWERSTATE_SWITCH;
> + } else {
> + omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
> + pwrdm_wait_transition(pwrdm);
> + sleep_switch = FORCEWAKEUP_SWITCH;
> + }
> }
>
> ret = pwrdm_set_next_pwrst(pwrdm, state);
> @@ -126,12 +135,19 @@
> goto err;
> }
>
> - if (sleep_switch) {
> + switch (sleep_switch) {
> + case FORCEWAKEUP_SWITCH:
> omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
> - pwrdm_wait_transition(pwrdm);
> - pwrdm_state_switch(pwrdm);
> + break;
> + case LOWPOWERSTATE_SWITCH:
> + pwrdm_set_lowpwrstchange(pwrdm);
> + break;
> + default:
> + return ret;
> }
>
> + pwrdm_wait_transition(pwrdm);
> + pwrdm_state_switch(pwrdm);
> err:
> return ret;
> }
>
>
>>
>> Kevin
>>
>> > + }
>> > omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
>> > sleep_switch = 1;
>> > pwrdm_wait_transition(pwrdm);
next prev parent reply other threads:[~2010-12-15 23:40 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 21:49 [PATCH 0/5] OMAP3&4: Fixes in setup/suspend/powerdomain Benoit Cousson
2010-12-13 21:49 ` Benoit Cousson
2010-12-13 21:49 ` [PATCH 1/5] OMAP4: PM: Use the lowpwrstatechange feature on OMAP4 Benoit Cousson
2010-12-13 21:49 ` Benoit Cousson
2010-12-14 19:51 ` Kevin Hilman
2010-12-14 19:51 ` Kevin Hilman
2010-12-15 15:17 ` Rajendra Nayak
2010-12-15 15:17 ` Rajendra Nayak
2010-12-15 23:40 ` Kevin Hilman [this message]
2010-12-15 23:40 ` Kevin Hilman
2010-12-13 21:49 ` [PATCH 2/5] OMAP4: PM: Do not assume clkdm supports hw transitions Benoit Cousson
2010-12-13 21:49 ` Benoit Cousson
2010-12-14 19:52 ` Kevin Hilman
2010-12-14 19:52 ` Kevin Hilman
2010-12-13 21:49 ` [PATCH 3/5] OMAP4: powerdomain: l4per pwrdm does not support OFF Benoit Cousson
2010-12-13 21:49 ` Benoit Cousson
2010-12-13 21:49 ` [PATCH 4/5] OMAP4: powerdomain: Remove L3INIT_PD OFF state Benoit Cousson
2010-12-13 21:49 ` Benoit Cousson
2010-12-13 21:49 ` [PATCH 5/5] OMAP4: clock data: Keep L3INSTR clock domain modulemode under HW control Benoit Cousson
2010-12-13 21:49 ` Benoit Cousson
2010-12-14 6:43 ` [PATCH 0/5] OMAP3&4: Fixes in setup/suspend/powerdomain Paul Walmsley
2010-12-14 6:43 ` Paul Walmsley
2010-12-14 19:53 ` Kevin Hilman
2010-12-14 19:53 ` Kevin Hilman
2010-12-22 3:43 ` Paul Walmsley
2010-12-22 3:43 ` Paul Walmsley
2010-12-22 3:45 ` Paul Walmsley
2010-12-22 3:45 ` Paul Walmsley
2010-12-22 3:44 ` Paul Walmsley
2010-12-22 3:44 ` Paul Walmsley
2010-12-22 11:42 ` Santosh Shilimkar
2010-12-22 11:42 ` Santosh Shilimkar
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=874oaek3kg.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=b-cousson@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=rnayak@ti.com \
--cc=santosh.shilimkar@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.