linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Wolfson MFD updates
@ 2010-11-24 18:00 Mark Brown
  2010-11-24 18:01 ` [PATCH 2.6.37 1/7] mfd: Supply IRQ base for WM832x devices Mark Brown
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-24 18:00 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches

This is a reposting of a number of Wolfson MFD patches previously posted
- I seem to building up a relatively large queue of patches here.

Patch 1/7 is a bugfix and really ought to go into 2.6.37, patch 7/7
would ideally be merged via ASoC as the bulk of the support for this
device is in the CODEC driver, 2-3 are a new device and 4-6 are some
housekeeping for new kernel APIs.

Mark Brown (7):
      mfd: Supply IRQ base for WM832x devices
      mfd: Simplify WM832x subdevice instantiation
      mfd: Add WM8326 support
      mfd: Convert WM831x to new irq_ interrupt methods
      mfd: Convert WM835x to new irq_ interrupt methods
      mfd: Convert WM8994 to new irq_ interrupt methods
      mfd: Add initial WM8958 support

 drivers/mfd/wm831x-core.c       |   19 +++-----
 drivers/mfd/wm831x-i2c.c        |    1 
 drivers/mfd/wm831x-irq.c        |   42 +++++++++---------
 drivers/mfd/wm831x-spi.c        |   18 +++++++
 drivers/mfd/wm8350-irq.c        |   32 +++++++------
 drivers/mfd/wm8994-core.c       |   93 +++++++++++++++++++++++++++++++---------
 drivers/mfd/wm8994-irq.c        |   32 +++++++------
 include/linux/mfd/wm831x/core.h |    1 
 include/linux/mfd/wm8994/core.h |    8 +++
 9 files changed, 166 insertions(+), 80 deletions(-)

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

* [PATCH 2.6.37 1/7] mfd: Supply IRQ base for WM832x devices
  2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
@ 2010-11-24 18:01 ` Mark Brown
  2010-11-24 18:01 ` [PATCH 2/7] mfd: Simplify WM832x subdevice instantiation Mark Brown
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-24 18:01 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown, stable

Without this the IRQ base will not be correctly configured for the
subdevices.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
---
 drivers/mfd/wm831x-core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 7d2563f..e1a2f4b 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1620,7 +1620,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
 	case WM8325:
 		ret = mfd_add_devices(wm831x->dev, -1,
 				      wm8320_devs, ARRAY_SIZE(wm8320_devs),
-				      NULL, 0);
+				      NULL, wm831x->irq_base);
 		break;
 
 	default:
-- 
1.7.1


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

* [PATCH 2/7] mfd: Simplify WM832x subdevice instantiation
  2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
  2010-11-24 18:01 ` [PATCH 2.6.37 1/7] mfd: Supply IRQ base for WM832x devices Mark Brown
@ 2010-11-24 18:01 ` Mark Brown
  2010-11-24 18:01 ` [PATCH 3/7] mfd: Add WM8326 support Mark Brown
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-24 18:01 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

All the current WM832x devices have the same set of subdevices so can
just use multiple case statements with a single body.

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

diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index e1a2f4b..278f3a7 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1606,17 +1606,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
 		break;
 
 	case WM8320:
-		ret = mfd_add_devices(wm831x->dev, -1,
-				      wm8320_devs, ARRAY_SIZE(wm8320_devs),
-				      NULL, 0);
-		break;
-
 	case WM8321:
-		ret = mfd_add_devices(wm831x->dev, -1,
-				      wm8320_devs, ARRAY_SIZE(wm8320_devs),
-				      NULL, 0);
-		break;
-
 	case WM8325:
 		ret = mfd_add_devices(wm831x->dev, -1,
 				      wm8320_devs, ARRAY_SIZE(wm8320_devs),
-- 
1.7.1


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

* [PATCH 3/7] mfd: Add WM8326 support
  2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
  2010-11-24 18:01 ` [PATCH 2.6.37 1/7] mfd: Supply IRQ base for WM832x devices Mark Brown
  2010-11-24 18:01 ` [PATCH 2/7] mfd: Simplify WM832x subdevice instantiation Mark Brown
@ 2010-11-24 18:01 ` Mark Brown
  2010-11-24 18:01 ` [PATCH 4/7] mfd: Convert WM831x to new irq_ interrupt methods Mark Brown
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-24 18:01 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

The WM8326 is a high performance variant of the WM832x series with
no software visible differences.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm831x-core.c       |    7 +++++++
 drivers/mfd/wm831x-i2c.c        |    1 +
 drivers/mfd/wm831x-spi.c        |   18 ++++++++++++++++++
 include/linux/mfd/wm831x/core.h |    1 +
 4 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 278f3a7..47b58cc 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1537,6 +1537,12 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
 		dev_info(wm831x->dev, "WM8325 revision %c\n", 'A' + rev);
 		break;
 
+	case WM8326:
+		parent = WM8326;
+		wm831x->num_gpio = 12;
+		dev_info(wm831x->dev, "WM8326 revision %c\n", 'A' + rev);
+		break;
+
 	default:
 		dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret);
 		ret = -EINVAL;
