From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rafael Wysocki <rjw@rjwysocki.net>,
khilman@baylibre.com, ulf.hansson@linaro.org,
Kevin Hilman <khilman@kernel.org>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, Stephen Boyd <sboyd@codeaurora.org>,
Nishanth Menon <nm@ti.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
robh+dt@kernel.org, mark.rutland@arm.com, lina.iyer@linaro.org,
rnayak@codeaurora.org, Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 5/6] PM / domain: Save/restore performance state at runtime suspend/resume
Date: Tue, 3 Jan 2017 16:36:11 +0530 [thread overview]
Message-ID: <dd5ae96e358f9c1e2e92d9ce523f7784dc05baf4.1483439894.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1483439894.git.viresh.kumar@linaro.org>
In-Reply-To: <cover.1483439894.git.viresh.kumar@linaro.org>
With runtime PM, the devices get suspended while the system is up and
running in order to save power. At such times, it is important to
re-evaluate the required performance state of the domain, in order to
choose a lower state if possible.
This patch updates the genpd suspend/resume callbacks to do that.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/base/power/domain.c | 19 +++++++++++++++++--
include/linux/pm_domain.h | 1 +
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index f460be4ca5f7..ef4062927713 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -576,7 +576,8 @@ static int genpd_runtime_suspend(struct device *dev)
{
struct generic_pm_domain *genpd;
bool (*suspend_ok)(struct device *__dev);
- struct gpd_timing_data *td = &dev_gpd_data(dev)->td;
+ struct generic_pm_domain_data *pd_data = dev_gpd_data(dev);
+ struct gpd_timing_data *td = &pd_data->td;
bool runtime_pm = pm_runtime_enabled(dev);
ktime_t time_start;
s64 elapsed_ns;
@@ -633,7 +634,14 @@ static int genpd_runtime_suspend(struct device *dev)
return 0;
genpd_lock(genpd);
+
+ /* Re-evaluate performance state of the domain */
+ pd_data->cached_performance_state = pd_data->performance_state;
+ pd_data->performance_state = 0;
+ update_domain_performance_state(genpd);
+
genpd_poweroff(genpd, false);
+
genpd_unlock(genpd);
return 0;
@@ -650,7 +658,8 @@ static int genpd_runtime_suspend(struct device *dev)
static int genpd_runtime_resume(struct device *dev)
{
struct generic_pm_domain *genpd;
- struct gpd_timing_data *td = &dev_gpd_data(dev)->td;
+ struct generic_pm_domain_data *pd_data = dev_gpd_data(dev);
+ struct gpd_timing_data *td = &pd_data->td;
bool runtime_pm = pm_runtime_enabled(dev);
ktime_t time_start;
s64 elapsed_ns;
@@ -673,7 +682,13 @@ static int genpd_runtime_resume(struct device *dev)
}
genpd_lock(genpd);
+
ret = genpd_poweron(genpd, 0);
+
+ /* Re-evaluate performance state of the domain */
+ pd_data->performance_state = pd_data->cached_performance_state;
+ update_domain_performance_state(genpd);
+
genpd_unlock(genpd);
if (ret)
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index d994ad5ba1c0..69b453d44adb 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -122,6 +122,7 @@ struct generic_pm_domain_data {
struct notifier_block nb;
struct notifier_block perf_nb;
unsigned int performance_state;
+ unsigned int cached_performance_state;
};
#ifdef CONFIG_PM_GENERIC_DOMAINS
--
2.7.1.410.g6faf27b
next prev parent reply other threads:[~2017-01-03 11:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-03 11:06 [PATCH 0/6] PM / Domains: Implement domain performance states Viresh Kumar
2017-01-03 11:06 ` [PATCH 1/6] PM / QOS: Add default case to the switch Viresh Kumar
2017-01-03 11:06 ` [PATCH 2/6] PM / QOS: Pass request type to dev_pm_qos_{add|remove}_notifier() Viresh Kumar
2017-01-03 11:06 ` [PATCH 3/6] PM / QOS: Add 'performance' request Viresh Kumar
2017-01-03 11:06 ` [PATCH 4/6] PM / domain: Register for PM QOS performance notifier Viresh Kumar
2017-01-19 4:36 ` Viresh Kumar
2017-01-03 11:06 ` Viresh Kumar [this message]
2017-01-03 11:06 ` [PATCH 6/6] PM / OPP: Add support to parse domain-performance-state Viresh Kumar
2017-01-16 5:30 ` [PATCH 0/6] PM / Domains: Implement domain performance states Viresh Kumar
2017-01-16 21:47 ` Rafael J. Wysocki
2017-01-17 3:21 ` Viresh Kumar
2017-02-06 5:35 ` Viresh Kumar
2017-02-06 11:39 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd5ae96e358f9c1e2e92d9ce523f7784dc05baf4.1483439894.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=khilman@baylibre.com \
--cc=khilman@kernel.org \
--cc=len.brown@intel.com \
--cc=lina.iyer@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nm@ti.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=rnayak@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=sboyd@codeaurora.org \
--cc=ulf.hansson@linaro.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).