Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252157
b: refs/heads/master
c: bf5892a
h: refs/heads/master
i:
  252155: d66ecfa
v: v3
  • Loading branch information
Mark Brown authored and Liam Girdwood committed May 27, 2011
1 parent 60e52a3 commit 3545d88
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 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: 492c826b9facefa84995f4dea917e301b5ee0884
refs/heads/master: bf5892a8167e4aa5a9a6d72f803fde850e0c5753
15 changes: 12 additions & 3 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,10 @@ static void print_constraints(struct regulator_dev *rdev)
count += sprintf(buf + count, "at %d mV ", ret / 1000);
}

if (constraints->uV_offset)
count += sprintf(buf, "%dmV offset ",
constraints->uV_offset / 1000);

if (constraints->min_uA && constraints->max_uA) {
if (constraints->min_uA == constraints->max_uA)
count += sprintf(buf + count, "%d mA ",
Expand Down Expand Up @@ -1641,6 +1645,9 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,

trace_regulator_set_voltage(rdev_get_name(rdev), min_uV, max_uV);

min_uV += rdev->constraints->uV_offset;
max_uV += rdev->constraints->uV_offset;

if (rdev->desc->ops->set_voltage) {
ret = rdev->desc->ops->set_voltage(rdev, min_uV, max_uV,
&selector);
Expand Down Expand Up @@ -1865,18 +1872,20 @@ EXPORT_SYMBOL_GPL(regulator_sync_voltage);

static int _regulator_get_voltage(struct regulator_dev *rdev)
{
int sel;
int sel, ret;

if (rdev->desc->ops->get_voltage_sel) {
sel = rdev->desc->ops->get_voltage_sel(rdev);
if (sel < 0)
return sel;
return rdev->desc->ops->list_voltage(rdev, sel);
ret = rdev->desc->ops->list_voltage(rdev, sel);
}
if (rdev->desc->ops->get_voltage)
return rdev->desc->ops->get_voltage(rdev);
ret = rdev->desc->ops->get_voltage(rdev);
else
return -EINVAL;

return ret - rdev->constraints->uV_offset;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/linux/regulator/machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ struct regulator_state {
*
* @min_uV: Smallest voltage consumers may set.
* @max_uV: Largest voltage consumers may set.
* @uV_offset: Offset applied to voltages from consumer to compensate for
* voltage drops.
*
* @min_uA: Smallest consumers consumers may set.
* @max_uA: Largest current consumers may set.
Expand Down Expand Up @@ -99,6 +101,8 @@ struct regulation_constraints {
int min_uV;
int max_uV;

int uV_offset;

/* current output range (inclusive) - for current control */
int min_uA;
int max_uA;
Expand Down

0 comments on commit 3545d88

Please sign in to comment.