From 2aecab9be85ceafdbab5f824eec5d1f81f3fa803 Mon Sep 17 00:00:00 2001 Message-Id: <2aecab9be85ceafdbab5f824eec5d1f81f3fa803.1384236097.git.viresh.kumar@linaro.org> From: Viresh Kumar Date: Tue, 12 Nov 2013 11:26:36 +0530 Subject: [PATCH] cpufreq: don't start governor in suspend path When we suspend our system, we remove all non-boot CPUs one by one. At this point we actually STOP/START governor for each non-boot cpu, which is a total waste of time as we aren't going to use governor until the time we are back. Also, this is causing problems for some platforms (like OMAP), where governor tries to change freq of core in suspend path which requires programming regulators via I2C which isn't possible then. So, to make it better for everybody don't start the governor again in suspend path. Reported-by: Nishanth Menon Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 02d534d..bec58cf 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1174,7 +1174,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, return -EINVAL; } - if (has_target()) { + if (has_target() && (!frozen || policy->governor_enabled)) { ret = __cpufreq_governor(policy, CPUFREQ_GOV_STOP); if (ret) { pr_err("%s: Failed to stop governor\n", __func__); @@ -1282,7 +1282,7 @@ static int __cpufreq_remove_dev_finish(struct device *dev, if (!frozen) cpufreq_policy_free(policy); } else { - if (has_target()) { + if (has_target() && !frozen) { if ((ret = __cpufreq_governor(policy, CPUFREQ_GOV_START)) || (ret = __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))) { pr_err("%s: Failed to start governor\n", -- 1.7.12.rc2.18.g61b472e