Commit 71a98a9d authored by Robin Gong's avatar Robin Gong Committed by Jason Liu

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: 's avatarRobin Gong <b38343@freescale.com>
parent e4d95259
......@@ -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 =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment