drm/amd/display: Link train only when link is DP and backend is enabled
authorSamson Tam <Samson.Tam@amd.com>
Mon, 4 Mar 2019 21:21:06 +0000 (16:21 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:45:17 +0000 (06:45 -0700)
[ Upstream commit 66acd4418d7de131ef3831e52a8af3d2480e5b15 ]

[Why]
In certain cases we do link training when we don't have a backend.

[How]
In dc_link_set_preferred_link_settings(), store preferred link settings
first and then verify that the link is DP and the link stream's backend is
enabled.  If either is false, then we will not do any link retraining.

Signed-off-by: Samson Tam <Samson.Tam@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/core/dc.c

index 5af2ea1f201d328340077c86a0a93e99fc39fc72..68529acba015f3185d4cef1f8b8ab76765221390 100644 (file)
@@ -524,6 +524,14 @@ void dc_link_set_preferred_link_settings(struct dc *dc,
        struct dc_stream_state *link_stream;
        struct dc_link_settings store_settings = *link_setting;
 
+       link->preferred_link_setting = store_settings;
+
+       /* Retrain with preferred link settings only relevant for
+        * DP signal type
+        */
+       if (!dc_is_dp_signal(link->connector_signal))
+               return;
+
        for (i = 0; i < MAX_PIPES; i++) {
                pipe = &dc->current_state->res_ctx.pipe_ctx[i];
                if (pipe->stream && pipe->stream->sink
@@ -539,7 +547,10 @@ void dc_link_set_preferred_link_settings(struct dc *dc,
 
        link_stream = link->dc->current_state->res_ctx.pipe_ctx[i].stream;
 
-       link->preferred_link_setting = store_settings;
+       /* Cannot retrain link if backend is off */
+       if (link_stream->dpms_off)
+               return;
+
        if (link_stream)
                decide_link_settings(link_stream, &store_settings);