aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-02-09 10:30:34 +0530
committerAlex Shi <alex.shi@linaro.org>2016-04-01 13:25:32 +0800
commita55a5305982d996a4db88c2525299edc836ebccf (patch)
tree58066207f45a3e0959c3cce746581b74fe587f75
parent509c44d86639c54e1e0d51f50e43f5fea7aa36c9 (diff)
PM / OPP: Disable OPPs that aren't supported by the regulator
Disable any OPPs where the connected regulator isn't able to provide the specified voltage. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 7d34d56ef3349cd5f29cf7aab6650f3414fa81b9) Signed-off-by: Alex Shi <alex.shi@linaro.org> Conflicts: rm debugfs part in drivers/base/power/opp/core.c
-rw-r--r--drivers/base/power/opp/core.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/base/power/opp/core.c b/drivers/base/power/opp/core.c
index 665a067669fc..3380944909fb 100644
--- a/drivers/base/power/opp/core.c
+++ b/drivers/base/power/opp/core.c
@@ -678,6 +678,22 @@ static struct dev_pm_opp *_allocate_opp(struct device *dev,
return opp;
}
+static bool _opp_supported_by_regulators(struct dev_pm_opp *opp,
+ struct device_opp *dev_opp)
+{
+ struct regulator *reg = dev_opp->regulator;
+
+ if (!IS_ERR(reg) &&
+ !regulator_is_supported_voltage(reg, opp->u_volt_min,
+ opp->u_volt_max)) {
+ pr_warn("%s: OPP minuV: %lu maxuV: %lu, not supported by regulator\n",
+ __func__, opp->u_volt_min, opp->u_volt_max);
+ return false;
+ }
+
+ return true;
+}
+
static int _opp_add(struct device *dev, struct dev_pm_opp *new_opp,
struct device_opp *dev_opp)
{