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

Commit 8a23b4e0 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

regulator: core: Fix logic to determinate if regulator can change voltage



Having a linear_min_sel setting means the first linear_min_sel selectors are
invalid. We need to subtract linear_min_sel when use n_voltages to determinate
if regulator can change voltage.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent b17fc86c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1881,7 +1881,7 @@ int regulator_can_change_voltage(struct regulator *regulator)

	if (rdev->constraints &&
	    rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
	    rdev->desc->n_voltages > 1)
	    (rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
		return 1;

	return 0;