Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252158
b: refs/heads/master
c: 98ea5c2
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Liam Girdwood committed May 27, 2011
1 parent 3545d88 commit ea62b7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 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: bf5892a8167e4aa5a9a6d72f803fde850e0c5753
refs/heads/master: 98ea5c218ed150bf7cabb879db4fc2c106b6fa5b
16 changes: 10 additions & 6 deletions trunk/drivers/regulator/mc13892-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ static int mc13892_sw_regulator_set_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV, unsigned *selector)
{
struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev);
int hi, value, val, mask, id = rdev_get_id(rdev);
int hi, value, mask, id = rdev_get_id(rdev);
u32 valread;
int ret;

dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n",
Expand All @@ -447,15 +448,16 @@ static int mc13892_sw_regulator_set_voltage(struct regulator_dev *rdev,

mc13xxx_lock(priv->mc13xxx);
ret = mc13xxx_reg_read(priv->mc13xxx,
mc13892_regulators[id].vsel_reg, &val);
mc13892_regulators[id].vsel_reg, &valread);
if (ret)
goto err;

hi = val & MC13892_SWITCHERS0_SWxHI;
if (value > 1375)
hi = 1;
if (value < 1100)
else if (value < 1100)
hi = 0;
else
hi = valread & MC13892_SWITCHERS0_SWxHI;

if (hi) {
value = (value - 1100000) / 25000;
Expand All @@ -464,8 +466,10 @@ static int mc13892_sw_regulator_set_voltage(struct regulator_dev *rdev,
value = (value - 600000) / 25000;

mask = mc13892_regulators[id].vsel_mask | MC13892_SWITCHERS0_SWxHI;
ret = mc13xxx_reg_rmw(priv->mc13xxx, mc13892_regulators[id].vsel_reg,
mask, value << mc13892_regulators[id].vsel_shift);
valread = (valread & ~mask) |
(value << mc13892_regulators[id].vsel_shift);
ret = mc13xxx_reg_write(priv->mc13xxx, mc13892_regulators[id].vsel_reg,
valread);
err:
mc13xxx_unlock(priv->mc13xxx);

Expand Down

0 comments on commit ea62b7a

Please sign in to comment.