From: Quentin Perret <quentin.perret@arm.com>
To: viresh.kumar@linaro.org, sudeep.holla@arm.com, rjw@rjwysocki.net,
nm@ti.com, sboyd@kernel.org, mka@chromium.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, dietmar.eggemann@arm.com,
quentin.perret@arm.com
Subject: [PATCH v3 2/5] cpufreq: dt: Register an Energy Model
Date: Fri, 1 Feb 2019 09:30:58 +0000 [thread overview]
Message-ID: <20190201093101.31869-3-quentin.perret@arm.com> (raw)
In-Reply-To: <20190201093101.31869-1-quentin.perret@arm.com>
Now that PM_OPP provides a helper function to estimate the power
consumed by CPUs, make sure to try and register an Energy Model (EM)
from cpufreq-dt, hence ensuring interested subsystems (the task
scheduler, for example) can make use of that information when available.
Signed-off-by: Quentin Perret <quentin.perret@arm.com>
---
drivers/cpufreq/cpufreq-dt.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index e58bfcb1169e..1d4ad6f67408 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -160,7 +160,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
unsigned int transition_latency;
bool fallback = false;
const char *name;
- int ret;
+ int ret, nr_opp;
cpu_dev = get_cpu_device(policy->cpu);
if (!cpu_dev) {
@@ -231,8 +231,8 @@ static int cpufreq_init(struct cpufreq_policy *policy)
* But we need OPP table to function so if it is not there let's
* give platform code chance to provide it for us.
*/
- ret = dev_pm_opp_get_opp_count(cpu_dev);
- if (ret <= 0) {
+ nr_opp = dev_pm_opp_get_opp_count(cpu_dev);
+ if (nr_opp <= 0) {
dev_dbg(cpu_dev, "OPP table is not ready, deferring probe\n");
ret = -EPROBE_DEFER;
goto out_free_opp;
@@ -280,6 +280,8 @@ static int cpufreq_init(struct cpufreq_policy *policy)
policy->cpuinfo.transition_latency = transition_latency;
policy->dvfs_possible_from_any_cpu = true;
+ dev_pm_opp_of_register_em(policy->cpus, nr_opp);
+
return 0;
out_free_cpufreq_table:
--
2.20.1
next prev parent reply other threads:[~2019-02-01 9:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-01 9:30 [PATCH v3 0/5] Register an Energy Model for Arm reference platforms Quentin Perret
2019-02-01 9:30 ` [PATCH v3 1/5] PM / OPP: Introduce a power estimation helper Quentin Perret
2019-02-01 12:04 ` Sudeep Holla
2019-02-01 12:09 ` Quentin Perret
2019-02-01 12:27 ` Sudeep Holla
2019-02-01 12:44 ` Sudeep Holla
2019-02-01 18:16 ` Matthias Kaehlcke
2019-02-01 9:30 ` Quentin Perret [this message]
2019-02-01 9:30 ` [PATCH v3 3/5] cpufreq: scpi: Register an Energy Model Quentin Perret
2019-02-01 9:31 ` [PATCH v3 4/5] cpufreq: arm_big_little: " Quentin Perret
2019-02-01 11:53 ` Sudeep Holla
2019-02-01 12:11 ` Quentin Perret
2019-02-01 9:31 ` [PATCH v3 5/5] cpufreq: scmi: " Quentin Perret
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=20190201093101.31869-3-quentin.perret@arm.com \
--to=quentin.perret@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mka@chromium.org \
--cc=nm@ti.com \
--cc=rjw@rjwysocki.net \
--cc=sboyd@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=viresh.kumar@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).