@@ -1608,6 +1614,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
 	case WM8320:
 	case WM8321:
 	case WM8325:
+	case WM8326:
 		ret = mfd_add_devices(wm831x->dev, -1,
 				      wm8320_devs, ARRAY_SIZE(wm8320_devs),
 				      NULL, wm831x->irq_base);
diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c
index 156b198..38be520 100644
--- a/drivers/mfd/wm831x-i2c.c
+++ b/drivers/mfd/wm831x-i2c.c
@@ -108,6 +108,7 @@ static const struct i2c_device_id wm831x_i2c_id[] = {
 	{ "wm8320", WM8320 },
 	{ "wm8321", WM8321 },
 	{ "wm8325", WM8325 },
+	{ "wm8326", WM8326 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id);
diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
index 2789b15..0a8f772 100644
--- a/drivers/mfd/wm831x-spi.c
+++ b/drivers/mfd/wm831x-spi.c
@@ -81,6 +81,8 @@ static int __devinit wm831x_spi_probe(struct spi_device *spi)
 		type = WM8321;
 	else if (strcmp(spi->modalias, "wm8325") == 0)
 		type = WM8325;
+	else if (strcmp(spi->modalias, "wm8326") == 0)
+		type = WM8326;
 	else {
 		dev_err(&spi->dev, "Unknown device type\n");
 		return -EINVAL;
@@ -184,6 +186,17 @@ static struct spi_driver wm8325_spi_driver = {
 	.suspend	= wm831x_spi_suspend,
 };
 
+static struct spi_driver wm8326_spi_driver = {
+	.driver = {
+		.name	= "wm8326",
+		.bus	= &spi_bus_type,
+		.owner	= THIS_MODULE,
+	},
+	.probe		= wm831x_spi_probe,
+	.remove		= __devexit_p(wm831x_spi_remove),
+	.suspend	= wm831x_spi_suspend,
+};
+
 static int __init wm831x_spi_init(void)
 {
 	int ret;
@@ -212,12 +225,17 @@ static int __init wm831x_spi_init(void)
 	if (ret != 0)
 		pr_err("Failed to register WM8325 SPI driver: %d\n", ret);
 
+	ret = spi_register_driver(&wm8326_spi_driver);
+	if (ret != 0)
+		pr_err("Failed to register WM8326 SPI driver: %d\n", ret);
+
 	return 0;
 }
 subsys_initcall(wm831x_spi_init);
 
 static void __exit wm831x_spi_exit(void)
 {
+	spi_unregister_driver(&wm8326_spi_driver);
 	spi_unregister_driver(&wm8325_spi_driver);
 	spi_unregister_driver(&wm8321_spi_driver);
 	spi_unregister_driver(&wm8320_spi_driver);
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index a1239c4..903280d 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -245,6 +245,7 @@ enum wm831x_parent {
 	WM8320 = 0x8320,
 	WM8321 = 0x8321,
 	WM8325 = 0x8325,
+	WM8326 = 0x8326,
 };
 
 struct wm831x {
-- 
1.7.1


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

* [PATCH 4/7] mfd: Convert WM831x to new irq_ interrupt methods
  2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
                   ` (2 preceding siblings ...)
  2010-11-24 18:01 ` [PATCH 3/7] mfd: Add WM8326 support Mark Brown
@ 2010-11-24 18:01 ` Mark Brown
  2010-11-24 18:01 ` [PATCH 5/7] mfd: Convert WM835x " Mark Brown
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-24 18:01 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

Kernel 2.6.37 adds new interrupt methods which take a struct irq_data
rather than an irq number. Convert over to these as they will become
mandatory in future.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm831x-irq.c |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c
index 294183b..eae5272 100644
--- a/drivers/mfd/wm831x-irq.c
+++ b/drivers/mfd/wm831x-irq.c
@@ -345,16 +345,16 @@ static inline struct wm831x_irq_data *irq_to_wm831x_irq(struct wm831x *wm831x,
 	return &wm831x_irqs[irq - wm831x->irq_base];
 }
 
-static void wm831x_irq_lock(unsigned int irq)
+static void wm831x_irq_lock(struct irq_data *data)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
+	struct wm831x *wm831x = data->chip_data;
 
 	mutex_lock(&wm831x->irq_lock);
 }
 
-static void wm831x_irq_sync_unlock(unsigned int irq)
+static void wm831x_irq_sync_unlock(struct irq_data *data)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
+	struct wm831x *wm831x = data->chip_data;
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) {
@@ -371,28 +371,30 @@ static void wm831x_irq_sync_unlock(unsigned int irq)
 	mutex_unlock(&wm831x->irq_lock);
 }
 
-static void wm831x_irq_unmask(unsigned int irq)
+static void wm831x_irq_unmask(struct irq_data *data)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
-	struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq);
+	struct wm831x *wm831x = data->chip_data;
+	struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x,
+							     data->irq);
 
 	wm831x->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask;
 }
 
