Skip to content

drm/apple: power-cycle a T6020 tunnel CRTC that lost its mode - #959

Merged
RyanTheTide merged 1 commit into
integration/aurorafrom
fix/dcp-t6020-tunnel-relink
Nov 5, 2026
Merged

RyanTheTide merged 1 commit into
integration/aurorafrom
fix/dcp-t6020-tunnel-relink

Conversation

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Problem

On a T6020 (M2 Pro/Max) with a display behind a Thunderbolt dock, the display can stay dark until it is replugged. This happens after a wake or screen unblank, or any time the monitor drops HPD for a second or two.

Seen on a J414s with a Winstars WL-UTD59 Thunderbolt 5 dock and a Samsung Odyssey G81SF at 4K 120 Hz (DSC):

  1. The monitor briefly drops HPD. It does this as it leaves standby, about 3 s after the picture arrives. With no signal it also repeats the drop every 33 s.
  2. The connection manager tears the DP tunnel down and builds it again. The DCP firmware powers the pipe down with the lost link (fDisplayPowerState=0).
  3. The compositor never sees a disconnect that short, so the CRTC stays active and it issues no modeset.
  4. dcp_hotplug() excluded T6020 tunnels from the active-CRTC retrain, so connected:1 valid_mode:0 led nowhere.
  5. Resetting the CRTC would not help either. With the CRTC still active it only sets the mode (dcp_external_recover() powers on only for H17P), and that modeset fails with link fault 22 / 80000104 because nothing powers the pipe back on.

Fix

For a T6020 tunnel, the hotplug retrain turns the CRTC off and on, the same transition the compositor makes on a real replug. dcp_poweron() then reconnects the DPTX, waits for the firmware's hotplug, and powers the pipe on before the mode is set.

  • The mode is checked again under the modeset locks, so a commit that got there first is not redone.
  • At most two cycles run until the mode is valid again.
  • Other outputs keep the existing link-status BAD + CRTC reset path.

Tested on hardware

J414s, Aurora Fedora 44 kernel 7.3.0-16 (21f7ffc) with this change in appledrm.ko:

  • The monitor dropped HPD 3 s after a wake. The tunnel was rebuilt, and the driver power-cycled the CRTC: dcp_poweroff, then dcp_poweron, then the mode set finished. The picture was back 0.6 s after the tunnel returned. Before this change it stayed dark until a replug.
  • The same recovery ran when the monitor's 33 s no-signal cycle came round, and the picture came back.
  • Normal wakes with a kept tunnel are unchanged.
  • Build-tested on this branch's base 3331309: appledrm.ko with W=1, no new warnings.

Known, separate: sometimes the monitor ignores the first post-wake modeset on a kept tunnel. It then lights only at its next 33 s cycle, which this change does recover.

🤖 Generated with Claude Code

A display behind a Thunderbolt dock on a T6020 (M2 Pro/Max) can drop
HPD for a second or two while the CRTC stays on, for example a monitor
that blips HPD as it leaves standby after a wake or unblank. The
connection manager tears the DP tunnel down and builds it again, and
the DCP firmware powers the pipe down with the lost link. The
compositor never sees the short disconnect, so it keeps the CRTC active
and issues no modeset.

dcp_hotplug() left T6020 tunnels out of the active-CRTC retrain, and a
reset of the CRTC would not have helped either: with the CRTC still
active it only sets the mode, and the modeset fails because nothing
powers the pipe back on. The display stayed dark until it was
replugged.

Turn the CRTC off and on instead. dcp_poweron() then reconnects the
DPTX, waits for the firmware's hotplug, and powers the pipe on before
the mode is set, as when the compositor wakes the display. Check the
mode again under the modeset locks, so a commit that got there first is
not redone, and allow two cycles until the mode is valid again.

Tested on a J414s with a Thunderbolt 5 dock and a 4K 120 Hz monitor:
the monitor dropped HPD 3 s after a wake and the picture came back
0.6 s after the tunnel returned. Before, it stayed dark.

Assisted-by: Claude Opus 5.5
Signed-off-by: DjDeveloperr <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train review (MT959):

  • DJ's own Signed-off-by is on the commit. Diff reviewed: the new path runs only for T6020 tunnels, is bounded at 2 power cycles, and re-checks the mode under the modeset locks; other SoCs keep the old behaviour.
  • Test merge on integration/aurora b500668: apple-dcp host selftests 85/85, drm/apple KUnit 112 passed, 1 skipped. run-host-tests fails only asahi-m4, identically on the base without this PR.
  • Regression boot on the M2 (T8112) with its own release 7.3.0-aurora-f959t: display up (eDP 2560x1664), dmesg warnings match fleet16 (no new ones), 0 AVCs with SELinux enforcing, no failed units. The M2 was restored to fleet16.
  • The T6020 path itself was not exercised here (no T6020 hardware in the fleet); DJ's J414s dock test stands for that.

Merging.

🤖 Generated with Claude Code

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.

2 participants