aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/twl-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/twl-regulator.c')
-rw-r--r--drivers/regulator/twl-regulator.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index a57262a4fa6c..bd332cf1cc3f 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -329,7 +329,8 @@ static int twl4030ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
329} 329}
330 330
331static int 331static int
332twl4030ldo_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) 332twl4030ldo_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
333 unsigned *selector)
333{ 334{
334 struct twlreg_info *info = rdev_get_drvdata(rdev); 335 struct twlreg_info *info = rdev_get_drvdata(rdev);
335 int vsel; 336 int vsel;
@@ -345,9 +346,11 @@ twl4030ldo_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV)
345 /* REVISIT for VAUX2, first match may not be best/lowest */ 346 /* REVISIT for VAUX2, first match may not be best/lowest */
346 347
347 /* use the first in-range value */ 348 /* use the first in-range value */
348 if (min_uV <= uV && uV <= max_uV) 349 if (min_uV <= uV && uV <= max_uV) {
350 *selector = vsel;
349 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, 351 return twlreg_write(info, TWL_MODULE_PM_RECEIVER,
350 VREG_VOLTAGE, vsel); 352 VREG_VOLTAGE, vsel);
353 }
351 } 354 }
352 355
353 return -EDOM; 356 return -EDOM;
@@ -389,7 +392,8 @@ static int twl6030ldo_list_voltage(struct regulator_dev *rdev, unsigned index)
389} 392}
390 393
391static int 394static int
392twl6030ldo_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) 395twl6030ldo_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
396 unsigned *selector)
393{ 397{
394 struct twlreg_info *info = rdev_get_drvdata(rdev); 398 struct twlreg_info *info = rdev_get_drvdata(rdev);
395 int vsel; 399 int vsel;
@@ -402,6 +406,7 @@ twl6030ldo_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV)
402 * mV = 1000mv + 100mv * (vsel - 1) 406 * mV = 1000mv + 100mv * (vsel - 1)
403 */ 407 */
404 vsel = (min_uV/1000 - 1000)/100 + 1; 408 vsel = (min_uV/1000 - 1000)/100 + 1;
409 *selector = vsel;
405 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE, vsel); 410 return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_VOLTAGE, vsel);
406 411
407} 412}