diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-10-03 10:58:20 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-10-15 18:50:27 -0400 |
commit | bf36e48d737ebcb2282f51c08e9c7667e30ed3b6 (patch) | |
tree | 99b08a7669f4280a8b2926a826368dd7d8e61e6e /drivers/cpufreq | |
parent | c3bc3d67ff07c1986e8ededc14e3fbdd26528f17 (diff) |
cpufreq: pxa: Use generic cpufreq routines
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 in the PXA driver.
Cc: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/pxa2xx-cpufreq.c | 27 | ||||
-rw-r--r-- | drivers/cpufreq/pxa3xx-cpufreq.c | 15 |
2 files changed, 4 insertions, 38 deletions
diff --git a/drivers/cpufreq/pxa2xx-cpufreq.c b/drivers/cpufreq/pxa2xx-cpufreq.c index 236531a0753a..82905fe0041b 100644 --- a/drivers/cpufreq/pxa2xx-cpufreq.c +++ b/drivers/cpufreq/pxa2xx-cpufreq.c | |||
@@ -262,23 +262,6 @@ static u32 mdrefr_dri(unsigned int freq) | |||
262 | return (interval - (cpu_is_pxa27x() ? 31 : 0)) / 32; | 262 | return (interval - (cpu_is_pxa27x() ? 31 : 0)) / 32; |
263 | } | 263 | } |
264 | 264 | ||
265 | /* find a valid frequency point */ | ||
266 | static int pxa_verify_policy(struct cpufreq_policy *policy) | ||
267 | { | ||
268 | struct cpufreq_frequency_table *pxa_freqs_table; | ||
269 | pxa_freqs_t *pxa_freqs; | ||
270 | int ret; | ||
271 | |||
272 | find_freq_tables(&pxa_freqs_table, &pxa_freqs); | ||
273 | ret = cpufreq_frequency_table_verify(policy, pxa_freqs_table); | ||
274 | |||
275 | if (freq_debug) | ||
276 | pr_debug("Verified CPU policy: %dKhz min to %dKhz max\n", | ||
277 | policy->min, policy->max); | ||
278 | |||
279 | return ret; | ||
280 | } | ||
281 | |||
282 | static unsigned int pxa_cpufreq_get(unsigned int cpu) | 265 | static unsigned int pxa_cpufreq_get(unsigned int cpu) |
283 | { | 266 | { |
284 | return get_clk_frequency_khz(0); | 267 | return get_clk_frequency_khz(0); |
@@ -465,17 +448,11 @@ static int pxa_cpufreq_init(struct cpufreq_policy *policy) | |||
465 | return 0; | 448 | return 0; |
466 | } | 449 | } |
467 | 450 | ||
468 | static int pxa_cpufreq_exit(struct cpufreq_policy *policy) | ||
469 | { | ||
470 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
471 | return 0; | ||
472 | } | ||
473 | |||
474 | static struct cpufreq_driver pxa_cpufreq_driver = { | 451 | static struct cpufreq_driver pxa_cpufreq_driver = { |
475 | .verify = pxa_verify_policy, | 452 | .verify = cpufreq_generic_frequency_table_verify, |
476 | .target = pxa_set_target, | 453 | .target = pxa_set_target, |
477 | .init = pxa_cpufreq_init, | 454 | .init = pxa_cpufreq_init, |
478 | .exit = pxa_cpufreq_exit, | 455 | .exit = cpufreq_generic_exit, |
479 | .get = pxa_cpufreq_get, | 456 | .get = pxa_cpufreq_get, |
480 | .name = "PXA2xx", | 457 | .name = "PXA2xx", |
481 | }; | 458 | }; |
diff --git a/drivers/cpufreq/pxa3xx-cpufreq.c b/drivers/cpufreq/pxa3xx-cpufreq.c index 65fd01e57cba..ae3ac08a7b23 100644 --- a/drivers/cpufreq/pxa3xx-cpufreq.c +++ b/drivers/cpufreq/pxa3xx-cpufreq.c | |||
@@ -150,11 +150,6 @@ static void __update_bus_freq(struct pxa3xx_freq_info *info) | |||
150 | cpu_relax(); | 150 | cpu_relax(); |
151 | } | 151 | } |
152 | 152 | ||
153 | static int pxa3xx_cpufreq_verify(struct cpufreq_policy *policy) | ||
154 | { | ||
155 | return cpufreq_frequency_table_verify(policy, pxa3xx_freqs_table); | ||
156 | } | ||
157 | |||
158 | static unsigned int pxa3xx_cpufreq_get(unsigned int cpu) | 153 | static unsigned int pxa3xx_cpufreq_get(unsigned int cpu) |
159 | { | 154 | { |
160 | return pxa3xx_get_clk_frequency_khz(0); | 155 | return pxa3xx_get_clk_frequency_khz(0); |
@@ -229,17 +224,11 @@ static int pxa3xx_cpufreq_init(struct cpufreq_policy *policy) | |||
229 | return 0; | 224 | return 0; |
230 | } | 225 | } |
231 | 226 | ||
232 | static int pxa3xx_cpufreq_exit(struct cpufreq_policy *policy) | ||
233 | { | ||
234 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
235 | return 0; | ||
236 | } | ||
237 | |||
238 | static struct cpufreq_driver pxa3xx_cpufreq_driver = { | 227 | static struct cpufreq_driver pxa3xx_cpufreq_driver = { |
239 | .verify = pxa3xx_cpufreq_verify, | 228 | .verify = cpufreq_generic_frequency_table_verify, |
240 | .target = pxa3xx_cpufreq_set, | 229 | .target = pxa3xx_cpufreq_set, |
241 | .init = pxa3xx_cpufreq_init, | 230 | .init = pxa3xx_cpufreq_init, |
242 | .exit = pxa3xx_cpufreq_exit, | 231 | .exit = cpufreq_generic_exit, |
243 | .get = pxa3xx_cpufreq_get, | 232 | .get = pxa3xx_cpufreq_get, |
244 | .name = "pxa3xx-cpufreq", | 233 | .name = "pxa3xx-cpufreq", |
245 | }; | 234 | }; |