Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230378
b: refs/heads/master
c: 5a7743e
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Dec 13, 2010
1 parent 4476c83 commit 600160b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 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: 7d8316df44053687625eef792d53b3ac62e82248
refs/heads/master: 5a7743edac3d720a52e721229938d21d40f045ce
23 changes: 21 additions & 2 deletions trunk/drivers/regulator/wm8994-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,19 @@ static struct regulator_ops wm8994_ldo1_ops = {
static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
unsigned int selector)
{
struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);

if (selector > WM8994_LDO2_MAX_SELECTOR)
return -EINVAL;

return (selector * 100000) + 900000;
switch (ldo->wm8994->type) {
case WM8994:
return (selector * 100000) + 900000;
case WM8958:
return (selector * 100000) + 1000000;
default:
return -EINVAL;
}
}

static int wm8994_ldo2_get_voltage(struct regulator_dev *rdev)
Expand All @@ -157,7 +166,17 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev,
struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
int selector, v;

selector = (min_uV - 900000) / 100000;
switch (ldo->wm8994->type) {
case WM8994:
selector = (min_uV - 900000) / 100000;
break;
case WM8958:
selector = (min_uV - 1000000) / 100000;
break;
default:
return -EINVAL;
}

v = wm8994_ldo2_list_voltage(rdev, selector);
if (v < 0 || v > max_uV)
return -EINVAL;
Expand Down

0 comments on commit 600160b

Please sign in to comment.