aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/omap-cpufreq.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2012-10-02 18:39:03 -0400
committerKevin Hilman <khilman@ti.com>2012-10-08 17:57:34 -0400
commit8df0a6637767474989022b93230a8615f11fb53b (patch)
tree78b455c21370f4625a5b6c75cede4404413973b3 /drivers/cpufreq/omap-cpufreq.c
parent16642a2e7be23bbda013fc32d8f6c68982eab603 (diff)
cpufreq: OMAP: ensure valid clock rate before scaling
Ensure the clock rate that will be used is a valid one before attempting to scale the voltage. Currently the driver assumes it has a valid frequency from the OPP table, but boards using different system oscillators might not have exact matches with the OPP table, and result in a failing call to clk_set_rate(). This is particularily bad because the voltage may be scaled even though the frequency is not. This will obviously lead to some unpredictable behavior, especially if the frequency is high and the voltage is dropped. Thanks to Joni Lapilainen for reporting crashes seen on 3430/n900. Reported-by: Joni Lapilainen <joni.lapilainen@gmail.com> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'drivers/cpufreq/omap-cpufreq.c')
-rw-r--r--drivers/cpufreq/omap-cpufreq.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index 65f8e9a54975..0fe395aea114 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -108,6 +108,14 @@ static int omap_target(struct cpufreq_policy *policy,
108 } 108 }
109 109
110 freq = freqs.new * 1000; 110 freq = freqs.new * 1000;
111 ret = clk_round_rate(mpu_clk, freq);
112 if (IS_ERR_VALUE(ret)) {
113 dev_warn(mpu_dev,
114 "CPUfreq: Cannot find matching frequency for %lu\n",
115 freq);
116 return ret;
117 }
118 freq = ret;
111 119
112 if (mpu_reg) { 120 if (mpu_reg) {
113 opp = opp_find_freq_ceil(mpu_dev, &freq); 121 opp = opp_find_freq_ceil(mpu_dev, &freq);