Skip to content

Commit f7df20e

Browse files
committed
regulator: core: Use list_voltage() to read single voltage regulators
If the regulator doesn't supply a way of reading back the voltage but does provide a list_voltage() operation then use that with a selector of zero to read the voltage. Regulators doing this means that we have the list operation there for consumers that want to configure themselves. Reported-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
1 parent 215b8b0 commit f7df20e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/regulator/core.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,6 +2395,8 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
23952395
ret = rdev->desc->ops->list_voltage(rdev, sel);
23962396
} else if (rdev->desc->ops->get_voltage) {
23972397
ret = rdev->desc->ops->get_voltage(rdev);
2398+
} else if (rdev->desc->ops->list_voltage) {
2399+
ret = rdev->desc->ops->list_voltage(rdev, 0);
23982400
} else {
23992401
return -EINVAL;
24002402
}

0 commit comments

Comments
 (0)