summaryrefslogtreecommitdiff
path: root/drivers/cpufreq/qcom-cpufreq.c
diff options
context:
space:
mode:
authorJunjie Wu <junjiew@codeaurora.org>2014-12-01 21:21:00 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:02:54 -0700
commitf1e1ba3b6cfa47f7f2e721dd6487b7891d9f7cae (patch)
tree90d261601c0fb2eb2ea60d75362915f38cf67790 /drivers/cpufreq/qcom-cpufreq.c
parent9c69b365d225b0a38e83558571b64ab1b63c1fd3 (diff)
qcom-cpufreq: Restore CPU frequency during resume
qcom-cpufreq blocks CPU frequency change request during suspend, because its dependencies might be suspended. Thus a freq change request would fail silently, and CPU clock won't change until first frequency update is requested after system comes out of suspend. This creates a period when thermal driver cannot perform frequency mitigation, even though policy->min/max have been correctly updated. Check each online CPU's policy during resume to correct any frequency violation as soon as possible. Change-Id: I3be79cf91e7d5e361314020c9806b770823c0b72 Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Diffstat (limited to 'drivers/cpufreq/qcom-cpufreq.c')
-rw-r--r--drivers/cpufreq/qcom-cpufreq.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/cpufreq/qcom-cpufreq.c b/drivers/cpufreq/qcom-cpufreq.c
index ffef104bbe3b..25d6a962ca48 100644
--- a/drivers/cpufreq/qcom-cpufreq.c
+++ b/drivers/cpufreq/qcom-cpufreq.c
@@ -262,12 +262,35 @@ static int msm_cpufreq_suspend(void)
static int msm_cpufreq_resume(void)
{
- int cpu;
+ int cpu, ret;
+ struct cpufreq_policy policy;
for_each_possible_cpu(cpu) {
per_cpu(cpufreq_suspend, cpu).device_suspended = 0;
}
+ /*
+ * Freq request might be rejected during suspend, resulting
+ * in policy->cur violating min/max constraint.
+ * Correct the frequency as soon as possible.
+ */
+ get_online_cpus();
+ for_each_online_cpu(cpu) {
+ ret = cpufreq_get_policy(&policy, cpu);
+ if (ret)
+ continue;
+ if (policy.cur <= policy.max && policy.cur >= policy.min)
+ continue;
+ ret = cpufreq_update_policy(cpu);
+ if (ret)
+ pr_info("cpufreq: Current frequency violates policy min/max for CPU%d\n",
+ cpu);
+ else
+ pr_info("cpufreq: Frequency violation fixed for CPU%d\n",
+ cpu);
+ }
+ put_online_cpus();
+
return NOTIFY_DONE;
}