public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Tero Kristo <tero.kristo@nokia.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCHv7 1/7] OMAP3: PM: Added support functions for omap3 pwrdm handling
Date: Thu, 18 Mar 2010 15:55:46 -0700	[thread overview]
Message-ID: <87fx3xi6j1.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1268408357-15621-1-git-send-email-tero.kristo@nokia.com> (Tero Kristo's message of "Fri\, 12 Mar 2010 17\:39\:11 +0200")

Tero Kristo <tero.kristo@nokia.com> writes:

> From: Tero Kristo <tero.kristo@nokia.com>
>
> Added omap3_pwrdm_set_next_pwrst and omap3_pwrdm_read_next_pwrst. These
> functions add support for INACTIVE and ON states to the standard OMAP
> powerdomain functions, and add caching logic for the next state. HW
> directly supports the reading of INACTIVE / ON from the previous state
> register, but programming INACTIVE / ON can't be done directly.
>
> These functions are used in subsequent patches to simplify the logic of
> the idle loop.
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>

This series looks good to me now.  

I'm ready pull into the PM branch, but would like a review/ack from
Paul before submitting for upstream merge

Kevin


> ---
>  arch/arm/mach-omap2/pm.h     |    2 +
>  arch/arm/mach-omap2/pm34xx.c |   65 +++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 66 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> index b761be5..5f35911 100644
> --- a/arch/arm/mach-omap2/pm.h
> +++ b/arch/arm/mach-omap2/pm.h
> @@ -67,6 +67,8 @@ static inline void omap3_pm_init_vc(struct prm_setup_vc *setup_vc)
>  
>  extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
>  extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
> +extern int omap3_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
> +extern int omap3_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
>  
>  extern u32 wakeup_timer_seconds;
>  extern struct omap_dm_timer *gptimer_wakeup;
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index a30941a..da4e684 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -576,6 +576,68 @@ int omap3_can_sleep(void)
>  	return 1;
>  }
>  
> +struct powerdomain_data {
> +	u8 next_state;
> +};
> +
> +static struct powerdomain_data mpu_pwrdm_data;
> +static struct powerdomain_data core_pwrdm_data;
> +static struct powerdomain_data neon_pwrdm_data;
> +
> +static struct powerdomain_data *get_pwrdm_data(struct powerdomain *pwrdm)
> +{
> +	if (pwrdm == mpu_pwrdm)
> +		return &mpu_pwrdm_data;
> +	else if (pwrdm == core_pwrdm)
> +		return &core_pwrdm_data;
> +	else if (pwrdm == neon_pwrdm)
> +		return &neon_pwrdm_data;
> +	return NULL;
> +}
> +
> +static void omap3_pwrdm_init_pwrst_cache(struct powerdomain *pwrdm)
> +{
> +	struct powerdomain_data *data = get_pwrdm_data(pwrdm);
> +	if (data)
> +		data->next_state = pwrdm_read_next_pwrst(pwrdm);
> +}
> +
> +int omap3_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
> +{
> +	struct powerdomain_data *data = get_pwrdm_data(pwrdm);
> +	u8 prg_pwrst;
> +
> +	if (!data)
> +		return pwrdm_set_next_pwrst(pwrdm, pwrst);
> +
> +	if (data->next_state == pwrst)
> +		return 0;
> +
> +	if (pwrst == PWRDM_POWER_INACTIVE)
> +		prg_pwrst = PWRDM_POWER_ON;
> +	else
> +		prg_pwrst = pwrst;
> +
> +	pwrdm_set_next_pwrst(pwrdm, prg_pwrst);
> +
> +	if (pwrst == PWRDM_POWER_ON)
> +		omap2_clkdm_deny_idle(pwrdm->pwrdm_clkdms[0]);
> +	else
> +		omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
> +
> +	data->next_state = pwrst;
> +	return 0;
> +}
> +
> +int omap3_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
> +{
> +	struct powerdomain_data *data = get_pwrdm_data(pwrdm);
> +
> +	if (!data)
> +		return pwrdm_read_next_pwrst(pwrdm);
> +	return data->next_state;
> +}
> +
>  /* This sets pwrdm state (other than mpu & core. Currently only ON &
>   * RET are supported. Function is assuming that clkdm doesn't have
>   * hw_sup mode enabled. */
> @@ -604,7 +666,7 @@ int set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
>  		pwrdm_wait_transition(pwrdm);
>  	}
>  
> -	ret = pwrdm_set_next_pwrst(pwrdm, state);
> +	ret = omap3_pwrdm_set_next_pwrst(pwrdm, state);
>  	if (ret) {
>  		printk(KERN_ERR "Unable to set state of powerdomain: %s\n",
>  		       pwrdm->name);
> @@ -1103,6 +1165,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
>  	if (!pwrdm->pwrsts)
>  		return 0;
>  
> +	omap3_pwrdm_init_pwrst_cache(pwrdm);
>  	pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC);
>  	if (!pwrst)
>  		return -ENOMEM;
> -- 
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2010-03-18 22:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12 15:39 [PATCHv7 1/7] OMAP3: PM: Added support functions for omap3 pwrdm handling Tero Kristo
2010-03-12 15:39 ` [PATCHv7 2/7] OMAP3: PM: Added support for INACTIVE and ON states in omap_sram_idle Tero Kristo
2010-03-12 15:39   ` [PATCHv7 3/7] OMAP3: CPUidle: Fixed support for ON / INACTIVE states Tero Kristo
2010-03-12 15:39     ` [PATCHv7 4/7] OMAP3: Clock: Added IDLEST definitions for SGX Tero Kristo
2010-03-12 15:39       ` [PATCHv7 5/7] OMAP: Powerdomains: Add support for checking if pwrdm/clkdm can idle Tero Kristo
2010-03-12 15:39         ` [PATCHv7 6/7] OMAP3: PM: Moved pwrdm state control logic from omap_sram_idle to cpuidle Tero Kristo
2010-03-12 15:39           ` [PATCHv7 7/7] OMAP3: PM: Added support for suspending to INACTIVE state Tero Kristo
2010-03-18 22:54       ` [PATCHv7 4/7] OMAP3: Clock: Added IDLEST definitions for SGX Kevin Hilman
2010-03-18 22:55 ` Kevin Hilman [this message]

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=87fx3xi6j1.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tero.kristo@nokia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox