From 4cc48f6d035bbbf97bdb9d6b9ed54ae23b0af18a Mon Sep 17 00:00:00 2001 From: Ramesh Babu K V Date: Thu, 6 Oct 2011 16:18:24 +0100 Subject: [PATCH] ASoC: sn95031: fix to avoid spurious jack interrupts When jack insertion is detected, jack detection interrupt is disabled to avoid spurious interrupts. Jack detection interrupt will be re-enabled when jack removal is detected. Change-Id: Ie43a0e881beb03e657e441cd801f5c84ba6768b7 Signed-off-by: Vinod Koul Signed-off-by: Ramesh Babu K V --- sound/soc/codecs/sn95031.c | 10 +++++++++- sound/soc/codecs/sn95031.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index dbdebd7..3ca051c 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c @@ -1081,14 +1081,22 @@ void sn95031_jack_detection(struct mfld_jack_data *jack_data) pr_debug("headset or headphones inserted\n"); status = sn95031_get_headset_state(jack_data->mfld_jack); } else if (jack_data->intr_id & 0x8) { - pr_debug("headset or headphones removed\n"); + pr_debug("headset or headphones removed, disabling btn and enabling JACKDET\n"); status = 0; sn95031_disable_jack_btn(jack_data->mfld_jack->codec); + snd_soc_update_bits(jack_data->mfld_jack->codec, + SN95031_ACCDETMASK, BIT(2), 0); } else { pr_err("unidentified interrupt\n"); return; } + if ((status == SND_JACK_HEADSET) | (status == SND_JACK_HEADPHONE)) { + pr_debug("detected headset or headphone, disabling JACKDET\n"); + snd_soc_update_bits(jack_data->mfld_jack->codec, + SN95031_ACCDETMASK, BIT(2), BIT(2)); + } + snd_soc_jack_report(jack_data->mfld_jack, status, mask); #ifdef CONFIG_SWITCH_MID if (status) { diff --git a/sound/soc/codecs/sn95031.h b/sound/soc/codecs/sn95031.h index a17718c..f0152fc 100644 --- a/sound/soc/codecs/sn95031.h +++ b/sound/soc/codecs/sn95031.h @@ -28,6 +28,8 @@ #define _SN95031_H /*register map*/ +#define SN95031_ACCDETMASK 0x1E + #define SN95031_VAUD 0xDB #define SN95031_VHSP 0xDC #define SN95031_VHSN 0xDD -- 2.7.4