From: George Shen <[email protected]>

[Why]
PHY will sometimes be in bad state on hotplugging display from USB-C
dongle.

[How]
Add additional calls to disable and then enable PHY before link training
starts during verify_link_cap.

Signed-off-by: George Shen <[email protected]>
Reviewed-by: Tony Cheng <[email protected]>
Acked-by: Harry Wentland <[email protected]>
Acked-by: Rodrigo Siqueira <[email protected]>
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c      | 10 ++++++++++
 drivers/gpu/drm/amd/display/dc/dc.h                   |  1 +
 drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c |  3 ++-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index 46f16a77e3a4..ea5a09ca3334 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -1892,6 +1892,16 @@ bool dp_verify_link_cap(
        /* disable PHY done possible by BIOS, will be done by driver itself */
        dp_disable_link_phy(link, link->connector_signal);
 
+       /* Temporary Renoir-specific workaround for SWDEV-215184;
+        * PHY will sometimes be in bad state on hotplugging display from 
certain USB-C dongle,
+        * so add extra cycle of enabling and disabling the PHY before first 
link training.
+        */
+       if (link->link_enc->features.flags.bits.DP_IS_USB_C &&
+                       link->dc->debug.usbc_combo_phy_reset_wa) {
+               dp_enable_link_phy(link, link->connector_signal, dp_cs_id, cur);
+               dp_disable_link_phy(link, link->connector_signal);
+       }
+
        dp_cs_id = get_clock_source_id(link);
 
        /* link training starts with the maximum common settings
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index ecd2257de80b..8c7ff9e322f1 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -421,6 +421,7 @@ struct dc_debug_options {
        bool disable_dram_clock_change_vactive_support;
        bool validate_dml_output;
        bool enable_dmcub_surface_flip;
+       bool usbc_combo_phy_reset_wa;
 };
 
 struct dc_debug_data {
diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c 
b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
index f1ec3448c0c0..0c02120311b6 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
@@ -835,7 +835,8 @@ static const struct dc_debug_options debug_defaults_drv = {
                .scl_reset_length10 = true,
                .sanity_checks = true,
                .disable_48mhz_pwrdwn = false,
-               .nv12_iflip_vm_wa = true
+               .nv12_iflip_vm_wa = true,
+               .usbc_combo_phy_reset_wa = true
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to