Skip to content

Detach the Thunderbolt controller around sleep on the MacBookPro14,1 - #15756

Open
joshuahamsa wants to merge 1 commit into
omacom:quattrofrom
joshuahamsa:macbookpro14-1-thunderbolt-suspend
Open

joshuahamsa wants to merge 1 commit into
omacom:quattrofrom
joshuahamsa:macbookpro14-1-thunderbolt-suspend

Conversation

@joshuahamsa

Copy link
Copy Markdown

The MacBookPro14,1 never wakes from a lid close, in deep or s2idle (#15630). Bisecting with /sys/power/pm_test in deep: freezer and devices return, platform hard-hangs, and the journal ends at PM: suspend entry (deep). The Alpine Ridge Thunderbolt controller wedges the late suspend phase.

This adds a system-sleep hook that removes the controller's upstream bridge (8086:1578), and with it the whole Thunderbolt tree, before sleep, and rescans the PCI bus on wake. The hardware leaf installs it on the MacBookPro14,1 only, and a migration installs it on existing installs, leaving an existing hook alone.

Deep sleep is kept, and the CPU idle states are untouched. This is an alternative for the 14,1 to the mem_sleep_default=s2idle + intel_idle.max_cstate=1 approach in #14409, which costs idle power all the time.

Hardware validation (MacBookPro14,1, BIOS 529.140.2.0.0, Omarchy 4.0.4-1, 7.2.5-3-omarchy):

  • The hook was installed through install/hardware/apple/fix-suspend-thunderbolt.sh from this branch, and a lid-close deep sleep of ~7.5 min resumed. The bridge is released before PM: suspend entry (deep) and re-enumerated after PM: suspend exit, with the TB NHI and xHCI back.
  • With the same logic in a hand-installed hook beforehand, 5 of 5 suspends resumed, including a ~22 h overnight sleep.
  • USB-C works after resume.

Trade-off: anything on USB-C/Thunderbolt is disconnected and re-enumerated on every sleep. Sleeping with a peripheral attached is untested. Other T1 models (14,2, 14,3) are deliberately left out, because they are untested and may differ (#12194, #14409).

Tests: test/shell.d/apple-thunderbolt-suspend-test.sh (hook against a fake PCI tree, the leaf's model gate, and the migration's install, preserve and no-sudo paths). The image-deferred-hardware, platform-setup, brcmfmac-supplicant and gb10-sleep tests also pass.

@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds a sleep hook for the MacBookPro14,1 that removes the Thunderbolt bridge before sleep and rescans the PCI bus after wake.

  • MacBookPro14,1 detaches its Thunderbolt bridge while sleeping.

No actionable issues were found. Tests were inspected, not executed.

Acknowledgment: joshuahamsa explicitly accepts USB-C/Thunderbolt devices disconnecting and reconnecting around sleep. Sleep with peripherals attached remains untested. Other T1 models are deliberately excluded because they are untested and may differ.

Reviews (1) · Last reviewed commit: "Detach the Thunderbolt controller around..." · Reviewed by Greptile

@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! labels Oct 18, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5.5, with Codex Medium as a second opinion. Both read this change next to the open pull requests that address the same MacBookPro14,1 sleep failure. This isn't being taken further as a separate fix, because an older pull request already makes the same change more carefully. Neither model ran anything on a worker. A worker has no Alpine Ridge controller, and verifying a fix that won't be the one merged would be wasted work.

#11570 makes the same change, and it is older. Before sleep it removes the Thunderbolt upstream ports, and after resume it rescans the bus. It installs on the 13,x and 14,x models, the 14,1 included, and it has been run on a 14,1. It also covers two cases this pull request doesn't. Both models found these in default/systemd/system-sleep/apple-thunderbolt-detach:

#10758 is older still and handles the 14,1 another way: s2idle by default, plus a shim module. When there are competing fixes, the oldest is preferred unless a newer one is clearly better. This pull request isn't, so it gives way to them. Which of the two lands is for the maintainer to decide.

Your report still matters to #11570. It shows on a second 14,1 that the machine hangs in the platform phase on the way into deep sleep, and that removing the bridge keeps it from hanging, through a ~22 hour overnight sleep. That bears on the question still open there: is Thunderbolt lost on every S3, or only on short sleeps? If you can, running #11570's hook at 936d96b091c564383b46f0654138f3196aa851c7 on your machine and posting the result there would help it more than anything else.

Next, this waits on the maintainer.

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.

2 participants