diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-07-16 18:10:42 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-08-07 19:10:26 +0200 |
commit | 3e2a928472daa839e7be0d71c1d8320334ea76e1 (patch) | |
tree | 0ec66e229c0572909758b24ac5b00b469501b61b /drivers/regulator/anatop-regulator.c | |
parent | regulator: tps6586x: correct vin pin for sm0/sm1/sm2 (diff) | |
download | linux-3e2a928472daa839e7be0d71c1d8320334ea76e1.tar.xz linux-3e2a928472daa839e7be0d71c1d8320334ea76e1.zip |
regulator: anatop: Fix wrong mask used in anatop_get_voltage_sel
The mask used in anatop_get_voltage_sel does not match the mask used in
anatop_set_voltage_sel.
We need to do left shift anatop_reg->vol_bit_shift bits for the correct mask.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r-- | drivers/regulator/anatop-regulator.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index e9c2085f9dfb..ce0fe72a428e 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c @@ -64,14 +64,15 @@ static int anatop_set_voltage_sel(struct regulator_dev *reg, unsigned selector) static int anatop_get_voltage_sel(struct regulator_dev *reg) { struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); - u32 val; + u32 val, mask; if (!anatop_reg->control_reg) return -ENOTSUPP; val = anatop_read_reg(anatop_reg->mfd, anatop_reg->control_reg); - val = (val & ((1 << anatop_reg->vol_bit_width) - 1)) >> + 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; } |