summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Zobel <dzobel1@motorola.com>2014-09-25 13:46:00 -0500
committerDoug Zobel <dzobel1@motorola.com>2014-09-25 13:49:47 -0500
commit4f9af9948ef92869d86447062520b690b7c11d12 (patch)
treea4b50af6152e1402cf9e54347465d7540cff1fa9
parentfb5d16c798a218004ef052fbb3f5df39c3966a1e (diff)
downloadolio-linux-3.10-4f9af9948ef92869d86447062520b690b7c11d12.tar.xz
olio-linux-3.10-4f9af9948ef92869d86447062520b690b7c11d12.zip
IKXCLOCK-3871 cpufreq: Use CPU max freq for suspend, resume and reboot
Override the user specified max scaling frequency for system suspend and reboot. If the user specifies too low of a frequency, then the reboot could fail due to under voltage conditions on CPU durring the warm reset. Change-Id: I0e15926ab3f1141faed6a6f4a8d2ce52bde11d61
-rw-r--r--drivers/cpufreq/cpufreq-cpu0.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index dd7bc175ca8..0b9f6a3c66c 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -150,15 +150,22 @@ out:
static int cpu0_cpufreq_pm_notify(struct notifier_block *nb,
unsigned long event, void *dummy)
{
+ static unsigned int old_policy_max;
mutex_lock(&cpu0_cpufreq_lock);
if (event == PM_SUSPEND_PREPARE) {
struct cpufreq_policy *policy = cpufreq_cpu_get(0);
is_suspended = true;
+ old_policy_max = policy->max;
+ policy->max = policy->cpuinfo.max_freq;
pr_debug("cpu0 cpufreq suspend: setting frequency to %d kHz\n",
policy->max);
__cpu0_set_target(policy, policy->max, CPUFREQ_RELATION_L);
cpufreq_cpu_put(policy);
} else if (event == PM_POST_SUSPEND) {
+ struct cpufreq_policy *policy = cpufreq_cpu_get(0);
+ policy->max = old_policy_max;
+ __cpu0_set_target(policy, policy->max, CPUFREQ_RELATION_L);
+ cpufreq_cpu_put(policy);
is_suspended = false;
}
mutex_unlock(&cpu0_cpufreq_lock);
@@ -182,6 +189,7 @@ static int cpu0_cpufreq_reboot_notify(struct notifier_block *nb,
mutex_lock(&cpu0_cpufreq_lock);
policy = cpufreq_cpu_get(0);
is_suspended = true;
+ policy->max = policy->cpuinfo.max_freq;
pr_info("cpu0 cpufreq shutdown: setting frequency to %d kHz\n",
policy->max);
__cpu0_set_target(policy, policy->max, CPUFREQ_RELATION_L);