diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-14 20:16:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-14 20:16:02 -0400 |
commit | ff398c45b03d9d64135d928c0146d8c38a70fd3b (patch) | |
tree | cb7feb8551e0424963305a4d36562145e0298535 /drivers | |
parent | cc198126c5b6fb675140b245b5757692a77bb9a0 (diff) | |
parent | 9365121869a15da99d6091802f11a82d59024d62 (diff) |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown:
"Another small batch of driver specific bug fixes, a couple more errors
in the da9052 driver and a bad return value in the tps6524x driver."
* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
regulator: da9052: Ensure the selected voltage falls within the specified range
regulator: Set n_voltages for da9052 regulators
regulator: Fix setting selector in tps6524x set_voltage function
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/da9052-regulator.c | 12 | ||||
-rw-r--r-- | drivers/regulator/tps6524x-regulator.c | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index ea4d8f575ac6..09915e89705d 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
@@ -226,7 +226,7 @@ static int da9052_regulator_set_voltage_int(struct regulator_dev *rdev, | |||
226 | if (min_uV < info->min_uV) | 226 | if (min_uV < info->min_uV) |
227 | min_uV = info->min_uV; | 227 | min_uV = info->min_uV; |
228 | 228 | ||
229 | *selector = (min_uV - info->min_uV) / info->step_uV; | 229 | *selector = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV); |
230 | 230 | ||
231 | ret = da9052_list_voltage(rdev, *selector); | 231 | ret = da9052_list_voltage(rdev, *selector); |
232 | if (ret < 0) | 232 | if (ret < 0) |
@@ -318,10 +318,10 @@ static int da9052_set_buckperi_voltage(struct regulator_dev *rdev, int min_uV, | |||
318 | if ((regulator->da9052->chip_id == DA9052) && | 318 | if ((regulator->da9052->chip_id == DA9052) && |
319 | (min_uV >= DA9052_CONST_3uV)) | 319 | (min_uV >= DA9052_CONST_3uV)) |
320 | *selector = DA9052_BUCK_PERI_REG_MAP_UPTO_3uV + | 320 | *selector = DA9052_BUCK_PERI_REG_MAP_UPTO_3uV + |
321 | ((min_uV - DA9052_CONST_3uV) / | 321 | DIV_ROUND_UP(min_uV - DA9052_CONST_3uV, |
322 | (DA9052_BUCK_PERI_3uV_STEP)); | 322 | DA9052_BUCK_PERI_3uV_STEP); |
323 | else | 323 | else |
324 | *selector = (min_uV - info->min_uV) / info->step_uV; | 324 | *selector = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV); |
325 | 325 | ||
326 | ret = da9052_list_buckperi_voltage(rdev, *selector); | 326 | ret = da9052_list_buckperi_voltage(rdev, *selector); |
327 | if (ret < 0) | 327 | if (ret < 0) |
@@ -400,6 +400,7 @@ static struct regulator_ops da9052_ldo_ops = { | |||
400 | .ops = &da9052_ldo5_6_ops,\ | 400 | .ops = &da9052_ldo5_6_ops,\ |
401 | .type = REGULATOR_VOLTAGE,\ | 401 | .type = REGULATOR_VOLTAGE,\ |
402 | .id = _id,\ | 402 | .id = _id,\ |
403 | .n_voltages = (max - min) / step + 1, \ | ||
403 | .owner = THIS_MODULE,\ | 404 | .owner = THIS_MODULE,\ |
404 | },\ | 405 | },\ |
405 | .min_uV = (min) * 1000,\ | 406 | .min_uV = (min) * 1000,\ |
@@ -417,6 +418,7 @@ static struct regulator_ops da9052_ldo_ops = { | |||
417 | .ops = &da9052_ldo_ops,\ | 418 | .ops = &da9052_ldo_ops,\ |
418 | .type = REGULATOR_VOLTAGE,\ | 419 | .type = REGULATOR_VOLTAGE,\ |
419 | .id = _id,\ | 420 | .id = _id,\ |
421 | .n_voltages = (max - min) / step + 1, \ | ||
420 | .owner = THIS_MODULE,\ | 422 | .owner = THIS_MODULE,\ |
421 | },\ | 423 | },\ |
422 | .min_uV = (min) * 1000,\ | 424 | .min_uV = (min) * 1000,\ |
@@ -434,6 +436,7 @@ static struct regulator_ops da9052_ldo_ops = { | |||
434 | .ops = &da9052_dcdc_ops,\ | 436 | .ops = &da9052_dcdc_ops,\ |
435 | .type = REGULATOR_VOLTAGE,\ | 437 | .type = REGULATOR_VOLTAGE,\ |
436 | .id = _id,\ | 438 | .id = _id,\ |
439 | .n_voltages = (max - min) / step + 1, \ | ||
437 | .owner = THIS_MODULE,\ | 440 | .owner = THIS_MODULE,\ |
438 | },\ | 441 | },\ |
439 | .min_uV = (min) * 1000,\ | 442 | .min_uV = (min) * 1000,\ |
@@ -451,6 +454,7 @@ static struct regulator_ops da9052_ldo_ops = { | |||
451 | .ops = &da9052_buckperi_ops,\ | 454 | .ops = &da9052_buckperi_ops,\ |
452 | .type = REGULATOR_VOLTAGE,\ | 455 | .type = REGULATOR_VOLTAGE,\ |
453 | .id = _id,\ | 456 | .id = _id,\ |
457 | .n_voltages = (max - min) / step + 1, \ | ||
454 | .owner = THIS_MODULE,\ | 458 | .owner = THIS_MODULE,\ |
455 | },\ | 459 | },\ |
456 | .min_uV = (min) * 1000,\ | 460 | .min_uV = (min) * 1000,\ |
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c index 70b7b1f4f000..2e94686b6fe6 100644 --- a/drivers/regulator/tps6524x-regulator.c +++ b/drivers/regulator/tps6524x-regulator.c | |||
@@ -481,7 +481,7 @@ static int set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, | |||
481 | if (i >= info->n_voltages) | 481 | if (i >= info->n_voltages) |
482 | i = info->n_voltages - 1; | 482 | i = info->n_voltages - 1; |
483 | 483 | ||
484 | *selector = info->voltages[i]; | 484 | *selector = i; |
485 | 485 | ||
486 | return write_field(hw, &info->voltage, i); | 486 | return write_field(hw, &info->voltage, i); |
487 | } | 487 | } |