Skip to content

thunderbolt: apple: T6050: J714s: the dock's USB4 link trains in place after a deep sleep (follow-up to #2046) - #2057

Merged
DjDeveloperr merged 2 commits into
integration/aurorafrom
j714s/usb4-dock-wake
Nov 16, 2026
Merged

DjDeveloperr merged 2 commits into
integration/aurorafrom
j714s/usb4-dock-wake

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #2046, which is now merged. The two commits are rebased onto integration/aurora (b2026aa) with their patch-ids unchanged (e913d5ab…, ca9ff11e…), and the files they touch are byte-identical to the tested branch head 9e0de8b.

What it fixes

With #2046 the J714s puts the dock's USB4 router to sleep in place across a deep sleep. On every wake, though, the dock was given up and enumerated again from cold, about 14 s later:

  • the router firmware's link reached the dock's broadcast and never trained;
  • about a second later the firmware reported its sideband lost.

The cause is the power order of the router's own domain, ATC2_CIO:

  • macOS takes it down before the PHY's CIO shutdown at the entry. At the wake it raises it only once the PHY's CIO mode is up (right after UC_TNBL_DONE and the PHY's reset release), before CIO_PCIE, CIO_USB and AUSS.
  • Linux left it on at the entry, because the router's DART still held it. The PMGR's driver then raised it at the very start of the wake, so the router was powered while the PHY was reset and started again.

Changes

  1. thunderbolt: apple: T6050: J714s: keep the router's domain down through the PHY's restart
  1. drm/apple: fabric: J714s: a returning DP tunnel goes back to its last pipeline
  • With the dock back in place, its DP IN 0 tunnel returned first and took the lowest free display pipeline. That was the pipeline a DP-alt display on another port had before the sleep, so both externals came back on other connectors (DP-2/DP-3 became DP-1/DP-4). Compositor monitor rules follow connector names.
  • A tunnel's last pipeline is now held for its return, for 20 s of running time. The tunnel waits for it to be free and ready instead of taking another.

Testing

  • Compile/link: Fedora kcheck OK (M5 sleep-kit config).
  • Hardware: J714s (M5 Pro) with a Thunderbolt 5 dock on the right port (PCIe, USB3 and DP tunnels), real deep sleeps with an RTC alarm. This was tested on the J714s test stack, with this change plus other test commits that did not by themselves change the result. In 8 deep sleeps and 2 refused (forced .enter) sleeps across two boots, every wake trained in place:
    • router lane trained about 0.8 s after the AP's return;
    • router back about 0.9 s after it;
    • the tunnelled PCIe link up again about 2.0 s after it;
    • no tunnel lost, every dock device back.
    • With commit 2 as well, in 5 deep sleeps + 1 refused sleep in one boot, both external displays came back on their connectors at 3840x2160@120 every time.
    • Before this change, 0 of 10 sleeps trained in place.
  • This exact public combination (T6050: J714s: a USB4 dock's router sleeps in place across a deep sleep, and the dock comes back #2046 + this commit on the deep-sleep default candidate) is being run on the same machine now. Results will be added here.

Not in this PR (follow-ups)

  • The dock port's dwc3 core loses its registers in the sleep, so xHCI starts over and the dock's devices are reset (last one back about 8 s after the wake).
  • External displays are back about 8 s after the AP's return; the panel is back much sooner. The display wake path is the next target.
  • Non-blocking, from T6050: J714s: a USB4 dock's router sleeps in place across a deep sleep, and the dock comes back #2046's harness review: dart_cio_check() (T6050: J714s: a USB4 dock's router sleeps in place across a deep sleep, and the dock comes back #2046) does not catch everything the later snapshot refuses. A stream enabled above the DART's hardware stream count is refused only by dart_cio_capture() (-EUCLEAN). On the NHI side that refusal would come after the router's sleep, in the panic path that the early check is meant to avoid. Real hardware should not report enable bits beyond its stream count, so this is theoretical. The fix is to make the same check in dart_cio_check() once the requesters are stopped. tools/asahi/dart-cio-power-tests.c currently records the gap as the one capture-only refusal (kind 8).

🤖 Generated with Claude Code

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Hardware result for the first commit on the public set. Default candidate intg9c6 = integration/aurora 41eb932 + #2046 + f1e10520 (same tree as 676f6a62 here) + the deep-sleep lead's fixes, on a J714s with the TB5 dock. 2 of 2 docked deep sleeps came back in place:

  • router woken in 429 ms, firmware wake path, no give-up;
  • last dock USB device back 6.4 s after the wake;
  • DP tunnels back 5.9 s after the wake.

The second commit (8724c2c, DP connectors kept across the sleep) is running in the next candidate now. This PR leaves draft once that confirms.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Hardware result for the second commit on the public set. Default candidate intg9c7, which carries 8724c2c, on the J714s with the TB5 dock:

  • 6 of 6 docked deep sleeps came back with the dock in place.
  • All three external displays came back at their boot modes, including the Odyssey G81SF at 3840x2160@240.
  • Connectors held across every wake: DELL S2725QC on DP-2, Odyssey G81SF on DP-5, panel on eDP-1. These are the same as at boot, after all six wakes.

Together with the intg9c6 result above, both commits are proven on the public set. Taking this out of draft. Both branches are being rebased onto integration/aurora 41eb932 (no conflicts, same changes).

…gh the PHY's restart

On a wake from a USB4 router's sleep in place, the J714s dock's link
reached the dock's broadcast and never trained: about a second later
the router firmware reported its sideband lost and the dock was given
up, then enumerated again from cold.

The difference from macOS is the order of the router's own domain,
ATC2_CIO. macOS takes it down before the PHY's CIO shutdown, and raises
it at the wake only once the PHY's CIO mode is up (right after
UC_TNBL_DONE and the PHY's reset release), before CIO_PCIE, CIO_USB and
AUSS. Here the router's DART still held the domain at the entry, so the
PMGR's driver raised it at the very start of the wake and the router
was powered while the PHY was reset and started again.

Take the domain down through the sleep driver at the entry, which then
leaves it to this driver at the wake, and raise it right after the PHY.
On a J714s with a Thunderbolt 5 dock the link then trains in place in
about 0.35 s and the dock comes back with its tunnels.

Signed-off-by: Diljit Singh <[email protected]>
… pipeline

T6050's DP connectors are port/pipeline pairs. After a deep sleep in
which the dock's USB4 router slept in place, the dock's DP IN 0 tunnel
came back first and took the lowest free pipeline: the one a DP-alt
display on another port had before the sleep. Both external displays
then came back on other connectors (DP-2/DP-3 before, DP-1/DP-4 after),
which compositor monitor rules, workspaces and wallpapers follow.

Hold a tunnel's last pipeline for its return, for 20 s of running time
after its teardown: the tunnel goes back there, waiting until that
pipeline is free and ready, and takes another only after that. With
this both displays keep their connectors and modes across the sleep.

Signed-off-by: Diljit Singh <[email protected]>
@DjDeveloperr
DjDeveloperr changed the base branch from j714s/usb4-dock-sleep to integration/aurora November 16, 2026 08:53
@DjDeveloperr
DjDeveloperr merged commit cc8cdb4 into integration/aurora Nov 16, 2026
1 check passed
@RyanTheTide
RyanTheTide deleted the j714s/usb4-dock-wake branch November 17, 2026 23:52
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