[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <085d1a2e-57b0-222e-c569-12f3c6bc8161@gmail.com>
Date: Mon, 23 Aug 2021 23:24:02 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Ulf Hansson <ulf.hansson@...aro.org>,
Viresh Kumar <viresh.kumar@...aro.org>
Cc: Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Viresh Kumar <vireshk@...nel.org>,
Stephen Boyd <sboyd@...nel.org>,
Peter De Schrijver <pdeschrijver@...dia.com>,
Mikko Perttunen <mperttunen@...dia.com>,
Peter Chen <peter.chen@...nel.org>,
Mark Brown <broonie@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Nishanth Menon <nm@...com>,
Vignesh Raghavendra <vigneshr@...com>,
Richard Weinberger <richard@....at>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Lucas Stach <dev@...xeye.de>, Stefan Agner <stefan@...er.ch>,
Adrian Hunter <adrian.hunter@...el.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Michael Turquette <mturquette@...libre.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-tegra <linux-tegra@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
Linux USB List <linux-usb@...r.kernel.org>,
linux-staging@...ts.linux.dev, linux-spi@...r.kernel.org,
linux-pwm@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-mmc <linux-mmc@...r.kernel.org>,
Linux Media Mailing List <linux-media@...r.kernel.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
DTML <devicetree@...r.kernel.org>,
linux-clk <linux-clk@...r.kernel.org>
Subject: Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper
20.08.2021 15:57, Ulf Hansson пишет:
...
>> We already have similar APIs, so that won't be a problem. We also have
>> a mechanism inside the OPP core, frequency based, which is used to
>> guess the current OPP. Maybe we can enhance and use that directly
>> here.
>
> After reading the last reply from Dmitry, I am starting to think that
> the problem he is facing can be described and solved in a much easier
> way.
>
> If I am correct, it looks like we don't need to add APIs to get OPPs
> for a clock rate or set initial performance state values according to
> the HW in genpd.
>
> See my other response to Dmitry, let's see where that leads us.
I'm going to start preparing v9 with GENPD performance state syncing moved into driver's probe where appropriate.
It's not clear to me whether it will be okay to add a generic OPP syncing by clock rate or should it be a Tegra-specific helper. Viresh, what do you think about this generic OPP helper:
/**
* dev_pm_opp_sync_with_clk_rate() - Sync OPP state with clock rate
* @dev: device for which we do this operation
*
* Sync OPP table state with the current clock rate of device.
*
* Return: 0 on success or a negative error value.
*/
int dev_pm_opp_sync_with_clk_rate(struct device *dev)
{
struct opp_table *opp_table;
int ret = 0;
/* Device may not have OPP table */
opp_table = _find_opp_table(dev);
if (IS_ERR(opp_table))
return 0;
/* Device may not use clock */
if (IS_ERR(opp_table->clk))
goto put_table;
/* Device may have empty OPP table */
if (!_get_opp_count(opp_table))
goto put_table;
ret = dev_pm_opp_set_rate(dev, clk_get_rate(opp_table->clk));
put_table:
/* Drop reference taken by _find_opp_table() */
dev_pm_opp_put_opp_table(opp_table);
return ret;
}
EXPORT_SYMBOL_GPL(dev_pm_opp_sync_with_clk_rate);
Powered by blists - more mailing lists