diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-01-09 10:08:43 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-01-16 20:00:44 -0500 |
commit | 652ed95d5fa6074b3c4ea245deb0691f1acb6656 (patch) | |
tree | 7b01079f3a582b0d6b08f541a8a344440bec8eae /drivers/cpufreq/exynos-cpufreq.c | |
parent | 0ad04fb30db0341d0b1134e2f592d9146c9abb64 (diff) |
cpufreq: introduce cpufreq_generic_get() routine
CPUFreq drivers that use clock frameworks interface,i.e. clk_get_rate(),
to get CPUs clk rate, have similar sort of code used in most of them.
This patch adds a generic ->get() which will do the same thing for them.
All those drivers are required to now is to set .get to cpufreq_generic_get()
and set their clk pointer in policy->clk during ->init().
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Stephen Warren <swarren@nvidia.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/exynos-cpufreq.c')
-rw-r--r-- | drivers/cpufreq/exynos-cpufreq.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index f7c322c7d7ed..4ee3804637be 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c | |||
@@ -31,11 +31,6 @@ static unsigned int locking_frequency; | |||
31 | static bool frequency_locked; | 31 | static bool frequency_locked; |
32 | static DEFINE_MUTEX(cpufreq_lock); | 32 | static DEFINE_MUTEX(cpufreq_lock); |
33 | 33 | ||
34 | static unsigned int exynos_getspeed(unsigned int cpu) | ||
35 | { | ||
36 | return clk_get_rate(exynos_info->cpu_clk) / 1000; | ||
37 | } | ||
38 | |||
39 | static int exynos_cpufreq_get_index(unsigned int freq) | 34 | static int exynos_cpufreq_get_index(unsigned int freq) |
40 | { | 35 | { |
41 | struct cpufreq_frequency_table *freq_table = exynos_info->freq_table; | 36 | struct cpufreq_frequency_table *freq_table = exynos_info->freq_table; |
@@ -215,6 +210,7 @@ static struct notifier_block exynos_cpufreq_nb = { | |||
215 | 210 | ||
216 | static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) | 211 | static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) |
217 | { | 212 | { |
213 | policy->clk = exynos_info->cpu_clk; | ||
218 | return cpufreq_generic_init(policy, exynos_info->freq_table, 100000); | 214 | return cpufreq_generic_init(policy, exynos_info->freq_table, 100000); |
219 | } | 215 | } |
220 | 216 | ||
@@ -222,7 +218,7 @@ static struct cpufreq_driver exynos_driver = { | |||
222 | .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, | 218 | .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, |
223 | .verify = cpufreq_generic_frequency_table_verify, | 219 | .verify = cpufreq_generic_frequency_table_verify, |
224 | .target_index = exynos_target, | 220 | .target_index = exynos_target, |
225 | .get = exynos_getspeed, | 221 | .get = cpufreq_generic_get, |
226 | .init = exynos_cpufreq_cpu_init, | 222 | .init = exynos_cpufreq_cpu_init, |
227 | .exit = cpufreq_generic_exit, | 223 | .exit = cpufreq_generic_exit, |
228 | .name = "exynos_cpufreq", | 224 | .name = "exynos_cpufreq", |
@@ -264,7 +260,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
264 | goto err_vdd_arm; | 260 | goto err_vdd_arm; |
265 | } | 261 | } |
266 | 262 | ||
267 | locking_frequency = exynos_getspeed(0); | 263 | locking_frequency = clk_get_rate(exynos_info->cpu_clk) / 1000; |
268 | 264 | ||
269 | register_pm_notifier(&exynos_cpufreq_nb); | 265 | register_pm_notifier(&exynos_cpufreq_nb); |
270 | 266 | ||