-static void wm831x_irq_mask(unsigned int irq)
+static void wm831x_irq_mask(struct irq_data *data)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
-	struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq);
+	struct wm831x *wm831x = data->chip_data;
+	struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x,
+							     data->irq);
 
 	wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask;
 }
 
-static int wm831x_irq_set_type(unsigned int irq, unsigned int type)
+static int wm831x_irq_set_type(struct irq_data *data, unsigned int type)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
-	int val;
+	struct wm831x *wm831x = data->chip_data;
+	int val, irq;
 
-	irq = irq - wm831x->irq_base;
+	irq = data->irq - wm831x->irq_base;
 
 	if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) {
 		/* Ignore internal-only IRQs */
@@ -421,12 +423,12 @@ static int wm831x_irq_set_type(unsigned int irq, unsigned int type)
 }
 
 static struct irq_chip wm831x_irq_chip = {
-	.name = "wm831x",
-	.bus_lock = wm831x_irq_lock,
-	.bus_sync_unlock = wm831x_irq_sync_unlock,
-	.mask = wm831x_irq_mask,
-	.unmask = wm831x_irq_unmask,
-	.set_type = wm831x_irq_set_type,
+	.name			= "wm831x",
+	.irq_bus_lock		= wm831x_irq_lock,
+	.irq_bus_sync_unlock	= wm831x_irq_sync_unlock,
+	.irq_mask		= wm831x_irq_mask,
+	.irq_unmask		= wm831x_irq_unmask,
+	.irq_set_type		= wm831x_irq_set_type,
 };
 
 /* The processing of the primary interrupt occurs in a thread so that
-- 
1.7.1


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

* [PATCH 5/7] mfd: Convert WM835x to new irq_ interrupt methods
  2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
                   ` (3 preceding siblings ...)
  2010-11-24 18:01 ` [PATCH 4/7] mfd: Convert WM831x to new irq_ interrupt methods Mark Brown
@ 2010-11-24 18:01 ` Mark Brown
  2010-11-24 18:01 ` [PATCH 6/7] mfd: Convert WM8994 " Mark Brown
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-24 18:01 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

Kernel 2.6.37 adds new interrupt methods which take a struct irq_data
rather than an irq number. Convert over to these as they will become
mandatory in future.

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

diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c
index f56c9ad..ba966ae 100644
--- a/drivers/mfd/wm8350-irq.c
+++ b/drivers/mfd/wm8350-irq.c
@@ -417,16 +417,16 @@ static irqreturn_t wm8350_irq(int irq, void *irq_data)
 	return IRQ_HANDLED;
 }
 
-static void wm8350_irq_lock(unsigned int irq)
+static void wm8350_irq_lock(struct irq_data *data)
 {
-	struct wm8350 *wm8350 = get_irq_chip_data(irq);
+	struct wm8350 *wm8350 = data->chip_data;
 
 	mutex_lock(&wm8350->irq_lock);
 }
 
-static void wm8350_irq_sync_unlock(unsigned int irq)
+static void wm8350_irq_sync_unlock(struct irq_data *data)
 {
-	struct wm8350 *wm8350 = get_irq_chip_data(irq);
+	struct wm8350 *wm8350 = data->chip_data;
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(wm8350->irq_masks); i++) {
@@ -442,28 +442,30 @@ static void wm8350_irq_sync_unlock(unsigned int irq)
 	mutex_unlock(&wm8350->irq_lock);
 }
 
-static void wm8350_irq_enable(unsigned int irq)
+static void wm8350_irq_enable(struct irq_data *data)
 {
-	struct wm8350 *wm8350 = get_irq_chip_data(irq);
-	struct wm8350_irq_data *irq_data = irq_to_wm8350_irq(wm8350, irq);
+	struct wm8350 *wm8350 = data->chip_data;
+	struct wm8350_irq_data *irq_data = irq_to_wm8350_irq(wm8350,
+							     data->irq);
 
 	wm8350->irq_masks[irq_data->reg] &= ~irq_data->mask;
 }
 
-static void wm8350_irq_disable(unsigned int irq)
+static void wm8350_irq_disable(struct irq_data *data)
 {
-	struct wm8350 *wm8350 = get_irq_chip_data(irq);
-	struct wm8350_irq_data *irq_data = irq_to_wm8350_irq(wm8350, irq);
+	struct wm8350 *wm8350 = data->chip_data;
+	struct wm8350_irq_data *irq_data = irq_to_wm8350_irq(wm8350,
+							     data->irq);
 
 	wm8350->irq_masks[irq_data->reg] |= irq_data->mask;
 }
 
 static struct irq_chip wm8350_irq_chip = {
-	.name = "wm8350",
-	.bus_lock = wm8350_irq_lock,
-	.bus_sync_unlock = wm8350_irq_sync_unlock,
-	.disable = wm8350_irq_disable,
-	.enable = wm8350_irq_enable,
+	.name			= "wm8350",
+	.irq_bus_lock		= wm8350_irq_lock,
+	.irq_bus_sync_unlock	= wm8350_irq_sync_unlock,
+	.irq_disable		= wm8350_irq_disable,
+	.irq_enable		= wm8350_irq_enable,
 };
 
 int wm8350_irq_init(struct wm8350 *wm8350, int irq,
-- 
1.7.1


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

* [PATCH 6/7] mfd: Convert WM8994 to new irq_ interrupt methods
  2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
                   ` (4 preceding siblings ...)
  2010-11-24 18:01 ` [PATCH 5/7] mfd: Convert WM835x " Mark Brown
@ 2010-11-24 18:01 ` Mark Brown
  2010-11-24 18:01 ` [PATCH 7/7] mfd: Add initial WM8958 support Mark Brown
  2010-11-26 14:05 ` [PATCH 0/7] Wolfson MFD updates Samuel Ortiz
  7 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-24 18:01 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

Kernel 2.6.37 adds new interrupt methods which take a struct irq_data
rather than an irq number. Convert over to these as they will become
mandatory in future.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/mfd/wm8994-irq.c |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c
index 8400eb1..6259884 100644
--- a/drivers/mfd/wm8994-irq.c
+++ b/drivers/mfd/wm8994-irq.c
@@ -156,16 +156,16 @@ static inline struct wm8994_irq_data *irq_to_wm8994_irq(struct wm8994 *wm8994,
 	return &wm8994_irqs[irq - wm8994->irq_base];
 }
 
-static void wm8994_irq_lock(unsigned int irq)
+static void wm8994_irq_lock(struct irq_data *data)
 {
-	struct wm8994 *wm8994 = get_irq_chip_data(irq);
+	struct wm8994 *wm8994 = data->chip_data;
 
 	mutex_lock(&wm8994->irq_lock);
 }
 
-static void wm8994_irq_sync_unlock(unsigned int irq)
+static void wm8994_irq_sync_unlock(struct irq_data *data)
 {
-	struct wm8994 *wm8994 = get_irq_chip_data(irq);
+	struct wm8994 *wm8994 = data->chip_data;
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(wm8994->irq_masks_cur); i++) {
@@ -182,28 +182,30 @@ static void wm8994_irq_sync_unlock(unsigned int irq)
 	mutex_unlock(&wm8994->irq_lock);
 }
 
-static void wm8994_irq_unmask(unsigned int irq)
+static void wm8994_irq_unmask(struct irq_data *data)
 {
-	struct wm8994 *wm8994 = get_irq_chip_data(irq);
-	struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994, irq);
+	struct wm8994 *wm8994 = data->chip_data;
+	struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994,
+							     data->irq);
 
 	wm8994->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask;
 }
 
-static void wm8994_irq_mask(unsigned int irq)
+static void wm8994_irq_mask(struct irq_data *data)
 {
-	struct wm8994 *wm8994 = get_irq_chip_data(irq);
-	struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994, irq);
+	struct wm8994 *wm8994 = data->chip_data;
+	struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994,
+							     data->irq);
 
 	wm8994->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask;
 }
 
 static struct irq_chip wm8994_irq_chip = {
-	.name = "wm8994",
-	.bus_lock = wm8994_irq_lock,
-	.bus_sync_unlock = wm8994_irq_sync_unlock,
-	.mask = wm8994_irq_mask,
-	.unmask = wm8994_irq_unmask,
+	.name			= "wm8994",
+	.irq_bus_lock		= wm8994_irq_lock,
+	.irq_bus_sync_unlock	= wm8994_irq_sync_unlock,
+	.irq_mask		= wm8994_irq_mask,
+	.irq_unmask		= wm8994_irq_unmask,
 };
 
 /* The processing of the primary interrupt occurs in a thread so that
-- 
1.7.1


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

* [PATCH 7/7] mfd: Add initial WM8958 support
  2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
                   ` (5 preceding siblings ...)
  2010-11-24 18:01 ` [PATCH 6/7] mfd: Convert WM8994 " Mark Brown
@ 2010-11-24 18:01 ` Mark Brown
  2010-11-26 14:05 ` [PATCH 0/7] Wolfson MFD updates Samuel Ortiz
  7 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-24 18:01 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches, Mark Brown

The WM8958 is a derivative of the WM8994 which is register compatible
with the addition of some extra features, mostly in the CODEC side.
The major change visible at the MFD level is that rather than a single
DBVDD supply we now have three separate DBVDDs so we must request and
enable a different set of supplies.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---

As the bulk of the work for this device is in the CODEC driver it would
be great if we could merge it via the ASoC tree.

 drivers/mfd/wm8994-core.c       |   93 +++++++++++++++++++++++++++++++--------
 include/linux/mfd/wm8994/core.h |    8 +++
 2 files changed, 82 insertions(+), 19 deletions(-)

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index b3b2aaf..8d221ba 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -218,6 +218,18 @@ static const char *wm8994_main_supplies[] = {
 	"SPKVDD2",
 };
 
+static const char *wm8958_main_supplies[] = {
+	"DBVDD1",
+	"DBVDD2",
+	"DBVDD3",
+	"DCVDD",
+	"AVDD1",
+	"AVDD2",
+	"CPVDD",
+	"SPKVDD1",
+	"SPKVDD2",
+};
+
 #ifdef CONFIG_PM
 static int wm8994_device_suspend(struct device *dev)
 {
@@ -239,7 +251,7 @@ static int wm8994_device_suspend(struct device *dev)
 	if (ret < 0)
 		dev_err(dev, "Failed to save LDO registers: %d\n", ret);
 
-	ret = regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
+	ret = regulator_bulk_disable(wm8994->num_supplies,
 				     wm8994->supplies);
 	if (ret != 0) {
 		dev_err(dev, "Failed to disable supplies: %d\n", ret);
@@ -254,7 +266,7 @@ static int wm8994_device_resume(struct device *dev)
 	struct wm8994 *wm8994 = dev_get_drvdata(dev);
 	int ret;
 
-	ret = regulator_bulk_enable(ARRAY_SIZE(wm8994_main_supplies),
+	ret = regulator_bulk_enable(wm8994->num_supplies,
 				    wm8994->supplies);
 	if (ret != 0) {
 		dev_err(dev, "Failed to enable supplies: %d\n", ret);
@@ -305,9 +317,10 @@ static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo)
 /*
  * Instantiate the generic non-control parts of the device.
  */
