From: Quentin Perret <quentin.perret@arm.com>
To: Joel Fernandes <joelaf@google.com>
Cc: Linux PM <linux-pm@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
vireshk@kernel.org, nm@ti.com, sboyd@codeaurora.org,
sudeep.holla@arm.com, amit.kachhap@gmail.com,
javi.merino@kernel.org, rui.zhang@intel.com, edubezval@gmail.com,
matthias.bgg@gmail.com,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Morten Rasmussen <morten.rasmussen@arm.com>,
Patrick Bellasi <patrick.bellasi@arm.com>,
Ionela Voinescu <ionela.voinescu@arm.com>,
Todd Kjos <tkjos@google.com>
Subject: Re: [PATCH v3 1/2] PM / OPP: introduce an OPP power estimation helper
Date: Mon, 22 Jan 2018 10:00:26 +0000 [thread overview]
Message-ID: <20180122100026.GC16453@e108498-lin.cambridge.arm.com> (raw)
In-Reply-To: <CAJWu+opFktdGqGMxjAr6Fudt90Ecqe2KEZ76wS8wFZ07P071Sg@mail.gmail.com>
On Friday 19 Jan 2018 at 15:36:42 (-0800), Joel Fernandes wrote:
> > +/**
> > + * Estimate the power of an OPP as P = C * V^2 * f, with C the device's
> > + * capacitance, V the OPP's voltage and f the OPP's frequency.
> > + */
> > +static void _opp_estimate_power(struct dev_pm_opp *opp, unsigned long cap)
> > +{
> > + unsigned long mV = opp->supplies[0].u_volt / 1000;
> > + unsigned long KHz = opp->rate / 1000;
> > +
> > + opp->power_estimate_uw = cap * mV * mV * KHz / 1000000000;
> > +}
> > +
> > /*
> > * Returns:
> > * 0: On success. And appropriate error message for duplicate OPPs.
> > @@ -1039,6 +1069,8 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
> > if (opp_table->get_pstate)
> > new_opp->pstate = opp_table->get_pstate(dev, new_opp->rate);
> >
> > + _opp_estimate_power(new_opp, opp_table->capacitance);
> > +
>
> Does this need to be a separate static function? There's only one user
> of the function in the C file and it adds more LOC.
True, but I guess that makes sense conceptually to factor out this
feature. Maybe it's just my personal taste :)
>
> Otherwise, feel free to add FWIW:
> Reviewed-by: Joel Fernandes <joelaf@google.com>
Cool, thank you very much !
Quentin
next prev parent reply other threads:[~2018-01-22 10:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 9:45 [PATCH v3 0/2] thermal, OPP: move the CPU power estimation to the OPP library Quentin Perret
2018-01-19 9:45 ` [PATCH v3 1/2] PM / OPP: introduce an OPP power estimation helper Quentin Perret
2018-01-19 23:36 ` Joel Fernandes
2018-01-22 5:12 ` Viresh Kumar
2018-01-22 10:00 ` Quentin Perret [this message]
2018-01-20 4:10 ` Joel Fernandes
2018-01-22 9:56 ` Quentin Perret
2018-01-22 21:33 ` Joel Fernandes
2018-01-19 9:45 ` [PATCH v3 2/2] thermal: cpu_cooling: use power models from the OPP library Quentin Perret
2018-01-19 23:15 ` Joel Fernandes
2018-01-22 5:11 ` Viresh Kumar
2018-01-22 21:30 ` Joel Fernandes
2018-01-23 2:47 ` Viresh Kumar
2018-01-22 11:03 ` Quentin Perret
2018-01-19 10:12 ` [PATCH v3 0/2] thermal, OPP: move the CPU power estimation to " Viresh Kumar
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=20180122100026.GC16453@e108498-lin.cambridge.arm.com \
--to=quentin.perret@arm.com \
--cc=amit.kachhap@gmail.com \
--cc=dietmar.eggemann@arm.com \
--cc=edubezval@gmail.com \
--cc=ionela.voinescu@arm.com \
--cc=javi.merino@kernel.org \
--cc=joelaf@google.com \
--cc=linux-pm@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=morten.rasmussen@arm.com \
--cc=nm@ti.com \
--cc=patrick.bellasi@arm.com \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--cc=sboyd@codeaurora.org \
--cc=sudeep.holla@arm.com \
--cc=tkjos@google.com \
--cc=vireshk@kernel.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).