Add T2 suspend/resume support#5998
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Apple T2 suspend/resume support by installing a systemd sleep hook and helper script, including a migration for existing installs.
Changes:
- Add a migration to install/enable the
apple-bce.serviceon existing T2 Mac installations. - Add an installer hardware config script to set up the same systemd unit during installation.
- Add the
omarchy-hw-t2-suspendhelper invoked by the systemd unit, and wire the new setup into the main install flow.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| migrations/1780070899.sh | Migration to install and enable the apple-bce systemd oneshot sleep service on T2 Macs. |
| install/config/hardware/apple/fix-t2-suspend.sh | New install-time configuration script that writes/enables the T2 suspend/resume service. |
| install/config/all.sh | Runs the new T2 suspend/resume fix script as part of the installer hardware steps. |
| bin/omarchy-hw-t2-suspend | Helper script to unload/reload T2-related modules around suspend/resume. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Awesome. This is very much needed in order to run Omarchy on older Intel MacBooks. Looking forward to trying this out! |
|
Any suggestion on how to test this particular fix on my macbook? |
|
The PR description has step-by-step test instructions under "For testers". |
|
This is awesome and badly needed! Would be great to also get it upstreamed into some of the other distros/build tools for the t2linux wiki. They've been quite responsive the few times I've reached out and opened PRs. I've had good experience with https://github.com/t2linux/T2-Mint in particular |
|
Tested on MacBookAir8,1 (2018 Retina Air, T2) with kernel 7.0.11-arch1-Watanare-T2-1-t2. Cloned the add-t2-suspend branch and ran the migration. The service runs correctly: aaudio unbound, apple_bce and all T2 modules unloaded in order before sleep, all reloaded cleanly after resume. No Thunderbolt D3hot errors, no audio XRUNs, no brcmfmac timeouts. Wi-Fi, keyboard/trackpad, USB-C data and charging all working after resume. I've been using it as a daily driver and it works fine across multiple suspend cycles. |
|
@jjohnson - Thanks for putting this clean solution together to fix the suspend/resume long standing issue for T2 Mac users. I have tested using the provided testing steps on my MacBookPro16,1. The suspend/resume now resumes rather than previously hanging the system. However the Wi-Fi does not properly load on resume consistently. The Wi-Fi interface (wlan0) only has properly loaded post resume 1% of the time when testing the fix. Current result: suspend/resume works, Touch Bar comes back, Wi-Fi does NOT comes back. Please see the attached t2-debug.txt: |
Tested on MacBookPro15,4 (MacBook Pro 13", 2019)
Setup:
Results:
Logs: No XRUNs, no brcmfmac D3 timeouts, no appletbdrm errors. Everything working cleanly across multiple suspend/resume cycles. The |
|
@joshpavlovich Thanks for testing! This is the first data point on a 16,1 and confirms the module lifecycle works — suspend/resume and Touch Bar recovering is good progress. The Wi-Fi D3cold issue (Unable to change power state from D3cold to D0) is specific to this model. A couple things to try:
Also, if you could collect debug info with collect-t2-debug > ~/t2-debug.txt (defined in the PR description) and attach that file above instead of a lengthy debug in PR. |
|
Hello. I have a target macbook that I can devote to testing if someone can give me appropriate instructions. I'm sure people have noticed that #5129 is also open; here's making it explicit. |
|
Again, Tested on MacBookPro15,4 (2019 13" MBP) with kernel Suspend/resume works, but Bluetooth (BCM4377) was not recovering after resume. The Fix applied to PRE_MODS=(appletbdrm hid_appletb_kbd hid_appletb_bl brcmfmac_wcc brcmfmac hci_bcm4377 bluetooth)
POST_MODS=(brcmfmac brcmfmac_wcc hci_bcm4377 bluetooth hid_appletb_bl hid_appletb_kbd appletbdrm)Test results after fix:
So now its fully usable 🎉 |
|
Follow-up on MacBookPro16,1 Wi-Fi fix After further investigation, the D3cold issue on the 16,1 is caused by unloading brcmfmac before sleep. The kernel PCI PM subsystem handles the D3cold->D0 transition correctly only when the driver stays bound — manual unbind/rebind breaks the sequence. Fix applied:
Results on MacBookPro16,1 (BCM4364):
Not needed:
I would be happy to open a PR with these changes... Thanks |
|
@jjohnson and @voioo thank you very much for this fix! I have omarchy installed on a 2018 mac mini. To date suspend/resume has worked after I made the modifications suggested by t2linux but wifi would not be available after waking. Initially I tried the solution in this PR from @jjohnson but still the wifi did not return after waking from suspend. After making the changes to After updating/changing anything that is specific to omarchy, would this fix work on other arch distributions? Eventually I will try but just wondering if anyone already has. Thanks again! |
* install/config/hardware/apple/t2-suspend: manages apple_bce module for clean suspend/resume by unbinding aaudio and unloading T2 modules before suspend, reloading after resume * install/config/hardware/apple/fix-t2-suspend.sh: install-time setup, copies script to /usr/local/libexec/omarchy/apple/t2-suspend and enables omarchy-apple-t2-suspend.service * migrations/1780075490.sh: install t2-suspend for existing T2 installs
* Skip brcmfmac unload on BCM4364; kernel PCI PM handles D3cold, keep, unload on BCM4377b and unknown chipsets to avoid D3 timeout * Add hci_bcm4377 to module lists for Bluetooth recovery after resume * Fix tiny-dfr start: use reset-failed + restart instead of stop/start, start is a no-op on already-running units
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
install/config/hardware/apple/fix-t2-suspend.sh:31
- This script writes/updates a systemd unit but doesn’t run
systemctl daemon-reload. Other installer steps reload the manager immediately after writing unit files/drop-ins (e.g.,install/config/fast-shutdown.sh:5,install/config/plocate-ac-only.sh:3). Without a reload, updates to an already-loaded unit may not be picked up until reboot.
sudo systemctl enable omarchy-apple-t2-suspend.service
echo "T2 suspend/resume service enabled."
|
Thanks for the detailed follow-ups. I've incorporated both findings into the latest script: Bluetooth — only hci_bcm4377 is cycled; the Bluetooth core module remains loaded and does not require reprobe. Mac 16,1 dGPU — The script now auto-detects the BCM4364 chipset via its PCI ID (14e4:4464) and skips brcmfmac/brcmfmac_wcc on those models, keeping the driver bound so kernel PCI PM handles D3cold→D0 natively. BCM4377b chipsets; brcmfmac is still unloaded (to avoid D3 timeout). The xhci_pci entry was dropped because it is built in (CONFIG_USB_XHCI_PCI=y on T2 kernels) and the attempted unload was a no-op. The earlier MBP16,1 test already showed Touch Bar recovery without an xHCI reset. Restarting tiny-dfr ensures the daemon is refreshed after the Touch Bar devices return. @voioo @joshpavlovich if you can retest and let us know. @hoclun-rigsep @jbisits Please retest the latest script on Mac mini and other models and report the results. |
Summary
Adds suspend/resume support for Apple T2 Macs. The
apple_bcemodule must beunloaded before suspend (its PCI PM can't handle D3 entry), but userspace ALSA
clients (PipeWire/WirePlumber) keep it pinned. This service unbinds aaudio before
suspend, unloads
apple_bceand dependent T2 modules, then reloads everythingafter resume.
Tested on
6.19.13-arch1-Watanare-T2-1-t27.1.3-arch1-Watanare-T2-2-t2Test results (extended suspend/resume + overnight/multi-night)
invalid position/scheduling while atomickernel errorsappletbdrm *ERROR* Failed to send messageon module unloadbrcmfmac: brcmf_pcie_pm_enter_D3: TimeoutFor testers
The service installs and enables automatically via Omarchy on T2 Macs
(detected via PCI ID
106b:180[12]). To test:Kernel module requirement (for clean audio after reload)
The fix is included in
linux-lts-t26.18.36-1 and newer. As oflinux-t27.1.4-1, it has not yet been imported into the mainline
linux-t2package.Clean audio after reloading
apple_bcerequires the PLAYBACK timestamp fixfrom
t2linux/apple-bce-drv#30. Without it,aaudio_pcm_pointercan returnan invalid position after module re-probe, causing XRUNs and
"scheduling while atomic"errors.The patch is one line in
audio/pcm.c: changedev_timestamp→os_timestampin the
aaudio_handle_stream_timestampcall for the PLAYBACK substream.Mainline linux-t2 testers can rebuild and install the corrected current upstream driver:
Model compatibility
The module lists in
PRE_MODS/POST_MODScover all T2 peripherals known on theMacBookPro15,4. Other T2 models (MacBookAir, Mac mini, Mac Pro, iMac) may need
adjustments if their Wi-Fi chipset or other modules differ. The
mod_ldguardskips absent modules silently.
More testing is needed on dGPU-equipped T2 Macs. Models with a discrete
GPU may require additional module handling. The latest consolidated
BCM4364 logic is based on MBP16,1 results, still awaiting retest.
Debugging
If suspend/resume doesn't work on your model, collect the debug info:
Then attach
~/t2-debug.txtto your comment.