All of lore.kernel.org
 help / color / mirror / Atom feed
* [PM-WIP_CPUFREQ][PATCH v4 0/4] Cleanups for cpufreq
@ 2011-05-27  2:39 Nishanth Menon
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 1/4] OMAP2+: cpufreq: dont support !freq_table Nishanth Menon
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Nishanth Menon @ 2011-05-27  2:39 UTC (permalink / raw)
  To: linux-omap; +Cc: Kevin, Nishanth Menon

Rev 4 of cleanups for cpufreq to take care of the review comments on
the remaining rev3 patches.

Applies on top of:
git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm.git
branch: pm-wip/cpufreq

Tested on SDP4430 - with a TI internal loadgenerator controlled on each cpu
while online/offline of cpu1 and using all governors. (Used a forked dvfs
for testing purposes)

Patch 4 Depends on: http://marc.info/?t=130630947000002&r=1&w=2
v4: changes:
	* we drop omap2 code for clk_init/exit and expect omap2 be
	supported once we get OPP/wrapper function to give us that
	function (http://marc.info/?l=linux-omap&m=130644155723048&w=2)
	* Dropped  the mutex infavor of atomic
	(http://marc.info/?l=linux-omap&m=130643487913294&w=2)

v3: http://marc.info/?l=linux-omap&m=130636674200733&w=2
v2: http://marc.info/?l=linux-omap&m=130570427214357&w=2
V1: http://marc.info/?l=linux-omap&m=130532085617487&w=2

Nishanth Menon (4):
  OMAP2+: cpufreq: dont support !freq_table
  OMAP2+: cpufreq: use OPP library
  OMAP2+: cpufreq: put clk if cpu_init failed
  OMAP2+: cpufreq: fix freq_table leak

 arch/arm/mach-omap2/Makefile            |    4 +-
 arch/arm/mach-omap2/omap2plus-cpufreq.c |  103 ++++++++++++++++++------------
 2 files changed, 64 insertions(+), 43 deletions(-)

Regards,
Nishanth Menon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PM-WIP_CPUFREQ][PATCH v4 1/4] OMAP2+: cpufreq: dont support !freq_table
  2011-05-27  2:39 [PM-WIP_CPUFREQ][PATCH v4 0/4] Cleanups for cpufreq Nishanth Menon
@ 2011-05-27  2:39 ` Nishanth Menon
  2011-06-02 22:11   ` Kevin Hilman
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library Nishanth Menon
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Nishanth Menon @ 2011-05-27  2:39 UTC (permalink / raw)
  To: linux-omap; +Cc: Kevin, Nishanth Menon

OMAP2+ all have frequency tables, hence the hacks we had for older
silicon do not need to be carried forward. As part of this change,
use cpufreq_frequency_table_target to find the best match for
frequency requested.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/omap2plus-cpufreq.c |   67 +++++++++++++++----------------
 1 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
index 33a91ec..acf18e8 100644
--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
@@ -38,8 +38,6 @@
 
 #include <mach/hardware.h>
 
-#define VERY_HI_RATE	900000000
-
 static struct cpufreq_frequency_table *freq_table;
 static struct clk *mpu_clk;
 static char *mpu_clk_name;
@@ -47,20 +45,9 @@ static struct device *mpu_dev;
 
 static int omap_verify_speed(struct cpufreq_policy *policy)
 {
-	if (freq_table)
-		return cpufreq_frequency_table_verify(policy, freq_table);
-
-	if (policy->cpu)
+	if (!freq_table)
 		return -EINVAL;
-
-	cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
-				     policy->cpuinfo.max_freq);
-
-	policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000;
-	policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000;
-	cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
-				     policy->cpuinfo.max_freq);
-	return 0;
+	return cpufreq_frequency_table_verify(policy, freq_table);
 }
 
 static unsigned int omap_getspeed(unsigned int cpu)
