diff options
Diffstat (limited to 'drivers/regulator/tps65023-regulator.c')
-rw-r--r-- | drivers/regulator/tps65023-regulator.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c index b912daae9fa0..11c9e1f14079 100644 --- a/drivers/regulator/tps65023-regulator.c +++ b/drivers/regulator/tps65023-regulator.c | |||
@@ -284,6 +284,7 @@ static int tps65023_dcdc_set_voltage(struct regulator_dev *dev, | |||
284 | struct tps_pmic *tps = rdev_get_drvdata(dev); | 284 | struct tps_pmic *tps = rdev_get_drvdata(dev); |
285 | int dcdc = rdev_get_id(dev); | 285 | int dcdc = rdev_get_id(dev); |
286 | int vsel; | 286 | int vsel; |
287 | int ret; | ||
287 | 288 | ||
288 | if (dcdc != TPS65023_DCDC_1) | 289 | if (dcdc != TPS65023_DCDC_1) |
289 | return -EINVAL; | 290 | return -EINVAL; |
@@ -306,11 +307,21 @@ static int tps65023_dcdc_set_voltage(struct regulator_dev *dev, | |||
306 | 307 | ||
307 | *selector = vsel; | 308 | *selector = vsel; |
308 | 309 | ||
309 | /* write to the register in case we found a match */ | ||
310 | if (vsel == tps->info[dcdc]->table_len) | 310 | if (vsel == tps->info[dcdc]->table_len) |
311 | return -EINVAL; | 311 | goto failed; |
312 | else | 312 | |
313 | return tps_65023_reg_write(tps, TPS65023_REG_DEF_CORE, vsel); | 313 | ret = tps_65023_reg_write(tps, TPS65023_REG_DEF_CORE, vsel); |
314 | |||
315 | /* Tell the chip that we have changed the value in DEFCORE | ||
316 | * and its time to update the core voltage | ||
317 | */ | ||
318 | tps_65023_set_bits(tps, TPS65023_REG_CON_CTRL2, | ||
319 | TPS65023_REG_CTRL2_GO); | ||
320 | |||
321 | return ret; | ||
322 | |||
323 | failed: | ||
324 | return -EINVAL; | ||
314 | } | 325 | } |
315 | 326 | ||
316 | static int tps65023_ldo_get_voltage(struct regulator_dev *dev) | 327 | static int tps65023_ldo_get_voltage(struct regulator_dev *dev) |