Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302208
b: refs/heads/master
c: 9f29c9e
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown committed Apr 15, 2012
1 parent 66c22af commit f5d65d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 36 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: 88c84c14cca44d9409f1733dfdecc1f473463f20
refs/heads/master: 9f29c9e30b98832d98e8f528252fe193123a7d80
41 changes: 6 additions & 35 deletions trunk/drivers/regulator/wm8994-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,11 @@ static int wm8994_ldo1_get_voltage_sel(struct regulator_dev *rdev)
return (val & WM8994_LDO1_VSEL_MASK) >> WM8994_LDO1_VSEL_SHIFT;
}

static int wm8994_ldo1_set_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV, unsigned *s)
static int wm8994_ldo1_set_voltage_sel(struct regulator_dev *rdev,
unsigned selector)
{
struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
int selector, v;

selector = (min_uV - 2400000) / 100000;
v = wm8994_ldo1_list_voltage(rdev, selector);
if (v < 0 || v > max_uV)
return -EINVAL;

*s = selector;
selector <<= WM8994_LDO1_VSEL_SHIFT;

return wm8994_set_bits(ldo->wm8994, WM8994_LDO_1,
Expand All @@ -124,7 +117,7 @@ static struct regulator_ops wm8994_ldo1_ops = {

.list_voltage = wm8994_ldo1_list_voltage,
.get_voltage_sel = wm8994_ldo1_get_voltage_sel,
.set_voltage = wm8994_ldo1_set_voltage,
.set_voltage_sel = wm8994_ldo1_set_voltage_sel,
};

static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
Expand Down Expand Up @@ -165,33 +158,11 @@ static int wm8994_ldo2_get_voltage_sel(struct regulator_dev *rdev)
return (val & WM8994_LDO2_VSEL_MASK) >> WM8994_LDO2_VSEL_SHIFT;
}

static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV, unsigned *s)
static int wm8994_ldo2_set_voltage_sel(struct regulator_dev *rdev,
unsigned selector)
{
struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
int selector, v;

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

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

*s = selector;
selector <<= WM8994_LDO2_VSEL_SHIFT;

return wm8994_set_bits(ldo->wm8994, WM8994_LDO_2,
Expand All @@ -206,7 +177,7 @@ static struct regulator_ops wm8994_ldo2_ops = {

.list_voltage = wm8994_ldo2_list_voltage,
.get_voltage_sel = wm8994_ldo2_get_voltage_sel,
.set_voltage = wm8994_ldo2_set_voltage,
.set_voltage_sel = wm8994_ldo2_set_voltage_sel,
};

static const struct regulator_desc wm8994_ldo_desc[] = {
Expand Down

0 comments on commit f5d65d4

Please sign in to comment.