From: Dmitry Osipenko <digetx@gmail.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Kevin Hilman <khilman@kernel.org>,
Viresh Kumar <vireshk@kernel.org>,
Stephen Boyd <sboyd@kernel.org>, Nishanth Menon <nm@ti.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-tegra <linux-tegra@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v10 4/8] PM: domains: Add dev_get_performance_state() callback
Date: Thu, 2 Sep 2021 11:42:37 +0300 [thread overview]
Message-ID: <a705b35f-8ece-bf74-b7db-7c4ded19e43e@gmail.com> (raw)
In-Reply-To: <CAPDyKFp4M30y9UB5Ss54ZfNjL_a6nqbka6Dq7xtGNzb2Mg8WrA@mail.gmail.com>
01.09.2021 19:59, Ulf Hansson пишет:
>> +static int genpd_dev_initialize_performance_state(struct device *dev,
>> + struct device *base_dev,
>> + unsigned int index)
>> +{
>> + struct generic_pm_domain *pd = dev_to_genpd(dev);
>> + bool state_default = false, suspended = false;
>> + int pstate, err;
>> +
>> + pstate = genpd_dev_get_current_performance_state(dev, base_dev, index,
>> + &state_default,
>> + &suspended);
>> + if (pstate <= 0)
>> + return pstate;
>> +
>> + /*
>> + * If device is suspended, then performance state will be applied
>> + * on RPM-resume. This prevents potential extra power consumption
>> + * if device won't be resumed soon.
>> + *
>> + * If device is known to be active at the moment, then the performance
>> + * state should be updated immediately to sync state with hardware.
>> + */
>> + if (suspended) {
>> + dev_gpd_data(dev)->rpm_pstate = pstate;
>> + } else {
>> + err = dev_pm_genpd_set_performance_state(dev, pstate);
>> + if (err) {
>> + dev_err(dev, "failed to set performance state for power-domain %s: %d\n",
>> + pd->name, err);
>> + return err;
>> + }
>> +
>> + if (state_default)
>> + dev_gpd_data(dev)->default_pstate = pstate;
>> + }
>> +
>> + return 0;
>> +}
> As I kind of indicated in my previous reply on the earlier version, I
> think the above code can be made a lot less complicated. Although,
> perhaps I may be missing some points.
>
> Anyway, I will post a couple patches, later this evening or tomorrow,
> to show more exactly what I had in mind. Let's see if that can work
> for you.
It's not obvious what you're wanting to improve, I'm probably missing
yours point. So indeed will be good to see the code sample, thanks.
next prev parent reply other threads:[~2021-09-02 8:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-31 13:54 [PATCH v10 0/8] NVIDIA Tegra power management patches for 5.16 Dmitry Osipenko
2021-08-31 13:54 ` [PATCH v10 1/8] opp: Add dev_pm_opp_get_current() Dmitry Osipenko
2021-09-01 4:39 ` Viresh Kumar
2021-09-01 5:43 ` Dmitry Osipenko
2021-09-01 6:05 ` Viresh Kumar
2021-08-31 13:54 ` [PATCH v10 2/8] opp: Allow dev_pm_opp_set_clkname() to replace released clock Dmitry Osipenko
2021-09-01 4:42 ` Viresh Kumar
2021-09-01 5:46 ` Dmitry Osipenko
2021-09-01 6:02 ` Viresh Kumar
2021-08-31 13:54 ` [PATCH v10 3/8] opp: Change type of dev_pm_opp_attach_genpd(names) argument Dmitry Osipenko
2021-09-01 4:41 ` Viresh Kumar
2021-09-01 5:44 ` Dmitry Osipenko
2021-09-01 5:48 ` Viresh Kumar
2021-08-31 13:54 ` [PATCH v10 4/8] PM: domains: Add dev_get_performance_state() callback Dmitry Osipenko
2021-09-01 16:59 ` Ulf Hansson
2021-09-02 8:42 ` Dmitry Osipenko [this message]
2021-08-31 13:54 ` [PATCH v10 5/8] soc/tegra: pmc: Implement " Dmitry Osipenko
2021-09-01 6:10 ` Viresh Kumar
2021-09-01 6:57 ` Dmitry Osipenko
2021-09-01 7:16 ` Viresh Kumar
2021-09-01 9:04 ` Dmitry Osipenko
2021-08-31 13:54 ` [PATCH v10 6/8] soc/tegra: Add devm_tegra_core_dev_init_opp_table_simple() Dmitry Osipenko
2021-08-31 13:54 ` [PATCH v10 7/8] gpu: host1x: Add host1x_channel_stop() Dmitry Osipenko
2021-08-31 13:54 ` [PATCH v10 8/8] drm/tegra: gr3d: Support generic power domain and runtime PM Dmitry Osipenko
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=a705b35f-8ece-bf74-b7db-7c4ded19e43e@gmail.com \
--to=digetx@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=khilman@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=nm@ti.com \
--cc=rjw@rjwysocki.net \
--cc=sboyd@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=ulf.hansson@linaro.org \
--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).