[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a705b35f-8ece-bf74-b7db-7c4ded19e43e@gmail.com>
Date: Thu, 2 Sep 2021 11:42:37 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Kevin Hilman <khilman@...nel.org>,
Viresh Kumar <vireshk@...nel.org>,
Stephen Boyd <sboyd@...nel.org>, Nishanth Menon <nm@...com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-tegra <linux-tegra@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v10 4/8] PM: domains: Add dev_get_performance_state()
callback
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.
Powered by blists - more mailing lists