@@ -78,22 +65,35 @@ static int omap_target(struct cpufreq_policy *policy,
 		       unsigned int target_freq,
 		       unsigned int relation)
 {
-	int i, ret = 0;
+	unsigned int i;
+	int ret = 0;
 	struct cpufreq_freqs freqs;
 
 	/* Changes not allowed until all CPUs are online */
 	if (is_smp() && (num_online_cpus() < NR_CPUS))
 		return ret;
 
-	/* Ensure desired rate is within allowed range.  Some govenors
-	 * (ondemand) will just pass target_freq=0 to get the minimum. */
-	if (target_freq < policy->min)
-		target_freq = policy->min;
-	if (target_freq > policy->max)
-		target_freq = policy->max;
+	if (!freq_table) {
+		dev_err(mpu_dev, "%s: cpu%d: no freq table!\n", __func__,
+				policy->cpu);
+		return -EINVAL;
+	}
+
+	ret = cpufreq_frequency_table_target(policy, freq_table, target_freq,
+			relation, &i);
+	if (ret) {
+		dev_dbg(mpu_dev, "%s: cpu%d: no freq match for %d(ret=%d)\n",
+			__func__, policy->cpu, target_freq, ret);
+		return ret;
+	}
+	freqs.new = freq_table[i].frequency;
+	if (!freqs.new) {
+		dev_err(mpu_dev, "%s: cpu%d: no match for freq %d\n", __func__,
+			policy->cpu, target_freq);
+		return -EINVAL;
+	}
 
 	freqs.old = omap_getspeed(policy->cpu);
-	freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
 	freqs.cpu = policy->cpu;
 
 	if (freqs.old == freqs.new)
@@ -166,19 +166,18 @@ 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 (freq_table) {
-		result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
-		if (!result)
-			cpufreq_frequency_table_get_attr(freq_table,
-							policy->cpu);
-	} else {
-		policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
-		policy->cpuinfo.max_freq = clk_round_rate(mpu_clk,
-							VERY_HI_RATE) / 1000;
+	result = opp_init_cpufreq_table(mpu_dev, &freq_table);
+
+	if (result) {
+		dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n",
+				__func__, policy->cpu, result);
+		return result;
 	}
 
+	result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
+	if (!result)
+		cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
+
 	policy->min = policy->cpuinfo.min_freq;
 	policy->max = policy->cpuinfo.max_freq;
 	policy->cur = omap_getspeed(policy->cpu);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library
  2011-05-27  2:39 [PM-WIP_CPUFREQ][PATCH v4 0/4] Cleanups for cpufreq Nishanth Menon
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 1/4] OMAP2+: cpufreq: dont support !freq_table Nishanth Menon
@ 2011-05-27  2:39 ` Nishanth Menon
  2011-06-02 22:10   ` Kevin Hilman
  2011-06-02 22:45   ` Kevin Hilman
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 3/4] OMAP2+: cpufreq: put clk if cpu_init failed Nishanth Menon
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 4/4] OMAP2+: cpufreq: fix freq_table leak Nishanth Menon
  3 siblings, 2 replies; 10+ messages in thread
From: Nishanth Menon @ 2011-05-27  2:39 UTC (permalink / raw)
  To: linux-omap; +Cc: Kevin, Nishanth Menon

OMAP2 is the only family using clk_[init|exit]_cpufreq_table, however,
the cpufreq code has does not use clk_init_cpufreq_table. As a result,
it is unusuable for OMAP2 and only usable only on platforms using OPP
library.

So move the compilation for cpufreq only if OPP is available for the
architecture and deny OMAP2 in multi-OMAP builds until OMAP2 is fixed.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/Makefile            |    4 ++--
 arch/arm/mach-omap2/omap2plus-cpufreq.c |   12 +++++++-----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index dcf5200..70c9fc7 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -54,10 +54,10 @@ ifeq ($(CONFIG_PM_OPP),y)
 obj-y					+= opp.o
 obj-$(CONFIG_ARCH_OMAP3)		+= opp3xxx_data.o
 obj-$(CONFIG_ARCH_OMAP4)		+= opp4xxx_data.o
-endif
-
 # CPUFREQ driver
 obj-$(CONFIG_CPU_FREQ)			+= omap2plus-cpufreq.o
+endif
+
 
 # Power Management
 ifeq ($(CONFIG_PM),y)
diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
index acf18e8..e10fcf8 100644
--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
@@ -1,7 +1,7 @@
 /*
  *  OMAP2PLUS cpufreq driver
  *
- *  CPU frequency scaling for OMAP
+ *  CPU frequency scaling for OMAP using OPP information
  *
  *  Copyright (C) 2005 Nokia Corporation
  *  Written by Tony Lindgren <tony@atomide.com>
@@ -203,7 +203,6 @@ 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);
 	clk_put(mpu_clk);
 	return 0;
 }
@@ -226,12 +225,15 @@ static struct cpufreq_driver omap_driver = {
 
 static int __init omap_cpufreq_init(void)
 {
-	if (cpu_is_omap24xx())
+	if (cpu_is_omap24xx()) {
 		mpu_clk_name = "virt_prcm_set";
-	else if (cpu_is_omap34xx())
+		pr_warning("%s: omap2 cpufreq needs fixing\n", __func__);
+		return -EINVAL;
+	} 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__);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PM-WIP_CPUFREQ][PATCH v4 3/4] OMAP2+: cpufreq: put clk if cpu_init failed
  2011-05-27  2:39 [PM-WIP_CPUFREQ][PATCH v4 0/4] Cleanups for cpufreq Nishanth Menon
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 1/4] OMAP2+: cpufreq: dont support !freq_table Nishanth Menon
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library Nishanth Menon
@ 2011-05-27  2:39 ` Nishanth Menon
  2011-06-02 22:12   ` Kevin Hilman
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 4/4] OMAP2+: cpufreq: fix freq_table leak Nishanth Menon
  3 siblings, 1 reply; 10+ messages in thread
From: Nishanth Menon @ 2011-05-27  2:39 UTC (permalink / raw)
  To: linux-omap; +Cc: Kevin, Nishanth Menon

Release the mpu_clk in fail paths.

Reported-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
 arch/arm/mach-omap2/omap2plus-cpufreq.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
index e10fcf8..40b2a7c 100644
--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
@@ -162,8 +162,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 	if (IS_ERR(mpu_clk))
 		return PTR_ERR(mpu_clk);
 
-	if (policy->cpu >= NR_CPUS)
-		return -EINVAL;
+	if (policy->cpu >= NR_CPUS) {
+		result = -EINVAL;
+		goto fail_ck;
+	}
 
 	policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
 	result = opp_init_cpufreq_table(mpu_dev, &freq_table);
@@ -171,12 +173,14 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 	if (result) {
 		dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n",
 				__func__, policy->cpu, result);
-		return result;
+		goto fail_ck;
 	}
 
 	result = cpufreq_frequency_table_cpuinfo(policy, freq_table);
 	if (!result)
 		cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
+	else
+		goto fail_ck;
 
 	policy->min = policy->cpuinfo.min_freq;
 	policy->max = policy->cpuinfo.max_freq;
@@ -199,6 +203,10 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 	policy->cpuinfo.transition_latency = 300 * 1000;
 
 	return 0;
+
+fail_ck:
+	clk_put(mpu_clk);
+	return result;
 }
 
 static int omap_cpu_exit(struct cpufreq_policy *policy)
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PM-WIP_CPUFREQ][PATCH v4 4/4] OMAP2+: cpufreq: fix freq_table leak
  2011-05-27  2:39 [PM-WIP_CPUFREQ][PATCH v4 0/4] Cleanups for cpufreq Nishanth Menon
                   ` (2 preceding siblings ...)
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 3/4] OMAP2+: cpufreq: put clk if cpu_init failed Nishanth Menon
@ 2011-05-27  2:39 ` Nishanth Menon
  3 siblings, 0 replies; 10+ messages in thread
From: Nishanth Menon @ 2011-05-27  2:39 UTC (permalink / raw)
  To: linux-omap; +Cc: Kevin, Nishanth Menon

We use a single frequency table for multiple CPUs. But, with
OMAP4, since we have multiple CPUs, the cpu_init call for CPU1
causes freq_table previously allocated for CPU0 to be overwritten.
In addition, we dont free the table on exit path.

We solve this by maintaining an atomic type counter to ensure
just a single table exists at a given time.

Signed-off-by: Nishanth Menon <nm@ti.com>
---

NOTE: Depends on: http://marc.info/?t=130630947000002&r=1&w=2

 arch/arm/mach-omap2/omap2plus-cpufreq.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
index 40b2a7c..e101737 100644
--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
@@ -39,6 +39,7 @@
 #include <mach/hardware.h>
 
 static struct cpufreq_frequency_table *freq_table;
+static atomic_t freq_table_users = ATOMIC_INIT(0);
 static struct clk *mpu_clk;
 static char *mpu_clk_name;
 static struct device *mpu_dev;
@@ -153,6 +154,12 @@ skip_lpj:
 	return ret;
 }
 
+static inline void freq_table_free(void)
+{
+	if (atomic_dec_and_test(&freq_table_users))
+		opp_free_cpufreq_table(mpu_dev, &freq_table);
+}
+
 static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 {
 	int result = 0;
@@ -168,7 +175,9 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 	}
 
 	policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu);
-	result = opp_init_cpufreq_table(mpu_dev, &freq_table);
+
+	if (atomic_inc_return(&freq_table_users) == 1)
+		result = opp_init_cpufreq_table(mpu_dev, &freq_table);
 
 	if (result) {
 		dev_err(mpu_dev, "%s: cpu%d: failed creating freq table[%d]\n",
@@ -180,7 +189,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 	if (!result)
 		cpufreq_frequency_table_get_attr(freq_table, policy->cpu);
 	else
-		goto fail_ck;
+		goto fail_table;
 
 	policy->min = policy->cpuinfo.min_freq;
 	policy->max = policy->cpuinfo.max_freq;
@@ -204,6 +213,8 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
 
 	return 0;
 
+fail_table:
+	freq_table_free();
 fail_ck:
 	clk_put(mpu_clk);
 	return result;
@@ -211,6 +222,7 @@ fail_ck:
 
 static int omap_cpu_exit(struct cpufreq_policy *policy)
 {
+	freq_table_free();
 	clk_put(mpu_clk);
 	return 0;
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library Nishanth Menon
@ 2011-06-02 22:10   ` Kevin Hilman
  2011-06-02 22:45   ` Kevin Hilman
  1 sibling, 0 replies; 10+ messages in thread
From: Kevin Hilman @ 2011-06-02 22:10 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: linux-omap

Nishanth Menon <nm@ti.com> writes:

> OMAP2 is the only family using clk_[init|exit]_cpufreq_table, however,
> the cpufreq code has does not use clk_init_cpufreq_table. As a result,
> it is unusuable for OMAP2 and only usable only on platforms using OPP
> library.
>
> So move the compilation for cpufreq only if OPP is available for the
> architecture and deny OMAP2 in multi-OMAP builds until OMAP2 is fixed.

Let's not prevent the build, just print a failure warning when the
freq_table is empty because there were no OPPs found.  We need this also
for any new platforms that are added but don't yet have OPPs available.

> Signed-off-by: Nishanth Menon <nm@ti.com>
> ---
>  arch/arm/mach-omap2/Makefile            |    4 ++--
>  arch/arm/mach-omap2/omap2plus-cpufreq.c |   12 +++++++-----
>  2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> index dcf5200..70c9fc7 100644
> --- a/arch/arm/mach-omap2/Makefile
> +++ b/arch/arm/mach-omap2/Makefile
> @@ -54,10 +54,10 @@ ifeq ($(CONFIG_PM_OPP),y)
>  obj-y					+= opp.o
>  obj-$(CONFIG_ARCH_OMAP3)		+= opp3xxx_data.o
>  obj-$(CONFIG_ARCH_OMAP4)		+= opp4xxx_data.o
> -endif
> -
>  # CPUFREQ driver
>  obj-$(CONFIG_CPU_FREQ)			+= omap2plus-cpufreq.o
> +endif
> +
>  
>  # Power Management
>  ifeq ($(CONFIG_PM),y)
> diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> index acf18e8..e10fcf8 100644
> --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
> +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> @@ -1,7 +1,7 @@
>  /*
>   *  OMAP2PLUS cpufreq driver
>   *
> - *  CPU frequency scaling for OMAP
> + *  CPU frequency scaling for OMAP using OPP information
>   *
>   *  Copyright (C) 2005 Nokia Corporation
>   *  Written by Tony Lindgren <tony@atomide.com>
> @@ -203,7 +203,6 @@ 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);
>  	clk_put(mpu_clk);
>  	return 0;
>  }
> @@ -226,12 +225,15 @@ static struct cpufreq_driver omap_driver = {
>  
>  static int __init omap_cpufreq_init(void)
>  {
> -	if (cpu_is_omap24xx())
> +	if (cpu_is_omap24xx()) {
>  		mpu_clk_name = "virt_prcm_set";
> -	else if (cpu_is_omap34xx())
> +		pr_warning("%s: omap2 cpufreq needs fixing\n", __func__);

Rather than the warning here, just have it fail with a warning when/if
the freq_table creation fails because of no OPPs.

Kevin

> +		return -EINVAL;
> +	} 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__);

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PM-WIP_CPUFREQ][PATCH v4 1/4] OMAP2+: cpufreq: dont support !freq_table
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 1/4] OMAP2+: cpufreq: dont support !freq_table Nishanth Menon
@ 2011-06-02 22:11   ` Kevin Hilman
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin Hilman @ 2011-06-02 22:11 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: linux-omap

