aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Medhurst \(Tixy\) <tixy@linaro.org>2015-10-21 05:55:33 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-11-01 19:58:27 -0500
commit14f1ba3af6209f0394192ef07fe2bd9bccdc755f (patch)
tree0441ad96036b06ea942e890b5d08a86947ba7f4a
parent3510fac4549201919c565250fdff5cfa63db9e86 (diff)
cpufreq: arm_big_little: fix frequency check when bL switcher is active
The check for correct frequency being set in bL_cpufreq_set_rate is broken when the big.LITTLE switcher is active, for two reasons. 1. The 'new_rate' variable gets overwritten before the test by the code calculating the frequency of the old cluster. 2. The frequency returned by bL_cpufreq_get_rate will be the virtual frequency, not the actual one the intended version of new_rate contains. This means the function always returns an error causing an endless stream of: "cpufreq: __target_index: Failed to change cpu frequency: -5" As the intent is to check for errors that clk_set_rate doesn't report lets move the check to immediately after that and directly use clk_get_rate, rather than the arm_big_little helpers which only confuse matters. Also, update the comment to be hopefully clearer about the purpose of the code. Fixes: 0a95e630b49a (cpufreq: arm_big_little: check if the frequency is set correctly) Signed-off-by: Jon Medhurst <tixy@linaro.org> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Michael Turquette <mturquette@baylibre.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/arm_big_little.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index f1e42f8ce0fc..c5d256caa664 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -149,6 +149,19 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
149 __func__, cpu, old_cluster, new_cluster, new_rate); 149 __func__, cpu, old_cluster, new_cluster, new_rate);
150 150
151 ret = clk_set_rate(clk[new_cluster], new_rate * 1000); 151 ret = clk_set_rate(clk[new_cluster], new_rate * 1000);
152 if (!ret) {
153 /*
154 * FIXME: clk_set_rate hasn't returned an error here however it
155 * may be that clk_change_rate failed due to hardware or
156 * firmware issues and wasn't able to report that due to the
157 * current design of the clk core layer. To work around this
158 * problem we will read back the clock rate and check it is
159 * correct. This needs to be removed once clk core is fixed.
160 */
161 if (clk_get_rate(clk[new_cluster]) != new_rate * 1000)
162 ret = -EIO;
163 }
164
152 if (WARN_ON(ret)) { 165 if (WARN_ON(ret)) {
153 pr_err("clk_set_rate failed: %d, new cluster: %d\n", ret, 166 pr_err("clk_set_rate failed: %d, new cluster: %d\n", ret,
154 new_cluster); 167 new_cluster);
@@ -189,15 +202,6 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
189 mutex_unlock(&cluster_lock[old_cluster]); 202 mutex_unlock(&cluster_lock[old_cluster]);
190 } 203 }
191 204
192 /*
193 * FIXME: clk_set_rate has to handle the case where clk_change_rate
194 * can fail due to hardware or firmware issues. Until the clk core
195 * layer is fixed, we can check here. In most of the cases we will
196 * be reading only the cached value anyway. This needs to be removed
197 * once clk core is fixed.
198 */
199 if (bL_cpufreq_get_rate(cpu) != new_rate)
200 return -EIO;
201 return 0; 205 return 0;
202} 206}
203 207