devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] opp: of: Support multiple suspend OPPs defined in DT
@ 2019-07-09  7:10 Anson.Huang
  2019-07-09  7:10 ` [PATCH 2/3] arm64: dts: imx8mq: Add opp-suspend property to OPP table Anson.Huang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Anson.Huang @ 2019-07-09  7:10 UTC (permalink / raw)
  To: robh+dt, mark.rutland, shawnguo, s.hauer, kernel, festevam,
	vireshk, nm, sboyd, leonard.crestez, aisheng.dong, daniel.baluta,
	ping.bai, l.stach, abel.vesa, ccaione, angus, andrew.smirnov, agx,
	devicetree, linux-arm-kernel, linux-kernel, linux-pm
  Cc: Linux-imx

From: Anson Huang <Anson.Huang@nxp.com>

With property "opp-supported-hw" introduced, the OPP table
in DT could be a large OPP table and ONLY a subset of OPPs
are available, based on the version of the hardware running
on. That introduces restriction of using "opp-suspend"
property to define the suspend OPP, as we are NOT sure if the
OPP containing "opp-suspend" property is available for the
hardware running on, and the of opp core does NOT allow multiple
suspend OPPs defined in DT OPP table.

To eliminate this restrition, make of opp core allow multiple
suspend OPPs defined in DT, and pick the OPP with highest rate
and with "opp-suspend" property present to be suspend OPP, it
can speed up the suspend/resume process.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/opp/of.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index b313aca..7e8ec6c 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -617,9 +617,12 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
 	/* OPP to select on device suspend */
 	if (of_property_read_bool(np, "opp-suspend")) {
 		if (opp_table->suspend_opp) {
-			dev_warn(dev, "%s: Multiple suspend OPPs found (%lu %lu)\n",
-				 __func__, opp_table->suspend_opp->rate,
-				 new_opp->rate);
+			/* Pick the OPP with higher rate as suspend OPP */
+			if (new_opp->rate > opp_table->suspend_opp->rate) {
+				opp_table->suspend_opp->suspend = false;
+				new_opp->suspend = true;
+				opp_table->suspend_opp = new_opp;
+			}
 		} else {
 			new_opp->suspend = true;
 			opp_table->suspend_opp = new_opp;
-- 
2.7.4

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

end of thread, other threads:[~2019-07-09  7:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-09  7:10 [PATCH 1/3] opp: of: Support multiple suspend OPPs defined in DT Anson.Huang
2019-07-09  7:10 ` [PATCH 2/3] arm64: dts: imx8mq: Add opp-suspend property to OPP table Anson.Huang
2019-07-09  7:10 ` [PATCH 3/3] arm64: dts: imx8mm: " Anson.Huang
2019-07-09  7:51 ` [PATCH 1/3] opp: of: Support multiple suspend OPPs defined in DT Viresh Kumar
2019-07-09  7:54   ` Anson Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).