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

PM / OPP: Don't support OPP if it provides supported-hw but platform does not

The OPP framework allows each OPP to set a opp-supported-hw property
which provides values that are matched against supported_hw values
provided by the platform to limit support for certain OPPs on specific
hardware. Currently, if the platform does not set supported_hw values,
all OPPs are interpreted as supported, even if they have provided their
own opp-supported-hw values.

If an OPP has provided opp-supported-hw, it is indicating that there is
some specific hardware configuration it is supported by. These constraints
should be honored, and if no supported_hw has been provided by the
platform, there is no way to determine if that OPP is actually supported,
so it should be marked as not supported.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Dave Gerlach and committed by
Rafael J. Wysocki
a4ee4545 4df27c91

+12 -2
+12 -2
drivers/base/power/opp/of.c
··· 71 71 u32 version; 72 72 int ret; 73 73 74 - if (!opp_table->supported_hw) 75 - return true; 74 + if (!opp_table->supported_hw) { 75 + /* 76 + * In the case that no supported_hw has been set by the 77 + * platform but there is an opp-supported-hw value set for 78 + * an OPP then the OPP should not be enabled as there is 79 + * no way to see if the hardware supports it. 80 + */ 81 + if (of_find_property(np, "opp-supported-hw", NULL)) 82 + return false; 83 + else 84 + return true; 85 + } 76 86 77 87 while (count--) { 78 88 ret = of_property_read_u32_index(np, "opp-supported-hw", count,