linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mfd: Mark WM835x USB_SLV_500MA bit as accessible
@ 2009-01-23 16:18 Mark Brown
  2009-01-23 16:18 ` [PATCH 2/3] mfd: Initialise WM8350 interrupts earlier Mark Brown
  2009-02-06 13:57 ` [PATCH 1/3] mfd: Mark WM835x USB_SLV_500MA bit as accessible Samuel Ortiz
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2009-01-23 16:18 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, Mark Brown

Brings the data table into sync with the silicon.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm8350-regmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/wm8350-regmap.c b/drivers/mfd/wm8350-regmap.c
index 68887b8..9a4cc95 100644
--- a/drivers/mfd/wm8350-regmap.c
+++ b/drivers/mfd/wm8350-regmap.c
@@ -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 */
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] mfd: Initialise WM8350 interrupts earlier
  2009-01-23 16:18 [PATCH 1/3] mfd: Mark WM835x USB_SLV_500MA bit as accessible Mark Brown
@ 2009-01-23 16:18 ` Mark Brown
  2009-01-23 16:18   ` [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe Mark Brown
  2009-02-06 13:57 ` [PATCH 1/3] mfd: Mark WM835x USB_SLV_500MA bit as accessible Samuel Ortiz
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2009-01-23 16:18 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, Mark Brown

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.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm8350-core.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index f92595c..70f5e77 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -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",
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe
  2009-01-23 16:18 ` [PATCH 2/3] mfd: Initialise WM8350 interrupts earlier Mark Brown
@ 2009-01-23 16:18   ` Mark Brown
  2009-01-30 20:10     ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2009-01-23 16:18 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, Mark Brown

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.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm8350-core.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index 70f5e77..e5e82c7 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -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);
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe
  2009-01-23 16:18   ` [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe Mark Brown
@ 2009-01-30 20:10     ` Andrew Morton
  2009-02-02 11:00       ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2009-01-30 20:10 UTC (permalink / raw)
  To: Mark Brown; +Cc: sameo, linux-kernel, broonie

On Fri, 23 Jan 2009 16:18:36 +0000
Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> @@ -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);

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe
  2009-01-30 20:10     ` Andrew Morton
@ 2009-02-02 11:00       ` Mark Brown
  2009-02-02 11:42         ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2009-02-02 11:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: sameo, linux-kernel

On Fri, Jan 30, 2009 at 12:10:09PM -0800, Andrew Morton wrote:

> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe
  2009-02-02 11:00       ` Mark Brown
@ 2009-02-02 11:42         ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2009-02-02 11:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: sameo, linux-kernel

On Mon, Feb 02, 2009 at 11:00:17AM +0000, Mark Brown wrote:
> On Fri, Jan 30, 2009 at 12:10:09PM -0800, Andrew Morton wrote:

> > 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] mfd: Mark WM835x USB_SLV_500MA bit as accessible
  2009-01-23 16:18 [PATCH 1/3] mfd: Mark WM835x USB_SLV_500MA bit as accessible Mark Brown
  2009-01-23 16:18 ` [PATCH 2/3] mfd: Initialise WM8350 interrupts earlier Mark Brown
@ 2009-02-06 13:57 ` Samuel Ortiz
  1 sibling, 0 replies; 7+ messages in thread
From: Samuel Ortiz @ 2009-02-06 13:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel

On Fri, Jan 23, 2009 at 04:18:34PM +0000, Mark Brown wrote:
> Brings the data table into sync with the silicon.
All 3 patches applied, thanks.

Cheers,
Samuel.

 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/mfd/wm8350-regmap.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mfd/wm8350-regmap.c b/drivers/mfd/wm8350-regmap.c
> index 68887b8..9a4cc95 100644
> --- a/drivers/mfd/wm8350-regmap.c
> +++ b/drivers/mfd/wm8350-regmap.c
> @@ -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 */
> -- 
> 1.5.6.5
> 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-02-06 13:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-23 16:18 [PATCH 1/3] mfd: Mark WM835x USB_SLV_500MA bit as accessible Mark Brown
2009-01-23 16:18 ` [PATCH 2/3] mfd: Initialise WM8350 interrupts earlier Mark Brown
2009-01-23 16:18   ` [PATCH 3/3] mfd: Improve diagnostics for WM8350 ID register probe Mark Brown
2009-01-30 20:10     ` Andrew Morton
2009-02-02 11:00       ` Mark Brown
2009-02-02 11:42         ` Mark Brown
2009-02-06 13:57 ` [PATCH 1/3] mfd: Mark WM835x USB_SLV_500MA bit as accessible Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).