diff options
author | Mark Brown <broonie@sirena.org.uk> | 2013-04-28 02:13:37 +0100 |
---|---|---|
committer | Mark Brown <broonie@sirena.org.uk> | 2013-04-28 02:13:37 +0100 |
commit | 1d60a4cf975a196d585149e667f58cbca1a574fc (patch) | |
tree | 208ae4c9539f349cd5fa87ac62b79cb6569c4d62 /drivers/regulator/core.c | |
parent | 0e340ce1ddcf41ca435ef695ef004a6f587c749e (diff) | |
parent | ea88b132acdf3270b812117f622b0df044e6b76f (diff) | |
download | talos-obmc-linux-1d60a4cf975a196d585149e667f58cbca1a574fc.tar.gz talos-obmc-linux-1d60a4cf975a196d585149e667f58cbca1a574fc.zip |
Merge remote-tracking branch 'regulator/topic/enable-invert' into v3.9-rc8
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6437949849b0..2434e2e1afcc 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1803,7 +1803,10 @@ int regulator_is_enabled_regmap(struct regulator_dev *rdev) if (ret != 0) return ret; - return (val & rdev->desc->enable_mask) != 0; + if (rdev->desc->enable_is_inverted) + return (val & rdev->desc->enable_mask) == 0; + else + return (val & rdev->desc->enable_mask) != 0; } EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap); @@ -1818,9 +1821,15 @@ EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap); */ int regulator_enable_regmap(struct regulator_dev *rdev) { + unsigned int val; + + if (rdev->desc->enable_is_inverted) + val = 0; + else + val = rdev->desc->enable_mask; + return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, - rdev->desc->enable_mask, - rdev->desc->enable_mask); + rdev->desc->enable_mask, val); } EXPORT_SYMBOL_GPL(regulator_enable_regmap); @@ -1835,8 +1844,15 @@ EXPORT_SYMBOL_GPL(regulator_enable_regmap); */ int regulator_disable_regmap(struct regulator_dev *rdev) { + unsigned int val; + + if (rdev->desc->enable_is_inverted) + val = rdev->desc->enable_mask; + else + val = 0; + return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, - rdev->desc->enable_mask, 0); + rdev->desc->enable_mask, val); } EXPORT_SYMBOL_GPL(regulator_disable_regmap); |