From: Takashi Iwai <tiwai@suse.de>
To: Steven 'Steve' Kendall <skend@chromium.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda/cs8409: Fix for Dell Cirrus audio jack detect
Date: Tue, 14 Jul 2026 07:50:11 +0200 [thread overview]
Message-ID: <87qzl6jf1o.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260713-fix-headphone-plug-cirrus-dell-v1-1-3c5157cd45cd@chromium.org>
On Mon, 13 Jul 2026 23:21:41 +0200,
Steven 'Steve' Kendall wrote:
>
> On some models like the Dell Inspiron 15 3520, jack
> detection does not work. This patch switches to polling
> and more regularly queries the lower values rather
> than cached values for the headphone and mic jacks.
> It also includes some logic to prevent the polling
> while headphones are already plugged so no
> audible "tick" can be heard.
>
> ---
This makes the remaining text not taken by git-am.
And, I guess the text above should have been combined with the below?
> This patch switches to a polling method for a
> specific Dell machine (Inspiron 15 3520). This fixes
> jack detection for this model. It's possible the gate
> on manufacturer and model are unnecessary and this problem
> is common to a wider set of machines, but I've only tested
> on one machine thus far. I left the other logic ungated
> as it seemed likely the cache was not providing up-to-date
> information broadly. But I'm open to gating more or less
> of the content or changing the approach entirely.
The jack polling is really the last resort, and I'd like to know why
the normal jack detection doesn't work at first. Is it the missing
unsol event? Or the jack detection itself doesn't work?
If it's a missing unsol event, this drop happens always? Or on
certain runtime PM state?
thanks,
Takashi
>
> Signed-off-by: Steven 'Steve' Kendall <skend@chromium.org>
> ---
> sound/hda/codecs/cirrus/cs8409.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/sound/hda/codecs/cirrus/cs8409.c b/sound/hda/codecs/cirrus/cs8409.c
> index c43ff3ef75b6e..733234844e7df 100644
> --- a/sound/hda/codecs/cirrus/cs8409.c
> +++ b/sound/hda/codecs/cirrus/cs8409.c
> @@ -766,6 +766,9 @@ static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_
> /* TIP_SENSE INSERT/REMOVE */
> switch (reg_ts_status) {
> case CS42L42_TS_PLUG:
> + // if jack is already plugged, ignore plug event
> + if (cs42l42->hp_jack_in)
> + break;
> if (cs42l42->no_type_dect) {
> status_changed = 1;
> cs42l42->hp_jack_in = 1;
> @@ -776,6 +779,9 @@ static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_
> break;
>
> case CS42L42_TS_UNPLUG:
> + // if jack is already unplugged, ignore unplug event
> + if (!cs42l42->hp_jack_in && !cs42l42->mic_jack_in)
> + break;
> status_changed = 1;
> cs42l42->hp_jack_in = 0;
> cs42l42->mic_jack_in = 0;
> @@ -1092,12 +1098,14 @@ static int cs8409_cs42l42_exec_verb(struct hdac_device *dev, unsigned int cmd, u
> switch (nid) {
> case CS8409_CS42L42_HP_PIN_NID:
> if (verb == AC_VERB_GET_PIN_SENSE) {
> + cs42l42_jack_unsol_event(cs42l42);
> *res = (cs42l42->hp_jack_in) ? AC_PINSENSE_PRESENCE : 0;
> return 0;
> }
> break;
> case CS8409_CS42L42_AMIC_PIN_NID:
> if (verb == AC_VERB_GET_PIN_SENSE) {
> + cs42l42_jack_unsol_event(cs42l42);
> *res = (cs42l42->mic_jack_in) ? AC_PINSENSE_PRESENCE : 0;
> return 0;
> }
> @@ -1157,6 +1165,11 @@ void cs8409_cs42l42_fixups(struct hda_codec *codec, const struct hda_fixup *fix,
> case CS8409_WARLOCK_MLK_DUAL_MIC:
> spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_0DB;
> spec->speaker_pdn_gpio = CS8409_WARLOCK_SPEAKER_PDN;
> + // if Dell Inspiron 15 3520, poll jack at 250ms
> + if (codec->bus->pci->subsystem_vendor == 0x1028 &&
> + codec->bus->pci->subsystem_device == 0x0bb2) {
> + codec->jackpoll_interval = msecs_to_jiffies(250);
> + }
> break;
> default:
> spec->scodecs[CS8409_CODEC0]->full_scale_vol =
> @@ -1208,8 +1221,10 @@ void cs8409_cs42l42_fixups(struct hda_codec *codec, const struct hda_fixup *fix,
> * Run immediately after init.
> */
> if (spec->init_done && spec->build_ctrl_done
> - && !spec->scodecs[CS8409_CODEC0]->hp_jack_in)
> + && !spec->scodecs[CS8409_CODEC0]->hp_jack_in) {
> cs42l42_run_jack_detect(spec->scodecs[CS8409_CODEC0]);
> + cs42l42_enable_jack_detect(spec->scodecs[CS8409_CODEC0]);
> + }
> break;
> default:
> break;
>
> ---
> base-commit: d96fcfe1b7f94ac742984ae7986b94a116abff1b
> change-id: 20260710-fix-headphone-plug-cirrus-dell-5e3b49da5f52
>
> Best regards,
> --
> Steven 'Steve' Kendall <skend@chromium.org>
>
next prev parent reply other threads:[~2026-07-14 5:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 21:21 Steven 'Steve' Kendall
2026-07-14 5:50 ` Takashi Iwai [this message]
2026-07-14 19:51 ` Steven Kendall
2026-07-15 7:47 ` Takashi Iwai
2026-07-17 21:18 ` Steven Kendall
2026-07-14 16:17 ` Stefan Binding
2026-07-14 19:26 ` Steven Kendall
2026-07-15 15:16 ` Stefan Binding
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=87qzl6jf1o.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=skend@chromium.org \
--cc=tiwai@suse.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