Commit 0ca68436 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Rafael J. Wysocki

cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()

clk_set_rate() isn't supposed to accept approximate frequencies, instead
a supported frequency should be obtained from clk_round_rate() and then
used to set the clock.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarShawn Guo <shawn.guo@linaro.org>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 2f7021a8
...@@ -45,7 +45,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, ...@@ -45,7 +45,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
struct opp *opp; struct opp *opp;
unsigned long volt = 0, volt_old = 0, tol = 0; unsigned long volt = 0, volt_old = 0, tol = 0;
long freq_Hz; long freq_Hz, freq_exact;
unsigned int index; unsigned int index;
int ret; int ret;
...@@ -60,6 +60,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, ...@@ -60,6 +60,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000); freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000);
if (freq_Hz < 0) if (freq_Hz < 0)
freq_Hz = freq_table[index].frequency * 1000; freq_Hz = freq_table[index].frequency * 1000;
freq_exact = freq_Hz;
freqs.new = freq_Hz / 1000; freqs.new = freq_Hz / 1000;
freqs.old = clk_get_rate(cpu_clk) / 1000; freqs.old = clk_get_rate(cpu_clk) / 1000;
...@@ -98,7 +99,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy, ...@@ -98,7 +99,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
} }
} }
ret = clk_set_rate(cpu_clk, freqs.new * 1000); ret = clk_set_rate(cpu_clk, freq_exact);
if (ret) { if (ret) {
pr_err("failed to set clock rate: %d\n", ret); pr_err("failed to set clock rate: %d\n", ret);
if (cpu_reg) if (cpu_reg)
......
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