[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <df162ba4cbdf1379ccfa5dd4ca34153626ae9c71.1385118256.git.viresh.kumar@linaro.org>
Date: Fri, 22 Nov 2013 16:59:49 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: rjw@...ysocki.net
Cc: linaro-kernel@...ts.linaro.org, patches@...aro.org,
cpufreq@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, tianyu.lan@...el.com, nm@...com,
jinchoi@...adcom.com, sebastian.capella@...aro.org,
Viresh Kumar <viresh.kumar@...aro.org>
Subject: [PATCH V2 2/2] cpufreq: Change freq before suspending governors
Some platforms might want to change frequency before suspending governors. Like:
- Some platform which want to set freq to max to speed up suspend/hibernation
process.
- Some platform (like: Tegra or exynos), set this to min or bootloader's
frequency.
This patch adds an option for those, so that they can specify this at call to
->init(), so that cpufreq core can take care of this before suspending system.
If this variable is not updated by ->init() then its value would be zero and so
core wouldn't do anything.
Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
drivers/cpufreq/cpufreq.c | 17 +++++++++++++++++
include/linux/cpufreq.h | 2 ++
2 files changed, 19 insertions(+)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 540bd87..e609102 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1476,6 +1476,7 @@ void cpufreq_suspend(void)
{
struct cpufreq_policy *policy;
unsigned long flags;
+ int ret;
if (!has_target())
return;
@@ -1487,6 +1488,22 @@ void cpufreq_suspend(void)
pr_err("%s: Failed to stop governor for policy: %p\n",
__func__, policy);
+ /*
+ * In case platform wants some specific frequency to be configured
+ * during suspend
+ */
+ if (policy->suspend_freq) {
+ pr_debug("%s: Suspending Governors: Setting suspend-freq: %u\n",
+ __func__, policy->suspend_freq);
+
+ ret = __cpufreq_driver_target(policy, policy->suspend_freq,
+ CPUFREQ_RELATION_H);
+ /* We can still suspend even if this failed */
+ if (ret)
+ pr_err("%s: Unable to set suspend-freq: %u. Err: %d\n",
+ __func__, policy->suspend_freq, ret);
+ }
+
write_lock_irqsave(&cpufreq_driver_lock, flags);
cpufreq_suspended = true;
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 6d93f91..867fdd4 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -72,6 +72,8 @@ struct cpufreq_policy {
unsigned int max; /* in kHz */
unsigned int cur; /* in kHz, only needed if cpufreq
* governors are used */
+ unsigned int suspend_freq; /* freq to set during suspend */
+
unsigned int policy; /* see above */
struct cpufreq_governor *governor; /* see below */
void *governor_data;
--
1.7.12.rc2.18.g61b472e
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists