]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: wm8994: Check jack is inserted when handling mic IRQ
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 3 Dec 2012 06:58:55 +0000 (15:58 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 3 Dec 2012 07:34:26 +0000 (16:34 +0900)
If we've got jack detection support then check that the jack is still
inserted when handling a mic IRQ in order to avoid transient reports
caused by shorts during the removal process as the two interrupts race
with each other.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm8994.c

index 1dcccdbbc8b6fec6330e9e015960855f55bb2651..fdef56c1320b15612958e9278612a661b01ffd5d 100644 (file)
@@ -3755,6 +3755,18 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
        trace_snd_soc_jack_irq(dev_name(codec->dev));
 #endif
 
+       /* Avoid a transient report when the accessory is being removed */
+       if (wm8994->jackdet) {
+               reg = snd_soc_read(codec, WM1811_JACKDET_CTRL);
+               if (reg < 0) {
+                       dev_err(codec->dev, "Failed to read jack status: %d\n",
+                               reg);
+               } else if (!(reg & WM1811_JACKDET_LVL)) {
+                       dev_dbg(codec->dev, "Ignoring removed jack\n");
+                       return IRQ_HANDLED;
+               }
+       }
+
        if (wm8994->mic_detecting)
                wm8958_mic_id(codec, reg);
        else