DisplayPort: Detect, train link, and make polling macros time out [1/2] - #282
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #281 at review request. #281 (USB Type-C) depends on both commits and should land after this.