Commit c6f0a0efb163b7d2e879f92197ab5e674868358e

Authored by Axel Lin
Committed by Mark Brown
1 parent adbf7eabb6

regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Showing 1 changed file with 6 additions and 32 deletions Side-by-side Diff

drivers/regulator/88pm8607.c
... ... @@ -30,8 +30,6 @@
30 30 unsigned int *vol_table;
31 31 unsigned int *vol_suspend;
32 32  
33   - int update_reg;
34   - int update_bit;
35 33 int slope_double;
36 34 };
37 35  
... ... @@ -222,30 +220,6 @@
222 220 return ret;
223 221 }
224 222  
225   -static int pm8607_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
226   -{
227   - struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
228   - uint8_t val;
229   - int ret;
230   -
231   - val = (uint8_t)(selector << (ffs(rdev->desc->vsel_mask) - 1));
232   -
233   - ret = pm860x_set_bits(info->i2c, rdev->desc->vsel_reg,
234   - rdev->desc->vsel_mask, val);
235   - if (ret)
236   - return ret;
237   - switch (info->desc.id) {
238   - case PM8607_ID_BUCK1:
239   - case PM8607_ID_BUCK2:
240   - case PM8607_ID_BUCK3:
241   - ret = pm860x_set_bits(info->i2c, info->update_reg,
242   - 1 << info->update_bit,
243   - 1 << info->update_bit);
244   - break;
245   - }
246   - return ret;
247   -}
248   -
249 223 static int pm8606_preg_enable(struct regulator_dev *rdev)
250 224 {
251 225 struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
... ... @@ -277,7 +251,7 @@
277 251  
278 252 static struct regulator_ops pm8607_regulator_ops = {
279 253 .list_voltage = pm8607_list_voltage,
280   - .set_voltage_sel = pm8607_set_voltage_sel,
  254 + .set_voltage_sel = regulator_set_voltage_sel_regmap,
281 255 .get_voltage_sel = regulator_get_voltage_sel_regmap,
282 256 .enable = regulator_enable_regmap,
283 257 .disable = regulator_disable_regmap,
284 258  
... ... @@ -314,11 +288,11 @@
314 288 .n_voltages = ARRAY_SIZE(vreg##_table), \
315 289 .vsel_reg = PM8607_##vreg, \
316 290 .vsel_mask = ARRAY_SIZE(vreg##_table) - 1, \
  291 + .apply_reg = PM8607_##ureg, \
  292 + .apply_bit = (ubit), \
317 293 .enable_reg = PM8607_##ereg, \
318 294 .enable_mask = 1 << (ebit), \
319 295 }, \
320   - .update_reg = PM8607_##ureg, \
321   - .update_bit = (ubit), \
322 296 .slope_double = (0), \
323 297 .vol_table = (unsigned int *)&vreg##_table, \
324 298 .vol_suspend = (unsigned int *)&vreg##_suspend_table, \
... ... @@ -344,9 +318,9 @@
344 318 }
345 319  
346 320 static struct pm8607_regulator_info pm8607_regulator_info[] = {
347   - PM8607_DVC(BUCK1, GO, 0, SUPPLIES_EN11, 0),
348   - PM8607_DVC(BUCK2, GO, 1, SUPPLIES_EN11, 1),
349   - PM8607_DVC(BUCK3, GO, 2, SUPPLIES_EN11, 2),
  321 + PM8607_DVC(BUCK1, GO, BIT(0), SUPPLIES_EN11, 0),
  322 + PM8607_DVC(BUCK2, GO, BIT(1), SUPPLIES_EN11, 1),
  323 + PM8607_DVC(BUCK3, GO, BIT(2), SUPPLIES_EN11, 2),
350 324  
351 325 PM8607_LDO(1, LDO1, 0, SUPPLIES_EN11, 3),
352 326 PM8607_LDO(2, LDO2, 0, SUPPLIES_EN11, 4),