Skip to contentSkip to conversation

mfd: Convert WM831x interrupt masking to enable/disable operations

PATCH In review Mark Brown 2 participants 4 messages Mar 1, 2011 – Mar 2, 2011

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/3 mfd: Convert WM831x interrupt masking to enable/disable operations

The WM831x interrupt masking support is a much better match for the genirq enable and disable operations than for the mask and unmask operations. The latter are intended to used during interrupt handling for temporary changes which isn't really practical on a slow bus. Convert the operations over to match this.

---
 drivers/mfd/wm831x-irq.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
drivers/mfd/wm831x-irq.c +8 -4
index 2e45f60..a5cd17e 100644
@@ -352,6 +352,10 @@ static void wm831x_irq_sync_unlock(struct irq_data *data)
 		/* If there's been a change in the mask write it back
 		 * to the hardware. */
 		if (wm831x->irq_masks_cur[i] != wm831x->irq_masks_cache[i]) {
+			dev_dbg(wm831x->dev, "IRQ mask sync: %x = %x\n",
+				WM831X_INTERRUPT_STATUS_1_MASK + i,
+				wm831x->irq_masks_cur[i]);
+
 			wm831x->irq_masks_cache[i] = wm831x->irq_masks_cur[i];
 			wm831x_reg_write(wm831x,
 					 WM831X_INTERRUPT_STATUS_1_MASK + i,
@@ -362,7 +366,7 @@ static void wm831x_irq_sync_unlock(struct irq_data *data)
 	mutex_unlock(&wm831x->irq_lock);
 }
 
-static void wm831x_irq_unmask(struct irq_data *data)
+static void wm831x_irq_enable(struct irq_data *data)
 {
 	struct wm831x *wm831x = irq_data_get_irq_chip_data(data);
 	struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x,
@@ -371,7 +375,7 @@ static void wm831x_irq_unmask(struct irq_data *data)
 	wm831x->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask;
 }
 
-static void wm831x_irq_mask(struct irq_data *data)
+static void wm831x_irq_disable(struct irq_data *data)
 {
 	struct wm831x *wm831x = irq_data_get_irq_chip_data(data);
 	struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x,
@@ -417,8 +421,8 @@ static struct irq_chip wm831x_irq_chip = {
 	.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_disable		= wm831x_irq_disable,
+	.irq_enable		= wm831x_irq_enable,
 	.irq_set_type		= wm831x_irq_set_type,
 };
 
Signature · 1 line
1.7.2.3
author
#1 lore raw

PATCH 2/3 mfd: Convert WM8994/58 interrupt masking to enable/disable operations

The WM8994/58 interrupt masking support is a much better match for the genirq enable and disable operations than for the mask and unmask operations. The latter are intended to used during interrupt handling for temporary changes which isn't really practical on a slow bus. Convert the operations over to match this.

---
 drivers/mfd/wm8994-irq.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/wm8994-irq.c +4 -4
index 29e8faf..f5e439a 100644
@@ -182,7 +182,7 @@ static void wm8994_irq_sync_unlock(struct irq_data *data)
 	mutex_unlock(&wm8994->irq_lock);
 }
 
-static void wm8994_irq_unmask(struct irq_data *data)
+static void wm8994_irq_enable(struct irq_data *data)
 {
 	struct wm8994 *wm8994 = irq_data_get_irq_chip_data(data);
 	struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994,
@@ -191,7 +191,7 @@ static void wm8994_irq_unmask(struct irq_data *data)
 	wm8994->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask;
 }
 
-static void wm8994_irq_mask(struct irq_data *data)
+static void wm8994_irq_disable(struct irq_data *data)
 {
 	struct wm8994 *wm8994 = irq_data_get_irq_chip_data(data);
 	struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994,
@@ -204,8 +204,8 @@ static struct irq_chip wm8994_irq_chip = {
 	.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,
+	.irq_disable		= wm8994_irq_disable,
+	.irq_enable		= wm8994_irq_enable,
 };
 
 /* The processing of the primary interrupt occurs in a thread so that
Signature · 1 line
1.7.2.3
author
#2 lore raw

PATCH 3/3 mfd: Add platform data to support multiple WM831x devices per board

In reply to Mark Brown

If a system contains multiple WM831x devices we need to pass a device number through to the MFD so that we use unique device IDs when we instantiate child devices. In order to get support for this into 2.6.39 add some platform data to support the configuration, but no implementation as yet.

---
 include/linux/mfd/wm831x/pdata.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/mfd/wm831x/pdata.h +3 -0
index ac3aa73..afe4db4 100644
@@ -104,6 +104,9 @@ struct wm831x_watchdog_pdata {
 #define WM831X_MAX_ISINK  2
 
 struct wm831x_pdata {
+	/** Used to distinguish multiple WM831x chips */
+	int wm831x_num;
+
 	/** Called before subdevices are set up */
 	int (*pre_init)(struct wm831x *wm831x);
 	/** Called after subdevices are set up */
Signature · 1 line
1.7.2.3
#3 lore raw
In reply to Mark Brown

Hi Mark,

Quoted 5 lines · Mark Brown

The WM831x interrupt masking support is a much better match for the genirq enable and disable operations than for the mask and unmask operations. The latter are intended to used during interrupt handling for temporary changes which isn't really practical on a slow bus. Convert the operations over to match this.

All 3 patches applied, thanks a lot.

Cheers,
Samuel.

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/