Skip to content

DisplayPort: Detect, train link, and make polling macros time out [1/2] - #282

Merged
mariobalanica merged 2 commits into
edk2-porting:masterfrom
C-Prime90:PR-DP
Sep 17, 2026
Merged

mariobalanica merged 2 commits into
edk2-porting:masterfrom
C-Prime90:PR-DP

Conversation

@C-Prime90

Copy link
Copy Markdown
Contributor

Split out of #281 at review request. #281 (USB Type-C) depends on both commits and should land after this.

readx_poll_timeout() and regmap_read_poll_timeout() both took a timeout
argument and never looked at it. The loops ended only on a read error or
on the condition coming true, so hardware that never settles -- a DP AUX
transfer that stalls, a USB-DP PHY PLL or CDR that never locks -- hung DXE
with nothing to fall back on. Both now return -ETIMEDOUT once the budget
runs out.

There are two copies of this header, the shared one under Include/Library
and UsbDpPhyDxe's own. Both carried the defect, so both are fixed here.

UsbDpPhyDxe's copy measures its deadline against the performance counter
rather than accumulating sleep_us, because one of its call sites polls with
sleep_us == 0 and a budget decremented by the sleep alone would never
advance. ArmArchTimerLib's counter is 64-bit and counts up from zero, and
TimerLib is already linked into that driver, so no INF change is needed.

No call site needs touching. The four lock waits in UsbDpPhyDxe -- the
LCPLL and the two RX CDR polls in rk3588_udphy_status_check(), and
CMN_ANA_ROPLL_DONE in rk3588_dp_phy_set_rate() -- already handle a non-zero
return and take their reset-and-fail paths. A PHY that cannot lock now
leaves that display or USB port dead instead of taking the boot with it.

Found via edk2-porting#249, where a ROCK 5B boot stall was
traced to this macro and confirmed by instrumenting the loop.
detect(), get_edid() and disable() were stubs, so the GOP always fell
back to a blind PHY configuration at RBR with no link training and no
picture unless Force Output was set by hand.

Implement HPD detection from DPTX_HPD_STATUS, EDID retrieval over
I2C-over-AUX (segment/offset addressing, 16-byte chunking, DEFER
retries), and a proper power-down on disable(). Wire dw_dp_link_probe()
in so a real sink now gets real link training, with the old blind path
kept as a fallback for boards whose HPD isn't usable.

Also implement AnalogixDpConnectorGetEdid() for eDP, though eDP still
can't be enabled anywhere since EdpEnableBacklight() has no platform
implementation.
@C-Prime90 C-Prime90 changed the title DisplayPort: Detect, train the link, and make the polling macros time out DisplayPort: Detect, train link, and make polling macros time out Sep 17, 2026
@C-Prime90 C-Prime90 changed the title DisplayPort: Detect, train link, and make polling macros time out DisplayPort: Detect, train link, and make polling macros time out [1/2] Sep 17, 2026
@mariobalanica
mariobalanica merged commit ad7c53a into edk2-porting:master Sep 17, 2026
23 checks passed
@C-Prime90
C-Prime90 deleted the PR-DP branch September 18, 2026 02:59
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