Skip to content
/ linux Public

Commit f378c3e

Browse files
dos1Sasha Levin
authored andcommitted
ASoC: wm8962: Don't report a microphone if it's shorted to ground on plug
[ Upstream commit e590752 ] 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>
1 parent 59d549d commit f378c3e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sound/soc/codecs/wm8962.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ struct wm8962_priv {
6767
struct mutex dsp2_ena_lock;
6868
u16 dsp2_ena;
6969

70+
int mic_status;
71+
7072
struct delayed_work mic_work;
7173
struct snd_soc_jack *jack;
7274

@@ -3073,8 +3075,16 @@ static void wm8962_mic_work(struct work_struct *work)
30733075
if (reg & WM8962_MICSHORT_STS) {
30743076
status |= SND_JACK_BTN_0;
30753077
irq_pol |= WM8962_MICSCD_IRQ_POL;
3078+
3079+
/* Don't report a microphone if it's shorted right after
3080+
* plugging in, as this may be a TRS plug in a TRRS socket.
3081+
*/
3082+
if (!(wm8962->mic_status & WM8962_MICDET_STS))
3083+
status = 0;
30763084
}
30773085

3086+
wm8962->mic_status = status;
3087+
30783088
snd_soc_jack_report(wm8962->jack, status,
30793089
SND_JACK_MICROPHONE | SND_JACK_BTN_0);
30803090

0 commit comments

Comments
 (0)