Skip to contentSkip to conversation

ASoC: qcom: sc8280xp: recreate the headset jack on card rebind for WCD codecs

PATCH New Vladyslav Tymoshchuk 1 participant 1 message Nov 29

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: qcom: sc8280xp: recreate the headset jack on card rebind for WCD codecs

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")

---
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(-)
sound/soc/qcom/sc8280xp.c +14 -4
index ac4dfb2c2182..15252e800c53 100644
@@ -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 = {
Signature · 1 line
2.43.0