-static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
+static int wm8994_device_init(struct wm8994 *wm8994, int irq)
 {
 	struct wm8994_pdata *pdata = wm8994->dev->platform_data;
+	const char *devname;
 	int ret, i;
 
 	mutex_init(&wm8994->io_lock);
@@ -323,25 +336,48 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
 		goto err;
 	}
 
+	switch (wm8994->type) {
+	case WM8994:
+		wm8994->num_supplies = ARRAY_SIZE(wm8994_main_supplies);
+		break;
+	case WM8958:
+		wm8994->num_supplies = ARRAY_SIZE(wm8958_main_supplies);
+		break;
+	default:
+		BUG();
+		return -EINVAL;
+	}
+
 	wm8994->supplies = kzalloc(sizeof(struct regulator_bulk_data) *
-				   ARRAY_SIZE(wm8994_main_supplies),
+				   wm8994->num_supplies,
 				   GFP_KERNEL);
 	if (!wm8994->supplies) {
 		ret = -ENOMEM;
 		goto err;
 	}
 
-	for (i = 0; i < ARRAY_SIZE(wm8994_main_supplies); i++)
-		wm8994->supplies[i].supply = wm8994_main_supplies[i];
-
-	ret = regulator_bulk_get(wm8994->dev, ARRAY_SIZE(wm8994_main_supplies),
+	switch (wm8994->type) {
+	case WM8994:
+		for (i = 0; i < ARRAY_SIZE(wm8994_main_supplies); i++)
+			wm8994->supplies[i].supply = wm8994_main_supplies[i];
+		break;
+	case WM8958:
+		for (i = 0; i < ARRAY_SIZE(wm8958_main_supplies); i++)
+			wm8994->supplies[i].supply = wm8958_main_supplies[i];
+		break;
+	default:
+		BUG();
+		return -EINVAL;
+	}
+		
+	ret = regulator_bulk_get(wm8994->dev, wm8994->num_supplies,
 				 wm8994->supplies);
 	if (ret != 0) {
 		dev_err(wm8994->dev, "Failed to get supplies: %d\n", ret);
 		goto err_supplies;
 	}
 
-	ret = regulator_bulk_enable(ARRAY_SIZE(wm8994_main_supplies),
+	ret = regulator_bulk_enable(wm8994->num_supplies,
 				    wm8994->supplies);
 	if (ret != 0) {
 		dev_err(wm8994->dev, "Failed to enable supplies: %d\n", ret);
@@ -353,7 +389,22 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
 		dev_err(wm8994->dev, "Failed to read ID register\n");
 		goto err_enable;
 	}
-	if (ret != 0x8994) {
+	switch (ret) {
+	case 0x8994:
+		devname = "WM8994";
+		if (wm8994->type != WM8994)
+			dev_warn(wm8994->dev, "Device registered as type %d\n",
+				 wm8994->type);
+		wm8994->type = WM8994;
+		break;
+	case 0x8958:
+		devname = "WM8958";
+		if (wm8994->type != WM8958)
+			dev_warn(wm8994->dev, "Device registered as type %d\n",
+				 wm8994->type);
+		wm8994->type = WM8958;
+		break;
+	default:
 		dev_err(wm8994->dev, "Device is not a WM8994, ID is %x\n",
 			ret);
 		ret = -EINVAL;
@@ -370,14 +421,16 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
 	switch (ret) {
 	case 0:
 	case 1:
-		dev_warn(wm8994->dev, "revision %c not fully supported\n",
-			'A' + ret);
+		if (wm8994->type == WM8994)
+			dev_warn(wm8994->dev,
+				 "revision %c not fully supported\n",
+				 'A' + ret);
 		break;
 	default:
-		dev_info(wm8994->dev, "revision %c\n", 'A' + ret);
 		break;
 	}
 
+	dev_info(wm8994->dev, "%s revision %c\n", devname, 'A' + ret);
 
 	if (pdata) {
 		wm8994->irq_base = pdata->irq_base;
@@ -423,10 +476,10 @@ static int wm8994_device_init(struct wm8994 *wm8994, unsigned long id, int irq)
 err_irq:
 	wm8994_irq_exit(wm8994);
 err_enable:
-	regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
+	regulator_bulk_disable(wm8994->num_supplies,
 			       wm8994->supplies);
 err_get:
-	regulator_bulk_free(ARRAY_SIZE(wm8994_main_supplies), wm8994->supplies);
+	regulator_bulk_free(wm8994->num_supplies, wm8994->supplies);
 err_supplies:
 	kfree(wm8994->supplies);
 err:
@@ -439,9 +492,9 @@ static void wm8994_device_exit(struct wm8994 *wm8994)
 {
 	mfd_remove_devices(wm8994->dev);
 	wm8994_irq_exit(wm8994);
-	regulator_bulk_disable(ARRAY_SIZE(wm8994_main_supplies),
+	regulator_bulk_disable(wm8994->num_supplies,
 			       wm8994->supplies);
-	regulator_bulk_free(ARRAY_SIZE(wm8994_main_supplies), wm8994->supplies);
+	regulator_bulk_free(wm8994->num_supplies, wm8994->supplies);
 	kfree(wm8994->supplies);
 	kfree(wm8994);
 }
@@ -506,8 +559,9 @@ static int wm8994_i2c_probe(struct i2c_client *i2c,
 	wm8994->read_dev = wm8994_i2c_read_device;
 	wm8994->write_dev = wm8994_i2c_write_device;
 	wm8994->irq = i2c->irq;
+	wm8994->type = id->driver_data;
 
-	return wm8994_device_init(wm8994, id->driver_data, i2c->irq);
+	return wm8994_device_init(wm8994, i2c->irq);
 }
 
 static int wm8994_i2c_remove(struct i2c_client *i2c)
@@ -535,7 +589,8 @@ static int wm8994_i2c_resume(struct i2c_client *i2c)
 #endif
 
 static const struct i2c_device_id wm8994_i2c_id[] = {
-	{ "wm8994", 0 },
+	{ "wm8994", WM8994 },
+	{ "wm8958", WM8958 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id);
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index de79bae..3fd3684 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -17,6 +17,11 @@
 
 #include <linux/interrupt.h>
 
+enum wm8994_type {
+	WM8994 = 0,
+	WM8958 = 1,
+};
+
 struct regulator_dev;
 struct regulator_bulk_data;
 
@@ -48,6 +53,8 @@ struct wm8994 {
 	struct mutex io_lock;
 	struct mutex irq_lock;
 
+	enum wm8994_type type;
+
 	struct device *dev;
 	int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
 			int bytes, void *dest);
@@ -68,6 +75,7 @@ struct wm8994 {
 	u16 gpio_regs[WM8994_NUM_GPIO_REGS];
 
 	struct regulator_dev *dbvdd;
+	int num_supplies;
 	struct regulator_bulk_data *supplies;
 };
 
-- 
1.7.1


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

* Re: [PATCH 0/7] Wolfson MFD updates
  2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
                   ` (6 preceding siblings ...)
  2010-11-24 18:01 ` [PATCH 7/7] mfd: Add initial WM8958 support Mark Brown
@ 2010-11-26 14:05 ` Samuel Ortiz
  2010-11-26 14:07   ` Mark Brown
  7 siblings, 1 reply; 12+ messages in thread
From: Samuel Ortiz @ 2010-11-26 14:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches

Hi Mark,

On Wed, Nov 24, 2010 at 06:00:55PM +0000, Mark Brown wrote:
> This is a reposting of a number of Wolfson MFD patches previously posted
> - I seem to building up a relatively large queue of patches here.
> 
> Patch 1/7 is a bugfix and really ought to go into 2.6.37, patch 7/7
> would ideally be merged via ASoC as the bulk of the support for this
> device is in the CODEC driver, 2-3 are a new device and 4-6 are some
> housekeeping for new kernel APIs.
All 7 patches applied, thanks a lot.

Cheers,
Samuel.

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

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

* Re: [PATCH 0/7] Wolfson MFD updates
  2010-11-26 14:05 ` [PATCH 0/7] Wolfson MFD updates Samuel Ortiz
@ 2010-11-26 14:07   ` Mark Brown
  2010-11-26 14:51     ` Samuel Ortiz
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Brown @ 2010-11-26 14:07 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches

On Fri, Nov 26, 2010 at 03:05:19PM +0100, Samuel Ortiz wrote:
> On Wed, Nov 24, 2010 at 06:00:55PM +0000, Mark Brown wrote:

> > This is a reposting of a number of Wolfson MFD patches previously posted
> > - I seem to building up a relatively large queue of patches here.

> > Patch 1/7 is a bugfix and really ought to go into 2.6.37, patch 7/7
> > would ideally be merged via ASoC as the bulk of the support for this
> > device is in the CODEC driver, 2-3 are a new device and 4-6 are some
> > housekeeping for new kernel APIs.

> All 7 patches applied, thanks a lot.

Thanks!

Would it be OK to apply patch 7 to the ASoC tree?  There's a bunch of
CODEC driver changes to support the WM8958 which depend on it and also
depend on changes in the ASoC tree.

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

* Re: [PATCH 0/7] Wolfson MFD updates
  2010-11-26 14:07   ` Mark Brown
@ 2010-11-26 14:51     ` Samuel Ortiz
  2010-11-26 15:18       ` Mark Brown
  0 siblings, 1 reply; 12+ messages in thread
From: Samuel Ortiz @ 2010-11-26 14:51 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches

Hi Mark,

On Fri, Nov 26, 2010 at 02:07:19PM +0000, Mark Brown wrote:
> On Fri, Nov 26, 2010 at 03:05:19PM +0100, Samuel Ortiz wrote:
> > On Wed, Nov 24, 2010 at 06:00:55PM +0000, Mark Brown wrote:
> 
> > > This is a reposting of a number of Wolfson MFD patches previously posted
> > > - I seem to building up a relatively large queue of patches here.
> 
> > > Patch 1/7 is a bugfix and really ought to go into 2.6.37, patch 7/7
> > > would ideally be merged via ASoC as the bulk of the support for this
> > > device is in the CODEC driver, 2-3 are a new device and 4-6 are some
> > > housekeeping for new kernel APIs.
> 
> > All 7 patches applied, thanks a lot.
> 
> Thanks!
> 
> Would it be OK to apply patch 7 to the ASoC tree?  There's a bunch of
> CODEC driver changes to support the WM8958 which depend on it and also
> depend on changes in the ASoC tree.
Sure, I'm fine with that.

Cheers,
Samuel.


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

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

* Re: [PATCH 0/7] Wolfson MFD updates
  2010-11-26 14:51     ` Samuel Ortiz
@ 2010-11-26 15:18       ` Mark Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2010-11-26 15:18 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-kernel, patches

On Fri, Nov 26, 2010 at 03:51:52PM +0100, Samuel Ortiz wrote:
> On Fri, Nov 26, 2010 at 02:07:19PM +0000, Mark Brown wrote:

> > Would it be OK to apply patch 7 to the ASoC tree?  There's a bunch of
> > CODEC driver changes to support the WM8958 which depend on it and also
> > depend on changes in the ASoC tree.

> Sure, I'm fine with that.

OK, I've gone ahead and done that with your ack added - thanks!

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

end of thread, other threads:[~2010-11-26 15:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-24 18:00 [PATCH 0/7] Wolfson MFD updates Mark Brown
2010-11-24 18:01 ` [PATCH 2.6.37 1/7] mfd: Supply IRQ base for WM832x devices Mark Brown
2010-11-24 18:01 ` [PATCH 2/7] mfd: Simplify WM832x subdevice instantiation Mark Brown
2010-11-24 18:01 ` [PATCH 3/7] mfd: Add WM8326 support Mark Brown
2010-11-24 18:01 ` [PATCH 4/7] mfd: Convert WM831x to new irq_ interrupt methods Mark Brown
2010-11-24 18:01 ` [PATCH 5/7] mfd: Convert WM835x " Mark Brown
2010-11-24 18:01 ` [PATCH 6/7] mfd: Convert WM8994 " Mark Brown
2010-11-24 18:01 ` [PATCH 7/7] mfd: Add initial WM8958 support Mark Brown
2010-11-26 14:05 ` [PATCH 0/7] Wolfson MFD updates Samuel Ortiz
2010-11-26 14:07   ` Mark Brown
2010-11-26 14:51     ` Samuel Ortiz
2010-11-26 15:18       ` Mark Brown

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