diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-19 12:42:29 +0000 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-19 12:42:29 +0000 |
commit | fc221525bd63887f74c18708ee1d654d019fa8c3 (patch) | |
tree | bcb2eb985fcc152ab4441cc82690930c2bce39a3 /drivers/regulator/core.c | |
parent | 0dbf165ec43dd7f61fc0d596083c136fde01530f (diff) | |
parent | c6f0a0efb163b7d2e879f92197ab5e674868358e (diff) | |
download | linux-fc221525bd63887f74c18708ee1d654d019fa8c3.tar.bz2 |
Merge remote-tracking branch 'regulator/topic/apply' into regulator-next
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 278584302f2d..de47880db203 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2080,10 +2080,20 @@ EXPORT_SYMBOL_GPL(regulator_get_voltage_sel_regmap); */ int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel) { + int ret; + sel <<= ffs(rdev->desc->vsel_mask) - 1; - return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg, + ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg, rdev->desc->vsel_mask, sel); + if (ret) + return ret; + + if (rdev->desc->apply_bit) + ret = regmap_update_bits(rdev->regmap, rdev->desc->apply_reg, + rdev->desc->apply_bit, + rdev->desc->apply_bit); + return ret; } EXPORT_SYMBOL_GPL(regulator_set_voltage_sel_regmap); |