ASoC: wcd9xxx: Avoid plug type re-determination
In the case where there is mechanical interrupt
at the same time when polling scheduled for execution,
we should make sure that if plug type is found and reported
by the polling, re-determination from the insertion irq
should be avoided. Add a check in the insertion irq before
proceeding further to determine the plug type.
Change-Id: I0da017073700d3a362b6175f1292d603885b7ab1
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
diff --git a/sound/soc/codecs/wcd9xxx-mbhc.c b/sound/soc/codecs/wcd9xxx-mbhc.c
index 88f46fa..eea4316 100644
--- a/sound/soc/codecs/wcd9xxx-mbhc.c
+++ b/sound/soc/codecs/wcd9xxx-mbhc.c
@@ -2850,6 +2850,10 @@
/* cancel detect plug */
wcd9xxx_cancel_hs_detect_plug(mbhc,
&mbhc->correct_plug_swch);
+ if ((mbhc->current_plug != PLUG_TYPE_NONE) &&
+ !(snd_soc_read(codec, WCD9XXX_A_MBHC_INSERT_DETECT) &
+ (1 << 1)))
+ goto exit;
/* Disable Mic Bias pull down and HPH Switch to GND */
snd_soc_update_bits(codec, mbhc->mbhc_bias_regs.ctl_reg, 0x01,
@@ -2902,7 +2906,7 @@
wcd9xxx_turn_onoff_override(mbhc, false);
}
}
-
+exit:
mbhc->in_swch_irq_handler = false;
WCD9XXX_BCL_UNLOCK(mbhc->resmgr);
pr_debug("%s: leave\n", __func__);