From c8a6b99b04833217438fd1bc18a6655ae96855e6 Mon Sep 17 00:00:00 2001 From: Anthony Koo Date: Thu, 7 Jan 2016 16:47:25 -0500 Subject: [PATCH 0677/1110] drm/amd/dal: Fix issue with sink being added to link on each dc_link_detect In normal hotplug case, all sinks are removed from link on disconnect. On connect, new sinks are added to link. If there is force triggered detection, such as on S3 resume, there may be existing sink when dc_link_detect is called. In this case, existing code keeps adding more sinks to link. This change assumes dc_link_detect will detect the correct new state and add the new sinks properly. So at the start of dc_link_detect, we should first detach all existing sinks. Signed-off-by: Jordan Lazare Acked-by: Jordan Lazare --- drivers/gpu/drm/amd/dal/dc/core/dc_link.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c index 5e39a41..5f24ef1 100644 --- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c @@ -571,6 +571,11 @@ void dc_link_detect(const struct dc_link *dc_link) return; } + /* Free existing state before doing detection on SST + * TODO: For MST, need to investigate if the same is required. */ + if (link->public.type != dc_connection_mst_branch) + link_disconnect_all_sinks(link); + if (new_connection_type != dc_connection_none) { link->public.type = new_connection_type; @@ -718,8 +723,6 @@ void dc_link_detect(const struct dc_link *dc_link) /* From Connected-to-Disconnected. */ if (link->public.type == dc_connection_mst_branch) dc_helpers_dp_mst_stop_top_mgr(link->ctx, &link->public); - else - link_disconnect_all_sinks(link); link->public.type = dc_connection_none; sink_caps.signal = SIGNAL_TYPE_NONE; -- 2.7.4