Nishanth Menon <nm@ti.com> writes:

> OMAP2+ all have frequency tables, hence the hacks we had for older
> silicon do not need to be carried forward. As part of this change,
> use cpufreq_frequency_table_target to find the best match for
> frequency requested.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>

Thanks, applied.

Kevin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PM-WIP_CPUFREQ][PATCH v4 3/4] OMAP2+: cpufreq: put clk if cpu_init failed
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 3/4] OMAP2+: cpufreq: put clk if cpu_init failed Nishanth Menon
@ 2011-06-02 22:12   ` Kevin Hilman
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin Hilman @ 2011-06-02 22:12 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: linux-omap

Nishanth Menon <nm@ti.com> writes:

> Release the mpu_clk in fail paths.
>
> Reported-by: Todd Poynor <toddpoynor@google.com>
> Signed-off-by: Nishanth Menon <nm@ti.com>

Thanks, applied.

Kevin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library
  2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library Nishanth Menon
  2011-06-02 22:10   ` Kevin Hilman
@ 2011-06-02 22:45   ` Kevin Hilman
  2011-06-02 23:14     ` Menon, Nishanth
  1 sibling, 1 reply; 10+ messages in thread
From: Kevin Hilman @ 2011-06-02 22:45 UTC (permalink / raw)
  To: Nishanth Menon; +Cc: linux-omap

