Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a55a5305 authored by Viresh Kumar's avatar Viresh Kumar Committed by Alex Shi
Browse files

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: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 7d34d56ef3349cd5f29cf7aab6650f3414fa81b9)
Signed-off-by: default avatarAlex Shi <alex.shi@linaro.org>

Conflicts:
	rm debugfs part in drivers/base/power/opp/core.c
parent 509c44d8
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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)
{