aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/anatop-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/anatop-regulator.c')
-rw-r--r--drivers/regulator/anatop-regulator.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index 49b2112b0486..3660bace123c 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -47,7 +47,7 @@ static int anatop_set_voltage(struct regulator_dev *reg, int min_uV,
47 int max_uV, unsigned *selector) 47 int max_uV, unsigned *selector)
48{ 48{
49 struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); 49 struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
50 u32 val, sel; 50 u32 val, sel, mask;
51 int uv; 51 int uv;
52 52
53 uv = min_uV; 53 uv = min_uV;
@@ -71,11 +71,10 @@ static int anatop_set_voltage(struct regulator_dev *reg, int min_uV,
71 val = anatop_reg->min_bit_val + sel; 71 val = anatop_reg->min_bit_val + sel;
72 *selector = sel; 72 *selector = sel;
73 dev_dbg(&reg->dev, "%s: calculated val %d\n", __func__, val); 73 dev_dbg(&reg->dev, "%s: calculated val %d\n", __func__, val);
74 anatop_set_bits(anatop_reg->mfd, 74 mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
75 anatop_reg->control_reg, 75 anatop_reg->vol_bit_shift;
76 anatop_reg->vol_bit_shift, 76 val <<= anatop_reg->vol_bit_shift;
77 anatop_reg->vol_bit_width, 77 anatop_write_reg(anatop_reg->mfd, anatop_reg->control_reg, val, mask);
78 val);
79 78
80 return 0; 79 return 0;
81} 80}
@@ -88,10 +87,9 @@ static int anatop_get_voltage_sel(struct regulator_dev *reg)
88 if (!anatop_reg->control_reg) 87 if (!anatop_reg->control_reg)
89 return -ENOTSUPP; 88 return -ENOTSUPP;
90 89
91 val = anatop_get_bits(anatop_reg->mfd, 90 val = anatop_read_reg(anatop_reg->mfd, anatop_reg->control_reg);
92 anatop_reg->control_reg, 91 val = (val & ((1 << anatop_reg->vol_bit_width) - 1)) >>
93 anatop_reg->vol_bit_shift, 92 anatop_reg->vol_bit_shift;
94 anatop_reg->vol_bit_width);
95 93
96 return val - anatop_reg->min_bit_val; 94 return val - anatop_reg->min_bit_val;
97} 95}