Nishanth Menon <nm@ti.com> writes:

> OMAP2 is the only family using clk_[init|exit]_cpufreq_table, however,
> the cpufreq code has does not use clk_init_cpufreq_table. As a result,
> it is unusuable for OMAP2 and only usable only on platforms using OPP
> library.
>
> So move the compilation for cpufreq only if OPP is available for the
> architecture and deny OMAP2 in multi-OMAP builds until OMAP2 is fixed.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>

I updated this patch slightly, preferring a more generic failure mode,
namely just failing with a warning on init when no OPPs are present.

I tested this on 3430/n900 by simply commenting out the
omap_init_opp_table() for OMAP3.  CPUfreq init fails predictably with

   platform mpu.0: opp_init_cpufreq_table: Device OPP not found (-19)
   platform mpu.0: omap_cpu_init: cpu0: failed creating freq table[-19]

So CPUfreq driver never gets registered.

Updated patch below.  If you're OK with this change, I'll apply it to
pm-wip/cpufreq.

Kevin


>From 22f1704e2ec30816e34b3d46a4c61513441fce8d Mon Sep 17 00:00:00 2001
From: Nishanth Menon <nm@ti.com>
Date: Thu, 26 May 2011 19:39:18 -0700
Subject: [PATCH 2/4] OMAP2+: cpufreq: only supports OPP library

