Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

opp: of: Support multiple suspend OPPs defined in DT

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>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

authored by

Anson Huang and committed by
Viresh Kumar
45275517 518c6880

+6 -3
+6 -3
drivers/opp/of.c
··· 617 617 /* OPP to select on device suspend */ 618 618 if (of_property_read_bool(np, "opp-suspend")) { 619 619 if (opp_table->suspend_opp) { 620 - dev_warn(dev, "%s: Multiple suspend OPPs found (%lu %lu)\n", 621 - __func__, opp_table->suspend_opp->rate, 622 - new_opp->rate); 620 + /* Pick the OPP with higher rate as suspend OPP */ 621 + if (new_opp->rate > opp_table->suspend_opp->rate) { 622 + opp_table->suspend_opp->suspend = false; 623 + new_opp->suspend = true; 624 + opp_table->suspend_opp = new_opp; 625 + } 623 626 } else { 624 627 new_opp->suspend = true; 625 628 opp_table->suspend_opp = new_opp;