summaryrefslogtreecommitdiff
path: root/drivers/regulator/anatop-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-09 08:07:43 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-10 12:38:59 +0900
commite1b0144f9997d3d52c46785143699d82dd525f1d (patch)
tree3c2178d52d94a1c18f76e8102039f7daa6545493 /drivers/regulator/anatop-regulator.c
parent985884db501d7026257d122c3cc32a7005a9a864 (diff)
regulator: anatop: Use regulator_[get|set]_voltage_sel_regmap
Call regulator_[get|set]_voltage_sel_regmap instead of open code. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Ying-Chun Liu <paulliu@debian.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r--drivers/regulator/anatop-regulator.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index b78b622d24c5..b6182e17b0dc 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -48,34 +48,21 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg,
unsigned selector)
{
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
- u32 mask;
if (!anatop_reg->control_reg)
return -ENOTSUPP;
- mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
- anatop_reg->vol_bit_shift;
- selector <<= anatop_reg->vol_bit_shift;
- regmap_update_bits(anatop_reg->anatop, anatop_reg->control_reg,
- mask, selector);
-
- return 0;
+ return regulator_set_voltage_sel_regmap(reg, selector);
}
static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg)
{
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
- u32 val, mask;
if (!anatop_reg->control_reg)
return -ENOTSUPP;
- regmap_read(anatop_reg->anatop, anatop_reg->control_reg, &val);
- mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
- anatop_reg->vol_bit_shift;
- val = (val & mask) >> anatop_reg->vol_bit_shift;
-
- return val;
+ return regulator_get_voltage_sel_regmap(reg);
}
static struct regulator_ops anatop_rops = {
@@ -161,11 +148,15 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev)
rdesc->min_uV = sreg->min_voltage;
rdesc->uV_step = 25000;
rdesc->linear_min_sel = sreg->min_bit_val;
+ rdesc->vsel_reg = sreg->control_reg;
+ rdesc->vsel_mask = ((1 << sreg->vol_bit_width) - 1) <<
+ sreg->vol_bit_shift;
config.dev = &pdev->dev;
config.init_data = initdata;
config.driver_data = sreg;
config.of_node = pdev->dev.of_node;
+ config.regmap = sreg->anatop;
/* register regulator */
rdev = regulator_register(rdesc, &config);