cc3f7c0192804872a122527cb1a99756b9efdd37
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / cpufreq / 0010-OMAP2-cpufreq-move-clk-name-decision-to-init.patch
1 From a81a661b40c6ca792f1cc8de46d529603b93215d Mon Sep 17 00:00:00 2001
2 From: Nishanth Menon <nm@ti.com>
3 Date: Wed, 25 May 2011 16:38:46 -0700
4 Subject: [PATCH 10/19] OMAP2+: cpufreq: move clk name decision to init
6 Clk name does'nt need to dynamically detected during clk init.
7 move them off to driver initialization, if we dont have a clk name,
8 there is no point in registering the driver anyways. The actual clk
9 get and put is left at cpu_init and exit functions.
11 Signed-off-by: Nishanth Menon <nm@ti.com>
12 Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
13 ---
14 arch/arm/mach-omap2/omap2plus-cpufreq.c | 20 +++++++++++++-------
15 1 files changed, 13 insertions(+), 7 deletions(-)
17 diff --git a/arch/arm/mach-omap2/omap2plus-cpufreq.c b/arch/arm/mach-omap2/omap2plus-cpufreq.c
18 index a725d90..c46d0cd 100644
19 --- a/arch/arm/mach-omap2/omap2plus-cpufreq.c
20 +++ b/arch/arm/mach-omap2/omap2plus-cpufreq.c
21 @@ -42,6 +42,7 @@
23 static struct cpufreq_frequency_table *freq_table;
24 static struct clk *mpu_clk;
25 +static char *mpu_clk_name;
27 static int omap_verify_speed(struct cpufreq_policy *policy)
28 {
29 @@ -157,13 +158,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
30 struct device *mpu_dev;
31 static cpumask_var_t cpumask;
33 - if (cpu_is_omap24xx())
34 - mpu_clk = clk_get(NULL, "virt_prcm_set");
35 - else if (cpu_is_omap34xx())
36 - mpu_clk = clk_get(NULL, "dpll1_ck");
37 - else if (cpu_is_omap44xx())
38 - mpu_clk = clk_get(NULL, "dpll_mpu_ck");
39 -
40 + mpu_clk = clk_get(NULL, mpu_clk_name);
41 if (IS_ERR(mpu_clk))
42 return PTR_ERR(mpu_clk);
44 @@ -238,6 +233,17 @@ static struct cpufreq_driver omap_driver = {
46 static int __init omap_cpufreq_init(void)
47 {
48 + if (cpu_is_omap24xx())
49 + mpu_clk_name = "virt_prcm_set";
50 + else if (cpu_is_omap34xx())
51 + mpu_clk_name = "dpll1_ck";
52 + else if (cpu_is_omap44xx())
53 + mpu_clk_name = "dpll_mpu_ck";
54 +
55 + if (!mpu_clk_name) {
56 + pr_err("%s: unsupported Silicon?\n", __func__);
57 + return -EINVAL;
58 + }
59 return cpufreq_register_driver(&omap_driver);
60 }
62 --
63 1.6.6.1