aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-18 09:30:10 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-24 16:34:11 +0000
commitc8520b4c5d25eb7b8b54f1ae9ba7da71375f2b2c (patch)
tree30ac7c7e9f1f2a00523019409bf223a5a4417aa9 /drivers/regulator/core.c
parentLinux 3.8-rc1 (diff)
downloadlinux-dev-c8520b4c5d25eb7b8b54f1ae9ba7da71375f2b2c.tar.xz
linux-dev-c8520b4c5d25eb7b8b54f1ae9ba7da71375f2b2c.zip
regulator: core: Allow specify apply_[reg|bit] for regmap based voltage_sel operations
Some DVM regulators needs to update apply_bit after setting vsel_reg to initiate voltage change on the output. This patch adds apply_reg and apply_bit to struct regulator_desc and update regulator_set_voltage_sel_regmap() to set apply_bit of apply_reg when apply_bit is set. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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 0f65b246cc0c..571ce0f1c06e 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2074,10 +2074,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);