]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
davinci: cpufreq: bailout on regulator errors
authorSekhar Nori <nsekhar@ti.com>
Tue, 20 Jul 2010 11:16:48 +0000 (16:46 +0530)
committerKevin Hilman <khilman@deeprootsystems.com>
Fri, 24 Sep 2010 14:40:23 +0000 (07:40 -0700)
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>
arch/arm/mach-davinci/cpufreq.c
arch/arm/mach-davinci/da850.c

index d3fa6de1e20f6d5cb85d4e8424e26a6c9d5889b4..bc8014279114ab5395e7f215c92618505820e8cb 100644 (file)
@@ -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;
index 68ed58a48252948ee756c544a97d002d0ded8082..868227e66cea078141e199e6c08a02be10c07517 100644 (file)
@@ -983,7 +983,7 @@ static int da850_set_pll0rate(struct clk *clk, unsigned long index)
        return 0;
 }
 #else
-int __init da850_register_cpufreq(void)
+int __init da850_register_cpufreq(char *async_clk)
 {
        return 0;
 }