Skip to content
/ linux Public

Commit 677681a

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 669220b commit 677681a

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

@@ -3077,8 +3079,16 @@ static void wm8962_mic_work(struct work_struct *work)
30773079
if (reg & WM8962_MICSHORT_STS) {
30783080
status |= SND_JACK_BTN_0;
30793081
irq_pol |= WM8962_MICSCD_IRQ_POL;
3082+
3083+
/* Don't report a microphone if it's shorted right after
3084+
* plugging in, as this may be a TRS plug in a TRRS socket.
3085+
*/
3086+
if (!(wm8962->mic_status & WM8962_MICDET_STS))
3087+
status = 0;
30803088
}
30813089

3090+
wm8962->mic_status = status;
3091+
30823092
snd_soc_jack_report(wm8962->jack, status,
30833093
SND_JACK_MICROPHONE | SND_JACK_BTN_0);
30843094

0 commit comments

Comments
 (0)