Skip to content

[Intel Mac P10] Real S3 suspend with Bluetooth and Wi-Fi recovery on MacBookAir9,1 - #5

Open
iJustinCabral wants to merge 11 commits into
andrew-boyd:intel-mac/p10-broadcom-wififrom
iJustinCabral:intel-mac/p10/t2-suspend
Open

iJustinCabral wants to merge 11 commits into
andrew-boyd:intel-mac/p10-broadcom-wififrom
iJustinCabral:intel-mac/p10/t2-suspend

Conversation

@iJustinCabral

@iJustinCabral iJustinCabral commented Sep 28, 2026 •

Copy link
Copy Markdown

Follow-up to [Intel Mac P10] Consolidate Broadcom calibration and sleep recovery (omacom#12688). Part of the Intel Mac series.

Stacked on #4 (Bluetooth startup), which depends on #1. Merge order: #1 → #4 → this PR. Until #4 merges, this diff also shows its commits; the suspend-specific commits start at "Install scoped T2 S3 radio drivers". #3 (Wi-Fi recovery) is independent and is not included here.

What this achieves

On the tested MacBookAir9,1 with BCM4377, real ACPI S3 (deep) suspend and resume with working Bluetooth/AirPods audio and Wi-Fi. Stock Wi-Fi failed to acknowledge its D3 request, so suspend aborted. The old workaround, unloading brcmfmac around sleep, broke Bluetooth and is retired here.

Change

  • Driver patches, pinned by hash, built as DKMS modules against the installed linux-t2 headers. The kernel image stays stock.
    • Wi-Fi: Asahi-derived control-ring mailbox protocol (credit: Hector Martin / Asahi Linux), startup ordering, and an opt-in function-reset path.
    • Bluetooth: vendor-window restore, and transport rebuild after S3.
  • BlueZ ResumeDelay = 5 so AirPods reconnect automatically after the rebuild.
  • A transactional installer (omarchy setup t2-suspend [--verify|--rollback]), a fresh hardware leaf, and migration 1789256882. An initcpio guard refuses to publish a boot image with the wrong radio modules or missing Apple firmware.
  • Fixes in this revision:
    • The DKMS source root was published 0700 (from a renamed TemporaryDirectory). It is now 0755, and repeat setup repairs it without rebuilding.
    • Eligibility no longer assumes Bluetooth is at 0000:73:00.1: it must be function 1 of the same chip as the Wi-Fi function discovered by ID.
    • The docs now state the real dependencies and separate combined-machine hardware evidence from this branch's standalone checks.
  • Kernel-update safety (package 1.1, this revision):
    • The radio package now builds only for kernels whose stock radio drivers match a qualified fingerprint table (installer/qualified-radio.conf: 7.2.6 and 7.2.7, byte-identical). Previously BUILD_EXCLUSIVE_KERNEL="-t2$" rebuilt the pinned 7.2.4-era source for every future linux-t2 kernel. An unqualified kernel is skipped cleanly by a DKMS PRE_BUILD gate: the update succeeds and the stock radio drivers stay in use (the old Wi-Fi suspend abort returns until the table is requalified, but boot and input are never at risk).
    • The gate reads DKMS's archive of the stock modules it moves aside on install (/var/lib/dkms/<pkg>/original_module/…, verified by .origin notes), so post-install verification sees the true stock fingerprint.
    • omarchy setup t2-suspend upgrades an older installed package version by its normal rollback, then a transactional install of 1.1; verify reports a version mismatch clearly. 1.0 was never released, so no extra migration is added: the existing one-time migration installs 1.1 on first rollout.
    • The boot-image hook and verify refuse any mixed or non-stock t2bce_* family and any mixed radio set. This package never replaces BCE, but a related working branch did, and on linux-t2 7.2.7 a DKMS t2bce_core next to in-tree t2bce_dma/t2bce_vhci killed the internal keyboard and trackpad. The guard makes that class of failure impossible to publish.

Validation

  • Hardware (combined integration install, MacBookAir9,1): installed-driver normal boot and a short real S3 cycle with Bluetooth/audio confirmed after resume, plus earlier repeated S3, longer sleeps and radio-off cases. See docs/t2-suspend/VALIDATION.md, which also keeps the failures (including one unexplained reboot on an earlier candidate).
  • Kernel update to 7.2.7 (owner's machine, 2026-09-29): stock radio srcversions are identical to 7.2.6; after the owner's omarchy update a real ACPI S3 lid-close cycle passed on 7.2.7 with the working branch's radio-only package (which additionally carries a hibernation-era Wi-Fi patch). That evidence is from the working branch, not from this PR's 1.1 build.
  • This branch standalone: installer (16), radio-gate (69, including the upgrade and DKMS-archive cases) and source-preparation (5) tests, Bluetooth/sleep/retirement suites, CLI, and hash-pinned source fetch and preparation of both profiles with the extracted-C Bluetooth, interface-open and FLR tests. All offline.

Not claimed: other Intel/T2 models, overnight battery drain, and hibernation/S4 (see the follow-up hibernation PR). s2idle is a separate suspend mode and wasn't the subject of this work.

Open questions for review

  1. Rollout: the migration builds DKMS drivers and rebuilds the boot image automatically during omarchy update on supported hardware. Should the first release be opt-in (omarchy setup t2-suspend) rather than automatic?
  2. Distribution: the source is fetched and prepared at install time. A package companion in omarchy-pkgs (an omarchy-t2-radio-dkms recipe, like the P08/P11/P12 companions) may fit the repo's conventions better.

🤖 Generated with Claude Code

iJustinCabral and others added 11 commits September 23, 2026 13:47
MacBookAir9,1 brings the controller up before combo firmware is ready,
so BlueZ reports powered with an empty class. Gate module load and
desktop startup on Wi-Fi readiness.

Follow-up to intel-mac/p10-broadcom-wifi. Taken from
fix-t2-vintage-mac-support at 3063fa2.
The gate and eligibility check waited for Wi-Fi at the fixed PCI address
0000:73:00.0, so a different bus enumeration would leave Bluetooth
unloaded for that boot. Discover the single 14e4:4488 function on every
poll, keeping the MacBookAir9,1 and T2 guards.

Installed gates record the helper's exact bytes and refuse a different
revision, so recognize the previous helper by SHA-256 and replace it in
place with rollback preserved. A migration upgrades installed gates only,
leaving absent or rolled-back setups alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BCM4377 on MacBookAir9,1 aborts suspend in brcmfmac D3. Ship the tested
DKMS mailbox and transport series for that model, include Apple Wi-Fi
firmware in the boot image, and disable the exact unload-around-sleep
unit that broke Bluetooth resume. The pre-T2 brcmfmac rebind is unchanged.

This follows intel-mac/p10/t2-bluetooth-startup because the installer
uses that gate's file helpers and model check. Hibernation callbacks,
candidate images, and speaker DSP are not included. Source revision
3063fa2 on fix-t2-vintage-mac-support.
Preparation and deployment rename a 0700 TemporaryDirectory into place,
and copytree preserves that mode into /usr/src, so unprivileged DKMS
inspection cannot traverse the registered source. Publish the source root
as 0755 and repair it on repeated setup without rebuilding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docs said the Wi-Fi firmware-stall watcher remained on this branch,
but it lives on the sibling t2-wifi-recovery contribution. State the
actual stack and merge order, mark the hardware ledger as combined-machine
evidence, and record the standalone offline checks separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Suspend eligibility checked Bluetooth at the fixed address 0000:73:00.1.
Require 14e4:5fa0 as function 1 of the same chip as the Wi-Fi function
the Bluetooth gate discovers by ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bump omarchy-t2-radio to 1.1. DKMS builds only for kernels whose stock radio
srcversions match installer/qualified-radio.conf (PRE_BUILD gate, reading the DKMS
original_module archive after install); other kernels keep stock drivers. Install
decides qualification before mutating, records it, and refuses when no kernel
qualifies. The initcpio hook and verify refuse any t2bce_* module outside the stock
kernel tree and apply an explicit radio policy. Adds gate/hook/archive tests and docs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Read the installed version from the receipt: install of an older installed version
rolls that version back (dkms remove, source removal, stock image) before installing
the new one, rollback removes whichever version the receipt names, and verify on a
version mismatch asks for omarchy setup t2-suspend. Adds 1.0 upgrade tests and
states the upgrade entry point in the installation doc.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant