Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312535
b: refs/heads/master
c: 38c20eb
h: refs/heads/master
i:
  312533: dc6ca13
  312531: 759425e
  312527: 42202f9
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Jun 13, 2012
1 parent 1ecd3cb commit 94e2ccd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 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: 3fe3a182adfeca84f39751af03c8571831a0877f
refs/heads/master: 38c20eb23fb7b5505ac80595f18f4209abc19cd3
22 changes: 7 additions & 15 deletions trunk/drivers/regulator/wm8400-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,19 @@ static int wm8400_ldo_map_voltage(struct regulator_dev *dev,
int min_uV, int max_uV)
{
u16 val;
int volt;

if (min_uV < 900000 || min_uV > 3300000)
return -EINVAL;

if (min_uV < 1700000) {
/* Steps of 50mV from 900mV; */
if (min_uV < 1700000) /* Steps of 50mV from 900mV; */
val = DIV_ROUND_UP(min_uV - 900000, 50000);
else /* Steps of 100mV from 1700mV */
val = DIV_ROUND_UP(min_uV - 1700000, 100000) + 15;

if ((val * 50000) + 900000 > max_uV)
return -EINVAL;
BUG_ON((val * 50000) + 900000 < min_uV);
} else {
/* Steps of 100mV from 1700mV */
val = DIV_ROUND_UP(min_uV - 1700000, 100000);

if ((val * 100000) + 1700000 > max_uV)
return -EINVAL;
BUG_ON((val * 100000) + 1700000 < min_uV);

val += 0xf;
}
volt = wm8400_ldo_list_voltage(dev, val);
if (volt < min_uV || volt > max_uV)
return -EINVAL;

return val;
}
Expand Down

0 comments on commit 94e2ccd

Please sign in to comment.