Re: [PATCH 1/1] OPP: Support multiple frequency points with opp-hz-<name>
From: Viresh Kumar
Date: Mon Mar 10 2025 - 01:56:49 EST
On 04-03-25, 20:52, Zxyan Zhu wrote:
> Current OPP driver only supports a single frequency value per OPP
> entry using `opp-hz`. This patch extends the functionality to allow
> retrieving named frequency points using `opp-hz-<name>`, improving
> flexibility for different operating modes.
I believe you have a use case for this ? Can you post that too ?
> Signed-off-by: Zxyan Zhu <zxyan20@xxxxxxx>
> ---
> drivers/opp/of.c | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index a24f76f5fd01..d20802b0f89c 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -752,18 +752,30 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
> static int _read_rate(struct dev_pm_opp *new_opp, struct opp_table *opp_table,
> struct device_node *np)
> {
> - struct property *prop;
> + struct property *prop = NULL;
> int i, count, ret;
> u64 *rates;
> + char name[NAME_MAX];
>
> - prop = of_find_property(np, "opp-hz", NULL);
> - if (!prop)
> - return -ENODEV;
> + /* Search for "opp-hz-<name>" */
> + if (opp_table->prop_name) {
There is a helper to do this job: _parse_named_prop() that you can
reuse.
You also need to update:
Documentation/devicetree/bindings/opp/opp-v2-base.yaml for this new
property. Entries are already there for other -named properties.
--
viresh