summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorSebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>2026-01-05 04:02:10 +0100
committerSasha Levin <sashal@kernel.org>2026-03-04 07:20:39 -0500
commit822530fb85d869f0f8dace76d4ceae8aaeb03e65 (patch)
treef9f2fe10b72ccfc39919f2a988033a41773783e3 /sound
parent21f6e02a19105ed40ac84c16a01dafc4048089a6 (diff)
ASoC: wm8962: Don't report a microphone if it's shorted to ground on plug
[ Upstream commit e590752119029d87ce46d725e11245a52d22e1fe ] This usually means that a TRS plug with no microphone pin has been plugged into a TRRS socket. Cases where a user is plugging in a microphone while pressing a button will be handled via incoming interrupt after the user releases the button, so the microphone will still be detected once it becomes usable. Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://patch.msgid.link/20260105-wm8962-l5-fixes-v1-3-f4f4eeacf089@puri.sm Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm8962.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 8aaa91a16d8b..68a5ca176d6f 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -67,6 +67,8 @@ struct wm8962_priv {
struct mutex dsp2_ena_lock;
u16 dsp2_ena;
+ int mic_status;
+
struct delayed_work mic_work;
struct snd_soc_jack *jack;
@@ -3073,8 +3075,16 @@ static void wm8962_mic_work(struct work_struct *work)
if (reg & WM8962_MICSHORT_STS) {
status |= SND_JACK_BTN_0;
irq_pol |= WM8962_MICSCD_IRQ_POL;
+
+ /* Don't report a microphone if it's shorted right after
+ * plugging in, as this may be a TRS plug in a TRRS socket.
+ */
+ if (!(wm8962->mic_status & WM8962_MICDET_STS))
+ status = 0;
}
+ wm8962->mic_status = status;
+
snd_soc_jack_report(wm8962->jack, status,
SND_JACK_MICROPHONE | SND_JACK_BTN_0);