All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: ulf.hansson@linaro.org, Rafael Wysocki <rjw@rjwysocki.net>,
	Kevin Hilman <khilman@kernel.org>, Pavel Machek <pavel@ucw.cz>,
	Len Brown <len.brown@intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	linux-pm@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Stephen Boyd <sboyd@kernel.org>, Nishanth Menon <nm@ti.com>,
	rnayak@codeaurora.org, niklas.cassel@linaro.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH V4 1/7] PM / Domains: Make genpd performance states orthogonal to the idlestates
Date: Fri, 14 Dec 2018 15:45:27 +0530	[thread overview]
Message-ID: <48a7fc66faec9ac5c157b0cadcdaeb07bfe78781.1544782279.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1544782279.git.viresh.kumar@linaro.org>

From: Ulf Hansson <ulf.hansson@linaro.org>

It's quite questionable whether genpd internally should care about if the
corresponding PM domain for a device is powered on, as to allow setting a
new performance state for it. The assumptions creates an unnecessary
limitation at this point, for both consumers and providers, but more
importantly it also makes the code more complicated.

Therefore, let's simplify the code to allow setting a performance state, by
invoking the ->set_performance_state() callback, no matter whether the PM
domain is powered on or off.

Do note, this change means genpd providers needs to restore the performance
state themselves during power on, via the ->power_on() callback. Moreover,
they may also need to check that the PM domain is powered on, from their
->set_performance_state() callback, before deciding to update the state.

Tested-by: Rajendra Nayak <rnayak@codeaurora.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/base/power/domain.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 8e554e6a82a2..4a4e39d12354 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -311,12 +311,10 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state)
 	 */
 
 update_state:
-	if (genpd_status_on(genpd)) {
-		ret = genpd->set_performance_state(genpd, state);
-		if (ret) {
-			gpd_data->performance_state = prev;
-			goto unlock;
-		}
+	ret = genpd->set_performance_state(genpd, state);
+	if (ret) {
+		gpd_data->performance_state = prev;
+		goto unlock;
 	}
 
 	genpd->performance_state = state;
@@ -347,15 +345,6 @@ static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
 		return ret;
 
 	elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start));
-
-	if (unlikely(genpd->set_performance_state)) {
-		ret = genpd->set_performance_state(genpd, genpd->performance_state);
-		if (ret) {
-			pr_warn("%s: Failed to set performance state %d (%d)\n",
-				genpd->name, genpd->performance_state, ret);
-		}
-	}
-
 	if (elapsed_ns <= genpd->states[state_idx].power_on_latency_ns)
 		return ret;
 
-- 
2.19.1.568.g152ad8e3369a


  reply	other threads:[~2018-12-14 10:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 10:15 [PATCH V4 0/7] PM / Domains: Allow performance state propagation Viresh Kumar
2018-12-14 10:15 ` Viresh Kumar [this message]
2018-12-14 10:15 ` [PATCH V4 2/7] OPP: Improve _find_table_of_opp_np() Viresh Kumar
2018-12-14 10:40   ` Ulf Hansson
2018-12-14 10:15 ` [PATCH V4 3/7] OPP: Add dev_pm_opp_xlate_performance_state() helper Viresh Kumar
2018-12-14 10:40   ` Ulf Hansson
2018-12-14 10:15 ` [PATCH V4 4/7] OPP: Don't return 0 on error from of_get_required_opp_performance_state() Viresh Kumar
2018-12-14 10:40   ` Ulf Hansson
2018-12-14 10:15 ` [PATCH V4 5/7] PM / Domains: Save OPP table pointer in genpd Viresh Kumar
2018-12-14 10:40   ` Ulf Hansson
2018-12-14 10:15 ` [PATCH V4 6/7] PM / Domains: Factorize dev_pm_genpd_set_performance_state() Viresh Kumar
2018-12-14 10:40   ` Ulf Hansson
2018-12-14 10:47     ` Viresh Kumar
2018-12-14 10:15 ` [PATCH V4 7/7] PM / Domains: Propagate performance state updates Viresh Kumar
2018-12-14 10:40   ` Ulf Hansson
2018-12-14 10:18 ` [PATCH V4 0/7] PM / Domains: Allow performance state propagation Rafael J. Wysocki
2018-12-14 10:19   ` Viresh Kumar
2018-12-14 18:05 ` Stephen Boyd
2018-12-14 18:05   ` Stephen Boyd

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=48a7fc66faec9ac5c157b0cadcdaeb07bfe78781.1544782279.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=niklas.cassel@linaro.org \
    --cc=nm@ti.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=rnayak@codeaurora.org \
    --cc=sboyd@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.