summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2021-01-18 03:55:14 +0300
committerViresh Kumar <viresh.kumar@linaro.org>2021-02-02 10:26:54 +0530
commitcf65948d62c6aefd22f51c1433743f80517ee3fe (patch)
tree6075cbc4c9ca2846b229397224df222e7854b76b /drivers
parent32715be4fe95fc98762959f8dff6f9f8a39df28f (diff)
opp: Filter out OPPs based on availability of a required-OPP
A required OPP may not be available, and thus, all OPPs which are using this required OPP should be unavailable too. Tested-by: Peter Geis <pgwipeout@gmail.com> Tested-by: Nicolas Chauvet <kwizart@gmail.com> Tested-by: Matt Merhar <mattmerhar@protonmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/opp/core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 5793c833b86a..253bc87b5695 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1522,6 +1522,7 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
struct opp_table *opp_table, bool rate_not_available)
{
struct list_head *head;
+ unsigned int i;
int ret;
mutex_lock(&opp_table->lock);
@@ -1547,6 +1548,16 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
__func__, new_opp->rate);
}
+ for (i = 0; i < opp_table->required_opp_count; i++) {
+ if (new_opp->required_opps[i]->available)
+ continue;
+
+ new_opp->available = false;
+ dev_warn(dev, "%s: OPP not supported by required OPP %pOF (%lu)\n",
+ __func__, new_opp->required_opps[i]->np, new_opp->rate);
+ break;
+ }
+
return 0;
}