On 30-05-18, 14:25, Rajendra Nayak wrote: > []... > > >>> +Required Properties: > >>> + - compatible: Should be one of the following > >>> + * qcom,sdm845-rpmhpd: RPMh powerdomain for the sdm845 family of SoC > >>> + - power-domain-cells: number of cells in power domain specifier > >>> + must be 1 > >>> + - operating-points-v2: Phandle to the OPP table for the power-domain. > >>> + Refer to Documentation/devicetree/bindings/power/power_domain.txt > >>> + and Documentation/devicetree/bindings/opp/qcom-opp.txt for more details > >>> + > >>> +Example: > >>> + > >>> + rpmhpd: power-controller { > >>> + compatible = "qcom,sdm845-rpmhpd"; > >>> + #power-domain-cells = <1>; > >>> + operating-points-v2 = <&rpmhpd_opp_table>, > >>> + <&rpmhpd_opp_table>, > >>> + <&rpmhpd_opp_table>, > >>> + <&rpmhpd_opp_table>, > >>> + <&rpmhpd_opp_table>, > >>> + <&rpmhpd_opp_table>, > >>> + <&rpmhpd_opp_table>, > >>> + <&rpmhpd_opp_table>, > >>> + <&rpmhpd_opp_table>; > >> > >> Can this be changed to simply: > >> operating-points-v2 = <&rpmhpd_opp_table>; > >> > >> The opp binding documentation [1] states that this should be ok: > >> > >> If only one phandle is available, then the same OPP table will be used > >> for all power domains provided by the power domain provider. > > > > thanks, I mentioned this to Viresh but didn't realize he fixed it up. > > Will remove the redundant entries. > > Looks like the kernel implementation does not handle this yet, and I get > an error adding the OPP tables for the powerdomains if I just specify > a single OPP table phandle. > > Viresh, is this expected with the latest patches in linux-next? > > It would be good if I can specify just one phandle instead of coping > the same phandle n times. Please try this untested hunk: diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 6d15f05bfc28..7af0ddec936b 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -554,11 +554,24 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table); int dev_pm_opp_of_add_table_indexed(struct device *dev, int index) { struct device_node *opp_np; - int ret; + int ret, count; +again: opp_np = _opp_of_get_opp_desc_node(dev->of_node, index); - if (!opp_np) + if (!opp_np) { + /* + * If only one phandle is present, then the same OPP table + * applies for all index requests. + */ + count = of_count_phandle_with_args(dev->of_node, + "operating-points-v2", NULL); + if (count == 1 && index) { + index = 0; + goto again; + } + return -ENODEV; + } ret = _of_add_opp_table_v2(dev, opp_np); of_node_put(opp_np); -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html