Skip to content

Enable speakers on pre-T2 MacBooks with the Cirrus CS8409 bridge - #8285

Open
jack-lech wants to merge 2 commits into
omacom:quattrofrom
jack-lech:apple-cs8409-audio
Open

jack-lech wants to merge 2 commits into
omacom:quattrofrom
jack-lech:apple-cs8409-audio

Conversation

@jack-lech

Copy link
Copy Markdown

Pre-T2 MacBooks built around the Cirrus CS8409 HDA bridge boot Omarchy with
completely silent speakers. The card enumerates, PipeWire shows a healthy
analog-stereo sink sitting on analog-output-speaker, nothing is muted — and
no sound comes out, which makes it look like a PipeWire routing problem rather
than a driver one.

The cause is that these machines switch their speaker amplifiers on over
GPIO/I2C, and the in-tree snd_hda_codec_cs8409 driver binds the codec without
ever enabling those lines. On a MacBookPro14,2 (subsystem 0x106b3600):

# in-tree driver — /proc/asound/card0/codec#0
GPIO: io=8
  IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  ...all eight at enable=0

$ amixer -c 0 scontrols
  -> only 'PCM' and mic controls; no Speaker or Headphone jacks at all

snd-hda-macbookpro-dkms-git replaces the module with a build that programs the
amps and brings up the CS42L83. Same machine afterwards:

GPIO: io=8
  IO[0]: enable=1, dir=0, wake=1, sticky=0, data=1, unsol=1
  IO[1]: enable=1, dir=1, wake=0, sticky=0, data=1, unsol=0
  IO[2]: enable=1 ... IO[3]: enable=1

$ aplay -l
  -> device 0: CS8409/CS42L83 Analog     (was "CS8409 Analog")

$ amixer -c 0 controls
  -> 'Speaker Front Phantom Jack', 'Speaker Surround Phantom Jack', 'Headphone Jack'

T2 Macs already get their audio through apple-t2-audio-config in fix-t2.sh.
This is the pre-T2 sibling of that fix, and every model the regex matches
predates the T2, so the two can't collide.

On installing linux-headers explicitly

This is the part I'd most like a second opinion on, because it's the reason the
bug is so easy to misdiagnose. Arch's DKMS pacman hook discovers kernels by
globbing usr/lib/modules/*/build (all_kver() in
/usr/share/libalpm/scripts/dkms). With no headers installed that glob matches
nothing, so the hook iterates zero kernels, builds nothing, and exits 0. The end
state is an installed package, an empty dkms status, and silent speakers —
with no error anywhere in the pacman output.

linux-headers is already in omarchy-other.packages, but that only guarantees
ISO availability, not that it's installed on the target. Since the hook is
PostTransaction and also triggers on usr/lib/modules/*/build/include/,
installing both in the same omarchy-pkg-add call is race-free.

Packaging note

snd-hda-macbookpro-dkms-git is AUR-only today. I've added it to
omarchy-other.packages on the assumption it should be built into the
[omarchy] repo the same way macbook12-spi-driver-dkms was, since no script
under install/ uses the AUR helper and omarchy-pkg-add goes through pacman.

That half needs you: it presumably requires a matching PKGBUILD in the
omarchy-pkgs repo, which isn't public, so this PR can't carry it. Until the
package exists in [omarchy], omarchy-pkg-add will fail on it
— so this
should probably land alongside (or after) that packaging change rather than
before it. Happy to restructure if you'd rather do the promotion separately, or
if you'd prefer the script call the AUR helper instead.

