summaryrefslogtreecommitdiff
path: root/arch/arm/mach-davinci/da850.c
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2009-10-22 13:42:16 +0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 21:21:37 +0300
commit13d5e27a4482e43bea9073706033c84cd873b5ca (patch)
tree2b66f5238dce2563741bf0524b2d731a7dc10ded /arch/arm/mach-davinci/da850.c
parent5aeb15aafc0c378d4ae2aff7b5d5c686793b8a0e (diff)
downloadlinux-13d5e27a4482e43bea9073706033c84cd873b5ca.tar.xz
davinci: DA850/OMAP-L138: avoid using separate initcall for initializing regulator
Using a device_initcall() for initializing the voltage regulator on DA850 is not such a good idea because it gets called for all platforms - even those who do not have a regulator implemented. This leads to a big fat warning message during boot-up when regulator cannot be found. Instead, tie initialization of voltage regulator to cpufreq init. Define a platform specific init call which in case of DA850 gets used for initializing the regulator. On other future platforms it can be used for other purposes. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/da850.c')
-rw-r--r--arch/arm/mach-davinci/da850.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 0f27c93545bf..717806c6cef9 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -907,8 +907,39 @@ static struct cpufreq_frequency_table da850_freq_table[] = {
},
};
+#ifdef CONFIG_REGULATOR
+static struct regulator *cvdd;
+
+static int da850_set_voltage(unsigned int index)
+{
+ struct da850_opp *opp;
+
+ if (!cvdd)
+ return -ENODEV;
+
+ opp = (struct da850_opp *) da850_freq_table[index].index;
+
+ return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
+}
+
+static int da850_regulator_init(void)
+{
+ cvdd = regulator_get(NULL, "cvdd");
+ if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
+ " voltage scaling unsupported\n")) {
+ return PTR_ERR(cvdd);
+ }
+
+ return 0;
+}
+#endif
+
static struct davinci_cpufreq_config cpufreq_info = {
.freq_table = &da850_freq_table[0],
+#ifdef CONFIG_REGULATOR
+ .init = da850_regulator_init,
+ .set_voltage = da850_set_voltage,
+#endif
};
static struct platform_device da850_cpufreq_device = {
@@ -997,39 +1028,6 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate)
}
#endif
-#ifdef CONFIG_REGULATOR
-static struct regulator *cvdd;
-
-static int da850_set_voltage(unsigned int index)
-{
- struct da850_opp *opp;
-
- if (!cvdd)
- return -ENODEV;
-
- opp = (struct da850_opp *) da850_freq_table[index].index;
-
- return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
-}
-
-static int __init da850_regulator_init(void)
-{
- int ret = 0;
-
- cvdd = regulator_get(NULL, "cvdd");
- if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
- " voltage scaling unsupported\n")) {
- ret = PTR_ERR(cvdd);
- goto out;
- }
-
- cpufreq_info.set_voltage = da850_set_voltage;
-
-out:
- return ret;
-}
-device_initcall(da850_regulator_init);
-#endif
static struct davinci_soc_info davinci_soc_info_da850 = {
.io_desc = da850_io_desc,