Skip to content

Commit

Permalink
ASoC: wm8994: Check jack is inserted when handling mic IRQ
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Brown committed Dec 3, 2012
1 parent 63dd545 commit e874de4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sound/soc/codecs/wm8994.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e874de4

Please sign in to comment.