Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] The newly added early return in `dpcd_write_rx_power_ctrl()` 
incorrectly relies on `link->aux_mode` before it is initialized, causing the DP 
receiver power-up sequence to be skipped for all newly detected DP monitors and 
active dongles.
--

commit 6bcb07f6c6cfc4188f9856f76b47789a74cb855e
Author: NepNep7601 <[email protected]>

drm/amd/display: skip receiver power control without AUX
    
Passive DP to TMDS dongles do not provide a DP receiver and use native
GPIO I2C rather than AUX. dpcd_write_rx_power_ctrl() nevertheless tries
to write DP_SET_POWER, causing the DP helpers to retry a transaction
that cannot succeed 32 times before giving up. Skip receiver power
control when the link is not using AUX mode.

> diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_phy.c 
> b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_phy.c
> index 49521ac4b0e85..7991531f6ef44 100644
> --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_phy.c
> +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_phy.c
> @@ -50,6 +50,15 @@ void dpcd_write_rx_power_ctrl(struct dc_link *link, bool 
> on)
>       if (link->sync_lt_in_progress)
>               return;
>  
> +     /*
> +      * A passive DP to TMDS dongle presents no DP receiver, so there is
> +      * nothing to power up or down. The write can only fail, and the DP
> +      * helpers retry it 32 times before giving up, which adds tens of
> +      * milliseconds to link bring up.
> +      */
> +     if (!link->aux_mode)
> +             return;

[Severity: High]
Does this early return skip the DP receiver power-up sequence for all newly
detected DP monitors and active dongles?

During system boot or display hotplug, the dc_link struct is zero-allocated,
so link->aux_mode defaults to false. The detection sequence starts with
detect_link_and_local_sink(), which calls detect_dp() -> retrieve_link_cap()
-> dp_wa_power_up_0010FA(), eventually calling dpcd_write_rx_power_ctrl().

Since link->aux_mode is still false at this point, the early return triggers
and skips the DP_SET_POWER D0 write. This breaks detection for active dongles
(such as the 0010FA) that depend on being powered up before a DPCD read.

Looking at detect_link_and_local_sink() in link_detection.c, link->aux_mode
is actually initialized after detect_dp() has already executed and failed:

drivers/gpu/drm/amd/display/dc/link/link_detection.c:detect_link_and_local_sink()
 {
    ...
    if (!detect_dp(link, &sink_caps, reason)) {
    ...
    link->aux_mode =
            link_is_in_aux_transaction_mode(link->ddc);
    ...
}

Should we ensure link->aux_mode is initialized earlier in the detection flow,
or use a different condition to skip the power control write?

> +
>       core_link_write_dpcd(link, DP_SET_POWER, &state,
>                                                sizeof(state));
>

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to