drm/amd/display: Maintain current link settings in link loss interrupt
authorGary Li <garyli12@amd.com>
Thu, 14 Apr 2022 13:01:48 +0000 (09:01 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 25 Apr 2022 21:11:27 +0000 (17:11 -0400)
[Why]
DP compliance test case 400.3.2.3 is failed because in link loss interrupt
the current link settings is not used in the DP link training.

[How]
In link loss interrupt, use the current link settings in the following DP
link training.

Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Gary Li <garyli12@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c

index 10f990e..50a12fd 100644 (file)
@@ -4576,6 +4576,7 @@ void dc_link_dp_handle_link_loss(struct dc_link *link)
 {
        int i;
        struct pipe_ctx *pipe_ctx;
+       struct dc_link_settings prev_link_settings = link->preferred_link_setting;
 
        for (i = 0; i < MAX_PIPES; i++) {
                pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
@@ -4586,6 +4587,10 @@ void dc_link_dp_handle_link_loss(struct dc_link *link)
        if (pipe_ctx == NULL || pipe_ctx->stream == NULL)
                return;
 
+       /* toggle stream state with the preference for current link settings */
+       dc_link_set_preferred_training_settings((struct dc *)link->dc,
+                                       &link->cur_link_settings, NULL, link, true);
+
        for (i = 0; i < MAX_PIPES; i++) {
                pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
                if (pipe_ctx && pipe_ctx->stream && !pipe_ctx->stream->dpms_off &&
@@ -4601,6 +4606,10 @@ void dc_link_dp_handle_link_loss(struct dc_link *link)
                        core_link_enable_stream(link->dc->current_state, pipe_ctx);
                }
        }
+
+       /* restore previous link settings preference */
+       dc_link_set_preferred_training_settings((struct dc *)link->dc,
+                                       &prev_link_settings, NULL, link, true);
 }
 
 bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpd_irq_dpcd_data, bool *out_link_loss,