Skip to content

drm/apple: t6030: keep an HDMI display connected while it is described again - #115

Merged
chriskearney merged 2 commits into
integration/aurorafrom
fix/j516s-hdmi-hold
Oct 15, 2026
Merged

chriskearney merged 2 commits into
integration/aurorafrom
fix/j516s-hdmi-hold

Conversation

@chriskearney

@chriskearney chriskearney commented Oct 13, 2026 •

Copy link
Copy Markdown

This fixes #87, where the M3 Pro's built-in HDMI port reported a display as disconnected and then connected again on every connect and mode set.

Two commits:

  1. An HDMI connect whose link came up no longer fails with -ENOLINK. The check read the Type-C cable flag, which the HDMI output never sets. It now uses the HDMI port's HPD, so the 1 s "link not set up" retry is no longer queued on every attach.
  2. The HDMI connector stays connected, with its modes and EDID, while the firmware describes the display again.
    • This applies while HPD is high, and the retry Type-C uses (2, 4 and 8 s) bounds it.
    • The description coming back ends the hold with at most one hotplug event.
    • A display that doesn't come back gets one disconnect event.

Scope: only the built-in HDMI port of the J514S and J516S (T6030). Type-C, Thunderbolt and M1/M2 behaviour is unchanged. J514S HDMI is untested.

Tests:

