All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OPP: Allow same OPP table to be used for multiple genpd
@ 2018-05-30 10:09 Viresh Kumar
  2018-06-02  6:45   ` Stephen Boyd
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2018-05-30 10:09 UTC (permalink / raw)
  To: Rafael Wysocki, Viresh Kumar, Nishanth Menon, Stephen Boyd
  Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rajendra Nayak, linux-kernel

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>
---
 drivers/opp/of.c | 17 +++++++++++++++--
 1 file 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);
 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);
-- 
2.15.0.194.g9af6a3dea062

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] OPP: Allow same OPP table to be used for multiple genpd
  2018-05-30 10:09 [PATCH] OPP: Allow same OPP table to be used for multiple genpd Viresh Kumar
@ 2018-06-02  6:45   ` Stephen Boyd
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2018-06-02  6:45 UTC (permalink / raw)
  To: Nishanth Menon, Rafael Wysocki, Viresh Kumar, Viresh Kumar
  Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rajendra Nayak, linux-kernel

Quoting Viresh Kumar (2018-05-30 03:09:02)
> 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>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] OPP: Allow same OPP table to be used for multiple genpd
@ 2018-06-02  6:45   ` Stephen Boyd
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2018-06-02  6:45 UTC (permalink / raw)
  To: Nishanth Menon, Rafael Wysocki, Viresh Kumar
  Cc: Viresh Kumar, linux-pm, Vincent Guittot, Rajendra Nayak, linux-kernel

Quoting Viresh Kumar (2018-05-30 03:09:02)
> 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>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-02  6:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-30 10:09 [PATCH] OPP: Allow same OPP table to be used for multiple genpd Viresh Kumar
2018-06-02  6:45 ` Stephen Boyd
2018-06-02  6:45   ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.