Skip to contentSkip to conversation

mfd: Add WM1811 support

PATCH In review Mark Brown 2 participants 5 messages Sep 27, 2011 – Oct 4, 2011

Subsystems (5)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/3 mfd: Add WM1811 support

The WM1811 is mostly register compatible with the WM8994 and WM8958, providing a high performance audio hub CODEC in a small form factor suitable for ultra compact system designs.

---

Due to the ASoC cross dependencies it seems like it'll be easier to merge this via ASoC - Samuel, does this make sense to you?

 drivers/mfd/wm8994-core.c       |   28 ++++++++++++++++++++++++++++
 include/linux/mfd/wm8994/core.h |    1 +
 2 files changed, 29 insertions(+), 0 deletions(-)
drivers/mfd/wm8994-core.c +28 -0
index 719fee8..61894fc 100644
@@ -167,6 +167,18 @@ static struct mfd_cell wm8994_devs[] = {
  * and should be handled via the standard regulator API supply
  * management.
  */
+static const char *wm1811_main_supplies[] = {
+	"DBVDD1",
+	"DBVDD2",
+	"DBVDD3",
+	"DCVDD",
+	"AVDD1",
+	"AVDD2",
+	"CPVDD",
+	"SPKVDD1",
+	"SPKVDD2",
+};
+
 static const char *wm8994_main_supplies[] = {
 	"DBVDD",
 	"DCVDD",
@@ -227,6 +239,7 @@ static int wm8994_suspend(struct device *dev)
 
 	switch (wm8994->type) {
 	case WM8958:
+	case WM1811:
 		ret = wm8994_reg_read(wm8994, WM8958_MIC_DETECT_1);
 		if (ret < 0) {
 			dev_err(dev, "Failed to read power status: %d\n", ret);
@@ -375,6 +388,9 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
 	}
 
 	switch (wm8994->type) {
+	case WM1811:
+		wm8994->num_supplies = ARRAY_SIZE(wm1811_main_supplies);
+		break;
 	case WM8994:
 		wm8994->num_supplies = ARRAY_SIZE(wm8994_main_supplies);
 		break;
@@ -395,6 +411,10 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
 	}
 
 	switch (wm8994->type) {
+	case WM1811:
+		for (i = 0; i < ARRAY_SIZE(wm1811_main_supplies); i++)
+			wm8994->supplies[i].supply = wm1811_main_supplies[i];
+		break;
 	case WM8994:
 		for (i = 0; i < ARRAY_SIZE(wm8994_main_supplies); i++)
 			wm8994->supplies[i].supply = wm8994_main_supplies[i];
@@ -428,6 +448,13 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
 		goto err_enable;
 	}
 	switch (ret) {
+	case 0x1811:
+		devname = "WM1811";
+		if (wm8994->type != WM1811)
+			dev_warn(wm8994->dev, "Device registered as type %d\n",
+				 wm8994->type);
+		wm8994->type = WM1811;
+		break;
 	case 0x8994:
 		devname = "WM8994";
 		if (wm8994->type != WM8994)
@@ -592,6 +619,7 @@ static int wm8994_i2c_remove(struct i2c_client *i2c)
 }
 
 static const struct i2c_device_id wm8994_i2c_id[] = {
+	{ "wm1811", WM1811 },
 	{ "wm8994", WM8994 },
 	{ "wm8958", WM8958 },
 	{ }
include/linux/mfd/wm8994/core.h +1 -0
index a275798..f44bdb7 100644
@@ -20,6 +20,7 @@
 enum wm8994_type {
 	WM8994 = 0,
 	WM8958 = 1,
+	WM1811 = 2,
 };
 
 struct regulator_dev;
Signature · 1 line
1.7.6.3
author
#1 lore raw

PATCH 2/3 regulator: Add WM1811 support

The WM1811 has a slightly different range on LDO2 to other WM8994 class devices.

---

As with the ASoC patch this depends on the MFD changes - Liam, given that ASoC is the thing most likely to run into cross-tree issues are you OK with merging this via ASoC?

 drivers/regulator/wm8994-regulator.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/regulator/wm8994-regulator.c +13 -0
index 1a6a690..b87bf5c 100644
@@ -140,6 +140,14 @@ static int wm8994_ldo2_list_voltage(struct regulator_dev *rdev,
 		return (selector * 100000) + 900000;
 	case WM8958:
 		return (selector * 100000) + 1000000;
+	case WM1811:
+		switch (selector) {
+		case 0:
+			return -EINVAL;
+		default:
+			return (selector * 100000) + 950000;
+		}
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -170,6 +178,11 @@ static int wm8994_ldo2_set_voltage(struct regulator_dev *rdev,
 	case WM8958:
 		selector = (min_uV - 1000000) / 100000;
 		break;
+	case WM1811:
+		selector = (min_uV - 950000) / 100000;
+		if (selector == 0)
+			selector = 1;
+		break;
 	default:
 		return -EINVAL;
 	}
Signature · 1 line
1.7.6.3
author
#2 lore raw

PATCH 3/3 ASoC: Add WM1811 support

In reply to Mark Brown

The WM1811 is mostly register compatible with the WM8994 and WM8958, providing a high performance audio hub CODEC in a small form factor suitable for ultra compact system designs.

---
 include/linux/mfd/wm8994/registers.h |    4 ++
 sound/soc/codecs/wm8994.c            |   83 +++++++++++++++++++++++++++++++--
 2 files changed, 82 insertions(+), 5 deletions(-)
include/linux/mfd/wm8994/registers.h +4 -0
index 23b24ca..d7be463 100644
@@ -2073,6 +2073,10 @@
 /*
  * R96 (0x60) - Analogue HP (1)
  */
+#define WM1811_HPOUT1_ATTN                      0x0100  /* HPOUT1_ATTN */
+#define WM1811_HPOUT1_ATTN_MASK                 0x0100  /* HPOUT1_ATTN */
+#define WM1811_HPOUT1_ATTN_SHIFT                     8  /* HPOUT1_ATTN */
+#define WM1811_HPOUT1_ATTN_WIDTH                     1  /* HPOUT1_ATTN */
 #define WM8994_HPOUT1L_RMV_SHORT                0x0080  /* HPOUT1L_RMV_SHORT */
 #define WM8994_HPOUT1L_RMV_SHORT_MASK           0x0080  /* HPOUT1L_RMV_SHORT */
 #define WM8994_HPOUT1L_RMV_SHORT_SHIFT               7  /* HPOUT1L_RMV_SHORT */
sound/soc/codecs/wm8994.c +78 -5

168 lines not on this page · raw message

Signature · 1 line
1.7.6.3
Acked-by on v1 1/3
#3 lore raw
In reply to Mark Brown

Hi Mark,

Quoted 9 lines · Mark Brown

The WM1811 is mostly register compatible with the WM8994 and WM8958, providing a high performance audio hub CODEC in a small form factor suitable for ultra compact system designs.

---

Due to the ASoC cross dependencies it seems like it'll be easier to merge this via ASoC - Samuel, does this make sense to you?

It does.
Liam, please add my:

to this one.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
author
#4 lore raw
Quoted 8 lines · Samuel Ortiz
Quoted 2 lines · Mark Brown

Due to the ASoC cross dependencies it seems like it'll be easier to merge this via ASoC - Samuel, does this make sense to you?

It does.
Liam, please add my:

Hrm, actually there's a bit of overlap with "mfd: Add more checks for WM8994 being active during suspend" from your tree. It's only a one line change (adding the WM1811 device ID) so I don't see any problem with just applying that during -rc, or I could cherry-pick that change over now? Anyway, I've applied the patch just now.