aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2013-02-19 12:42:29 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-02-19 12:42:29 +0000
commitfc221525bd63887f74c18708ee1d654d019fa8c3 (patch)
treebcb2eb985fcc152ab4441cc82690930c2bce39a3 /drivers/regulator/core.c
parentMerge remote-tracking branch 'regulator/topic/anatop' into regulator-next (diff)
parentregulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations (diff)
downloadlinux-dev-fc221525bd63887f74c18708ee1d654d019fa8c3.tar.xz
linux-dev-fc221525bd63887f74c18708ee1d654d019fa8c3.zip
Merge remote-tracking branch 'regulator/topic/apply' into regulator-next
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c12
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);