[PATCH v1 0/2] ALSA: hda/cs420x: MacBook8,1 speakers and headset mic
From: Shih-Yuan Lee
Date: Tue Dec 01 2026 - 10:32:37 EST
This series adds audio support for the 12-inch MacBook (MacBook8,1,
codec SSID 106b:6400, Cirrus Logic CS4208), which currently has no
working internal speakers or headset microphone on mainline.
Patch 1 adds a CS4208_MB81 fixup for the four MAX98357B TDM speaker
amplifiers (digital pin 0x1d / converter 0x0a, enabled via GPIO0), with
a { FL, FR, NA, NA } channel map and GPIO0 automute on headphone
plug/unplug.
Patch 2 adds 4-pole TRRS headset mic support. Pin 0x18 has no
mechanical jack sense, so CTIA/OMTP/3-pole polarity is detected with the
CS4208 HS3/HS4 impedance detector and routed via NID 0x24 CIR 0x1a.
Userspace needs a matching alsa-ucm-conf profile (SplitPCM to expose the
4-channel TDM PCM as a stereo sink); I will send that once this is
settled. Background and reverse-engineering credits are in
https://bugzilla.kernel.org/show_bug.cgi?id=110561 (Leif Liddy,
Thomas Shirley, Zach Robinson and others).
Questions for review:
- Patch 1 locks the "IEC958 Default PCM Playback Switch" read-only in
HDA_FIXUP_ACT_BUILD to stop analog playback from being mirrored onto
the 4-channel TDM converter. Would you prefer a flag in
hda_gen_spec (e.g. no_share_spdif) that skips
snd_hda_create_spdif_share_sw() instead?
- Patch 2 calls snd_hda_gen_fix_pin_power() for pin 0x18, because
dyn_adc_switch does not propagate stream_enabled to the newly
selected input pin when switching an already open capture stream.
Should this be fixed in generic.c rather than worked around here?
Known limitations: speaker protection (pin 0x22 IV-sense) is not
implemented, so keep volume moderate. Only MacBook8,1 was tested;
MacBook9,1/10,1 share the hardware family but are not added.
Testing, on a real MacBook8,1 (Ubuntu 7.0.0-44-generic, built as an
out-of-tree module of this cs420x.c since no mainline kernel with this
base is installed there):
- Cold boot matches the quirk; speaker playback (4ch/44.1kHz/S16_LE
via UCM SplitPCM), headphone plug/unplug with GPIO0 automute,
internal mic, and TRRS headset mic hotplug all work.
- Runtime PM D3 -> D0 resume and S3 suspend/resume keep working. On
this machine the codec does not wake the HDA link from D3 on jack
plug/unplug, hence cs_init() re-runs debounced detection on resume.
- Caveat for S3: on this MacBook8,1 suspend/resume is only reliable
with three platform workarounds that are unrelated to this series:
the ACPI LID0 wakeup source is disabled (otherwise the machine
wakes again about 2 seconds after suspending with the lid open),
the WiFi/Bluetooth kernel modules are unloaded before suspending,
and my separate spi-pxa2xx patchset (currently under review) is
applied. Without those, suspend/resume fails or wakes up
immediately regardless of this driver.
- Analog headphone playback (hw:PCH,0, 48/96 kHz S32_LE) leaves
converter 0x0a idle (stream=0).
- checkpatch.pl --strict is clean, W=1 and sparse report nothing, and
each patch builds on its own on top of v7.4-rc5-era master.
- The locking and runtime-PM interaction of the headset detection
(hs_mutex vs. runtime PM, unplug vs. resume, unsol vs. resume) was
also modelled in SPIN and checked exhaustively.
Tool disclosure: I used an AI coding assistant for review feedback and
iteration on the code and for drafting parts of the changelogs, and the
SPIN model above was written with its help. I reviewed and tested
everything myself and take responsibility for the submission.
Shih-Yuan Lee (2):
ALSA: hda/cs420x: Add CS4208 TDM speaker fixup for MacBook8,1
ALSA: hda/cs420x: Support headset mic type detection on MacBook8,1
Documentation/sound/hd-audio/models.rst | 2 +
sound/hda/codecs/cirrus/cs420x.c | 751 +++++++++++++++++++++++-
2 files changed, 747 insertions(+), 6 deletions(-)
--
2.39.5