summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gong <b38343@freescale.com>2012-11-26 11:23:28 +0800
committerJason Liu <r64343@freescale.com>2012-11-28 16:57:06 +0800
commit71a98a9dbbae8194739321493607fad9cb384d37 (patch)
treeeb105df2326e71d0ad76edf08fc228f067c4398f
parente4d9525954eced5a3e866dad27d272556b4810fa (diff)
ENGR00234685-1 cpufreq:fix one bug in cpufreq driver if I2C transfer error
Currently, if we used LDO bypass, will set pfuze register by I2C bus to modify voltage according to different cpu frequency, if I2C transfer error, we should restore to old cpu frequency, not only in cpufreq driver but also cpufreq core. Signed-off-by: Robin Gong <b38343@freescale.com>
-rwxr-xr-xarch/arm/plat-mxc/cpufreq.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/plat-mxc/cpufreq.c
index 3d450e07d6a8..4cdc8377e972 100755
--- a/arch/arm/plat-mxc/cpufreq.c
+++ b/arch/arm/plat-mxc/cpufreq.c
@@ -264,8 +264,18 @@ static int mxc_set_target(struct cpufreq_policy *policy,
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
}
ret = set_cpu_freq(freq_Hz);
- if (ret)
+ if (ret) {
+ /*restore cpufreq and tell cpufreq core if set fail*/
+ freqs.old = clk_get_rate(cpu_clk) / 1000;
+ freqs.new = freqs.old;
+ freqs.cpu = policy->cpu;
+ freqs.flags = 0;
+ for (i = 0; i < num_cpus; i++) {
+ freqs.cpu = i;
+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+ }
goto Set_finish;
+ }
#ifdef CONFIG_SMP
/* Loops per jiffy is not updated by the CPUFREQ driver for SMP systems.
* So update it for all CPUs.
@@ -417,8 +427,17 @@ static int cpufreq_pm_notify(struct notifier_block *nb, unsigned long event,
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
}
ret = set_cpu_freq(imx_freq_table[0].frequency * 1000);
- if (ret)
+ /*restore cpufreq and tell cpufreq core if set fail*/
+ if (ret) {
+ freqs.old = clk_get_rate(cpu_clk)/1000;
+ freqs.new = freqs.old;
+ freqs.flags = 0;
+ for (i = 0; i < num_cpus; i++) {
+ freqs.cpu = i;
+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+ }
goto Notify_finish;/*if update freq error,return*/
+ }
#ifdef CONFIG_SMP
for_each_possible_cpu(i)
per_cpu(cpu_data, i).loops_per_jiffy =
@@ -446,8 +465,17 @@ static int cpufreq_pm_notify(struct notifier_block *nb, unsigned long event,
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
}
ret = set_cpu_freq(pre_suspend_rate);
- if (ret)
+ /*restore cpufreq and tell cpufreq core if set fail*/
+ if (ret) {
+ freqs.old = clk_get_rate(cpu_clk)/1000;
+ freqs.new = freqs.old;
+ freqs.flags = 0;
+ for (i = 0; i < num_cpus; i++) {
+ freqs.cpu = i;
+ cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
+ }
goto Notify_finish;/*if update freq error,return*/
+ }
#ifdef CONFIG_SMP
for_each_possible_cpu(i)
per_cpu(cpu_data, i).loops_per_jiffy =