aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2018-05-30 05:49:38 -0400
committerViresh Kumar <viresh.kumar@linaro.org>2018-05-30 06:08:21 -0400
commit8a352fd8787cefcb19c25ca1390301f874797b9c (patch)
tree2fd017804d8aa6b236d56b36efb5883cc825c44d
parent5019acc693d3183a19d4844f6e2d878ea2dd7ddd (diff)
OPP: Allow same OPP table to be used for multiple genpd
The OPP binding says: Property: operating-points-v2 ... This can contain more than one phandle for power domain providers that provide multiple power domains. That is, one phandle for each power domain. If only one phandle is available, then the same OPP table will be used for all power domains provided by the power domain provider. But the OPP core isn't allowing the same OPP table to be used for multiple domains. Update dev_pm_opp_of_add_table_indexed() to allow that. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Rajendra Nayak <rnayak@codeaurora.org>
-rw-r--r--drivers/opp/of.c17
1 files changed, 15 insertions, 2 deletions
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);
554int dev_pm_opp_of_add_table_indexed(struct device *dev, int index) 554int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
555{ 555{
556 struct device_node *opp_np; 556 struct device_node *opp_np;
557 int ret; 557 int ret, count;
558 558
559again:
559 opp_np = _opp_of_get_opp_desc_node(dev->of_node, index); 560 opp_np = _opp_of_get_opp_desc_node(dev->of_node, index);
560 if (!opp_np) 561 if (!opp_np) {
562 /*
563 * If only one phandle is present, then the same OPP table
564 * applies for all index requests.
565 */
566 count = of_count_phandle_with_args(dev->of_node,
567 "operating-points-v2", NULL);
568 if (count == 1 && index) {
569 index = 0;
570 goto again;
571 }
572
561 return -ENODEV; 573 return -ENODEV;
574 }
562 575
563 ret = _of_add_opp_table_v2(dev, opp_np); 576 ret = _of_add_opp_table_v2(dev, opp_np);
564 of_node_put(opp_np); 577 of_node_put(opp_np);