aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/omap-cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/omap-cpufreq.c')
-rw-r--r--drivers/cpufreq/omap-cpufreq.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index 65f8e9a54975..1f3417a8322d 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -30,20 +30,12 @@
30#include <asm/smp_plat.h> 30#include <asm/smp_plat.h>
31#include <asm/cpu.h> 31#include <asm/cpu.h>
32 32
33#include <plat/clock.h>
34#include <plat/omap-pm.h>
35#include <plat/common.h>
36#include <plat/omap_device.h>
37
38#include <mach/hardware.h>
39
40/* OPP tolerance in percentage */ 33/* OPP tolerance in percentage */
41#define OPP_TOLERANCE 4 34#define OPP_TOLERANCE 4
42 35
43static struct cpufreq_frequency_table *freq_table; 36static struct cpufreq_frequency_table *freq_table;
44static atomic_t freq_table_users = ATOMIC_INIT(0); 37static atomic_t freq_table_users = ATOMIC_INIT(0);
45static struct clk *mpu_clk; 38static struct clk *mpu_clk;
46static char *mpu_clk_name;
47static struct device *mpu_dev; 39static struct device *mpu_dev;
48static struct regulator *mpu_reg; 40static struct regulator *mpu_reg;
49 41
@@ -108,6 +100,14 @@ static int omap_target(struct cpufreq_policy *policy,
108 } 100 }
109 101
110 freq = freqs.new * 1000; 102 freq = freqs.new * 1000;
103 ret = clk_round_rate(mpu_clk, freq);
104 if (IS_ERR_VALUE(ret)) {
105 dev_warn(mpu_dev,
106 "CPUfreq: Cannot find matching frequency for %lu\n",
107 freq);
108 return ret;
109 }
110 freq = ret;
111 111
112 if (mpu_reg) { 112 if (mpu_reg) {
113 opp = opp_find_freq_ceil(mpu_dev, &freq); 113 opp = opp_find_freq_ceil(mpu_dev, &freq);
@@ -172,7 +172,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *policy)
172{ 172{
173 int result = 0; 173 int result = 0;
174 174
175 mpu_clk = clk_get(NULL, mpu_clk_name); 175 mpu_clk = clk_get(NULL, "cpufreq_ck");
176 if (IS_ERR(mpu_clk)) 176 if (IS_ERR(mpu_clk))
177 return PTR_ERR(mpu_clk); 177 return PTR_ERR(mpu_clk);
178 178
@@ -253,22 +253,10 @@ static struct cpufreq_driver omap_driver = {
253 253
254static int __init omap_cpufreq_init(void) 254static int __init omap_cpufreq_init(void)
255{ 255{
256 if (cpu_is_omap24xx()) 256 mpu_dev = get_cpu_device(0);
257 mpu_clk_name = "virt_prcm_set"; 257 if (!mpu_dev) {
258 else if (cpu_is_omap34xx())
259 mpu_clk_name = "dpll1_ck";
260 else if (cpu_is_omap44xx())
261 mpu_clk_name = "dpll_mpu_ck";
262
263 if (!mpu_clk_name) {
264 pr_err("%s: unsupported Silicon?\n", __func__);
265 return -EINVAL;
266 }
267
268 mpu_dev = omap_device_get_by_hwmod_name("mpu");
269 if (IS_ERR(mpu_dev)) {
270 pr_warning("%s: unable to get the mpu device\n", __func__); 258 pr_warning("%s: unable to get the mpu device\n", __func__);
271 return PTR_ERR(mpu_dev); 259 return -EINVAL;
272 } 260 }
273 261
274 mpu_reg = regulator_get(mpu_dev, "vcc"); 262 mpu_reg = regulator_get(mpu_dev, "vcc");