diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-10 07:43:00 +0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-10 07:43:00 +0400 |
commit | adca48f7c61c53708a1f1ed567e0447ccb2b3b96 (patch) | |
tree | d1860df280202eb86a625bd3400eab02b819100a /drivers/regulator/anatop-regulator.c | |
parent | 9e218670737e01ef37bd1ac400482462049dfeff (diff) | |
parent | e1b0144f9997d3d52c46785143699d82dd525f1d (diff) | |
download | linux-adca48f7c61c53708a1f1ed567e0447ccb2b3b96.tar.xz |
Merge remote-tracking branch 'regulator/topic/min' into regulator-next
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r-- | drivers/regulator/anatop-regulator.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 1aa5246c79d9..0199eeea63b1 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -48,36 +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 val, mask; if (!anatop_reg->control_reg) return -ENOTSUPP; - val = anatop_reg->min_bit_val + selector; - dev_dbg(®->dev, "%s: calculated val %d\n", __func__, val); - mask = ((1 << anatop_reg->vol_bit_width) - 1) << - anatop_reg->vol_bit_shift; - val <<= anatop_reg->vol_bit_shift; - regmap_update_bits(anatop_reg->anatop, anatop_reg->control_reg, - mask, val); - - 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 - anatop_reg->min_bit_val; + return regulator_get_voltage_sel_regmap(reg); } static struct regulator_ops anatop_rops = { @@ -158,15 +143,20 @@ static int anatop_regulator_probe(struct platform_device *pdev) goto anatop_probe_end; } - rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) - / 25000 + 1; + rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) / 25000 + 1 + + sreg->min_bit_val; 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); |