[PATCH 1/5] OMAP4: PM: Use the lowpwrstatechange feature on OMAP4

Kevin Hilman khilman at deeprootsystems.com
Tue Dec 14 14:51:52 EST 2010


Benoit Cousson <b-cousson at ti.com> writes:

> From: Rajendra Nayak <rnayak at ti.com>
>
> For pwrdm's which support lowperstatechange, do not try waking
> up the domain to put it back to deeper sleep state.
>
> Signed-off-by: Rajendra Nayak <rnayak at ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar at ti.com>
> Acked-by: Benoit Cousson <b-cousson at ti.com>

Re: $SUBJECT, the rather than using the cryptic lowpwrstchange name from the 
pwrdm API, just use the more readable "low-power state change"

Also, readability/flow, I have some questions/comments...

> ---
>  arch/arm/mach-omap2/pm.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index cf1c4c9..dc68044 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -114,6 +114,14 @@ int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
>  		return ret;
>  
>  	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?

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.

Kevin

> +		}
>  		omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
>  		sleep_switch = 1;
>  		pwrdm_wait_transition(pwrdm);



More information about the linux-arm-kernel mailing list