From: George Shen <george.s...@amd.com>

[Why]
The is_automated flag logic only applies to USB4 DPIA links during DP LL
compliance test automation. The flag should not be set for non-DPIA
cases.

[How]
Add check for DPIA link endpoint type before setting the flag. Also,
rename is_automated to skip_fallback_on_link_loss for clarity.

Reviewed-by: Meenakshikumar Somasundaram <meenakshikumar.somasunda...@amd.com>
Reviewed-by: Wenjing Liu <wenjing....@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.sique...@amd.com>
Signed-off-by: George Shen <george.s...@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dc.h                       | 8 +++++++-
 .../amd/display/dc/link/protocols/link_dp_irq_handler.c   | 6 ++++--
 .../amd/display/dc/link/protocols/link_dp_training_dpia.c | 4 ++--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h 
b/drivers/gpu/drm/amd/display/dc/dc.h
index cf7f88b80390..35a654fa97ee 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -1541,7 +1541,13 @@ struct dc_link {
        bool is_dig_mapping_flexible;
        bool hpd_status; /* HPD status of link without physical HPD pin. */
        bool is_hpd_pending; /* Indicates a new received hpd */
-       bool is_automated; /* Indicates automated testing */
+
+       /* USB4 DPIA links skip verifying link cap, instead performing the 
fallback method
+        * for every link training. This is incompatible with DP LL compliance 
automation,
+        * which expects the same link settings to be used every retry on a 
link loss.
+        * This flag is used to skip the fallback when link loss occurs during 
automation.
+        */
+       bool skip_fallback_on_link_loss;
 
        bool edp_sink_present;
 
diff --git 
a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c
index 0c00e94e90b1..ae271c830c9a 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c
@@ -265,7 +265,7 @@ void dp_handle_link_loss(struct dc_link *link)
 
        for (i = count - 1; i >= 0; i--) {
                // Always use max settings here for DP 1.4a LL Compliance CTS
-               if (link->is_automated) {
+               if (link->skip_fallback_on_link_loss) {
                        pipes[i]->link_config.dp_link_settings.lane_count =
                                        link->verified_link_cap.lane_count;
                        pipes[i]->link_config.dp_link_settings.link_rate =
@@ -404,7 +404,9 @@ bool dp_handle_hpd_rx_irq(struct dc_link *link,
 
        if (hpd_irq_dpcd_data.bytes.device_service_irq.bits.AUTOMATED_TEST) {
                // Workaround for DP 1.4a LL Compliance CTS as USB4 has to 
share encoders unlike DP and USBC
-               link->is_automated = true;
+               if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA)
+                       link->skip_fallback_on_link_loss = true;
+
                device_service_clear.bits.AUTOMATED_TEST = 1;
                core_link_write_dpcd(
                        link,
diff --git 
a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c 
b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c
index 4f4e899e5c46..e8dda44b23cb 100644
--- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c
+++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training_dpia.c
@@ -811,7 +811,7 @@ static enum link_training_result 
dpia_training_eq_transparent(
                        /* Take into consideration corner case for DP 1.4a LL 
Compliance CTS as USB4
                         * has to share encoders unlike DP and USBC
                         */
-                       if (dp_is_interlane_aligned(dpcd_lane_status_updated) 
|| (link->is_automated && retries_eq)) {
+                       if (dp_is_interlane_aligned(dpcd_lane_status_updated) 
|| (link->skip_fallback_on_link_loss && retries_eq)) {
                                result =  LINK_TRAINING_SUCCESS;
                                break;
                        }
@@ -1037,7 +1037,7 @@ enum link_training_result dpia_perform_link_training(
         */
        if (result == LINK_TRAINING_SUCCESS) {
                fsleep(5000);
-               if (!link->is_automated)
+               if (!link->skip_fallback_on_link_loss)
                        result = dp_check_link_loss_status(link, &lt_settings);
        } else if (result == LINK_TRAINING_ABORT)
                dpia_training_abort(link, &lt_settings, repeater_id);
-- 
2.42.0

Reply via email to