Hardware check: passed on a J516S (@aronvandepol, #87 comment): appledrm from the .18 tag plus this diff, stock aquamarine 0.15.1 and Hyprland 0.56.2, a 1080p HDMI display on the built-in port.

  • plug in, then log in: no -67, the hold line logged, no 0x0 output;
  • 60 → 75 → 60 Hz: the connector never read disconnected;
  • DPMS off and on: pass;
  • unplug and a quick replug: disconnected only while HPD was low, back with 24 modes;
  • no GPU faults in the session.

s2idle with HDMI attached is refused by the existing external-display sleep veto, with and without this PR, so it is outside this change.

🤖 Generated with Claude Code

chriskearney and others added 2 commits October 13, 2026 11:29
On a T6030 external pipe, dcp_dptx_connect() checks at the end that the
port still has its display before it marks the link ready. The check
reads the Type-C cable flag, which the fixed HDMI output never sets, so
every HDMI connect returned -ENOLINK after the link had come up and the
firmware had started to describe the display. Since the HDMI output got
the bounded retry, each such connect has also queued one:

  HDMI display link not set up (-67): retry 1 of 3 in 1000 ms

on every HDMI attach. It used up one of the three tries of the attach,
and when it fired while the display was being described again, with the
connector reported disconnected, it released the HDMI link and set it up
again, which withdraws the description once more.

For the fixed HDMI output, check its HPD instead. A connect that brings
the link up now returns 0 and marks it ready; one whose display went
away while it waited (HPD low) still fails with -ENOLINK and is retried
as before. With appledrm.hdmi_audio=1 the T6030 HDMI port now also
connects its AV service at that point, as the other outputs do.

Type-C and Thunderbolt routes still pass on the cable flag. dcp->external
is only set on T6030 external pipes, so M1/M2 are unchanged.

Link: #87
Signed-off-by: Chris Kearney <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d again

On the T6030 HDMI port (J514S, J516S), the firmware can withdraw the
description of the attached display (timings, color modes, attributes)
after a connect and after a mode set, with HPD high, and publish it
again a fraction of a second later. A J516S with a 1080p HDMI display
shows it on every connect and mode set:

  display TimingElements withdrawn, 0 bytes
  dcp_hotplug() connected:0 valid_mode:0 nr_modes:24
  display description complete again
  dcp_hotplug() connected:1 valid_mode:0 nr_modes:24

The driver reported each withdrawal as a disconnect and the return as a
connect, about half a second apart. Compositors dropped the output and
added it again. aquamarine could read the connector in that window as
connected with no modes and keep a 0x0 output, and Hyprland removed and
re-added its wl_output global while Xwayland was binding it.

Direct Type-C routes already keep the connector connected through such a
withdrawal; the fixed HDMI output was left out. Hold it the same way
while its HPD is high:

- A withdrawal with HPD high queues the bounded retry (2 s, then 4 and
  8 s), as on Type-C. If the display is not described again by then, the
  retry reports it disconnected and sets the HDMI link up again
  (dcp_fabric_hdmi_retry()).
- While that retry is queued, the connector stays connected with the
  modes and EDID it has. The mode is invalidated as before, and a mode
  set in the window waits for the description.
- The description coming back ends the hold with at most one hotplug
  event, the connector still connected, which re-applies the mode as
  before. A display that does not come back gets one disconnect event.
- Every HDMI withdrawal with HPD high is held, not only the first of a
  connection as on Type-C, since this port withdraws on mode sets too.
  The queued retry bounds it: with no retry left (3 per attach, given
  back by a mode set that succeeds), a withdrawal disconnects as before.
- An HDMI HPD edge while a display is held keeps the retry that bounds
  the hold instead of cancelling it; the converter's HPD pulses also
  run the attach path.

HPD low at the withdrawal, a pipe lent to a Type-C display, and a
withdrawal with no retry left take the old path. Type-C, Thunderbolt and
M1/M2 pipes are unchanged.

Tests: the apple-display-external-hold KUnit suite gets five HDMI cases,
with the HPD level supplied through a KUnit static stub of the new
dcp_hdmi_port_attached(). A probe in the withdrawn window reads the
display with its mode and EDID, the return sends one event, and the
retry then sends none. Four withdrawals in a row, more than there are
retries, are each held with one event per return. A display that is not
described again and was unplugged gets one disconnect event. HPD low at
the withdrawal, or no retry left, disconnects at once. These replace the
case that expected the HDMI output to disconnect at once.

Link: #87
Signed-off-by: Chris Kearney <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chriskearney

Copy link
Copy Markdown
Author

Adversarial review before merge, at head d4a128739e3d merged onto integration/aurora cadfb30a: two passes, one of them by an independent reviewer with no part in writing this. No blocker. The hardware check on a J516S is in the description.

Checked and holding:

  • Scope: every changed line needs dcp->external (apple,t6030-dcpext) or, on the HDMI paths, hdmi-hpd-gpios, which only t603x-j514s-j516s-hdmi.dtsi has. M1/M2, T8122 (J613/J615) and T6031 cannot reach them. On dcpext1 and while a Type-C display borrows dcpext0, dcp_hdmi_port_attached() is false, so Type-C, Thunderbolt and USB4 keep their old conditions.
  • Context: the HPD GPIO is read only in process context, under v14->lock from the description callback (which already allocates with GFP_KERNEL) or under hpd_mutex in connect. This adds no new lock-order edge.
  • Commit 1's new success path: on HDMI it now sets external_link_ready and calls dcpext_scanout_link_restored() (a no-op without the non-native scanout), plus av_service_connect() only with appledrm.hdmi_audio=1. The sleep veto already refused on dptxport[0].connected, so its result does not change.
  • Retry budget: every successful mode set resets it (iomfb_v14_7.c), so repeated mode sets do not exhaust it.

Follow-ups (not blocking). Each is narrow and at worst gives the behaviour from before this PR:

  1. A hold can end on a retry queued for an earlier withdrawal. dcp_external_retry() does not re-arm a pending retry. If a mode set's withdrawal lands within 2 s of the attach's withdrawal and its description is late, the first retry reports a disconnect and relinks. That is the old flap. Fix: when an HDMI hold starts with a retry pending, push the retry out to DCP_V14_DESC_RELINK_MS without charging the budget.
  2. A Type-C hand-back has a short window. dcp_typec_route_deactivate() clears active_typec_route before it marks the departing Type-C connector disconnected and switches dcp->connector. A withdrawal in that window, or a late one after it, is treated as an HDMI one: it queues an HDMI retry, and in the narrow window it can hold the Type-C connector.
  3. A hold flag can be left set. external_held is cleared only by a description returning or by the retry. A retry dropped by a generation change (hand-back, Thunderbolt claim, suspend) can leave it set, and the next attach then keeps the EDID it had. Type-C has the same gap.
  4. Test gaps:
    • hold_hdmi_not_back_releases has a NULL hdmi_hpd in the fixture, so it never reaches the HDMI relink branch.
    • No test covers follow-up 1, the dcp_hdmi_connect_fixed() change or the connect check.
    • The return path calls the hotplug directly and skips dcp_modes_replace(), so whether the EDID is kept on return is not tested.
  5. To check on hardware: HDMI has no CRTC-off guard like Type-C's typec_crtc_off. Hold DPMS off for more than 15 s and check that the journal has no display withdrawn on the HDMI port. If a withdrawal does show up, the 2 s retry would relink and DPMS off would not stick.

Local results on the merged tree: display KUnit (display.kunitconfig, arm64, LLVM): 224 tests, 222 pass. The one failure (apple-display-parser.parser_route_programming_guard) and the one skip (S35_dual_retry_off) are the same as on base bbcd9c60, and nothing under drivers/gpu/drm/apple has changed on base since. apple-display-external-hold passes 12/12, with no WARN, BUG or Oops. Release-config kernel build: r18 recipe config plus olddefconfig, Image modules with LLVM, rc=0, no warnings in the changed files. The wording scan on the commits and the diff is clean.

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.

J516S HDMI: link-setup retry reports the display as disconnected to userspace, so compositors drop and re-add the output

1 participant