[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210824030421.3tjfjkx3c2silbnz@vireshk-i7>
Date: Tue, 24 Aug 2021 08:34:21 +0530
From: Viresh Kumar <viresh.kumar@...aro.org>
To: Dmitry Osipenko <digetx@...il.com>
Cc: Ulf Hansson <ulf.hansson@...aro.org>,
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
On 23-08-21, 23:24, Dmitry Osipenko wrote:
> 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);
I am not sure why you still need this, hope we were going another way
? Anyway I will have a look at what you have posted now.
--
viresh
Powered by blists - more mailing lists