From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Charles Keepax <ckeepax@opensource.cirrus.com>,
Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>,
david.rhodes@cirrus.com, rf@opensource.cirrus.com,
lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
linux-sound@vger.kernel.org, patches@opensource.cirrus.com,
linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 6.19-6.6] ASoC: cs42l43: Report insert for exotic peripherals
Date: Thu, 5 Mar 2026 10:36:50 -0500 [thread overview]
Message-ID: <20260305153704.106918-7-sashal@kernel.org> (raw)
In-Reply-To: <20260305153704.106918-1-sashal@kernel.org>
From: Charles Keepax <ckeepax@opensource.cirrus.com>
[ Upstream commit 6510e1324bcdc8caf21f6d17efe27604c48f0d64 ]
For some exotic peripherals the type detect can return a reserved value
of 0x4. This will currently return an error and not report anything to
user-space, update this to report the insert normally.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260223093616.3800350-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Analysis
### What the commit does
This is a one-line fix to the CS42L43 audio codec's jack type detection.
The hardware's type detect register can return a reserved value of `0x4`
for "exotic peripherals." Before this fix, value `0x4` falls through to
the `default: return -EINVAL` case in the switch statement.
### What happens when -EINVAL is returned
The caller `cs42l43_tip_sense_work()` checks `if (report < 0)` and on
error:
1. Logs `"Jack detect failed: %d\n"`
2. Jumps to `error:` label
3. **No jack insert event is reported to userspace**
This means users with these "exotic peripherals" get no audio jack
detection at all — the device appears to not be plugged in.
### Bug classification
This is a **hardware quirk/workaround** — the hardware returns a
reserved value for certain real peripherals. The fix treats type `0x4`
the same as CTIA/OMTP (running load detection with headset=true), which
allows the system to properly detect and report the insert.
### Stable criteria assessment
1. **Fixes a real bug**: Yes — exotic peripherals are completely non-
functional without this fix (no insert reported to userspace)
2. **Obviously correct**: Yes — the fix adds one case label to treat
`0x4` like other headset types. The author (Charles Keepax) is the
subsystem maintainer at Cirrus Logic.
3. **Small and contained**: Yes — one line added to a switch statement
in a single file
4. **No new features**: Correct — this just makes existing hardware work
properly
5. **Risk**: Extremely low — it only affects the `0x4` type value which
previously returned an error anyway
This falls squarely into the **hardware quirks/workarounds** exception
category. The CS42L43 driver has been in the kernel since v6.6
(introduced August 2023, merged for 6.6-rc1), so it exists in recent
stable trees.
### Verification
- Explored `cs42l43_tip_sense_work()` at line ~766: confirmed that
negative return from `cs42l43_run_type_detect()` goes to `error:`
label without reporting jack state to userspace
- Confirmed the file was introduced in commit `fc918cbe874ee` (August 4,
2023) — present since v6.6
- Confirmed the author Charles Keepax is the original driver author and
Cirrus Logic engineer
- The commit was reviewed and merged by Mark Brown (ASoC maintainer)
- Multiple prior commits show ongoing type detection refinement for this
codec (dc96528b176fa, e77a4081d7e32, etc.)
- The change is a single `case 0x4:` fallthrough to the existing
CTIA/OMTP handler — no new code paths introduced
The fix is small, surgical, low-risk, and makes real hardware work for
users. It clearly meets stable kernel criteria.
**YES**
sound/soc/codecs/cs42l43-jack.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/codecs/cs42l43-jack.c b/sound/soc/codecs/cs42l43-jack.c
index b83bc4de1301d..3e04e6897b142 100644
--- a/sound/soc/codecs/cs42l43-jack.c
+++ b/sound/soc/codecs/cs42l43-jack.c
@@ -699,6 +699,7 @@ static int cs42l43_run_type_detect(struct cs42l43_codec *priv)
switch (type & CS42L43_HSDET_TYPE_STS_MASK) {
case 0x0: // CTIA
case 0x1: // OMTP
+ case 0x4:
return cs42l43_run_load_detect(priv, true);
case 0x2: // 3-pole
return cs42l43_run_load_detect(priv, false);
--
2.51.0
next prev parent reply other threads:[~2026-03-05 15:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 15:36 [PATCH AUTOSEL 6.19-6.18] scsi: ufs: core: Reset urgent_bkops_lvl to allow runtime PM power mode Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-5.10] unshare: fix unshare_fs() handling Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-6.12] drm/amdgpu/vcn5: Add SMU dpm interface type Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-6.1] wifi: mac80211: set default WMM parameters on all links Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-5.15] ALSA: usb-audio: Check max frame size for implicit feedback mode, too Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-5.10] scsi: ses: Fix devices attaching to different hosts Sasha Levin
2026-03-05 15:36 ` Sasha Levin [this message]
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-5.15] ALSA: usb-audio: Avoid implicit feedback mode on DIYINHK USB Audio 2.0 Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-5.10] ACPI: PM: Save NVS memory on Lenovo G70-35 Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-5.10] scsi: storvsc: Fix scheduling while atomic on PREEMPT_RT Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-6.1] ASoC: amd: yc: Add ASUS EXPERTBOOK BM1503CDA to quirk table Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-5.10] ACPI: OSI: Add DMI quirk for Acer Aspire One D255 Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-6.18] fs: init flags_valid before calling vfs_fileattr_get Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-6.6] scsi: ufs: core: Fix possible NULL pointer dereference in ufshcd_add_command_trace() Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-6.18] perf/core: Fix refcount bug and potential UAF in perf_mmap Sasha Levin
2026-03-05 15:36 ` [PATCH AUTOSEL 6.19-6.6] scsi: ufs: core: Fix shift out of bounds when MAXQ=32 Sasha Levin
2026-03-05 15:37 ` [PATCH AUTOSEL 6.19-5.15] scsi: mpi3mr: Add NULL checks when resetting request and reply queues Sasha Levin
2026-03-05 15:37 ` [PATCH AUTOSEL 6.19-6.12] ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter Sasha Levin
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=20260305153704.106918-7-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=david.rhodes@cirrus.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=rf@opensource.cirrus.com \
--cc=stable@vger.kernel.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