From: Steven Price <steven.price@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Chanwoo Choi <cw00.choi@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Qiang Yu <yuq825@gmail.com>, Rob Herring <robh@kernel.org>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
Nishanth Menon <nm@ti.com>, Stephen Boyd <sboyd@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH V3 02/20] OPP: Make dev_pm_opp_set_regulators() accept NULL terminated list
Date: Wed, 6 Jul 2022 09:09:50 +0100 [thread overview]
Message-ID: <ca5b2602-358c-ce37-c698-8aaf4f579945@arm.com> (raw)
In-Reply-To: <20220705043439.xlrxusxrhwjupiyt@vireshk-i7>
On 05/07/2022 05:34, Viresh Kumar wrote:
> On 04-07-22, 15:35, Steven Price wrote:
>> I have to say the 'new improved' list ending with NULL approach doesn't
>> work out so well for Panfrost. We already have to have a separate
>> 'num_supplies' variable for devm_regulator_bulk_get() /
>> regulator_bulk_{en,dis}able(), so the keeping everything in sync
>> argument is lost here.
>>
>> I would suggest added the NULL on the end of the lists in panfrost_drv.c
>> but then it would break the use of ARRAY_SIZE() to automagically keep
>> the length correct...
>
> Actually we can still make it work.
>
>> For now the approach isn't too bad because Panfrost doesn't yet support
>> enabling devfreq with more than one supply. But that array isn't going
>> to work so nicely when that restriction is removed.
>>
>> The only sane way I can see of handling this in Panfrost would be
>> replicating the loop to count the supplies in the Panfrost code which
>> would allow dropping num_supplies from struct panfrost_compatible and
>> then supply_names in the same struct could be NULL terminated ready for
>> devm_pm_opp_set_regulators().
>
> Or doing this, which will simplify both the cases.
Yes the below works, it's just a bit ugly having the "- 1", and
potentially easy to forgot when adding another. However I don't suppose
it would get far in that case so I think it would be spotted quickly
when adding a new compatible.
It's probably the best solution at the moment.
Thanks,
Steve
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 7fcbc2a5b6cd..b3b55565b8ef 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -625,24 +625,29 @@ static int panfrost_remove(struct platform_device *pdev)
> return 0;
> }
>
> -static const char * const default_supplies[] = { "mali" };
> +/*
> + * The OPP core wants the supply names to be NULL terminated, but we need the
> + * correct num_supplies value for regulator core. Hence, we NULL terminate here
> + * and then initialize num_supplies with ARRAY_SIZE - 1.
> + */
> +static const char * const default_supplies[] = { "mali", NULL };
> static const struct panfrost_compatible default_data = {
> - .num_supplies = ARRAY_SIZE(default_supplies),
> + .num_supplies = ARRAY_SIZE(default_supplies) - 1,
> .supply_names = default_supplies,
> .num_pm_domains = 1, /* optional */
> .pm_domain_names = NULL,
> };
>
> static const struct panfrost_compatible amlogic_data = {
> - .num_supplies = ARRAY_SIZE(default_supplies),
> + .num_supplies = ARRAY_SIZE(default_supplies) - 1,
> .supply_names = default_supplies,
> .vendor_quirk = panfrost_gpu_amlogic_quirk,
> };
>
> -static const char * const mediatek_mt8183_supplies[] = { "mali", "sram" };
> +static const char * const mediatek_mt8183_supplies[] = { "mali", "sram", NULL };
> static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
> static const struct panfrost_compatible mediatek_mt8183_data = {
> - .num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies),
> + .num_supplies = ARRAY_SIZE(mediatek_mt8183_supplies) - 1,
> .supply_names = mediatek_mt8183_supplies,
> .num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
> .pm_domain_names = mediatek_mt8183_pm_domains,
>
next prev parent reply other threads:[~2022-07-06 8:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 12:07 [PATCH V3 00/20] OPP: Add new configuration interface: dev_pm_opp_set_config() Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 01/20] OPP: Track if clock name is configured by platform Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 02/20] OPP: Make dev_pm_opp_set_regulators() accept NULL terminated list Viresh Kumar
2022-07-04 14:35 ` Steven Price
2022-07-05 4:34 ` Viresh Kumar
2022-07-06 8:09 ` Steven Price [this message]
2022-07-06 8:18 ` [PATCH V3.1 " Viresh Kumar
2022-07-06 9:50 ` Steven Price
2022-07-07 19:04 ` [PATCH V3 " Chanwoo Choi
2022-07-04 12:07 ` [PATCH V3 03/20] OPP: Add dev_pm_opp_set_config() and friends Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 04/20] cpufreq: qcom-nvmem: Migrate to dev_pm_opp_set_config() Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 05/20] cpufreq: sti: " Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 06/20] cpufreq: ti: " Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 07/20] drm/lima: " Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 08/20] soc/tegra: Add comment over devm_pm_opp_set_clkname() Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 09/20] soc/tegra: Migrate to dev_pm_opp_set_config() Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 10/20] OPP: Migrate set-regulators API to use set-config helpers Viresh Kumar
2022-07-07 19:29 ` Chanwoo Choi
2022-07-04 12:07 ` [PATCH V3 11/20] OPP: Migrate set-supported-hw " Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 12/20] OPP: Migrate set-clk-name " Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 13/20] OPP: Migrate set-opp-helper " Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 14/20] OPP: Migrate attach-genpd " Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 15/20] OPP: Migrate set-prop-name helper " Viresh Kumar
2022-07-04 18:59 ` Samuel Holland
2022-07-04 12:07 ` [PATCH V3 16/20] OPP: Add support for config_regulators() helper Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 17/20] OPP: Make _generic_set_opp_regulator() a config_regulators() interface Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 18/20] OPP: Add dev_pm_opp_get_supplies() Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 19/20] OPP: ti: Migrate to dev_pm_opp_set_config_regulators() Viresh Kumar
2022-07-04 12:07 ` [PATCH V3 20/20] OPP: Remove custom OPP helper support Viresh Kumar
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=ca5b2602-358c-ce37-c698-8aaf4f579945@arm.com \
--to=steven.price@arm.com \
--cc=alim.akhtar@samsung.com \
--cc=alyssa.rosenzweig@collabora.com \
--cc=cw00.choi@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=kyungmin.park@samsung.com \
--cc=lima@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=nm@ti.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tomeu.vizoso@collabora.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=yuq825@gmail.com \
/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
Powered by JetHome