Skip to content

phy/drm: apple: seamless handover from early bootloader HDMI bring-up (T6050/T8132) - #2764

Draft
DjDeveloperr wants to merge 2 commits into
mainfrom
djdev/dcp-hdmi-inherited-handoff
Draft

DjDeveloperr wants to merge 2 commits into
mainfrom
djdev/dcp-hdmi-inherited-handoff

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Enables clean Linux lpdptx_phy + apple-dcp takeover when early bootloader HDMI bring-up (aurora-silicon/aura#445) leaves a T6050/T8132 HDMI link and DPTX port 0 live across simpledrm boot:

  1. phy: apple: dptx: power down bootloader-locked PLL before T6050 activation: power down PHY TX and unlock the PLL before rewriting PLL calibration/config in t6050_activate() when the PLL lock bit is still set from early bootloader bring-up. Cold boots (PLL already unlocked) are unchanged. Includes host regression test (phy.py).
  2. drm/apple: dcp: release inherited bootloader HDMI DPTX session before reconnecting: detect an inherited fixed-HDMI DPTX session in dcp_enable_dp2hdmi_hpd() and release port 0 via dptxport_release_display() (waiting up to 260 ms outside hpd_mutex for disconnect) before normal dcp_dptx_connect() activates the PHY and trains the full link cleanly. Cold boots are unchanged. Includes host regression test (lifecycle.py).

Verification

  • Host tests (t6050-warm-activate and inherited-hdmi-handoff): PASS.
  • Draft pending end-to-end J773g aura#445 → simpledrm → apple-dcp 4K@120Hz handoff verification.

…ation

When early bootloader HDMI bring-up leaves a T6050/T8132 lpdptx PHY
running across handoff, the hardware PLL lock bit (dptx+0x1008 bit 3)
is still set when Linux activates the PHY for the first time.

Power down the PHY TX and unlock the PLL before rewriting PLL core
calibration and configuration in t6050_activate(), leaving the cold-boot
path unchanged when the PLL is already unlocked. Add a host regression
test covering cold activation, warm bootloader-locked activation across
both pclkdrv_select polarities, subsequent HBR3 reconfiguration, and
PLL unlock error handling.

Signed-off-by: Diljit Singh <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Read at 9cc0fb3 (draft).

The PHY half keys on the hardware state (PLL lock bit still set) rather than on a board or a flag, which is the right shape, and cold boots take the old path.

On the DCP half, dcp_release_inherited_hdmi_dptx() waits for the disconnect by polling connector->connected 13 times at 20 ms, then sleeps another 20 ms (or a flat 60 ms with no connector). Those are fixed delays with no stated source. The firmware reports the disconnect through the same hot-plug path that clears connected, so waiting on that event (a completion signalled from the hot-plug handler, with one timeout whose value comes from a measured release time) would replace all three numbers. If the poll stays, the commit message should say where 260 ms and the extra 20 / 60 ms come from, and what happens when the timeout passes with the display still connected (today it warns and goes on to dcp_dptx_connect() anyway).

Rows when it leaves draft: the J773g aura#445 -> simpledrm -> apple-dcp handover at 4K@120, plus one cold boot without aura#445 on the same head showing no change, and one T6050 board, since the PHY change covers it too.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr
DjDeveloperr force-pushed the djdev/dcp-hdmi-inherited-handoff branch from 9cc0fb3 to e8ced17 Compare November 22, 2026 02:34
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Updated djdev/dcp-hdmi-inherited-handoff at e8ced1713bef2 to address the review comment:

  • Replaced the fixed polling and settle msleep() delays in dcp_release_inherited_hdmi_dptx() with struct completion hdmi_disconnect_done, re-initialized before dptxport_release_display() under hpd_mutex, completed from the IOMFB hotplug disconnect handlers (iomfb_template.c, iomfb_v14_7.c, and dcp_external_report_disconnected()), and waited outside hpd_mutex with a single 500 ms timeout (~5x the 58–99 ms release-to-unplug latency measured on J773g 26B123).
  • Changed dcp_release_inherited_hdmi_dptx() to return int; on release error or -ETIMEDOUT with the display still connected (or no connector yet), dcp_enable_dp2hdmi_hpd() skips dcp_dptx_connect(dcp, 0) while still arming the HPD IRQ for replug recovery (unplugged cable still runs _dcp_poweroff()).
  • Updated inherited-hdmi-handoff in lifecycle.py to verify completion ordering, lock discipline, NULL-connector completion wait, release errors, and timeout handling (inherited-hdmi-handoff and t6050-warm-activate PASS; checkpatch.pl --strict 0/0/0).

Will add the J773g aura#445 -> simpledrm -> apple-dcp 4K@120Hz and cold-boot HDMI rows before moving out of draft.

Assisted-by: LLM (Gemini:4 Neon)

… reconnecting

When early bootloader HDMI bring-up leaves DCP holding DPTX port 0 live
across quiesce so simpledrm keeps scanning out through early boot,
apple-dcp wakes firmware with the bootloader display already reported
connected while Linux's dptxport[0].connected is still false and
lpdptx_phy is still unactivated.

Calling dcp_dptx_connect(dcp, 0) directly on that live session stalls
for 2 s waiting for a linkcfg_completion callback that firmware never
re-emits, and the timeout teardown then disconnects the output and
leaves the connector permanently down.

Detect an inherited fixed-HDMI DPTX session (non-Type-C with hdmi_hpd,
port 0 service available, dptxport[0].connected still false, and display
already reported connected) in dcp_enable_dp2hdmi_hpd() and release port
0 via dptxport_release_display() before the normal connect or poweroff
path runs. Replace fixed polling delays with a completion
(hdmi_disconnect_done) re-initialized before releasing port 0 and
completed by the IOMFB hotplug disconnect handlers, waited outside
hpd_mutex with a 500 ms timeout (~5x the 58..99 ms measured
release-to-unplug latency on J773g 26B123). If release fails or the
disconnect wait times out with the display still connected (or no
connector yet), skip dcp_dptx_connect(dcp, 0) rather than racing a live
session while still arming the HPD IRQ for replug recovery. Cold boots
have no active display at takeover and remain unchanged.

Add a host regression test in lifecycle.py exercising cold boot, warm
inherited HDMI takeover (with and without connector), cable unplugged
before takeover, hdmi_yielded, release errors, disconnect timeout
skipping connect, timeout race where connector already cleared, stale
nr_modes after unplug, and non-applicable paths.

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

This branch has not been deployed

No deployments
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