Commit 5a7743ed authored by Mark Brown's avatar Mark Brown

regulator: Update LDO2 for WM8958

LDO2 has a slightly different range of supported voltages on WM8958
so update the selector<->voltage mappings to match.
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 7d8316df
...@@ -131,10 +131,19 @@ static struct regulator_ops wm8994_ldo1_ops = { ...@@ -131,10 +131,19 @@ static struct regulator_ops wm8994_ldo1_ops = {
static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev, static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
unsigned int selector) unsigned int selector)
{ {
struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
if (selector > WM8994_LDO2_MAX_SELECTOR) if (selector > WM8994_LDO2_MAX_SELECTOR)
return -EINVAL; return -EINVAL;
switch (ldo->wm8994->type) {
case WM8994:
return (selector * 100000) + 900000; return (selector * 100000) + 900000;
case WM8958:
return (selector * 100000) + 1000000;
default:
return -EINVAL;
}
} }
static int wm8994_ldo2_get_voltage(struct regulator_dev *rdev) static int wm8994_ldo2_get_voltage(struct regulator_dev *rdev)
...@@ -157,7 +166,17 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev, ...@@ -157,7 +166,17 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev,
struct wm8994_ldo *ldo = rdev_get_drvdata(rdev); struct wm8994_ldo *ldo = rdev_get_drvdata(rdev);
int selector, v; int selector, v;
switch (ldo->wm8994->type) {
case WM8994:
selector = (min_uV - 900000) / 100000; selector = (min_uV - 900000) / 100000;
break;
case WM8958:
selector = (min_uV - 1000000) / 100000;
break;
default:
return -EINVAL;
}
v = wm8994_ldo2_list_voltage(rdev, selector); v = wm8994_ldo2_list_voltage(rdev, selector);
if (v < 0 || v > max_uV) if (v < 0 || v > max_uV)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment