All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
@ 2013-08-13 13:31 ` Viresh Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-13 13:31 UTC (permalink / raw)
  To: rjw
  Cc: linaro-kernel, patches, cpufreq, linux-pm, linux-kernel, linux,
	linux-arm-kernel, Viresh Kumar

Hi Rafael/Russell,

These patches would be part of this patchset finally, sending it separately as I
didn't wanted to send other patches in that series..

https://lkml.org/lkml/2013/8/10/48

(Above series was rebased over https://lkml.org/lkml/2013/8/8/263 and hence this
patchset too)..

These first exposes frequency table and then uses cpufreq generic routines
(which uses exposed table) instead of its own .verify() routine.

Later I will send another patch that would be part of this series:

http://lkml.org/lkml/2013/8/12/406

(I need to send that series again today and so not sending that patch twice,
once here and then in that series)..

All these patches are pushed here with all dependencies:

https://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/for-v3.13

Viresh Kumar (3):
  cpufreq: sa11x0: Expose frequency table
  cpufreq: sa11x0: let cpufreq core initialize struct policy fields
  cpufreq: sa11x0: Use generic cpufreq routines

 arch/arm/mach-sa1100/generic.c   | 65 +++++++++++++---------------------------
 arch/arm/mach-sa1100/generic.h   |  2 +-
 drivers/cpufreq/sa1100-cpufreq.c |  9 +++---
 drivers/cpufreq/sa1110-cpufreq.c |  9 +++---
 4 files changed, 30 insertions(+), 55 deletions(-)

-- 
1.7.12.rc2.18.g61b472e


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

* [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
@ 2013-08-13 13:31 ` Viresh Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-13 13:31 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rafael/Russell,

These patches would be part of this patchset finally, sending it separately as I
didn't wanted to send other patches in that series..

https://lkml.org/lkml/2013/8/10/48

(Above series was rebased over https://lkml.org/lkml/2013/8/8/263 and hence this
patchset too)..

These first exposes frequency table and then uses cpufreq generic routines
(which uses exposed table) instead of its own .verify() routine.

Later I will send another patch that would be part of this series:

http://lkml.org/lkml/2013/8/12/406

(I need to send that series again today and so not sending that patch twice,
once here and then in that series)..

All these patches are pushed here with all dependencies:

https://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/for-v3.13

Viresh Kumar (3):
  cpufreq: sa11x0: Expose frequency table
  cpufreq: sa11x0: let cpufreq core initialize struct policy fields
  cpufreq: sa11x0: Use generic cpufreq routines

 arch/arm/mach-sa1100/generic.c   | 65 +++++++++++++---------------------------
 arch/arm/mach-sa1100/generic.h   |  2 +-
 drivers/cpufreq/sa1100-cpufreq.c |  9 +++---
 drivers/cpufreq/sa1110-cpufreq.c |  9 +++---
 4 files changed, 30 insertions(+), 55 deletions(-)

-- 
1.7.12.rc2.18.g61b472e

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

* [PATCH 1/3] cpufreq: sa11x0: Expose frequency table
  2013-08-13 13:31 ` Viresh Kumar
@ 2013-08-13 13:31   ` Viresh Kumar
  -1 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-13 13:31 UTC (permalink / raw)
  To: rjw
  Cc: linaro-kernel, patches, cpufreq, linux-pm, linux-kernel, linux,
	linux-arm-kernel, Viresh Kumar

This patch exposes sa11x0's frequency table to cpufreq core. It always existed
but not as an array frequencies and not in the format cpufreq core wants it to.
Also it was present in the unit of 100kHz earlier which is made consistent with
cpufreq core now, i.e. kHz.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 arch/arm/mach-sa1100/generic.c   | 45 ++++++++++++++++++++--------------------
 arch/arm/mach-sa1100/generic.h   |  1 +
 drivers/cpufreq/sa1100-cpufreq.c |  3 ++-
 drivers/cpufreq/sa1110-cpufreq.c |  3 ++-
 4 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index f25b611..5c8167b 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -42,23 +42,24 @@ EXPORT_SYMBOL(reset_status);
 /*
  * This table is setup for a 3.6864MHz Crystal.
  */
