summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown2012-08-09 17:42:19 +0200
committerMark Brown2012-08-09 20:48:27 +0200
commitf7df20ec323009bd2ea8e1c65f11bb43fd526c4f (patch)
treec6cd62c2219c47e2929208ee44cb7db8424fbfba /drivers/regulator/core.c
parentregulator: make the dummy regulator's print_constraint more helpful (diff)
downloadkernel-qcow2-linux-f7df20ec323009bd2ea8e1c65f11bb43fd526c4f.tar.gz
kernel-qcow2-linux-f7df20ec323009bd2ea8e1c65f11bb43fd526c4f.tar.xz
kernel-qcow2-linux-f7df20ec323009bd2ea8e1c65f11bb43fd526c4f.zip
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>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 157def15ed78..ff8f54447305 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2395,6 +2395,8 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
ret = rdev->desc->ops->list_voltage(rdev, sel);
} else if (rdev->desc->ops->get_voltage) {
ret = rdev->desc->ops->get_voltage(rdev);
+ } else if (rdev->desc->ops->list_voltage) {
+ ret = rdev->desc->ops->list_voltage(rdev, 0);
} else {
return -EINVAL;
}