aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-07 20:56:48 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-09 22:22:29 -0500
commit2c129927870499aaa8840b5e97ffb4f0c8e5eb86 (patch)
tree9dbff664746a40920ff69cb48f58c98c695447cf
parent9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff)
regulator: lp872x: Kill _rdev_to_offset() function
There is only one user calling _rdev_to_offset() function. Remove _rdev_to_offset() makes the code simpler. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--drivers/regulator/lp872x.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/drivers/regulator/lp872x.c b/drivers/regulator/lp872x.c
index 708f4b6a17dc..f3bf80e56b1c 100644
--- a/drivers/regulator/lp872x.c
+++ b/drivers/regulator/lp872x.c
@@ -181,20 +181,6 @@ static inline int lp872x_update_bits(struct lp872x *lp, u8 addr,
181 return regmap_update_bits(lp->regmap, addr, mask, data); 181 return regmap_update_bits(lp->regmap, addr, mask, data);
182} 182}
183 183
184static int _rdev_to_offset(struct regulator_dev *rdev)
185{
186 enum lp872x_regulator_id id = rdev_get_id(rdev);
187
188 switch (id) {
189 case LP8720_ID_LDO1 ... LP8720_ID_BUCK:
190 return id;
191 case LP8725_ID_LDO1 ... LP8725_ID_BUCK2:
192 return id - LP8725_ID_BASE;
193 default:
194 return -EINVAL;
195 }
196}
197
198static int lp872x_get_timestep_usec(struct lp872x *lp) 184static int lp872x_get_timestep_usec(struct lp872x *lp)
199{ 185{
200 enum lp872x_id chip = lp->chipid; 186 enum lp872x_id chip = lp->chipid;
@@ -234,28 +220,20 @@ static int lp872x_get_timestep_usec(struct lp872x *lp)
234static int lp872x_regulator_enable_time(struct regulator_dev *rdev) 220static int lp872x_regulator_enable_time(struct regulator_dev *rdev)
235{ 221{
236 struct lp872x *lp = rdev_get_drvdata(rdev); 222 struct lp872x *lp = rdev_get_drvdata(rdev);
237 enum lp872x_regulator_id regulator = rdev_get_id(rdev); 223 enum lp872x_regulator_id rid = rdev_get_id(rdev);
238 int time_step_us = lp872x_get_timestep_usec(lp); 224 int time_step_us = lp872x_get_timestep_usec(lp);
239 int ret, offset; 225 int ret;
240 u8 addr, val; 226 u8 addr, val;
241 227
242 if (time_step_us < 0) 228 if (time_step_us < 0)
243 return -EINVAL; 229 return -EINVAL;
244 230
245 switch (regulator) { 231 switch (rid) {
246 case LP8720_ID_LDO1 ... LP8720_ID_LDO5: 232 case LP8720_ID_LDO1 ... LP8720_ID_BUCK:
247 case LP8725_ID_LDO1 ... LP8725_ID_LILO2: 233 addr = LP872X_LDO1_VOUT + rid;
248 offset = _rdev_to_offset(rdev);
249 if (offset < 0)
250 return -EINVAL;
251
252 addr = LP872X_LDO1_VOUT + offset;
253 break;
254 case LP8720_ID_BUCK:
255 addr = LP8720_BUCK_VOUT1;
256 break; 234 break;
257 case LP8725_ID_BUCK1: 235 case LP8725_ID_LDO1 ... LP8725_ID_BUCK1:
258 addr = LP8725_BUCK1_VOUT1; 236 addr = LP872X_LDO1_VOUT + rid - LP8725_ID_BASE;
259 break; 237 break;
260 case LP8725_ID_BUCK2: 238 case LP8725_ID_BUCK2:
261 addr = LP8725_BUCK2_VOUT1; 239 addr = LP8725_BUCK2_VOUT1;