All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mfd: Add missing mutex.h inclusion to WM8994 core.h
@ 2011-12-01 13:56 Mark Brown
  2011-12-01 13:56 ` [PATCH 2/2] mfd: Mark WM1811 GPIO6 register volatile for later revisions Mark Brown
  2011-12-19 11:18 ` [PATCH 1/2] mfd: Add missing mutex.h inclusion to WM8994 core.h Samuel Ortiz
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2011-12-01 13:56 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

struct wm8994 includes a mutex so we need to include mutex.h before we
declare it. All current users rely on this being done implicitly.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 include/linux/mfd/wm8994/core.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index b9a44e7..c22b352 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -15,6 +15,7 @@
 #ifndef __MFD_WM8994_CORE_H__
 #define __MFD_WM8994_CORE_H__
 
+#include <linux/mutex.h>
 #include <linux/interrupt.h>
 
 enum wm8994_type {
-- 
1.7.7.3


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

* [PATCH 2/2] mfd: Mark WM1811 GPIO6 register volatile for later revisions
  2011-12-01 13:56 [PATCH 1/2] mfd: Add missing mutex.h inclusion to WM8994 core.h Mark Brown
@ 2011-12-01 13:56 ` Mark Brown
  2011-12-19 11:17   ` Samuel Ortiz
  2011-12-19 11:18 ` [PATCH 1/2] mfd: Add missing mutex.h inclusion to WM8994 core.h Samuel Ortiz
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2011-12-01 13:56 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

For later chip revisions the WM1811 GPIO6 register is always volatile so
store the device revision when initialising the driver and then check at
runtime if we're running on a newer device.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm8994-core.c       |   12 +++++++-----
 drivers/mfd/wm8994-regmap.c     |   19 +++++++++++++++++--
 include/linux/mfd/wm8994/core.h |    1 +
 3 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 92aa22f..3160cdd 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -446,15 +446,16 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
 			ret);
 		goto err_enable;
 	}
+	wm8994->revision = ret;
 
 	switch (wm8994->type) {
 	case WM8994:
-		switch (ret) {
+		switch (wm8994->revision) {
 		case 0:
 		case 1:
 			dev_warn(wm8994->dev,
 				 "revision %c not fully supported\n",
-				 'A' + ret);
+				 'A' + wm8994->revision);
 			break;
 		default:
 			break;
@@ -462,14 +463,15 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
 		break;
 	case WM1811:
 		/* Revision C did not change the relevant layer */
-		if (ret > 1)
-			ret++;
+		if (wm8994->revision > 1)
+			wm8994->revision++;
 		break;
 	default:
 		break;
 	}
 
-	dev_info(wm8994->dev, "%s revision %c\n", devname, 'A' + ret);
+	dev_info(wm8994->dev, "%s revision %c\n", devname,
+		 'A' + wm8994->revision);
 
 	if (pdata) {
 		wm8994->irq_base = pdata->irq_base;
diff --git a/drivers/mfd/wm8994-regmap.c b/drivers/mfd/wm8994-regmap.c
index d98a70e..2fdefa124 100644
--- a/drivers/mfd/wm8994-regmap.c
+++ b/drivers/mfd/wm8994-regmap.c
@@ -12,6 +12,7 @@
  *
  */
 
+#include <linux/mfd/wm8994/core.h>
 #include <linux/mfd/wm8994/registers.h>
 #include <linux/regmap.h>
 
@@ -210,7 +211,6 @@ static struct reg_default wm1811_defaults[] = {
 	{ 0x0702, 0xA101 },    /* R1794 - Pull Control (BCLK2) */
 	{ 0x0703, 0xA101 },    /* R1795 - Pull Control (DACLRCLK2) */
 	{ 0x0704, 0xA101 },    /* R1796 - Pull Control (DACDAT2) */
-	{ 0x0705, 0xA101 },    /* R1797 - GPIO 6 */
 	{ 0x0707, 0xA101 },    /* R1799 - GPIO 8 */
 	{ 0x0708, 0xA101 },    /* R1800 - GPIO 9 */
 	{ 0x0709, 0xA101 },    /* R1801 - GPIO 10 */
@@ -1145,6 +1145,21 @@ static bool wm8994_volatile_register(struct device *dev, unsigned int reg)
 	}
 }
 
+static bool wm1811_volatile_register(struct device *dev, unsigned int reg)
+{
+	struct wm8994 *wm8994 = dev_get_drvdata(dev);
+
+	switch (reg) {
+	case WM8994_GPIO_6:
+		if (wm8994->revision > 1)
+			return true;
+		else
+			return false;
+	default:
+		return wm8994_volatile_register(dev, reg);
+	}
+}
+
 static bool wm8958_volatile_register(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
@@ -1185,7 +1200,7 @@ struct regmap_config wm1811_regmap_config = {
 	.num_reg_defaults = ARRAY_SIZE(wm1811_defaults),
 
 	.max_register = WM8994_MAX_REGISTER,
-	.volatile_reg = wm8994_volatile_register,
+	.volatile_reg = wm1811_volatile_register,
 	.readable_reg = wm1811_readable_register,
 };
 
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index c22b352..9eff2a3 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -56,6 +56,7 @@ struct wm8994 {
 	struct mutex irq_lock;
 
 	enum wm8994_type type;
+	int revision;
 
 	struct device *dev;
 	struct regmap *regmap;
-- 
1.7.7.3


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

* Re: [PATCH 2/2] mfd: Mark WM1811 GPIO6 register volatile for later revisions
  2011-12-01 13:56 ` [PATCH 2/2] mfd: Mark WM1811 GPIO6 register volatile for later revisions Mark Brown
@ 2011-12-19 11:17   ` Samuel Ortiz
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Ortiz @ 2011-12-19 11:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches

Hi Mark,

On Thu, Dec 01, 2011 at 01:56:54PM +0000, Mark Brown wrote:
> For later chip revisions the WM1811 GPIO6 register is always volatile so
> store the device revision when initialising the driver and then check at
> runtime if we're running on a newer device.
This one depends on your regmap branch, so I'll let you push it.
Acked-by: Samuel Ortiz <sameo@linux.intel.com>

Cheers,
Samuel.

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

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

* Re: [PATCH 1/2] mfd: Add missing mutex.h inclusion to WM8994 core.h
  2011-12-01 13:56 [PATCH 1/2] mfd: Add missing mutex.h inclusion to WM8994 core.h Mark Brown
  2011-12-01 13:56 ` [PATCH 2/2] mfd: Mark WM1811 GPIO6 register volatile for later revisions Mark Brown
@ 2011-12-19 11:18 ` Samuel Ortiz
  1 sibling, 0 replies; 4+ messages in thread
From: Samuel Ortiz @ 2011-12-19 11:18 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches

Hi Mark,

On Thu, Dec 01, 2011 at 01:56:53PM +0000, Mark Brown wrote:
> struct wm8994 includes a mutex so we need to include mutex.h before we
> declare it. All current users rely on this being done implicitly.
Patch applied, thanks.

Cheers,
Samuel.

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

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

end of thread, other threads:[~2011-12-19 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-01 13:56 [PATCH 1/2] mfd: Add missing mutex.h inclusion to WM8994 core.h Mark Brown
2011-12-01 13:56 ` [PATCH 2/2] mfd: Mark WM1811 GPIO6 register volatile for later revisions Mark Brown
2011-12-19 11:17   ` Samuel Ortiz
2011-12-19 11:18 ` [PATCH 1/2] mfd: Add missing mutex.h inclusion to WM8994 core.h Samuel Ortiz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.