Skip to contentSkip to conversation

ASoC: Support edge triggered IRQs for WM8915

PATCH In review Mark Brown 2 participants 2 messages Jun 1, 2011

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: Support edge triggered IRQs for WM8915

Really this should be something the IRQ core can cope with for us but since it doesn't currently do so (at least for threaded interrupts like this) do so in the driver. This allows us to run with interrupt controllers that only support edge triggered interrupts.

---
 sound/soc/codecs/wm8915.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8915.c +22 -2
index a0b1a72..bb1ff2c 100644
@@ -2382,6 +2382,20 @@ static irqreturn_t wm8915_irq(int irq, void *data)
 	}
 }
 
+static irqreturn_t wm8915_edge_irq(int irq, void *data)
+{
+	irqreturn_t ret = IRQ_NONE;
+	irqreturn_t val;
+
+	do {
+		val = wm8915_irq(irq, data);
+		if (val != IRQ_NONE)
+			ret = val;
+	} while (val != IRQ_NONE);
+
+	return ret;
+}
+
 static void wm8915_retune_mobile_pdata(struct snd_soc_codec *codec)
 {
 	struct wm8915_priv *wm8915 = snd_soc_codec_get_drvdata(codec);
@@ -2708,8 +2722,14 @@ static int wm8915_probe(struct snd_soc_codec *codec)
 
 		irq_flags |= IRQF_ONESHOT;
 
-		ret = request_threaded_irq(i2c->irq, NULL, wm8915_irq,
-					   irq_flags, "wm8915", codec);
+		if (irq_flags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))
+			ret = request_threaded_irq(i2c->irq, NULL,
+						   wm8915_edge_irq,
+						   irq_flags, "wm8915", codec);
+		else
+			ret = request_threaded_irq(i2c->irq, NULL, wm8915_irq,
+						   irq_flags, "wm8915", codec);
+
 		if (ret == 0) {
 			/* Unmask the interrupt */
 			snd_soc_update_bits(codec, WM8915_INTERRUPT_CONTROL,
Signature · 1 line
1.7.5.3
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Mark Brown

Really this should be something the IRQ core can cope with for us but since it doesn't currently do so (at least for threaded interrupts like this) do so in the driver. This allows us to run with interrupt controllers that only support edge triggered interrupts.