summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2016-04-27 18:32:14 +0300
committerMark Brown <broonie@kernel.org>2016-04-27 18:32:14 +0300
commitcbc13a66fdd89ac5e360af32fec0a1a4fcd4d2f1 (patch)
tree701908d65a4627d146fd26fb8b5e6515fd0cc32a /drivers/regulator
parentc438b9d017362b65f6b1a9e54f7f35e7f873dc7c (diff)
parentfef95019016ac10e250d2c67a3c97af5797e3938 (diff)
downloadlinux-cbc13a66fdd89ac5e360af32fec0a1a4fcd4d2f1.tar.xz
Merge branch 'topic/bypass' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-supply
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 8362a0a5105d..f6d624dfcf9f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3110,6 +3110,20 @@ EXPORT_SYMBOL_GPL(regulator_sync_voltage);
static int _regulator_get_voltage(struct regulator_dev *rdev)
{
int sel, ret;
+ bool bypassed;
+
+ if (rdev->desc->ops->get_bypass) {
+ ret = rdev->desc->ops->get_bypass(rdev, &bypassed);
+ if (ret < 0)
+ return ret;
+ if (bypassed) {
+ /* if bypassed the regulator must have a supply */
+ if (!rdev->supply)
+ return -EINVAL;
+
+ return _regulator_get_voltage(rdev->supply->rdev);
+ }
+ }
if (rdev->desc->ops->get_voltage_sel) {
sel = rdev->desc->ops->get_voltage_sel(rdev);