Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: tps80031: Convert tps80031_dcdc_ops to [get|set]_voltage_sel_regmap

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by

Axel Lin and committed by
Mark Brown
bc49c87e 58fa6ab4

+6 -33
+6 -33
drivers/regulator/tps80031-regulator.c
··· 282 282 return regulator_map_voltage_linear(rdev, min_uV, max_uV); 283 283 } 284 284 285 - static int tps80031_ldo_set_voltage_sel(struct regulator_dev *rdev, 286 - unsigned sel) 287 - { 288 - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); 289 - struct device *parent = to_tps80031_dev(rdev); 290 - int ret; 291 - 292 - ret = tps80031_write(parent, ri->rinfo->volt_id, 293 - ri->rinfo->volt_reg, sel); 294 - if (ret < 0) 295 - dev_err(ri->dev, "Error in writing reg 0x%02x, e = %d\n", 296 - ri->rinfo->volt_reg, ret); 297 - return ret; 298 - } 299 - 300 - static int tps80031_ldo_get_voltage_sel(struct regulator_dev *rdev) 301 - { 302 - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); 303 - struct device *parent = to_tps80031_dev(rdev); 304 - uint8_t vsel; 305 - int ret; 306 - 307 - ret = tps80031_read(parent, ri->rinfo->volt_id, 308 - ri->rinfo->volt_reg, &vsel); 309 - if (ret < 0) { 310 - dev_err(ri->dev, "Error in writing the Voltage register\n"); 311 - return ret; 312 - } 313 - return vsel & rdev->desc->vsel_mask; 314 - } 315 - 316 285 static int tps80031_vbus_is_enabled(struct regulator_dev *rdev) 317 286 { 318 287 struct tps80031_regulator *ri = rdev_get_drvdata(rdev); ··· 390 421 static struct regulator_ops tps80031_ldo_ops = { 391 422 .list_voltage = tps80031_ldo_list_voltage, 392 423 .map_voltage = tps80031_ldo_map_voltage, 393 - .set_voltage_sel = tps80031_ldo_set_voltage_sel, 394 - .get_voltage_sel = tps80031_ldo_get_voltage_sel, 424 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 425 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 395 426 .enable = tps80031_reg_enable, 396 427 .disable = tps80031_reg_disable, 397 428 .is_enabled = tps80031_reg_is_enabled, ··· 458 489 .uV_step = 100000, \ 459 490 .linear_min_sel = 1, \ 460 491 .n_voltages = 25, \ 492 + .vsel_reg = TPS80031_##_id##_CFG_VOLTAGE, \ 461 493 .vsel_mask = LDO_VSEL_MASK, \ 462 494 .enable_time = 500, \ 463 495 }, \ ··· 680 710 struct tps80031_regulator *pmic; 681 711 struct regulator_dev *rdev; 682 712 struct regulator_config config = { }; 713 + struct tps80031 *tps80031_mfd = dev_get_drvdata(pdev->dev.parent); 683 714 int ret; 684 715 int num; 685 716 ··· 708 737 config.dev = &pdev->dev; 709 738 config.init_data = NULL; 710 739 config.driver_data = ri; 740 + config.regmap = tps80031_mfd->regmap[ri->rinfo->volt_id]; 741 + 711 742 if (tps_pdata) { 712 743 config.init_data = tps_pdata->reg_init_data; 713 744 ri->config_flags = tps_pdata->config_flags;