summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-03 07:58:55 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-03 08:34:26 +0100
commite874de436f6c7ddbcca1e1fb7edd4d05ad274048 (patch)
tree3e27bd9a7d8e3c1d078dd584165b1c770aa0b190 /sound/soc
parentASoC: wm8994: Support custom accessory identification for WM1811A (diff)
downloadlinux-e874de436f6c7ddbcca1e1fb7edd4d05ad274048.tar.xz
linux-e874de436f6c7ddbcca1e1fb7edd4d05ad274048.zip
ASoC: wm8994: Check jack is inserted when handling mic IRQ
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>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm8994.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 1dcccdbbc8b6..fdef56c1320b 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -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