Re: [[PATCH v2 2/2] OPP: Add 'opp-microwatt' parsing for advanced EM registration

From: Viresh Kumar
Date: Wed Feb 23 2022 - 00:54:09 EST


On 22-02-22, 14:07, Lukasz Luba wrote:
> +static int _of_find_opp_microwatt_property(struct device *dev)
> +{
> + unsigned long freq = 0;
> + struct dev_pm_opp *opp;
> + struct device_node *np;
> + struct property *prop;
> +
> + /* We only support "operating-points-v2" */
> + np = dev_pm_opp_of_get_opp_desc_node(dev);
> + if (!np)
> + return -EINVAL;
> +
> + of_node_put(np);
> +
> + /* Check if an OPP has needed property */
> + opp = dev_pm_opp_find_freq_ceil(dev, &freq);
> + if (IS_ERR(opp))
> + return -EINVAL;
> +
> + prop = of_find_property(opp->np, "opp-microwatt", NULL);
> + dev_pm_opp_put(opp);
> + if (!prop)
> + return -EINVAL;
> +
> + return 0;
> +}

Please follow everything just like opp-microvolt is defined. Create a new field
in the struct dev_pm_opp, initialize it only once when the OPP is created, that
field should be used here instead of parsing the DT here again. There also needs
to be a debug file in debugfs for this new field.

Search for "supply" and "microvolt" in the OPP core, you will see all the places
that need it.

--
viresh