Repository navigation
J714s: keep the USB4 dock port's USB host in place through a deep sleep - #2072
DjDeveloperr wants to merge 2 commits into
Conversation
… router's sleep
macOS keeps the USB host on the USB4 dock's port through the router's
sleep in place, and xHCI restores its state at the wake, so no device
behind the dock is reset. Linux parked the host's PIPE on its dummy
producer and stopped the USB2 PHY, and the controller lost its power
with nothing kept: the xHCI restore failed (USBSTS save/restore error)
and every dock device was reset at each wake.
Do as macOS does on J714s:
- At the PIPE's park for the router's sleep (xHCI has saved its state
by then; macOS does this right after the save), take the controller
into hibernation through its power control ("pwrctl", the
controller's window beside the PIPE handler, as on T8140): D3 asked
for, VDD_OFF awaited and cleared, the wake events armed, SLEEP in the
status. Without the region, or if the hibernation fails, the PIPE is
parked on its dummy producer as before.
- Keep the USB3 PIPE on the tunnel producer with its clock gated
instead of moving it to the dummy producer, and take the core's
reset after the CIO shutdown.
- Suspend the USB2 PHY instead of stopping it, and give it back before
the PHY's restart at the wake.
- At the host's resume, give the PIPE its clock back on the tunnel,
disarm the wake events, ask for D0, release the core's reset and
wait for D0_ON (about 1 ms). A new RETAINED step reports whether the
controller's bank kept the sleep's state, for the glue to resume the
host in place. A refused sleep, the reset's release and a failed
hibernation ask for D0 too.
A power control that reads all zeros after the sleep lost its state:
the host starts over, as before. A controller that gives no D0_ON and
still reports SLEEP may be unpowered: the PHY is marked faulted and the
glue keeps away from its core. The region is described for the J714s
display layout of the right port's PHY and mapped only there.
Signed-off-by: Diljit Singh <hey@djdev.me>
… deep sleep With the dock port's controller kept through the USB4 router's sleep in hibernation, its core still comes back without its registers (GUID at its reset value), but the controller's state is kept: macOS writes back only a few globals (the ADT's host tunables, the CIO timers and the DRD configuration), with no core soft reset, and xHCI then restores its saved state. Do the same on J714s: mark GUID before the sleep; after the wake, when the PHY reports the controller's bank kept the sleep's state, resume in place if the core kept the mark, otherwise write back the globals and the host's GCTL hibernation setup and let xHCI restore its state. After a sleep refused behind the hibernation the core is set up the same way. The J714s's T6050 controllers now get the same GCTL hibernation enable and power-down scale as T8140 at every start, as macOS's controller start sets them on the dock's port. Signed-off-by: Diljit Singh <hey@djdev.me>
|
First hardware run of this exact code on
🤖 Generated with Claude Code |
|
atc_sleep_macos_usb() in atc-t6050-dp.c, the pwrctl mapping in combo_setup() and the GBLHIBERNATIONEN setup in dwc3-apple.c are all keyed on of_machine_is_compatible("apple,j714s"). The behaviour is a property of the T6050 ATC PHY and its dwc3 instance, not of one board, so every other T6050 machine silently keeps the old path. Select it from the device nodes: map pwrctl when the PHY node has it, use the apple,t6050-dwc3 compatible (or a DT property) for hibernation, and drop the board checks. Until then this should stay a draft. |
|
The controller hibernation sequence is not on 110861f. Both commits apply cleanly on 110861f, even though dwc3-apple.c and the T6050 PHY gained several sleep commits since this branch's base. @DjDeveloperr, the review point is still open: select the pwrctl mapping, atc_sleep_macos_usb() and the GBLHIBERNATIONEN setup from the PHY and dwc3 nodes instead of the apple,j714s machine compatible. #2441 is doing the same for the existing T6050 sleep paths. The dock's USB3 devices still re-enumerate after each wake, which the body also says. Build check of 110861f plus this change (arm64, LLVM=1, Image, dtbs and every directory it touches, Fedora config plus asahi.config): builds, no warnings in the files it touches; CHECK_DTBS over every Apple DTB: no new warnings against the tip. |
Follow-up to #2046 and #2057 (merged), based on
integration/aurora.This is still draft: the host restores successfully, but the dock's USB3 devices still disconnect during resume. Sustained deep-sleep qualification is also pending a separate wake/alarm investigation.
With the existing router sleep fixes, the J714s dock router returns in place but xHCI loses its saved state when its controller loses power. This change follows the controller hibernation sequence observed under macOS: request D3 after xHCI saves its state, wait for the power-control handshake, gate the PIPE clock on the tunnel producer, then restore D0 and the host globals before xHCI restores its state. It avoids the core soft reset that invalidates that restore.
The two commits add the J714s power-control mapping and PHY hibernation sequence, then the DWC3 host restore in place. They also suspend and restore the USB2 PHY, retain the PIPE producer, and handle return from a refused entry. The rest of the router sleep and display stack remains a dependency.
Validation:
568c9e4cfc915, this PR's code, a refused-entry keep follow-up, an entry-refusal test switch, early port-controller S0, and an experimental PCIe readiness poll. Those additional changes are not in this PR head.memtransitions and onesystemctl suspendtransition committed and returned. The corrected RTC estimates for the three direct transitions were approximately +0.50, −0.29, and +0.76 seconds, with ±1 second quantization uncertainty. They do not demonstrate the programmed 30-second hold. Earlier clean recovery counts likewise do not establish sustained sleep duration.Open work: identify the late USB3 disconnect, qualify sustained sleep after the alarm investigation, and reduce resume latency. No zero-reset or fast-resume qualification is claimed for this head.