From patchwork Tue Dec 11 10:04:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 153413 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp429947ljp; Tue, 11 Dec 2018 02:05:00 -0800 (PST) X-Received: by 2002:a2e:99d7:: with SMTP id l23-v6mr9068739ljj.165.1544522700240; Tue, 11 Dec 2018 02:05:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544522700; cv=none; d=google.com; s=arc-20160816; b=VbDJ14dLvPLS+2O8y/vc1pqNxAxqaNZd7E6eP4B4fPxj3vzVnXVgsp8BiDdsxHKRY9 YG7xqH+n0gcT5DYmo4wLUsLZxcwP8MhB28NLBsa5WaNdThogAtnPr3brpG5NSwYh5fAZ x8hLUlitY8IseFPo/OLW/tpkgUXHHPgGZ888AYT/CJeHRDpt+aDGla6YyKgqzL6Zngcl Fbxphabscb1ir+e3p3Q83RwPMGGanvTR80sznV98QsqpzNtDDFIA3fZlMjviTEKtGhEm 7KIK8rBBEvawIzUB78cDKG4YxIJPqkrVQQU3YHdSuxtRDmB73pF8al7wDedhk9dBhZAb 6mCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=BKyhNUMH3pAdnZZ6tolvxpJR7jgAjax62ysYVHFn6ik=; b=e1an9k7D+ijytYrOUAaUTldOVCUbHHA1bIWrA1xjZPUuRAvjEYcvMoIT9W3oPnUNrk Z4WDWOYD+FK8gT1C+62iS6qGfvVMorH482pIUxfti5HxHbmcysep5Pm2xG1GR8RBGxhc LLoI9dlWC6WJ/ew/nZ/Ij3whwEx4sV/pOpnJ3r5PmsU6hngYt0p3WKEgx/m1+vdAZiiv kWYP8l7buIQFTqIUMIJFhW6M0eVgi6pcYh6GVg2NaieNPcY4kbMUELg9UdoraKpD/t8r 7HMSY7h/D4XxAKq1UlEnjSVKpNtPtG2buiGVId4XmVMiUTCO1eNcraNGNs443Y+yPzh1 JRxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XpXnGOCQ; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m191sor3573357lfa.53.2018.12.11.02.05.00 for (Google Transport Security); Tue, 11 Dec 2018 02:05:00 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XpXnGOCQ; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=BKyhNUMH3pAdnZZ6tolvxpJR7jgAjax62ysYVHFn6ik=; b=XpXnGOCQJo9i3IQbeBeF+/14cS05+IKSuHNRPfA5B7WFQSgfNabBid7MdrlKSOCpeH z6ZR7vpLulDkcnrABfAGZuVz9XxknQX6lrZSrOlQ78NNKMKZBTk6wR8mLEosu/4G73+X 188uRu1/p6Yr+V9MXID265z2C3bHMeuRINuUM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BKyhNUMH3pAdnZZ6tolvxpJR7jgAjax62ysYVHFn6ik=; b=inakOrcHKqazFL5UaU7breTabzTlOAfAhfpgNWYLAQCUWm5hkRubYJ54bCGMRxCCRB U2ijjEVq5zZRi169NAu2JNmnimvhxxtVNtXWYSItGpTHHMwy2yukP69MTnlLhIOoLD7o iujPODBf1aLfHtju7svzpMhDWNZ/0moVIiwQPEPW6UgD4RinIJWeAJMv6KoW3fE5JZXD Aqi6csbUBOX2D9KWoCuGS/lmVcNkZQw3E/a3aLS1KYzVy7I5dtfFKkHAZujiCNs4iiQk h6QSiPfR5NmGDTdNzrOT2fRBestC0d9IulM9LaUJF/0bKLHtuyDP7MzSCqXTJNK85ELS nijQ== X-Gm-Message-State: AA+aEWb6pKf04nfZkCYXOwAazR5ere/VoVJofrSNCGTHznoVUqCtAPje D/voKzqDqGf836AQihEGIemwdFAO X-Google-Smtp-Source: AFSGD/Wn1EjYa/2UVRaghy0a0XHhF6ykJA9vHvtAYvVyyv3DgMHm5qEhu/X2zFcv83E+ef56y/CCRg== X-Received: by 2002:a19:690d:: with SMTP id e13mr8857246lfc.84.1544522699756; Tue, 11 Dec 2018 02:04:59 -0800 (PST) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 6sm2742920lfa.27.2018.12.11.02.04.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 02:04:59 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org Cc: Ulf Hansson , Rajendra Nayak , Vincent Guittot , Stephen Boyd , Mike Turquette , Graham Roff Subject: [PATCH v2] PM / Domains: Make genpd performance states orthogonal to the idlestates Date: Tue, 11 Dec 2018 11:04:55 +0100 Message-Id: <20181211100455.25905-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 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. Signed-off-by: Ulf Hansson --- Changes in v2: - Clarified in the changelog, the new constraints this change put on genpd providers. --- drivers/base/power/domain.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) -- 2.17.1 Tested-by: Rajendra Nayak Acked-by: Viresh Kumar diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7f38a92b444a..4c39ea1b2cf6 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;