Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312580
b: refs/heads/master
c: f11d08c
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Jun 23, 2012
1 parent 2166c02 commit 1678486
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: baae019efe84b6d2c6d5e7e7e1c9cfa130ad6b2a
refs/heads/master: f11d08c3d611d6f2845677caabe13b2c58f95658
23 changes: 9 additions & 14 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2296,15 +2296,15 @@ EXPORT_SYMBOL_GPL(regulator_set_voltage_time);
* Provided with the starting and target voltage selectors, this function
* returns time in microseconds required to rise or fall to this new voltage
*
* Drivers providing uV_step or volt_table in their regulator_desc and
* ramp_delay in regulation_constraints can use this as their
* Drivers providing ramp_delay in regulation_constraints can use this as their
* set_voltage_time_sel() operation.
*/
int regulator_set_voltage_time_sel(struct regulator_dev *rdev,
unsigned int old_selector,
unsigned int new_selector)
{
unsigned int ramp_delay = 0;
int old_volt, new_volt;

if (rdev->constraints->ramp_delay)
ramp_delay = rdev->constraints->ramp_delay;
Expand All @@ -2316,19 +2316,14 @@ int regulator_set_voltage_time_sel(struct regulator_dev *rdev,
return 0;
}

if (rdev->desc->uV_step) {
return DIV_ROUND_UP(rdev->desc->uV_step *
abs(new_selector - old_selector),
ramp_delay);
} else if (rdev->desc->volt_table) {
return DIV_ROUND_UP(abs(rdev->desc->volt_table[new_selector] -
rdev->desc->volt_table[old_selector]),
ramp_delay);
} else {
rdev_warn(rdev, "Unsupported voltage mapping settings\n");
}
/* sanity check */
if (!rdev->desc->ops->list_voltage)
return -EINVAL;

return 0;
old_volt = rdev->desc->ops->list_voltage(rdev, old_selector);
new_volt = rdev->desc->ops->list_voltage(rdev, new_selector);

return DIV_ROUND_UP(abs(new_volt - old_volt), ramp_delay);
}
EXPORT_SYMBOL_GPL(regulator_set_voltage_time_sel);

Expand Down

0 comments on commit 1678486

Please sign in to comment.