summaryrefslogtreecommitdiff
path: root/drivers/regulator/helpers.c
diff options
context:
space:
mode:
authorJon Hunter <jonathanh@nvidia.com>2016-04-21 17:12:01 +0100
committerMark Brown <broonie@kernel.org>2016-04-22 11:49:03 +0100
commitdd1a571daee7cdd6504a5771721e34f9b118f17a (patch)
tree5fac10c6f937560bbed4ba353c13704a0a2db313 /drivers/regulator/helpers.c
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
regulator: helpers: Ensure bypass register field matches ON value
When checking bypass state for a regulator, we check to see if any bits in the bypass mask are set. For most cases this is fine because there is typically, only a single bit used to determine if the regulator is in bypass. However, for some regulators, such as LDO6 on AS3722, the bypass state is indicate by a value rather than a single bit. Therefore, when checking the bypass state, check that the bypass field matches the ON value. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/helpers.c')
-rw-r--r--drivers/regulator/helpers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
index b1e32e7482e9..bcf38fd5106a 100644
--- a/drivers/regulator/helpers.c
+++ b/drivers/regulator/helpers.c
@@ -460,7 +460,7 @@ int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable)
if (ret != 0)
return ret;
- *enable = val & rdev->desc->bypass_mask;
+ *enable = (val & rdev->desc->bypass_mask) == rdev->desc->bypass_val_on;
return 0;
}