aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@sirena.org.uk>2013-04-27 21:13:48 -0400
committerMark Brown <broonie@sirena.org.uk>2013-04-27 21:13:48 -0400
commit32e40be1e27de1eee224c4e27dba963c11852b54 (patch)
treeeaf8d3ca74b6543536f68b9af20c579d4f81ffe1 /drivers/regulator
parent64dceea44604e1b1b84f666ac5bb54ca8d2be56b (diff)
parentbc49c87ec7a7695f30db73a7d73efd3566db4404 (diff)
Merge remote-tracking branch 'regulator/topic/tps80031' into v3.9-rc8
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/tps80031-regulator.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/drivers/regulator/tps80031-regulator.c b/drivers/regulator/tps80031-regulator.c
index 9019d0e7ecb6..6511d0bfd896 100644
--- a/drivers/regulator/tps80031-regulator.c
+++ b/drivers/regulator/tps80031-regulator.c
@@ -238,12 +238,11 @@ static int tps80031_dcdc_get_voltage_sel(struct regulator_dev *rdev)
238 return vsel & SMPS_VSEL_MASK; 238 return vsel & SMPS_VSEL_MASK;
239} 239}
240 240
241static int tps80031_ldo_set_voltage_sel(struct regulator_dev *rdev, 241static int tps80031_ldo_list_voltage(struct regulator_dev *rdev,
242 unsigned sel) 242 unsigned int sel)
243{ 243{
244 struct tps80031_regulator *ri = rdev_get_drvdata(rdev); 244 struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
245 struct device *parent = to_tps80031_dev(rdev); 245 struct device *parent = to_tps80031_dev(rdev);
246 int ret;
247 246
248 /* Check for valid setting for TPS80031 or TPS80032-ES1.0 */ 247 /* Check for valid setting for TPS80031 or TPS80032-ES1.0 */
249 if ((ri->rinfo->desc.id == TPS80031_REGULATOR_LDO2) && 248 if ((ri->rinfo->desc.id == TPS80031_REGULATOR_LDO2) &&
@@ -260,28 +259,27 @@ static int tps80031_ldo_set_voltage_sel(struct regulator_dev *rdev,
260 } 259 }
261 } 260 }
262 261
263 ret = tps80031_write(parent, ri->rinfo->volt_id, 262 return regulator_list_voltage_linear(rdev, sel);
264 ri->rinfo->volt_reg, sel);
265 if (ret < 0)
266 dev_err(ri->dev, "Error in writing reg 0x%02x, e = %d\n",
267 ri->rinfo->volt_reg, ret);
268 return ret;
269} 263}
270 264
271static int tps80031_ldo_get_voltage_sel(struct regulator_dev *rdev) 265static int tps80031_ldo_map_voltage(struct regulator_dev *rdev,
266 int min_uV, int max_uV)
272{ 267{
273 struct tps80031_regulator *ri = rdev_get_drvdata(rdev); 268 struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
274 struct device *parent = to_tps80031_dev(rdev); 269 struct device *parent = to_tps80031_dev(rdev);
275 uint8_t vsel;
276 int ret;
277 270
278 ret = tps80031_read(parent, ri->rinfo->volt_id, 271 /* Check for valid setting for TPS80031 or TPS80032-ES1.0 */
279 ri->rinfo->volt_reg, &vsel); 272 if ((ri->rinfo->desc.id == TPS80031_REGULATOR_LDO2) &&
280 if (ret < 0) { 273 (ri->device_flags & TRACK_MODE_ENABLE)) {
281 dev_err(ri->dev, "Error in writing the Voltage register\n"); 274 if (((tps80031_get_chip_info(parent) == TPS80031) ||
282 return ret; 275 ((tps80031_get_chip_info(parent) == TPS80032) &&
276 (tps80031_get_pmu_version(parent) == 0x0)))) {
277 return regulator_map_voltage_iterate(rdev, min_uV,
278 max_uV);
279 }
283 } 280 }
284 return vsel & rdev->desc->vsel_mask; 281
282 return regulator_map_voltage_linear(rdev, min_uV, max_uV);
285} 283}
286 284
287static int tps80031_vbus_is_enabled(struct regulator_dev *rdev) 285static int tps80031_vbus_is_enabled(struct regulator_dev *rdev)
@@ -390,9 +388,10 @@ static struct regulator_ops tps80031_dcdc_ops = {
390}; 388};
391 389
392static struct regulator_ops tps80031_ldo_ops = { 390static struct regulator_ops tps80031_ldo_ops = {
393 .list_voltage = regulator_list_voltage_linear, 391 .list_voltage = tps80031_ldo_list_voltage,
394 .set_voltage_sel = tps80031_ldo_set_voltage_sel, 392 .map_voltage = tps80031_ldo_map_voltage,
395 .get_voltage_sel = tps80031_ldo_get_voltage_sel, 393 .set_voltage_sel = regulator_set_voltage_sel_regmap,
394 .get_voltage_sel = regulator_get_voltage_sel_regmap,
396 .enable = tps80031_reg_enable, 395 .enable = tps80031_reg_enable,
397 .disable = tps80031_reg_disable, 396 .disable = tps80031_reg_disable,
398 .is_enabled = tps80031_reg_is_enabled, 397 .is_enabled = tps80031_reg_is_enabled,
@@ -459,6 +458,7 @@ static struct regulator_ops tps80031_ext_reg_ops = {
459 .uV_step = 100000, \ 458 .uV_step = 100000, \
460 .linear_min_sel = 1, \ 459 .linear_min_sel = 1, \
461 .n_voltages = 25, \ 460 .n_voltages = 25, \
461 .vsel_reg = TPS80031_##_id##_CFG_VOLTAGE, \
462 .vsel_mask = LDO_VSEL_MASK, \ 462 .vsel_mask = LDO_VSEL_MASK, \
463 .enable_time = 500, \ 463 .enable_time = 500, \
464 }, \ 464 }, \
@@ -680,6 +680,7 @@ static int tps80031_regulator_probe(struct platform_device *pdev)
680 struct tps80031_regulator *pmic; 680 struct tps80031_regulator *pmic;
681 struct regulator_dev *rdev; 681 struct regulator_dev *rdev;
682 struct regulator_config config = { }; 682 struct regulator_config config = { };
683 struct tps80031 *tps80031_mfd = dev_get_drvdata(pdev->dev.parent);
683 int ret; 684 int ret;
684 int num; 685 int num;
685 686
@@ -707,6 +708,8 @@ static int tps80031_regulator_probe(struct platform_device *pdev)
707 config.dev = &pdev->dev; 708 config.dev = &pdev->dev;
708 config.init_data = NULL; 709 config.init_data = NULL;
709 config.driver_data = ri; 710 config.driver_data = ri;
711 config.regmap = tps80031_mfd->regmap[ri->rinfo->volt_id];
712
710 if (tps_pdata) { 713 if (tps_pdata) {
711 config.init_data = tps_pdata->reg_init_data; 714 config.init_data = tps_pdata->reg_init_data;
712 ri->config_flags = tps_pdata->config_flags; 715 ri->config_flags = tps_pdata->config_flags;