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>
This commit is contained in:
parent
9c69b365d2
commit
f1e1ba3b6c
1 changed files with 24 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue