From 316e1f0b97f4f8362473af69f76695cb75c7466d Mon Sep 17 00:00:00 2001 From: S-M Robinson Date: Fri, 14 Aug 2026 23:05:04 -0600 Subject: [PATCH 1/4] Install the CS4208 speaker driver on 12-inch MacBooks Mainline detects the codec on MacBook9,1 and MacBook10,1 but never enables the speaker amp, so PipeWire plays to a silent analog path. --- install/hardware/all.sh | 1 + install/hardware/apple/fix-cs4208-audio.sh | 14 +++ install/omarchy-other.packages | 1 + manual/44-mac-support.md | 2 +- migrations/1786719479.sh | 23 ++++ test/shell.d/cs4208-audio-test.sh | 117 +++++++++++++++++++++ 6 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 install/hardware/apple/fix-cs4208-audio.sh create mode 100644 migrations/1786719479.sh create mode 100644 test/shell.d/cs4208-audio-test.sh diff --git a/install/hardware/all.sh b/install/hardware/all.sh index 6adcff9c8a43..a34a96bf07a1 100644 --- a/install/hardware/all.sh +++ b/install/hardware/all.sh @@ -33,6 +33,7 @@ run_logged "$OMARCHY_INSTALL/hardware/asus/fix-z13-touchpad.sh" run_logged "$OMARCHY_INSTALL/hardware/framework/qmk-hid.sh" run_logged "$OMARCHY_INSTALL/hardware/apple/fix-spi-keyboard.sh" +run_logged "$OMARCHY_INSTALL/hardware/apple/fix-cs4208-audio.sh" run_logged "$OMARCHY_INSTALL/hardware/apple/fix-suspend-nvme.sh" run_logged "$OMARCHY_INSTALL/hardware/apple/fix-t2.sh" run_logged "$OMARCHY_INSTALL/hardware/apple/fix-brcmfmac-supplicant.sh" diff --git a/install/hardware/apple/fix-cs4208-audio.sh b/install/hardware/apple/fix-cs4208-audio.sh new file mode 100644 index 000000000000..677ee94e9aa4 --- /dev/null +++ b/install/hardware/apple/fix-cs4208-audio.sh @@ -0,0 +1,14 @@ +# Enable speakers on 12-inch MacBooks (MacBook9,1 / 2016 and MacBook10,1 / 2017). +# Mainline snd_hda_codec_cs420x detects the CS4208 but never runs the macOS +# init that powers the speaker amplifier, so PipeWire plays to a silent analog +# path. The out-of-tree module replays that init. +# MacBook8,1 (2015) is not supported by this driver. +# https://github.com/leifliddy/macbook12-audio-driver +# https://github.com/basecamp/omarchy/issues/2101 + +product_name="${OMARCHY_MACBOOK12_AUDIO_MODEL:-$(cat /sys/class/dmi/id/product_name 2>/dev/null)}" +if [[ $product_name == "MacBook9,1" || $product_name == "MacBook10,1" ]]; then + echo "Detected 12-inch MacBook with CS4208 audio" + + omarchy-pkg-add macbook12-audio-driver-dkms +fi diff --git a/install/omarchy-other.packages b/install/omarchy-other.packages index 02ac645e9a55..7754725d8b72 100644 --- a/install/omarchy-other.packages +++ b/install/omarchy-other.packages @@ -26,6 +26,7 @@ linux-headers linux-ptl linux-ptl-headers macbook12-spi-driver-dkms +macbook12-audio-driver-dkms nvidia-580xx-dkms nvidia-dkms nvidia-open-dkms diff --git a/manual/44-mac-support.md b/manual/44-mac-support.md index e86fdd064d8f..60f89dbd1491 100644 --- a/manual/44-mac-support.md +++ b/manual/44-mac-support.md @@ -35,7 +35,7 @@ It is necessary to disable Apple's Secure Boot in order to boot the bootable USB 3. Select the orange EFI Boot device 4. Proceed with the [install as normal](02-getting-started.md) -The installer detects Mac hardware and applies the needed fixes automatically: Broadcom Wi-Fi drivers and firmware, the SPI keyboard driver on the MacBook models that need it, and an NVMe suspend fix for those same models. +The installer detects Mac hardware and applies the needed fixes automatically: Broadcom Wi-Fi drivers and firmware, the SPI keyboard driver on the MacBook models that need it, the CS4208 speaker driver on the 12-inch MacBook (2016 and 2017), and an NVMe suspend fix for those same models. ### Known Limitations diff --git a/migrations/1786719479.sh b/migrations/1786719479.sh new file mode 100644 index 000000000000..8d38d8346f12 --- /dev/null +++ b/migrations/1786719479.sh @@ -0,0 +1,23 @@ +echo "Install the CS4208 speaker driver on 12-inch MacBooks" + +# Fresh installs get this from install/hardware/apple/fix-cs4208-audio.sh. +# Existing MacBook9,1 / MacBook10,1 installs still have silent speakers: +# mainline detects the codec and PipeWire plays, but the speaker amp is never +# enabled. Skip machines that already have the packaged module or the same +# DKMS driver installed by hand. + +product_name="${OMARCHY_MACBOOK12_AUDIO_MODEL:-$(cat /sys/class/dmi/id/product_name 2>/dev/null)}" +if [[ $product_name != "MacBook9,1" && $product_name != "MacBook10,1" ]]; then + exit 0 +fi + +if omarchy-pkg-present macbook12-audio-driver-dkms; then + exit 0 +fi + +if dkms status 2>/dev/null | grep -q '^macbook12-audio/'; then + exit 0 +fi + +omarchy-pkg-add macbook12-audio-driver-dkms +omarchy-state set reboot-required diff --git a/test/shell.d/cs4208-audio-test.sh b/test/shell.d/cs4208-audio-test.sh new file mode 100644 index 000000000000..6ac0cd4c7a6c --- /dev/null +++ b/test/shell.d/cs4208-audio-test.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +set -euo pipefail + +source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" + +leaf="$ROOT/install/hardware/apple/fix-cs4208-audio.sh" +all="$ROOT/install/hardware/all.sh" +other_packages="$ROOT/install/omarchy-other.packages" +migration="$ROOT/migrations/1786719479.sh" + +grep -q 'apple/fix-cs4208-audio.sh' "$all" || + fail "the CS4208 audio fix runs during hardware setup" +grep -qx 'macbook12-audio-driver-dkms' "$other_packages" || + fail "the ISO caches the CS4208 speaker driver" +grep -Fq 'MacBook9,1' "$leaf" && grep -Fq 'MacBook10,1' "$leaf" || + fail "the CS4208 leaf matches the 12-inch MacBooks" +pass "the CS4208 audio fix is wired into setup" + +test_tmp=$(mktemp -d) +trap 'rm -rf "$test_tmp"' EXIT + +stub_bin="$test_tmp/bin" +calls="$test_tmp/calls.log" +mkdir -p "$stub_bin" + +cat >"$stub_bin/omarchy-pkg-add" <<'SH' +#!/bin/bash + +printf 'omarchy-pkg-add' >>"$TEST_LOG" +printf '\t%s' "$@" >>"$TEST_LOG" +printf '\n' >>"$TEST_LOG" +SH + +cat >"$stub_bin/omarchy-pkg-present" <<'SH' +#!/bin/bash + +(( ${CS4208_PKG_PRESENT:-0} == 1 )) +SH + +cat >"$stub_bin/omarchy-state" <<'SH' +#!/bin/bash + +printf 'omarchy-state' >>"$TEST_LOG" +printf '\t%s' "$@" >>"$TEST_LOG" +printf '\n' >>"$TEST_LOG" +SH + +cat >"$stub_bin/dkms" <<'SH' +#!/bin/bash + +if (( ${CS4208_DKMS_INSTALLED:-0} == 1 )); then + echo 'macbook12-audio/0.1, 7.1.8-arch1-3, x86_64: installed (Original modules exist)' + exit 0 +fi +echo 'macbook12-spi-driver/0+git.315: added' +SH + +chmod +x "$stub_bin"/* + +run_leaf() { + local model="$1" + : >"$calls" + PATH="$stub_bin:$PATH" TEST_LOG="$calls" \ + OMARCHY_MACBOOK12_AUDIO_MODEL="$model" \ + bash -eE -o pipefail -c 'source "$1"' bash "$leaf" +} + +run_leaf "MacBook10,1" >/dev/null +grep -Fq $'omarchy-pkg-add\tmacbook12-audio-driver-dkms' "$calls" || + fail "a 2017 12-inch MacBook gets the CS4208 driver" "$(cat "$calls")" +pass "a 2017 12-inch MacBook gets the CS4208 driver" + +run_leaf "MacBook9,1" >/dev/null +grep -Fq $'omarchy-pkg-add\tmacbook12-audio-driver-dkms' "$calls" || + fail "a 2016 12-inch MacBook gets the CS4208 driver" "$(cat "$calls")" +pass "a 2016 12-inch MacBook gets the CS4208 driver" + +run_leaf "MacBook8,1" >/dev/null +[[ ! -s $calls ]] || fail "the 2015 12-inch MacBook is left alone" "$(cat "$calls")" +pass "the 2015 12-inch MacBook is left alone" + +run_leaf "MacBookPro14,1" >/dev/null +[[ ! -s $calls ]] || fail "a MacBook Pro is left alone" "$(cat "$calls")" +pass "a MacBook Pro is left alone" + +run_leaf "XPS 13 9310" >/dev/null +[[ ! -s $calls ]] || fail "non-Apple hardware is left alone" "$(cat "$calls")" +pass "non-Apple hardware is left alone" + +run_migration() { + : >"$calls" + PATH="$stub_bin:$PATH" TEST_LOG="$calls" \ + OMARCHY_MACBOOK12_AUDIO_MODEL="$1" \ + CS4208_PKG_PRESENT="${2:-0}" \ + CS4208_DKMS_INSTALLED="${3:-0}" \ + bash -euo pipefail "$migration" >/dev/null +} + +run_migration "MacBook10,1" 0 0 +grep -Fq $'omarchy-pkg-add\tmacbook12-audio-driver-dkms' "$calls" || + fail "the migration installs the CS4208 driver" "$(cat "$calls")" +grep -Fq $'omarchy-state\tset\treboot-required' "$calls" || + fail "the migration asks for the reboot that loads the module" "$(cat "$calls")" +pass "the migration installs the CS4208 driver" + +run_migration "MacBook10,1" 1 0 +[[ ! -s $calls ]] || fail "the migration skips a machine that already has the package" "$(cat "$calls")" +pass "the migration skips a machine that already has the package" + +run_migration "MacBook10,1" 0 1 +[[ ! -s $calls ]] || fail "the migration skips a hand-installed DKMS driver" "$(cat "$calls")" +pass "the migration skips a hand-installed DKMS driver" + +run_migration "MacBookPro14,1" 0 0 +[[ ! -s $calls ]] || fail "the migration skips unrelated hardware" "$(cat "$calls")" +pass "the migration skips unrelated hardware" From 0345c98a0c9f543cc40d0624d07faacb7a03bd13 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 15 Aug 2026 03:15:26 -0700 Subject: [PATCH 2/4] Match the DKMS module name the CS4208 driver actually registers Upstream's dkms.conf sets PACKAGE_NAME="macbook12-audio-driver", so dkms status prints that, never "macbook12-audio". The skip for a hand-installed driver never fired, and the test stub printed the same wrong name so it passed anyway. Co-Authored-By: Claude Opus 5 (1M context) --- migrations/1786719479.sh | 2 +- test/shell.d/cs4208-audio-test.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/migrations/1786719479.sh b/migrations/1786719479.sh index 8d38d8346f12..23c3ffeb3baf 100644 --- a/migrations/1786719479.sh +++ b/migrations/1786719479.sh @@ -15,7 +15,7 @@ if omarchy-pkg-present macbook12-audio-driver-dkms; then exit 0 fi -if dkms status 2>/dev/null | grep -q '^macbook12-audio/'; then +if dkms status 2>/dev/null | grep -q '^macbook12-audio-driver/'; then exit 0 fi diff --git a/test/shell.d/cs4208-audio-test.sh b/test/shell.d/cs4208-audio-test.sh index 6ac0cd4c7a6c..430b55272e45 100644 --- a/test/shell.d/cs4208-audio-test.sh +++ b/test/shell.d/cs4208-audio-test.sh @@ -50,7 +50,8 @@ cat >"$stub_bin/dkms" <<'SH' #!/bin/bash if (( ${CS4208_DKMS_INSTALLED:-0} == 1 )); then - echo 'macbook12-audio/0.1, 7.1.8-arch1-3, x86_64: installed (Original modules exist)' + # The name upstream's dkms.conf registers, which is what dkms status prints. + echo 'macbook12-audio-driver/0.1, 7.1.8-arch1-3, x86_64: installed (Original modules exist)' exit 0 fi echo 'macbook12-spi-driver/0+git.315: added' From 2d7cbf608cb6884ffa9240f2949670f38d935800 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 15 Aug 2026 03:15:32 -0700 Subject: [PATCH 3/4] Keep "those same models" pointing at the SPI keyboard models The CS4208 clause landed between them and the NVMe fix, which made the NVMe fix read as 12-inch only. Co-Authored-By: Claude Opus 5 (1M context) --- manual/44-mac-support.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/44-mac-support.md b/manual/44-mac-support.md index 60f89dbd1491..da08f53ffed9 100644 --- a/manual/44-mac-support.md +++ b/manual/44-mac-support.md @@ -35,7 +35,7 @@ It is necessary to disable Apple's Secure Boot in order to boot the bootable USB 3. Select the orange EFI Boot device 4. Proceed with the [install as normal](02-getting-started.md) -The installer detects Mac hardware and applies the needed fixes automatically: Broadcom Wi-Fi drivers and firmware, the SPI keyboard driver on the MacBook models that need it, the CS4208 speaker driver on the 12-inch MacBook (2016 and 2017), and an NVMe suspend fix for those same models. +The installer detects Mac hardware and applies the needed fixes automatically: Broadcom Wi-Fi drivers and firmware, the SPI keyboard driver on the MacBook models that need it, an NVMe suspend fix for those same models, and the CS4208 speaker driver on the 12-inch MacBook (2016 and 2017). ### Known Limitations From 73d8accad68a439a2449f29d59b02e9ebf416f3b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 28 Sep 2026 04:20:29 +0200 Subject: [PATCH 4/4] Give the CS4208 migration a timestamp quattro does not already use migrations/1786719479.sh already exists on quattro as the Antigravity agent migration. omarchy-migrate records completion by filename, so sharing it would both conflict on merge and skip this migration on every machine that already ran the other one. Co-Authored-By: Claude Opus 5.5 --- migrations/{1786719479.sh => 1790562029.sh} | 0 test/shell.d/cs4208-audio-test.sh | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename migrations/{1786719479.sh => 1790562029.sh} (100%) diff --git a/migrations/1786719479.sh b/migrations/1790562029.sh similarity index 100% rename from migrations/1786719479.sh rename to migrations/1790562029.sh diff --git a/test/shell.d/cs4208-audio-test.sh b/test/shell.d/cs4208-audio-test.sh index 430b55272e45..70ea2749819a 100644 --- a/test/shell.d/cs4208-audio-test.sh +++ b/test/shell.d/cs4208-audio-test.sh @@ -7,7 +7,7 @@ source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" leaf="$ROOT/install/hardware/apple/fix-cs4208-audio.sh" all="$ROOT/install/hardware/all.sh" other_packages="$ROOT/install/omarchy-other.packages" -migration="$ROOT/migrations/1786719479.sh" +migration="$ROOT/migrations/1790562029.sh" grep -q 'apple/fix-cs4208-audio.sh' "$all" || fail "the CS4208 audio fix runs during hardware setup"