Skip to contentSkip to conversation

regulator: Update LDO2 for WM8958

PATCH In review Mark Brown 2 participants 2 messages Dec 13, 2010

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 regulator: Update LDO2 for WM8958

LDO2 has a slightly different range of supported voltages on WM8958 so update the selector<->voltage mappings to match.

---

As the WM8958 support is currently sitting in the ASoC tree for the next merge window this should get merged that way. I've done some test merges here and git seems to be able to figure out the overlaps with the code in your tree so are you OK with applying to ASoC?

 drivers/regulator/wm8994-regulator.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
drivers/regulator/wm8994-regulator.c +21 -2
index 03713bc..21fefef 100644
@@ -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)
@@ -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;
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Mark Brown

LDO2 has a slightly different range of supported voltages on WM8958 so update the selector<->voltage mappings to match.

---

As the WM8958 support is currently sitting in the ASoC tree for the next merge window this should get merged that way. I've done some test merges here and git seems to be able to figure out the overlaps with the code in your tree so are you OK with applying to ASoC?

Fine by me.

Quoted 3 lines
 drivers/regulator/wm8994-regulator.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk