[PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper
Dmitry Osipenko
digetx at gmail.com
Wed Aug 18 04:29:38 UTC 2021
18.08.2021 07:12, Dmitry Osipenko пишет:
> 18.08.2021 06:55, Viresh Kumar пишет:
>> On 17-08-21, 18:49, Dmitry Osipenko wrote:
>>> 17.08.2021 10:55, Viresh Kumar пишет:
>>> ...
>>>>> +int dev_pm_opp_sync(struct device *dev)
>>>>> +{
>>>>> + struct opp_table *opp_table;
>>>>> + struct dev_pm_opp *opp;
>>>>> + int ret = 0;
>>>>> +
>>>>> + /* Device may not have OPP table */
>>>>> + opp_table = _find_opp_table(dev);
>>>>> + if (IS_ERR(opp_table))
>>>>> + return 0;
>>>>> +
>>>>> + if (!_get_opp_count(opp_table))
>>>>> + goto put_table;
>>>>> +
>>>>> + opp = _find_current_opp(dev, opp_table);
>>>>> + ret = _set_opp(dev, opp_table, opp, opp->rate);
>>>>
>>>> And I am not sure how this will end up working, since new OPP will be
>>>> equal to old one. Since I see you call this from resume() at many
>>>> places.
>>>
>>> Initially OPP table is "uninitialized" and opp_table->enabled=false,
>>> hence the first sync always works even if OPP is equal to old one. Once
>>> OPP has been synced, all further syncs are NO-OPs, hence it doesn't
>>> matter how many times syncing is called.
>>>
>>> https://elixir.bootlin.com/linux/v5.14-rc6/source/drivers/opp/core.c#L1012
>>
>> Right, but how will this work from Resume ? Won't that be a no-op ?
>
> The first resume initializes the OPP state on sync, all further syncs on
> resume are no-ops.
>
Notice that we use GENPD here. GENPD core takes care of storing PD's
performance state (voltage in case of Tegra) and dropping it to 0 after
rpm-suspend, GENPD core also restores the state before rpm-resume.
More information about the dri-devel
mailing list