OMAP2 is the only family using clk_[init|exit]_cpufreq_table, however,
the cpufreq code does not currently use clk_init_cpufreq_table. As a
result, it is unusuable for OMAP2 and only usable only on platforms
using OPP library.

Remove the unbalanced clk_exit_cpufreq_table().  Any platforms where
OPPs are not availble will fail on init because a freq table will not
be properly initialized.

Signed-off-by: Nishanth Menon <nm@ti.com>
[khilman@ti.com: changelog edits, and graceful failure mode changes]
Acked-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/omap2plus-cpufreq.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
index acf18e8..3af7cda 100644
--- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
+++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
@@ -1,7 +1,7 @@
 /*
  *  OMAP2PLUS cpufreq driver
  *
- *  CPU frequency scaling for OMAP
+ *  CPU frequency scaling for OMAP using OPP information
  *
  *  Copyright (C) 2005 Nokia Corporation
  *  Written by Tony Lindgren <tony@atomide.com>
@@ -203,7 +203,6 @@ 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);
 	clk_put(mpu_clk);
 	return 0;
 }
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library
  2011-06-02 22:45   ` Kevin Hilman
@ 2011-06-02 23:14     ` Menon, Nishanth
  0 siblings, 0 replies; 10+ messages in thread
From: Menon, Nishanth @ 2011-06-02 23:14 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap

On Thu, Jun 2, 2011 at 17:45, Kevin Hilman <khilman@ti.com> wrote:
> Nishanth Menon <nm@ti.com> writes:
>
>> OMAP2 is the only family using clk_[init|exit]_cpufreq_table, however,
>> the cpufreq code has does not use clk_init_cpufreq_table. As a result,
>> it is unusuable for OMAP2 and only usable only on platforms using OPP
>> library.
>>
>> So move the compilation for cpufreq only if OPP is available for the
>> architecture and deny OMAP2 in multi-OMAP builds until OMAP2 is fixed.
>>
>> Signed-off-by: Nishanth Menon <nm@ti.com>
>
> I updated this patch slightly, preferring a more generic failure mode,
> namely just failing with a warning on init when no OPPs are present.
>
> I tested this on 3430/n900 by simply commenting out the
> omap_init_opp_table() for OMAP3.  CPUfreq init fails predictably with
>
>   platform mpu.0: opp_init_cpufreq_table: Device OPP not found (-19)
>   platform mpu.0: omap_cpu_init: cpu0: failed creating freq table[-19]
>
> So CPUfreq driver never gets registered.
>
> Updated patch below.  If you're OK with this change, I'll apply it to
> pm-wip/cpufreq.
>
> Kevin
>
>
> From 22f1704e2ec30816e34b3d46a4c61513441fce8d Mon Sep 17 00:00:00 2001
> From: Nishanth Menon <nm@ti.com>
> Date: Thu, 26 May 2011 19:39:18 -0700
> Subject: [PATCH 2/4] OMAP2+: cpufreq: only supports OPP library
>
> OMAP2 is the only family using clk_[init|exit]_cpufreq_table, however,
> the cpufreq code does not currently use clk_init_cpufreq_table. As a
> result, it is unusuable for OMAP2 and only usable only on platforms
> using OPP library.
>
> Remove the unbalanced clk_exit_cpufreq_table().  Any platforms where
> OPPs are not availble will fail on init because a freq table will not
> be properly initialized.
>
> Signed-off-by: Nishanth Menon <nm@ti.com>
> [khilman@ti.com: changelog edits, and graceful failure mode changes]
> Acked-by: Kevin Hilman <khilman@ti.com>
> ---
>  arch/arm/mach-omap2/omap2plus-cpufreq.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> index acf18e8..3af7cda 100644
> --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
> +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
> @@ -1,7 +1,7 @@
>  /*
>  *  OMAP2PLUS cpufreq driver
>  *
> - *  CPU frequency scaling for OMAP
> + *  CPU frequency scaling for OMAP using OPP information
>  *
>  *  Copyright (C) 2005 Nokia Corporation
>  *  Written by Tony Lindgren <tony@atomide.com>
> @@ -203,7 +203,6 @@ 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);
>        clk_put(mpu_clk);
>        return 0;
>  }
> --
> 1.7.4
>
>
Fine with me. thanks for it. it achieves what I needed as well :)

Regards,
Nishanth Menon
--
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-06-02 23:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27  2:39 [PM-WIP_CPUFREQ][PATCH v4 0/4] Cleanups for cpufreq Nishanth Menon
2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 1/4] OMAP2+: cpufreq: dont support !freq_table Nishanth Menon
2011-06-02 22:11   ` Kevin Hilman
2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 2/4] OMAP2+: cpufreq: use OPP library Nishanth Menon
2011-06-02 22:10   ` Kevin Hilman
2011-06-02 22:45   ` Kevin Hilman
2011-06-02 23:14     ` Menon, Nishanth
2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 3/4] OMAP2+: cpufreq: put clk if cpu_init failed Nishanth Menon
2011-06-02 22:12   ` Kevin Hilman
2011-05-27  2:39 ` [PM-WIP_CPUFREQ][PATCH v4 4/4] OMAP2+: cpufreq: fix freq_table leak Nishanth Menon

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.