Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177717
b: refs/heads/master
c: af5866c
h: refs/heads/master
i:
  177715: 64c8d98
v: v3
  • Loading branch information
Mark Brown authored and Liam Girdwood committed Dec 17, 2009
1 parent 9127e12 commit 166efae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 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: e79055d62ea6ca3c36962209f4c819614972c95a
refs/heads/master: af5866c9cdc9e43ef775a14765fd8eab95c7fd20
35 changes: 18 additions & 17 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,22 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
const char *name, struct regulation_constraints *constraints)
{
struct regulator_ops *ops = rdev->desc->ops;
int ret;

/* do we need to apply the constraint voltage */
if (rdev->constraints->apply_uV &&
rdev->constraints->min_uV == rdev->constraints->max_uV &&
ops->set_voltage) {
ret = ops->set_voltage(rdev,
rdev->constraints->min_uV, rdev->constraints->max_uV);
if (ret < 0) {
printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
__func__,
rdev->constraints->min_uV, name);
rdev->constraints = NULL;
return ret;
}
}

/* constrain machine-level voltage specs to fit
* the actual range supported by this regulator.
Expand Down Expand Up @@ -773,27 +789,12 @@ static int set_machine_constraints(struct regulator_dev *rdev,
else
name = "regulator";

rdev->constraints = constraints;

ret = machine_constraints_voltage(rdev, name, constraints);
if (ret != 0)
goto out;

rdev->constraints = constraints;

/* do we need to apply the constraint voltage */
if (rdev->constraints->apply_uV &&
rdev->constraints->min_uV == rdev->constraints->max_uV &&
ops->set_voltage) {
ret = ops->set_voltage(rdev,
rdev->constraints->min_uV, rdev->constraints->max_uV);
if (ret < 0) {
printk(KERN_ERR "%s: failed to apply %duV constraint to %s\n",
__func__,
rdev->constraints->min_uV, name);
rdev->constraints = NULL;
goto out;
}
}

/* do we need to setup our suspend state */
if (constraints->initial_state) {
ret = suspend_prepare(rdev, constraints->initial_state);
Expand Down

0 comments on commit 166efae

Please sign in to comment.