mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladyslav Tymoshchuk <tvlad744@gmail.com>
To: srini@kernel.org, broonie@kernel.org
Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
	tyler.baker@oss.qualcomm.com, linux-sound@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: qcom: sc8280xp: recreate the headset jack on card rebind for WCD codecs
Date: Sun, 29 Nov 2026 16:25:12 +0200	[thread overview]
Message-ID: <20261129142512.1727-1-tvlad744@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-29 14:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261129142512.1727-1-tvlad744@gmail.com \
    --to=tvlad744@gmail.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=srini@kernel.org \
    --cc=tiwai@suse.com \
    --cc=tyler.baker@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®