diff options
author | Javier Martinez Canillas <javier.martinez@collabora.co.uk> | 2014-07-29 18:28:55 +0200 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-07-29 19:24:43 +0100 |
commit | e303996e94b8705c85f3d78f3c094d05b0620c9d (patch) | |
tree | 72589a3d0de40db8730b5c7ac4d2c38414ed59ce /drivers/regulator/core.c | |
parent | 69d588392b057c0cedb1ba58d7973b77a65997ec (diff) | |
download | blackbird-op-linux-e303996e94b8705c85f3d78f3c094d05b0620c9d.tar.gz blackbird-op-linux-e303996e94b8705c85f3d78f3c094d05b0620c9d.zip |
regulator: core: Get voltage from parent if not available
Load switches are modeled as regulators but they just provide
the voltage of their parent input supply. So the drivers for
these switches usually don't provide a .get_voltage function
handler but there is code in the kernel that assumes that all
regulators should be able to provide its current voltage rail.
So, if the output voltage for a regulator is not available and
it has a parent supply, then pass the voltage of its parent.
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index b4902ab64abe..57fe446fabce 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2620,6 +2620,8 @@ static int _regulator_get_voltage(struct regulator_dev *rdev) ret = rdev->desc->ops->list_voltage(rdev, 0); } else if (rdev->desc->fixed_uV && (rdev->desc->n_voltages == 1)) { ret = rdev->desc->fixed_uV; + } else if (rdev->supply) { + ret = regulator_get_voltage(rdev->supply); } else { return -EINVAL; } |