mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: qcom: sc8280xp: recreate the headset jack on card rebind for WCD codecs
@ 2026-11-29 14:25 Vladyslav Tymoshchuk
  0 siblings, 0 replies; only message in thread
From: Vladyslav Tymoshchuk @ 2026-11-29 14:25 UTC (permalink / raw)
  To: srini, broonie
  Cc: lgirdwood, perex, tiwai, tyler.baker, linux-sound, linux-arm-msm,
	linux-kernel

The headset jack is only created while jack_setup is false, and
sc8280xp_snd_exit() clears it only for the boards that set the jack up
on a codec link. On boards with a WCD codec it stays true, so after a
card rebind, for example after an ADSP restart, the jack is not created
again and the codec is given a jack that was already freed.

Clear it for the WCD boards too, like
commit 704251f9dad3 ("ASoC: qcom: x1e80100: recreate the headset jack on
card rebind") does for x1e80100.

Fixes: 295aeea6646a ("ASoC: qcom: add machine driver for sc8280xp")
Signed-off-by: Vladyslav Tymoshchuk <tvlad744@gmail.com>
---
Tested on a OnePlus Pad 3 (SM8750, WCD939x; the board DT is not upstream
yet): unbind and bind one of the speaker amplifiers, so that the card is
unbound and bound again, three times:

                       jack controls after the rebind
  without the change   0/3
  with the change      3/3

With the change the speakers stay selected. Without it PipeWire switched
to the headphones profile. An ADSP restart behaves the same (5 restarts
with the change). I did not test with headphones plugged in after the
rebind.

The test kernels are v7.3-rc5 plus board patches, where the driver has
no per-DAI data, so only the wcd_jack path was run. The kernel with the
change also had other patches for ADSP restart. On next-20261127 I only
built the patch.

I used an AI assistant (Claude) to find the problem and write the patch.

 sound/soc/qcom/sc8280xp.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c
index ac4dfb2c2182..15252e800c53 100644
--- a/sound/soc/qcom/sc8280xp.c
+++ b/sound/soc/qcom/sc8280xp.c
@@ -523,11 +523,21 @@ static void sc8280xp_snd_exit(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
 	const struct sc8280xp_dai_data *dai_data;
 
-	dai_data = sc8280xp_get_dai_data(data->priv, cpu_dai->id);
-	if (dai_data && dai_data->jack_setup == SC8280XP_JACK_SETUP_CODEC) {
-		qcom_snd_headset_jack_cleanup(rtd);
-		data->jack_setup = false;
+	switch (cpu_dai->id) {
+	case DISPLAY_PORT_RX_0:
+	case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
+		return;
+	default:
+		break;
 	}
+
+	dai_data = sc8280xp_get_dai_data(data->priv, cpu_dai->id);
+	if (dai_data ? dai_data->jack_setup == SC8280XP_JACK_SETUP_NONE :
+		       !data->priv->wcd_jack)
+		return;
+
+	qcom_snd_headset_jack_cleanup(rtd);
+	data->jack_setup = false;
 }
 
 static const struct snd_soc_ops sc8280xp_be_ops = {
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-29 14:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 14:25 [PATCH] ASoC: qcom: sc8280xp: recreate the headset jack on card rebind for WCD codecs Vladyslav Tymoshchuk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®