summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/cpufreq.c
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2010-07-20 16:46:48 +0530
committerKevin Hilman <khilman@deeprootsystems.com>2010-09-24 07:40:23 -0700
commitfca97b3337edb6b12707d167460b224dd8ef6052 (patch)
tree135f93d4c852af28cd767d1b015be2b712cda7a6 /arch/arm/mach-davinci/cpufreq.c
parentc89f1681450822c74afb3217ed4c24a177a23f43 (diff)
downloadblackbird-op-linux-fca97b3337edb6b12707d167460b224dd8ef6052.tar.gz
blackbird-op-linux-fca97b3337edb6b12707d167460b224dd8ef6052.zip
davinci: cpufreq: bailout on regulator errors
Current cpufreq code does not consider errors that can occur while changing voltage. Code to increase CPU frequency goes ahead even in the case the regulator has failed to increase the voltage. This leads to hard error since lower voltages cannot support increased frequency. Prevent this by not increasing frequency in case increasing voltage is not successful. Also, do not lower the voltage if changing the cpu frequency has failed for some reason. Note that we do not return error on failure to decrease voltage as that is not a hard error. Build fix for non-cpufreq kernels by Caglar Akyuz. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Cc: Caglar Akyuz <caglar@bilkon-kontrol.com.tr> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/cpufreq.c')
-rw-r--r--arch/arm/mach-davinci/cpufreq.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
index d3fa6de1e20f..bc8014279114 100644
--- a/arch/arm/mach-davinci/cpufreq.c
+++ b/arch/arm/mach-davinci/cpufreq.c
@@ -104,15 +104,21 @@ static int davinci_target(struct cpufreq_policy *policy,
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
/* if moving to higher frequency, up the voltage beforehand */
- if (pdata->set_voltage && freqs.new > freqs.old)
- pdata->set_voltage(idx);
+ if (pdata->set_voltage && freqs.new > freqs.old) {
+ ret = pdata->set_voltage(idx);
+ if (ret)
+ goto out;
+ }
ret = clk_set_rate(armclk, idx);
+ if (ret)
+ goto out;
/* if moving to lower freq, lower the voltage after lowering freq */
if (pdata->set_voltage && freqs.new < freqs.old)
pdata->set_voltage(idx);
+out:
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
return ret;
OpenPOWER on IntegriCloud