drm/amd/display: Clear dc remote sinks on MST disconnect
authorAurabindo Pillai <aurabindo.pillai@amd.com>
Thu, 26 Nov 2020 14:31:05 +0000 (09:31 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 1 Dec 2020 20:59:57 +0000 (15:59 -0500)
[Why&How]
Recent changes to upstream mst code remove the callback which
cleared the internal state for mst. Move the missing functionality
that was previously called through the destroy call back for mst connector
destroy

Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Eryk Brol <eryk.brol@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
drivers/gpu/drm/amd/display/dc/dm_helpers.h

index b7d7ec3..d8b0f07 100644 (file)
@@ -418,9 +418,10 @@ bool dm_helpers_dp_mst_start_top_mgr(
 
 void dm_helpers_dp_mst_stop_top_mgr(
                struct dc_context *ctx,
-               const struct dc_link *link)
+               struct dc_link *link)
 {
        struct amdgpu_dm_connector *aconnector = link->priv;
+       uint8_t i;
 
        if (!aconnector) {
                DRM_ERROR("Failed to find connector for link!");
@@ -430,8 +431,25 @@ void dm_helpers_dp_mst_stop_top_mgr(
        DRM_INFO("DM_MST: stopping TM on aconnector: %p [id: %d]\n",
                        aconnector, aconnector->base.base.id);
 
-       if (aconnector->mst_mgr.mst_state == true)
+       if (aconnector->mst_mgr.mst_state == true) {
                drm_dp_mst_topology_mgr_set_mst(&aconnector->mst_mgr, false);
+
+               for (i = 0; i < MAX_SINKS_PER_LINK; i++) {
+                       if (link->remote_sinks[i] == NULL)
+                               continue;
+
+                       if (link->remote_sinks[i]->sink_signal ==
+                           SIGNAL_TYPE_DISPLAY_PORT_MST) {
+                               dc_link_remove_remote_sink(link, link->remote_sinks[i]);
+
+                               if (aconnector->dc_sink) {
+                                       dc_sink_release(aconnector->dc_sink);
+                                       aconnector->dc_sink = NULL;
+                                       aconnector->dc_link->cur_link_settings.lane_count = 0;
+                               }
+                       }
+               }
+       }
 }
 
 bool dm_helpers_dp_read_dpcd(
index b2cd849..07e349b 100644 (file)
@@ -113,7 +113,7 @@ bool dm_helpers_dp_mst_start_top_mgr(
 
 void dm_helpers_dp_mst_stop_top_mgr(
                struct dc_context *ctx,
-               const struct dc_link *link);
+               struct dc_link *link);
 /**
  * OS specific aux read callback.
  */