All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Nishanth Menon <nm@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>
Subject: Re: [PM-WIP_CPUFREQ][PATCH V3 3/8] OMAP2+: cpufreq: use opp/clk_*cpufreq_table based on silicon
Date: Thu, 26 May 2011 10:38:56 -0700	[thread overview]
Message-ID: <87pqn5e4zz.fsf@ti.com> (raw)
In-Reply-To: <1306366733-8439-4-git-send-email-nm@ti.com> (Nishanth Menon's message of "Wed, 25 May 2011 16:38:48 -0700")

Nishanth Menon <nm@ti.com> writes:

> OMAP2 is the only family using clk_[init|exit]_cpufreq_table, while
> OMAP3+ use OPP table to generate and release the cpufreq tables.
>
> Hence use a flag to mark which API to use for allocating and freeing
> the tables.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>

I'd prefer to see this even cleaner by dropping the clk_* versions all
together.  Then, for those who want OMAP2 support (currently not working
or validated anyways), all that's needed is to add a function simlilar
to clk_init_cpufreq_table() which registers OPPs.

Kevin

> ---
>  arch/arm/mach-omap2/omap2plus-cpufreq.c |   20 +++++++++++++++-----
>  1 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> index 2d4e9d7..dbbf8b2 100644
> --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
> +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> @@ -44,6 +44,7 @@ static struct cpufreq_frequency_table *freq_table;
>  static struct clk *mpu_clk;
>  static char *mpu_clk_name;
>  static struct device *mpu_dev;
> +static bool use_opp;
>  
>  static int omap_verify_speed(struct cpufreq_policy *policy)
>  {
> @@ -166,7 +167,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
>  		return -EINVAL;
>  
>  	policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
> -	opp_init_cpufreq_table(mpu_dev, &freq_table);
> +	if (use_opp)
> +		opp_init_cpufreq_table(mpu_dev, &freq_table);
> +	else
> +		clk_init_cpufreq_table(&freq_table);
>  
>  	if (freq_table) {
>  		result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
> @@ -204,7 +208,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
>  
>  static int omap_cpu_exit(struct cpufreq_policy *policy)
>  {
> -	clk_exit_cpufreq_table(&freq_table);
> +	if (use_opp)
> +		opp_free_cpufreq_table(mpu_dev, &freq_table);
> +	else
> +		clk_exit_cpufreq_table(&freq_table);
>  	clk_put(mpu_clk);
>  	return 0;
>  }
> @@ -227,12 +234,15 @@ static struct cpufreq_driver omap_driver = {
>  
>  static int __init omap_cpufreq_init(void)
>  {
> -	if (cpu_is_omap24xx())
> +	use_opp = true;
> +	if (cpu_is_omap24xx()) {
>  		mpu_clk_name = "virt_prcm_set";
> -	else if (cpu_is_omap34xx())
> +		use_opp = false;
> +	} else if (cpu_is_omap34xx()) {
>  		mpu_clk_name = "dpll1_ck";
> -	else if (cpu_is_omap44xx())
> +	} else if (cpu_is_omap44xx()) {
>  		mpu_clk_name = "dpll_mpu_ck";
> +	}
>  
>  	if (!mpu_clk_name) {
>  		pr_err("%s: unsupported Silicon?\n", __func__);

  reply	other threads:[~2011-05-26 17:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 23:38 [PM-WIP_CPUFREQ][PATCH 0/6 V3] Cleanups for cpufreq Nishanth Menon
2011-05-25 23:38 ` [PM-WIP_CPUFREQ][PATCH V3 1/8] OMAP2+: cpufreq: move clk name decision to init Nishanth Menon
2011-05-26 17:33   ` Kevin Hilman
2011-05-25 23:38 ` [PM-WIP_CPUFREQ][PATCH V3 2/8] OMAP2+: cpufreq: deny initialization if no mpudev Nishanth Menon
2011-05-26 17:34   ` Kevin Hilman
2011-05-25 23:38 ` [PM-WIP_CPUFREQ][PATCH V3 3/8] OMAP2+: cpufreq: use opp/clk_*cpufreq_table based on silicon Nishanth Menon
2011-05-26 17:38   ` Kevin Hilman [this message]
2011-05-26 18:35     ` Menon, Nishanth
2011-05-26 18:39       ` Menon, Nishanth
2011-05-26 20:25         ` Kevin Hilman
2011-05-25 23:38 ` [PM-WIP_CPUFREQ][PATCH V3 4/8] OMAP2+: cpufreq: dont support !freq_table Nishanth Menon
2011-05-26  0:51   ` Todd Poynor
2011-05-26  0:53     ` Menon, Nishanth
     [not found]     ` <SNT104-W336E0DDFB034FA635C328BBA770@phx.gbl>
2011-05-26  1:03       ` Menon, Nishanth
2011-05-25 23:38 ` [PM-WIP_CPUFREQ][PATCH V3 5/8] OMAP2+: cpufreq: fix invalid cpufreq table with central alloc/free Nishanth Menon
2011-05-26  1:09   ` Todd Poynor
2011-05-26  1:21     ` Menon, Nishanth
2011-05-25 23:38 ` [PM-WIP_CPUFREQ][PATCH V3 6/8] OMAP2+: cpufreq: fix freq_table leak Nishanth Menon
2011-05-26  0:16   ` Kevin Hilman
2011-05-26  0:47     ` Menon, Nishanth
2011-05-26 17:11       ` Kevin Hilman
2011-05-26 18:34         ` Menon, Nishanth
2011-05-26  1:25   ` Todd Poynor
2011-05-26  1:36     ` Menon, Nishanth
2011-05-25 23:38 ` [PM-WIP_CPUFREQ][PATCH V3 7/8] OMAP2+: cpufreq: put clk if cpu_init failed Nishanth Menon
2011-05-25 23:38 ` [PM-WIP_CPUFREQ][PATCH V3 8/8] OMAP: cpufreq: minor file header updates Nishanth Menon
2011-05-26  0:18   ` Kevin Hilman
2011-05-26  0:48     ` Menon, Nishanth
2011-05-26 18:15   ` Kevin Hilman
2011-05-26 18:10 ` [PM-WIP_CPUFREQ][PATCH 0/6 V3] Cleanups for cpufreq Kevin Hilman
2011-05-26 18:36   ` Menon, Nishanth
2011-05-27  5:06   ` Santosh Shilimkar
2011-05-27  6:07     ` Menon, Nishanth
2011-05-27  6:26       ` Santosh Shilimkar
2011-05-27 15:33         ` Turquette, Mike
2011-05-27 23:27           ` Kevin Hilman
2011-05-29 17:25             ` Menon, Nishanth

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=87pqn5e4zz.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@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.