-static const unsigned short cclk_frequency_100khz[NR_FREQS] = {
-	 590,	/*  59.0 MHz */
-	 737,	/*  73.7 MHz */
-	 885,	/*  88.5 MHz */
-	1032,	/* 103.2 MHz */
-	1180,	/* 118.0 MHz */
-	1327,	/* 132.7 MHz */
-	1475,	/* 147.5 MHz */
-	1622,	/* 162.2 MHz */
-	1769,	/* 176.9 MHz */
-	1917,	/* 191.7 MHz */
-	2064,	/* 206.4 MHz */
-	2212,	/* 221.2 MHz */
-	2359,	/* 235.9 MHz */
-	2507,	/* 250.7 MHz */
-	2654,	/* 265.4 MHz */
-	2802	/* 280.2 MHz */
+struct cpufreq_frequency_table sa11x0_freq_table[NR_FREQS+1] = {
+	{ .frequency = 59000,	/*  59.0 MHz */},
+	{ .frequency = 73700,	/*  73.7 MHz */},
+	{ .frequency = 88500,	/*  88.5 MHz */},
+	{ .frequency = 103200,	/* 103.2 MHz */},
+	{ .frequency = 118000,	/* 118.0 MHz */},
+	{ .frequency = 132700,	/* 132.7 MHz */},
+	{ .frequency = 147500,	/* 147.5 MHz */},
+	{ .frequency = 162200,	/* 162.2 MHz */},
+	{ .frequency = 176900,	/* 176.9 MHz */},
+	{ .frequency = 191700,	/* 191.7 MHz */},
+	{ .frequency = 206400,	/* 206.4 MHz */},
+	{ .frequency = 221200,	/* 221.2 MHz */},
+	{ .frequency = 235900,	/* 235.9 MHz */},
+	{ .frequency = 250700,	/* 250.7 MHz */},
+	{ .frequency = 265400,	/* 265.4 MHz */},
+	{ .frequency = 280200,	/* 280.2 MHz */},
+	{ .frequency = CPUFREQ_TABLE_END, },
 };
 
 /* rounds up(!)  */
@@ -66,10 +67,8 @@ unsigned int sa11x0_freq_to_ppcr(unsigned int khz)
 {
 	int i;
 
-	khz /= 100;
-
 	for (i = 0; i < NR_FREQS; i++)
-		if (cclk_frequency_100khz[i] >= khz)
+		if (sa11x0_freq_table[i].frequency >= khz)
 			break;
 
 	return i;
@@ -79,7 +78,7 @@ unsigned int sa11x0_ppcr_to_freq(unsigned int idx)
 {
 	unsigned int freq = 0;
 	if (idx < NR_FREQS)
-		freq = cclk_frequency_100khz[idx] * 100;
+		freq = sa11x0_freq_table[idx].frequency;
 	return freq;
 }
 
@@ -96,7 +95,7 @@ int sa11x0_verify_speed(struct cpufreq_policy *policy)
 	cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
 
 	/* make sure that at least one frequency is within the policy */
-	tmp = cclk_frequency_100khz[sa11x0_freq_to_ppcr(policy->min)] * 100;
+	tmp = sa11x0_freq_table[sa11x0_freq_to_ppcr(policy->min)].frequency;
 	if (tmp > policy->max)
 		policy->max = tmp;
 
@@ -109,7 +108,7 @@ unsigned int sa11x0_getspeed(unsigned int cpu)
 {
 	if (cpu)
 		return 0;
-	return cclk_frequency_100khz[PPCR & 0xf] * 100;
+	return sa11x0_freq_table[PPCR & 0xf].frequency;
 }
 
 /*
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index 9a33695..f5214ce 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -21,6 +21,7 @@ extern void sa1110_mb_disable(void);
 
 struct cpufreq_policy;
 
+extern struct cpufreq_frequency_table sa11x0_freq_table[];
 extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
 extern int sa11x0_verify_speed(struct cpufreq_policy *policy);
 extern unsigned int sa11x0_getspeed(unsigned int cpu);
diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c
index cff18e8..1323a69 100644
--- a/drivers/cpufreq/sa1100-cpufreq.c
+++ b/drivers/cpufreq/sa1100-cpufreq.c
@@ -224,7 +224,8 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
 	policy->cpuinfo.min_freq = 59000;
 	policy->cpuinfo.max_freq = 287000;
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
-	return 0;
+
+	return cpufreq_table_validate_and_show(policy, sa11x0_freq_table);
 }
 
 static struct cpufreq_driver sa1100_driver __refdata = {
diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c
index 39c90b6..adb0524 100644
--- a/drivers/cpufreq/sa1110-cpufreq.c
+++ b/drivers/cpufreq/sa1110-cpufreq.c
@@ -338,7 +338,8 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
 	policy->cpuinfo.min_freq = 59000;
 	policy->cpuinfo.max_freq = 287000;
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
-	return 0;
+
+	return cpufreq_table_validate_and_show(policy, sa11x0_freq_table);
 }
 
 /* sa1110_driver needs __refdata because it must remain after init registers
-- 
1.7.12.rc2.18.g61b472e


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

* [PATCH 1/3] cpufreq: sa11x0: Expose frequency table
@ 2013-08-13 13:31   ` Viresh Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-13 13:31 UTC (permalink / raw)
  To: linux-arm-kernel

This patch exposes sa11x0's frequency table to cpufreq core. It always existed
but not as an array frequencies and not in the format cpufreq core wants it to.
Also it was present in the unit of 100kHz earlier which is made consistent with
cpufreq core now, i.e. kHz.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 arch/arm/mach-sa1100/generic.c   | 45 ++++++++++++++++++++--------------------
 arch/arm/mach-sa1100/generic.h   |  1 +
 drivers/cpufreq/sa1100-cpufreq.c |  3 ++-
 drivers/cpufreq/sa1110-cpufreq.c |  3 ++-
 4 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index f25b611..5c8167b 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -42,23 +42,24 @@ EXPORT_SYMBOL(reset_status);
 /*
  * This table is setup for a 3.6864MHz Crystal.
  */
-static const unsigned short cclk_frequency_100khz[NR_FREQS] = {
-	 590,	/*  59.0 MHz */
-	 737,	/*  73.7 MHz */
-	 885,	/*  88.5 MHz */
-	1032,	/* 103.2 MHz */
-	1180,	/* 118.0 MHz */
-	1327,	/* 132.7 MHz */
-	1475,	/* 147.5 MHz */
-	1622,	/* 162.2 MHz */
-	1769,	/* 176.9 MHz */
-	1917,	/* 191.7 MHz */
-	2064,	/* 206.4 MHz */
-	2212,	/* 221.2 MHz */
-	2359,	/* 235.9 MHz */
-	2507,	/* 250.7 MHz */
-	2654,	/* 265.4 MHz */
-	2802	/* 280.2 MHz */
+struct cpufreq_frequency_table sa11x0_freq_table[NR_FREQS+1] = {
+	{ .frequency = 59000,	/*  59.0 MHz */},
+	{ .frequency = 73700,	/*  73.7 MHz */},
+	{ .frequency = 88500,	/*  88.5 MHz */},
+	{ .frequency = 103200,	/* 103.2 MHz */},
+	{ .frequency = 118000,	/* 118.0 MHz */},
+	{ .frequency = 132700,	/* 132.7 MHz */},
+	{ .frequency = 147500,	/* 147.5 MHz */},
+	{ .frequency = 162200,	/* 162.2 MHz */},
+	{ .frequency = 176900,	/* 176.9 MHz */},
+	{ .frequency = 191700,	/* 191.7 MHz */},
+	{ .frequency = 206400,	/* 206.4 MHz */},
+	{ .frequency = 221200,	/* 221.2 MHz */},
+	{ .frequency = 235900,	/* 235.9 MHz */},
+	{ .frequency = 250700,	/* 250.7 MHz */},
+	{ .frequency = 265400,	/* 265.4 MHz */},
+	{ .frequency = 280200,	/* 280.2 MHz */},
+	{ .frequency = CPUFREQ_TABLE_END, },
 };
 
 /* rounds up(!)  */
@@ -66,10 +67,8 @@ unsigned int sa11x0_freq_to_ppcr(unsigned int khz)
 {
 	int i;
 
-	khz /= 100;
-
 	for (i = 0; i < NR_FREQS; i++)
-		if (cclk_frequency_100khz[i] >= khz)
+		if (sa11x0_freq_table[i].frequency >= khz)
 			break;
 
 	return i;
@@ -79,7 +78,7 @@ unsigned int sa11x0_ppcr_to_freq(unsigned int idx)
 {
 	unsigned int freq = 0;
 	if (idx < NR_FREQS)
-		freq = cclk_frequency_100khz[idx] * 100;
+		freq = sa11x0_freq_table[idx].frequency;
 	return freq;
 }
 
@@ -96,7 +95,7 @@ int sa11x0_verify_speed(struct cpufreq_policy *policy)
 	cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
 
 	/* make sure that at least one frequency is within the policy */
-	tmp = cclk_frequency_100khz[sa11x0_freq_to_ppcr(policy->min)] * 100;
+	tmp = sa11x0_freq_table[sa11x0_freq_to_ppcr(policy->min)].frequency;
 	if (tmp > policy->max)
 		policy->max = tmp;
 
@@ -109,7 +108,7 @@ unsigned int sa11x0_getspeed(unsigned int cpu)
 {
 	if (cpu)
 		return 0;
-	return cclk_frequency_100khz[PPCR & 0xf] * 100;
+	return sa11x0_freq_table[PPCR & 0xf].frequency;
 }
 
 /*
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index 9a33695..f5214ce 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -21,6 +21,7 @@ extern void sa1110_mb_disable(void);
 
 struct cpufreq_policy;
 
+extern struct cpufreq_frequency_table sa11x0_freq_table[];
 extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
 extern int sa11x0_verify_speed(struct cpufreq_policy *policy);
 extern unsigned int sa11x0_getspeed(unsigned int cpu);
diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c
index cff18e8..1323a69 100644
--- a/drivers/cpufreq/sa1100-cpufreq.c
+++ b/drivers/cpufreq/sa1100-cpufreq.c
@@ -224,7 +224,8 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
 	policy->cpuinfo.min_freq = 59000;
 	policy->cpuinfo.max_freq = 287000;
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
-	return 0;
+
+	return cpufreq_table_validate_and_show(policy, sa11x0_freq_table);
 }
 
 static struct cpufreq_driver sa1100_driver __refdata = {
diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c
index 39c90b6..adb0524 100644
--- a/drivers/cpufreq/sa1110-cpufreq.c
+++ b/drivers/cpufreq/sa1110-cpufreq.c
@@ -338,7 +338,8 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
 	policy->cpuinfo.min_freq = 59000;
 	policy->cpuinfo.max_freq = 287000;
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
-	return 0;
+
+	return cpufreq_table_validate_and_show(policy, sa11x0_freq_table);
 }
 
 /* sa1110_driver needs __refdata because it must remain after init registers
-- 
1.7.12.rc2.18.g61b472e

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

* [PATCH 2/3] cpufreq: sa11x0: let cpufreq core initialize struct policy fields
  2013-08-13 13:31 ` Viresh Kumar
@ 2013-08-13 13:31   ` Viresh Kumar
  -1 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-13 13:31 UTC (permalink / raw)
  To: rjw
  Cc: linaro-kernel, patches, cpufreq, linux-pm, linux-kernel, linux,
	linux-arm-kernel, Viresh Kumar

Many fields of struct policy are filled by cpufreq core when we call
cpufreq_table_validate_and_show() and so cpufreq driver doesn't need to set them
anymore.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/sa1100-cpufreq.c | 4 +---
 drivers/cpufreq/sa1110-cpufreq.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c
index 1323a69..235500c 100644
--- a/drivers/cpufreq/sa1100-cpufreq.c
+++ b/drivers/cpufreq/sa1100-cpufreq.c
@@ -220,9 +220,7 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
 {
 	if (policy->cpu != 0)
 		return -EINVAL;
-	policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
-	policy->cpuinfo.min_freq = 59000;
-	policy->cpuinfo.max_freq = 287000;
+	policy->cur = a11x0_getspeed(0);
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
 
 	return cpufreq_table_validate_and_show(policy, sa11x0_freq_table);
diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c
index adb0524..13760fc 100644
--- a/drivers/cpufreq/sa1110-cpufreq.c
+++ b/drivers/cpufreq/sa1110-cpufreq.c
@@ -334,9 +334,7 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
 {
 	if (policy->cpu != 0)
 		return -EINVAL;
-	policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
-	policy->cpuinfo.min_freq = 59000;
-	policy->cpuinfo.max_freq = 287000;
+	policy->cur = sa11x0_getspeed(0);
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
 
 	return cpufreq_table_validate_and_show(policy, sa11x0_freq_table);
-- 
1.7.12.rc2.18.g61b472e


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

* [PATCH 2/3] cpufreq: sa11x0: let cpufreq core initialize struct policy fields
@ 2013-08-13 13:31   ` Viresh Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-13 13:31 UTC (permalink / raw)
  To: linux-arm-kernel

Many fields of struct policy are filled by cpufreq core when we call
cpufreq_table_validate_and_show() and so cpufreq driver doesn't need to set them
anymore.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/sa1100-cpufreq.c | 4 +---
 drivers/cpufreq/sa1110-cpufreq.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c
index 1323a69..235500c 100644
--- a/drivers/cpufreq/sa1100-cpufreq.c
+++ b/drivers/cpufreq/sa1100-cpufreq.c
@@ -220,9 +220,7 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
 {
 	if (policy->cpu != 0)
 		return -EINVAL;
-	policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
-	policy->cpuinfo.min_freq = 59000;
-	policy->cpuinfo.max_freq = 287000;
+	policy->cur = a11x0_getspeed(0);
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
 
 	return cpufreq_table_validate_and_show(policy, sa11x0_freq_table);
diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c
index adb0524..13760fc 100644
--- a/drivers/cpufreq/sa1110-cpufreq.c
+++ b/drivers/cpufreq/sa1110-cpufreq.c
@@ -334,9 +334,7 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
 {
 	if (policy->cpu != 0)
 		return -EINVAL;
-	policy->cur = policy->min = policy->max = sa11x0_getspeed(0);
-	policy->cpuinfo.min_freq = 59000;
-	policy->cpuinfo.max_freq = 287000;
+	policy->cur = sa11x0_getspeed(0);
 	policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
 
 	return cpufreq_table_validate_and_show(policy, sa11x0_freq_table);
-- 
1.7.12.rc2.18.g61b472e

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

* [PATCH 3/3] cpufreq: sa11x0: Use generic cpufreq routines
  2013-08-13 13:31 ` Viresh Kumar
@ 2013-08-13 13:31   ` Viresh Kumar
  -1 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-13 13:31 UTC (permalink / raw)
  To: rjw
  Cc: linaro-kernel, patches, cpufreq, linux-pm, linux-kernel, linux,
	linux-arm-kernel, Viresh Kumar

Most of the CPUFreq drivers do similar things in .exit() and .verify() routines
and .attr. So its better if we have generic routines for them which can be used
by cpufreq drivers then.

This patch uses these generic routines for this driver.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 arch/arm/mach-sa1100/generic.c   | 22 ----------------------
 arch/arm/mach-sa1100/generic.h   |  1 -
 drivers/cpufreq/sa1100-cpufreq.c |  2 +-
 drivers/cpufreq/sa1110-cpufreq.c |  2 +-
 4 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 5c8167b..cb4b2ca 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -82,28 +82,6 @@ unsigned int sa11x0_ppcr_to_freq(unsigned int idx)
 	return freq;
 }
 
-
-/* make sure that only the "userspace" governor is run -- anything else wouldn't make sense on
- * this platform, anyway.
- */
-int sa11x0_verify_speed(struct cpufreq_policy *policy)
-{
-	unsigned int tmp;
-	if (policy->cpu)
-		return -EINVAL;
-
-	cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
-
-	/* make sure that at least one frequency is within the policy */
-	tmp = sa11x0_freq_table[sa11x0_freq_to_ppcr(policy->min)].frequency;
-	if (tmp > policy->max)
-		policy->max = tmp;
-
-	cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
-
-	return 0;
-}
-
 unsigned int sa11x0_getspeed(unsigned int cpu)
 {
 	if (cpu)
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index f5214ce..39d56a67 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -23,7 +23,6 @@ struct cpufreq_policy;
 
 extern struct cpufreq_frequency_table sa11x0_freq_table[];
 extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
-extern int sa11x0_verify_speed(struct cpufreq_policy *policy);
 extern unsigned int sa11x0_getspeed(unsigned int cpu);
 extern unsigned int sa11x0_ppcr_to_freq(unsigned int idx);
 
diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c
index 235500c..02fe8b2 100644
--- a/drivers/cpufreq/sa1100-cpufreq.c
+++ b/drivers/cpufreq/sa1100-cpufreq.c
@@ -228,7 +228,7 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
 
 static struct cpufreq_driver sa1100_driver __refdata = {
 	.flags		= CPUFREQ_STICKY,
-	.verify		= sa11x0_verify_speed,
+	.verify		= cpufreq_generic_frequency_table_verify,
 	.target		= sa1100_target,
 	.get		= sa11x0_getspeed,
 	.init		= sa1100_cpu_init,
diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c
index 13760fc..a38d904 100644
--- a/drivers/cpufreq/sa1110-cpufreq.c
+++ b/drivers/cpufreq/sa1110-cpufreq.c
@@ -344,7 +344,7 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
  * it with cpufreq_register_driver() */
 static struct cpufreq_driver sa1110_driver __refdata = {
 	.flags		= CPUFREQ_STICKY,
-	.verify		= sa11x0_verify_speed,
+	.verify		= cpufreq_generic_frequency_table_verify,
 	.target		= sa1110_target,
 	.get		= sa11x0_getspeed,
 	.init		= sa1110_cpu_init,
-- 
1.7.12.rc2.18.g61b472e


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

* [PATCH 3/3] cpufreq: sa11x0: Use generic cpufreq routines
@ 2013-08-13 13:31   ` Viresh Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-13 13:31 UTC (permalink / raw)
  To: linux-arm-kernel

Most of the CPUFreq drivers do similar things in .exit() and .verify() routines
and .attr. So its better if we have generic routines for them which can be used
by cpufreq drivers then.

This patch uses these generic routines for this driver.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 arch/arm/mach-sa1100/generic.c   | 22 ----------------------
 arch/arm/mach-sa1100/generic.h   |  1 -
 drivers/cpufreq/sa1100-cpufreq.c |  2 +-
 drivers/cpufreq/sa1110-cpufreq.c |  2 +-
 4 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 5c8167b..cb4b2ca 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -82,28 +82,6 @@ unsigned int sa11x0_ppcr_to_freq(unsigned int idx)
 	return freq;
 }
 
-
-/* make sure that only the "userspace" governor is run -- anything else wouldn't make sense on
- * this platform, anyway.
- */
-int sa11x0_verify_speed(struct cpufreq_policy *policy)
-{
-	unsigned int tmp;
-	if (policy->cpu)
-		return -EINVAL;
-
-	cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
-
-	/* make sure that at least one frequency is within the policy */
-	tmp = sa11x0_freq_table[sa11x0_freq_to_ppcr(policy->min)].frequency;
-	if (tmp > policy->max)
-		policy->max = tmp;
-
-	cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
-
-	return 0;
-}
-
 unsigned int sa11x0_getspeed(unsigned int cpu)
 {
 	if (cpu)
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index f5214ce..39d56a67 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -23,7 +23,6 @@ struct cpufreq_policy;
 
 extern struct cpufreq_frequency_table sa11x0_freq_table[];
 extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
-extern int sa11x0_verify_speed(struct cpufreq_policy *policy);
 extern unsigned int sa11x0_getspeed(unsigned int cpu);
 extern unsigned int sa11x0_ppcr_to_freq(unsigned int idx);
 
diff --git a/drivers/cpufreq/sa1100-cpufreq.c b/drivers/cpufreq/sa1100-cpufreq.c
index 235500c..02fe8b2 100644
--- a/drivers/cpufreq/sa1100-cpufreq.c
+++ b/drivers/cpufreq/sa1100-cpufreq.c
@@ -228,7 +228,7 @@ static int __init sa1100_cpu_init(struct cpufreq_policy *policy)
 
 static struct cpufreq_driver sa1100_driver __refdata = {
 	.flags		= CPUFREQ_STICKY,
-	.verify		= sa11x0_verify_speed,
+	.verify		= cpufreq_generic_frequency_table_verify,
 	.target		= sa1100_target,
 	.get		= sa11x0_getspeed,
 	.init		= sa1100_cpu_init,
diff --git a/drivers/cpufreq/sa1110-cpufreq.c b/drivers/cpufreq/sa1110-cpufreq.c
index 13760fc..a38d904 100644
--- a/drivers/cpufreq/sa1110-cpufreq.c
+++ b/drivers/cpufreq/sa1110-cpufreq.c
@@ -344,7 +344,7 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy)
  * it with cpufreq_register_driver() */
 static struct cpufreq_driver sa1110_driver __refdata = {
 	.flags		= CPUFREQ_STICKY,
-	.verify		= sa11x0_verify_speed,
+	.verify		= cpufreq_generic_frequency_table_verify,
 	.target		= sa1110_target,
 	.get		= sa11x0_getspeed,
 	.init		= sa1110_cpu_init,
-- 
1.7.12.rc2.18.g61b472e

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

* Re: [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
  2013-08-13 13:31 ` Viresh Kumar
@ 2013-08-13 20:01   ` Rafael J. Wysocki
  -1 siblings, 0 replies; 16+ messages in thread
From: Rafael J. Wysocki @ 2013-08-13 20:01 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: linaro-kernel, patches, cpufreq, linux-pm, linux-kernel, linux,
	linux-arm-kernel

On Tuesday, August 13, 2013 07:01:04 PM Viresh Kumar wrote:
> Hi Rafael/Russell,
> 
> These patches would be part of this patchset finally, sending it separately as I
> didn't wanted to send other patches in that series..
> 
> https://lkml.org/lkml/2013/8/10/48
> 
> (Above series was rebased over https://lkml.org/lkml/2013/8/8/263 and hence this
> patchset too)..
> 
> These first exposes frequency table and then uses cpufreq generic routines
> (which uses exposed table) instead of its own .verify() routine.
> 
> Later I will send another patch that would be part of this series:
> 
> http://lkml.org/lkml/2013/8/12/406
> 
> (I need to send that series again today and so not sending that patch twice,
> once here and then in that series)..
> 
> All these patches are pushed here with all dependencies:
> 
> https://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/for-v3.13

Are the three patches in this series prerequisite for the big target_index
one?  If so, I think they can go into 3.12 actually, if they are ACKed by the
appropriate platform maintainers.

> Viresh Kumar (3):
>   cpufreq: sa11x0: Expose frequency table
>   cpufreq: sa11x0: let cpufreq core initialize struct policy fields
>   cpufreq: sa11x0: Use generic cpufreq routines
> 
>  arch/arm/mach-sa1100/generic.c   | 65 +++++++++++++---------------------------
>  arch/arm/mach-sa1100/generic.h   |  2 +-
>  drivers/cpufreq/sa1100-cpufreq.c |  9 +++---
>  drivers/cpufreq/sa1110-cpufreq.c |  9 +++---
>  4 files changed, 30 insertions(+), 55 deletions(-)

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
@ 2013-08-13 20:01   ` Rafael J. Wysocki
  0 siblings, 0 replies; 16+ messages in thread
From: Rafael J. Wysocki @ 2013-08-13 20:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday, August 13, 2013 07:01:04 PM Viresh Kumar wrote:
> Hi Rafael/Russell,
> 
> These patches would be part of this patchset finally, sending it separately as I
> didn't wanted to send other patches in that series..
> 
> https://lkml.org/lkml/2013/8/10/48
> 
> (Above series was rebased over https://lkml.org/lkml/2013/8/8/263 and hence this
> patchset too)..
> 
> These first exposes frequency table and then uses cpufreq generic routines
> (which uses exposed table) instead of its own .verify() routine.
> 
> Later I will send another patch that would be part of this series:
> 
> http://lkml.org/lkml/2013/8/12/406
> 
> (I need to send that series again today and so not sending that patch twice,
> once here and then in that series)..
> 
> All these patches are pushed here with all dependencies:
> 
> https://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/for-v3.13

Are the three patches in this series prerequisite for the big target_index
one?  If so, I think they can go into 3.12 actually, if they are ACKed by the
appropriate platform maintainers.

> Viresh Kumar (3):
>   cpufreq: sa11x0: Expose frequency table
>   cpufreq: sa11x0: let cpufreq core initialize struct policy fields
>   cpufreq: sa11x0: Use generic cpufreq routines
> 
>  arch/arm/mach-sa1100/generic.c   | 65 +++++++++++++---------------------------
>  arch/arm/mach-sa1100/generic.h   |  2 +-
>  drivers/cpufreq/sa1100-cpufreq.c |  9 +++---
>  drivers/cpufreq/sa1110-cpufreq.c |  9 +++---
>  4 files changed, 30 insertions(+), 55 deletions(-)

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
  2013-08-13 20:01   ` Rafael J. Wysocki
  (?)
@ 2013-08-14  2:26     ` Viresh Kumar
  -1 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-14  2:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Lists linaro-kernel, Patch Tracking, cpufreq, linux-pm,
	Linux Kernel Mailing List, Russell King - ARM Linux,
	linux-arm-kernel

On 14 August 2013 01:31, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Tuesday, August 13, 2013 07:01:04 PM Viresh Kumar wrote:

> Are the three patches in this series prerequisite for the big target_index
> one?  If so, I think they can go into 3.12 actually, if they are ACKed by the
> appropriate platform maintainers.

Yes, but they depend on cpufreq_table_validate_and_show() which
will also go in 3.13 and so these will be made part of that series in
future..

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

* Re: [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
@ 2013-08-14  2:26     ` Viresh Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-14  2:26 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Lists linaro-kernel, Patch Tracking, cpufreq, linux-pm,
	Linux Kernel Mailing List, Russell King - ARM Linux,
	linux-arm-kernel

On 14 August 2013 01:31, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Tuesday, August 13, 2013 07:01:04 PM Viresh Kumar wrote:

> Are the three patches in this series prerequisite for the big target_index
> one?  If so, I think they can go into 3.12 actually, if they are ACKed by the
> appropriate platform maintainers.

Yes, but they depend on cpufreq_table_validate_and_show() which
will also go in 3.13 and so these will be made part of that series in
future..

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

* [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
@ 2013-08-14  2:26     ` Viresh Kumar
  0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-08-14  2:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 14 August 2013 01:31, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> On Tuesday, August 13, 2013 07:01:04 PM Viresh Kumar wrote:

> Are the three patches in this series prerequisite for the big target_index
> one?  If so, I think they can go into 3.12 actually, if they are ACKed by the
> appropriate platform maintainers.

Yes, but they depend on cpufreq_table_validate_and_show() which
will also go in 3.13 and so these will be made part of that series in
future..

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

* Re: [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
  2013-08-14  2:26     ` Viresh Kumar
  (?)
@ 2013-08-14 13:14       ` Rafael J. Wysocki
  -1 siblings, 0 replies; 16+ messages in thread
From: Rafael J. Wysocki @ 2013-08-14 13:14 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Lists linaro-kernel, Patch Tracking, cpufreq, linux-pm,
	Linux Kernel Mailing List, Russell King - ARM Linux,
	linux-arm-kernel

On Wednesday, August 14, 2013 07:56:44 AM Viresh Kumar wrote:
> On 14 August 2013 01:31, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > On Tuesday, August 13, 2013 07:01:04 PM Viresh Kumar wrote:
> 
> > Are the three patches in this series prerequisite for the big target_index
> > one?  If so, I think they can go into 3.12 actually, if they are ACKed by the
> > appropriate platform maintainers.
> 
> Yes, but they depend on cpufreq_table_validate_and_show() which
> will also go in 3.13 and so these will be made part of that series in
> future..

OK


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

* Re: [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
@ 2013-08-14 13:14       ` Rafael J. Wysocki
  0 siblings, 0 replies; 16+ messages in thread
From: Rafael J. Wysocki @ 2013-08-14 13:14 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Lists linaro-kernel, Patch Tracking, cpufreq, linux-pm,
	Linux Kernel Mailing List, Russell King - ARM Linux,
	linux-arm-kernel

On Wednesday, August 14, 2013 07:56:44 AM Viresh Kumar wrote:
> On 14 August 2013 01:31, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > On Tuesday, August 13, 2013 07:01:04 PM Viresh Kumar wrote:
> 
> > Are the three patches in this series prerequisite for the big target_index
> > one?  If so, I think they can go into 3.12 actually, if they are ACKed by the
> > appropriate platform maintainers.
> 
> Yes, but they depend on cpufreq_table_validate_and_show() which
> will also go in 3.13 and so these will be made part of that series in
> future..

OK


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

* [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13
@ 2013-08-14 13:14       ` Rafael J. Wysocki
  0 siblings, 0 replies; 16+ messages in thread
From: Rafael J. Wysocki @ 2013-08-14 13:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday, August 14, 2013 07:56:44 AM Viresh Kumar wrote:
> On 14 August 2013 01:31, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > On Tuesday, August 13, 2013 07:01:04 PM Viresh Kumar wrote:
> 
> > Are the three patches in this series prerequisite for the big target_index
> > one?  If so, I think they can go into 3.12 actually, if they are ACKed by the
> > appropriate platform maintainers.
> 
> Yes, but they depend on cpufreq_table_validate_and_show() which
> will also go in 3.13 and so these will be made part of that series in
> future..

OK

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

end of thread, other threads:[~2013-08-14 13:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-13 13:31 [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13 Viresh Kumar
2013-08-13 13:31 ` Viresh Kumar
2013-08-13 13:31 ` [PATCH 1/3] cpufreq: sa11x0: Expose frequency table Viresh Kumar
2013-08-13 13:31   ` Viresh Kumar
2013-08-13 13:31 ` [PATCH 2/3] cpufreq: sa11x0: let cpufreq core initialize struct policy fields Viresh Kumar
2013-08-13 13:31   ` Viresh Kumar
2013-08-13 13:31 ` [PATCH 3/3] cpufreq: sa11x0: Use generic cpufreq routines Viresh Kumar
2013-08-13 13:31   ` Viresh Kumar
2013-08-13 20:01 ` [PATCH 0/3] cpufreq: sa11x0: cleanups for 3.13 Rafael J. Wysocki
2013-08-13 20:01   ` Rafael J. Wysocki
2013-08-14  2:26   ` Viresh Kumar
2013-08-14  2:26     ` Viresh Kumar
2013-08-14  2:26     ` Viresh Kumar
2013-08-14 13:14     ` Rafael J. Wysocki
2013-08-14 13:14       ` Rafael J. Wysocki
2013-08-14 13:14       ` Rafael J. Wysocki

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.