Testing

  • Verified on a MacBookPro14,2 (2017 13" Touch Bar, i5-7267U) on kernel 7.1.8:
    speakers and headphones both working after the driver builds and the machine
    reboots. The driver compiled clean against kernel 7.1.8 with gcc 16 with no
    patching.
  • Confirmed the detection matches this machine and that dkms status reports
    installed afterwards.
  • ./test/all: 202 of 205 test files pass. The three failures are
    config-test.sh, snapper-test.sh and unowned-system-paths-test.sh, all
    reporting a missing omarchy-pkgs checkout ("not ok - omarchy-pkgs checkout
    found for PKGBUILD coverage" and equivalents). I verified they fail
    identically on clean quattro without this change, so they're environmental
    rather than caused by it — but I can't run those three properly, so they're
    worth a look on your side given this PR touches omarchy-other.packages.

Scope

Limited to MacBookPro13,x / MacBookPro14,x, matching the regex already used
by fix-spi-keyboard.sh. The same driver also covers iMac18,x and iMac19,1
(subsystems 0x106b0e00/0f00/1000), but I have no way to test those, so I
left them out rather than guess at DMI strings. Easy to extend later if someone
with the hardware confirms.

The 2016-2017 MacBook Pros switch their speaker amplifiers on over GPIO/I2C,
and the in-tree snd_hda_codec_cs8409 driver binds the codec without ever
enabling those lines. The card enumerates and PipeWire reports a healthy
analog-stereo sink, so the machine looks fine while producing no sound.

Install snd-hda-macbookpro-dkms-git, which programs the amps and brings up the
CS42L83. T2 Macs take a different audio path and are already handled by
fix-t2.sh; every model matched here predates the T2.

linux-headers is installed by name because Arch's DKMS pacman hook discovers
kernels by globbing usr/lib/modules/*/build. With no headers present it builds
nothing and exits quietly, leaving an installed package, an empty dkms status
and silent speakers.

Co-Authored-By: Claude Opus 5 <[email protected]>
@j7j7

j7j7 commented Sep 1, 2026

Copy link
Copy Markdown

Draft note about iMac18/19 is covered in #9516 (builds on #7140, uses the omarchy-pkgs DKMS package rather than the AUR -git name).

@ari-ahm

ari-ahm commented Sep 2, 2026 •

Copy link
Copy Markdown

Independent confirmation on a second model, plus a packaging problem worth
knowing about before snd-hda-macbookpro-dkms-git gets promoted into
[omarchy].

Confirmed on MacBookPro14,1

Same symptom and same fix as your 14,2, on subsystem 0x106b3300 instead of
0x106b3600 — both are handled by the same branch upstream:

else if (codec->core.subsystem_id == 0x106b3300 || codec->core.subsystem_id == 0x106b3600) {
        // macbook pro 14,1?13,1, 14,2
        fixup_found = 1;
}

Omarchy 4.0.2, kernel 7.1.9-arch1-2, gcc 16, no patching needed. The two
upstream diffs apply with offsets and some fuzz but succeed. Useful side
markers, in case they help anyone else confirm the driver is actually live:
the sink moves 48000 -> 44100 Hz (the driver fixes format at 44.1/24-bit),
an alsa_input... source appears, and the headphone port goes from
availability unknown to real jack detection.

The AUR package downloads 151 MB on every kernel update

This is the part I'd flag before promoting it. snd-hda-macbookpro-dkms-git
ships upstream's dkms.conf as-is, which wires the installer in as PRE_BUILD:

PRE_BUILD="install.cirrus.driver.sh -k $kernelver --dkms"

That script fetches a full kernel tarball from cdn.kernel.org every time DKMS
builds — i.e. on every kernel update, for every user:

wget -c https://cdn.kernel.org/pub/linux/kernel/v$major_version.x/linux-$kernel_version.tar.xz -P $build_dir

The AUR PKGBUILD has wget in depends=() for exactly this reason. For
linux-7.1.9 that is a 158,435,316-byte download, of which it uses 2,490,543 —
only sound/hda. It also means a kernel update on a metered connection, behind
a proxy, or on a machine with a local pacman mirror but no general internet,
silently ends with a failed build and no audio.

It doesn't need to be that way

All of the PRE_BUILD work — fetch sound/hda, swap in the cut-down Makefiles,
copy the Apple headers, apply the two cs8409 diffs — is deterministic and can
happen once at package build time. Ship the prepared tree in the package, drop
PRE_BUILD entirely, and dkms.conf reduces to:

MAKE[0]="make KERNELRELEASE=${kernelver}"
AUTOINSTALL="yes"

DKMS rebuilds then run make and nothing else. I've been running this for a day
on the 14,1; rebuilds verified under unshare -n with no network interfaces at
all, and makepkg itself is offline too once the sources are vendored.

It's up at https://github.com/ari-ahm/snd-hda-macbookpro-dkms if it's useful
for the omarchy-pkgs side — GPL-2.0-only like upstream, and mostly just moving
upstream's own steps from PRE_BUILD into prepare(). Take it, fork it or
ignore it; no attribution needed. Note it vendors its sources, which suits a
distro package but isn't AUR-idiomatic — for AUR you'd fetch the kernel tarball
in source=() at build time and still drop PRE_BUILD, which keeps the
offline rebuilds.

Doing the patching at build time has a second benefit for a distro: a patch
conflict against a newer kernel surfaces when the package is built, rather than
silently breaking users' audio on a kernel update months later.

On installing linux-headers

Your diagnosis matches what I hit — headers absent, dkms status empty, no
error anywhere. Worth knowing that installing them has a side effect on exactly
the machines this issue targets: it makes macbook12-spi-driver-dkms, which
fix-spi-keyboard.sh installs on every MacBookPro13,x/14,x, start failing on
every kernel update. That package can no longer build (applespi is mainlined;
it still includes asm/unaligned.h, removed in 6.12), it just isn't visible
while the DKMS hook has zero kernels to iterate. Filed separately as #9831, but
it's coupled to this one: if this lands first, those machines start surfacing a
failed build.

Quattro treats matching kernel headers as a base system guarantee (24417bf): DKMS hardware scripts install only their driver. linux-headers is the stock kernel's, so on a linux-omarchy install it pulls in headers for a kernel that is not there and DKMS builds the module for it too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at ce47b35. The diagnosis and the approach look right, but this cannot land yet: the package it installs does not exist in [omarchy], and on the machines it targets that stops the install. This now waits on the maintainer to decide the packaging.

What was checked. The diff was read against current quattro (b18ab49). It was then run on a disposable Omarchy VM (no Mac hardware), both on the branch and merged into quattro. The run covered ./test/cli, plus the hardware and packaging shell tests (t2-hardware-test, brcmfmac-supplicant-test, synaptic-touchpad-test, provisioning-groups-test, xps13-sidecar-amps-test, yt6801-driver-test, kernel-headers-migration-test). It also ran config-test, snapper-test and unowned-system-paths-test against an omarchy-pkgs checkout, which covers the three the description mentions being unable to run. All pass except vscode generated theme references current theme file and kernel-headers-migration-test, which fail identically on clean quattro and are unrelated to this change.

What was found.

  • The package does not exist yet, and the install fails without it. snd-hda-macbookpro-dkms-git is not in [omarchy], and neither is snd-hda-macbookpro-dkms. The VM's DMI product name was set to MacBookPro14,2 and fix-cs8409-audio.sh run the way run_logged runs it. It prints error: target not found: snd-hda-macbookpro-dkms-git and exits 1. bin/omarchy-apply-hardware and bin/omarchy-apply-system both run under set -euo pipefail, so on a MacBookPro13,x/14,x the rest of hardware setup is skipped and finalization fails. On any other machine the script is a no-op (checked on the VM).
  • The package name does not match the packaging PRs. The two open packaging PRs, Add snd-hda-macbookpro-dkms for 2016-2017 MacBook speakers omarchy-pkgs#155 and Add snd-hda-macbookpro-dkms for pre-T2 MacBook and iMac speakers omarchy-pkgs#249, both add snd-hda-macbookpro-dkms, while this PR installs and lists snd-hda-macbookpro-dkms-git. Whichever lands, this PR has to name the same package.
  • Nothing reaches existing installs. Only a fresh install runs install/hardware/all.sh. The earlier attempts at this, Install CS8409 speaker driver on 2016-2017 MacBook Pros #7140 and Install CS8409 speaker driver on pre-T2 MacBook Pros and iMacs #9516, both carried a migration for machines already installed. Whether this one should is the maintainer's call.
  • Fixed on this branch: kernel headers. quattro now treats matching kernel headers as a base-system guarantee (24417bf): DKMS hardware scripts install only their driver, and migration 1789444024 installs linux-omarchy-headers. linux-headers is the stock kernel's headers. On a linux-omarchy install it would add headers for a kernel that is not installed, and DKMS would build for that kernel too. ce47b35 drops it, along with the comment paragraph that explained it. This also answers the question in the description about installing headers explicitly.

The speaker fix itself cannot be proved on a VM. Once the package exists in [omarchy], it needs confirming on a MacBookPro13,x/14,x at the head that ships: after a reboot, aplay -l should show CS8409/CS42L83 and the speakers should play.

Second opinion. The configured reviewer is Codex at medium effort. It answered a ping, but it did not review this PR because the day's review budget was spent. This review is one model's reasoning only.

@andyholst

Copy link
Copy Markdown

This MacBookPro13,3 (subsystem 0x106b3900, Omarchy 4.5.0-3, kernel 7.2.15-4-omarchy) already shows the post-fix GPIO from this description after a cold boot: IO[0], IO[1], and IO[5] are enable=1, and IO[0]/IO[1]/IO[5] have data=1. The module is davidjo's snd-hda-macbookpro 0.1 under updates/dkms.

#11064 is mergeable and skips a machine whose dkms status already lists snd_hda_macbookpro, which is this one. I would land that skip and not a second package that races the same module. The codec dump is on #11064.

@omarchybot

Copy link
Copy Markdown
Collaborator

@andyholst, the cold-boot dump shows an out-of-tree module and enabled GPIO lines. As your comment on #11064 notes, no playback was tested. This does not verify installation or audio at this PR's head, ce47b358c94929d0ae31d05b2fdbb55b3c472a9d.

There is also a distinction in #11064's skip: it checks dkms status snd_hda_macbookpro, while your output names snd-hda-macbookpro/0.1. On a disposable Omarchy worker with DKMS 3.4.5, an actual registration under the hyphenated name was absent from the underscore-filtered result. The separate /usr/src/snd_hda_macbookpro-0.1 check could still make it skip, but that path was not shown in the report. This PR has no equivalent guard for hardware replay over a hand-built driver.

Rechecked this head on the worker: after refreshing package databases, neither snd-hda-macbookpro-dkms-git nor snd-hda-macbookpro-dkms was available. With the VM's DMI temporarily set to MacBookPro14,2, the actual installer through run_logged failed with target not found and exit 1; the following step was not reached. The non-target run, ./test/cli, t2-hardware-test.sh and provisioning-groups-test.sh passed. No speakers were tested; the worker has no CS8409 hardware.

GPT-6 in Codex (High) checked the source and ran those checks. Opus 5.5 High and muse-wonder via pi (High thinking) reviewed the source comparison and agreed that the new report does not verify either head; independence is not guaranteed. They disagreed on which competing implementation to retain: #8285 includes the offline package-list entry, while #11064 adds a migration for existing installs. Neither PR was changed or closed.

This remains waiting on the maintainer's package-delivery and integration decision. The selected implementation then needs its conflicts resolved and confirmation of the exact head on affected hardware through a reboot and audible playback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants