Skip to contentSkip to conversation

mfd: Mark WM835x USB_SLV_500MA bit as accessible

PATCH In review Mark Brown 4 participants 7 messages Jan 23, 2009 – Feb 6, 2009

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/3 mfd: Mark WM835x USB_SLV_500MA bit as accessible

Brings the data table into sync with the silicon.

---
 drivers/mfd/wm8350-regmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/wm8350-regmap.c +1 -1
index 68887b8..9a4cc95 100644
@@ -3188,7 +3188,7 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = {
 	{ 0x7CFF, 0x0C00, 0x7FFF }, /* R1   - ID */
 	{ 0x0000, 0x0000, 0x0000 }, /* R2 */
 	{ 0xBE3B, 0xBE3B, 0x8000 }, /* R3   - System Control 1 */
-	{ 0xFCF7, 0xFCF7, 0xF800 }, /* R4   - System Control 2 */
+	{ 0xFEF7, 0xFEF7, 0xF800 }, /* R4   - System Control 2 */
 	{ 0x80FF, 0x80FF, 0x8000 }, /* R5   - System Hibernate */
 	{ 0xFB0E, 0xFB0E, 0x0000 }, /* R6   - Interface Control */
 	{ 0x0000, 0x0000, 0x0000 }, /* R7 */
Signature · 1 line
1.5.6.5
author
#1 lore raw

PATCH 2/3 mfd: Initialise WM8350 interrupts earlier

Ensure that the interrupt handling is configured before we do platform specific init. This allows the platform specific initialisation to configure things which use interrupts safely.

---
 drivers/mfd/wm8350-core.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/mfd/wm8350-core.c +9 -9
index f92595c..70f5e77 100644
@@ -1404,15 +1404,6 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 		return ret;
 	}
 
-	if (pdata && pdata->init) {
-		ret = pdata->init(wm8350);
-		if (ret != 0) {
-			dev_err(wm8350->dev, "Platform init() failed: %d\n",
-				ret);
-			goto err;
-		}
-	}
-
 	mutex_init(&wm8350->auxadc_mutex);
 	mutex_init(&wm8350->irq_mutex);
 	INIT_WORK(&wm8350->irq_work, wm8350_irq_worker);
@@ -1430,6 +1421,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 	}
 	wm8350->chip_irq = irq;
 
+	if (pdata && pdata->init) {
+		ret = pdata->init(wm8350);
+		if (ret != 0) {
+			dev_err(wm8350->dev, "Platform init() failed: %d\n",
+				ret);
+			goto err;
+		}
+	}
+
 	wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
 
 	wm8350_client_dev_register(wm8350, "wm8350-codec",
Signature · 1 line
1.5.6.5
author
#2 lore raw

PATCH 3/3 mfd: Improve diagnostics for WM8350 ID register probe

Check the return value of the device I/O functions when reading the ID registers so we can provide a more useful diagnostic when we're having trouble talking to the device.

---
 drivers/mfd/wm8350-core.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)
drivers/mfd/wm8350-core.c +19 -4
index 70f5e77..e5e82c7 100644
@@ -1297,14 +1297,29 @@ static void wm8350_client_dev_register(struct wm8350 *wm8350,
 int wm8350_device_init(struct wm8350 *wm8350, int irq,
 		       struct wm8350_platform_data *pdata)
 {
-	int ret = -EINVAL;
+	int ret;
 	u16 id1, id2, mask_rev;
 	u16 cust_id, mode, chip_rev;
 
 	/* get WM8350 revision and config mode */
-	wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
-	wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);
-	wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev);
+	ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
+	if (ret != 0) {
+		dev_err(wm8350->dev, "Failed to read ID: %d\n", ret);
+		goto err;
+	}
+
+	ret = wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);
+	if (ret != 0) {
+		dev_err(wm8350->dev, "Failed to read ID: %d\n", ret);
+		goto err;
+	}
+
+	ret = wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev),
+			       &mask_rev);
+	if (ret != 0) {
+		dev_err(wm8350->dev, "Failed to read revision: %d\n", ret);
+		goto err;
+	}
 
 	id1 = be16_to_cpu(id1);
 	id2 = be16_to_cpu(id2);
Signature · 1 line
1.5.6.5
#3 lore raw

Re: [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe

Quoted 10 lines · On Fri, 23 Jan 2009 16:18:36 +0000 Mark Brown…
drivers/mfd/wm8350-core.c +1 -1
@@ -1297,14 +1297,29 @@ static void wm8350_client_dev_register(struct wm8350 *wm8350,
 int wm8350_device_init(struct wm8350 *wm8350, int irq,
 		       struct wm8350_platform_data *pdata)
 {
-	int ret = -EINVAL;
+	int ret;
 	u16 id1, id2, mask_rev;
 	u16 cust_id, mode, chip_rev;
 
 	/* get WM8350 revision and config mode */

drivers/mfd/wm8350-core.c static void wm8350_client_dev_register(struct wm8350 *wm8350, · line 1311

Quoted 10 lines
drivers/mfd/wm8350-core.c +7 -3
-	wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
-	wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);
-	wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev);
+	ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
+	if (ret != 0) {
+		dev_err(wm8350->dev, "Failed to read ID: %d\n", ret);
+		goto err;
+	}
+
+	ret = wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);

Reading a bunch of bytes into a u16 looks a bit fishy from the endianness point of view?

#4 lore raw

Re: [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe

Quoted 2 lines · Andrew Morton

Reading a bunch of bytes into a u16 looks a bit fishy from the endianness point of view?

Hrm, yeah. I'll send a patch for this. Shouldn't be an issue in practice since this is a primary PMIC and is unlikely to be used to power anything with the wrong endianness.

#5 lore raw

Re: [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe

Quoted 8 lines · Mark Brown
Quoted 2 lines · Andrew Morton

Reading a bunch of bytes into a u16 looks a bit fishy from the endianness point of view?

Hrm, yeah. I'll send a patch for this. Shouldn't be an issue in practice since this is a primary PMIC and is unlikely to be used to power anything with the wrong endianness.

...or not, the code is already OK. The next block of code uses be16_to_cpu() on all the values before they're actually used.

#6 lore raw
In reply to Mark Brown
Quoted 1 line · Mark Brown

Brings the data table into sync with the silicon.

All 3 patches applied, thanks.

Cheers,
Samuel.

Quoted 21 lines
---
 drivers/mfd/wm8350-regmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/wm8350-regmap.c +1 -1
index 68887b8..9a4cc95 100644
@@ -3188,7 +3188,7 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = {
 	{ 0x7CFF, 0x0C00, 0x7FFF }, /* R1   - ID */
 	{ 0x0000, 0x0000, 0x0000 }, /* R2 */
 	{ 0xBE3B, 0xBE3B, 0x8000 }, /* R3   - System Control 1 */
-	{ 0xFCF7, 0xFCF7, 0xF800 }, /* R4   - System Control 2 */
+	{ 0xFEF7, 0xFEF7, 0xF800 }, /* R4   - System Control 2 */
 	{ 0x80FF, 0x80FF, 0x8000 }, /* R5   - System Hibernate */
 	{ 0xFB0E, 0xFB0E, 0x0000 }, /* R6   - Interface Control */
 	{ 0x0000, 0x0000, 0x0000 }, /* R7 */
Signature · 1 line
1.5.6.5
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/