OSDN Git Service

drm/amd/display: Change return type of dm_helpers_dp_mst_stop_top_mgr
authorIan Chen <ian.chen@amd.com>
Sun, 23 Jan 2022 18:20:03 +0000 (13:20 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Jan 2022 23:00:35 +0000 (18:00 -0500)
Prepare for future dm can have different implementation depends on the
return value.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Ian Chen <ian.chen@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/core/dc_link.c
drivers/gpu/drm/amd/display/dc/dm_helpers.h

index bfeace3..575840c 100644 (file)
@@ -445,40 +445,24 @@ bool dm_helpers_dp_mst_start_top_mgr(
        return (drm_dp_mst_topology_mgr_set_mst(&aconnector->mst_mgr, true) == 0);
 }
 
-void dm_helpers_dp_mst_stop_top_mgr(
+bool dm_helpers_dp_mst_stop_top_mgr(
                struct dc_context *ctx,
                struct dc_link *link)
 {
        struct amdgpu_dm_connector *aconnector = link->priv;
-       uint8_t i;
 
        if (!aconnector) {
                DRM_ERROR("Failed to find connector for link!");
-               return;
+               return false;
        }
 
        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;
-                               }
-                       }
-               }
-       }
+       return false;
 }
 
 bool dm_helpers_dp_read_dpcd(
index f8f3637..08fbf0a 100644 (file)
@@ -840,20 +840,22 @@ static bool discover_dp_mst_topology(struct dc_link *link, enum dc_detect_reason
        return link->type == dc_connection_mst_branch;
 }
 
-static void reset_cur_dp_mst_topology(struct dc_link *link)
+static bool reset_cur_dp_mst_topology(struct dc_link *link)
 {
+       bool result = false;
        DC_LOGGER_INIT(link->ctx->logger);
 
        LINK_INFO("link=%d, mst branch is now Disconnected\n",
                  link->link_index);
 
        revert_dpia_mst_dsc_always_on_wa(link);
-       dm_helpers_dp_mst_stop_top_mgr(link->ctx, link);
+       result = dm_helpers_dp_mst_stop_top_mgr(link->ctx, link);
 
        link->mst_stream_alloc_table.stream_count = 0;
        memset(link->mst_stream_alloc_table.stream_allocations,
                        0,
                        sizeof(link->mst_stream_alloc_table.stream_allocations));
+       return result;
 }
 
 static bool should_prepare_phy_clocks_for_link_verification(const struct dc *dc,
@@ -1306,7 +1308,7 @@ static bool detect_link_and_local_sink(struct dc_link *link,
 bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
 {
        bool is_local_sink_detect_success;
-       bool is_remote_sink_detect_required = false;
+       bool is_delegated_to_mst_top_mgr = false;
        enum dc_connection_type pre_link_type = link->type;
 
        is_local_sink_detect_success = detect_link_and_local_sink(link, reason);
@@ -1317,14 +1319,14 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
        if (is_local_sink_detect_success && link->local_sink &&
                        dc_is_dp_signal(link->local_sink->sink_signal) &&
                        link->dpcd_caps.is_mst_capable)
-               is_remote_sink_detect_required = discover_dp_mst_topology(link, reason);
+               is_delegated_to_mst_top_mgr = discover_dp_mst_topology(link, reason);
 
        if (is_local_sink_detect_success &&
                        pre_link_type == dc_connection_mst_branch &&
                        link->type != dc_connection_mst_branch)
-               reset_cur_dp_mst_topology(link);
+               is_delegated_to_mst_top_mgr = reset_cur_dp_mst_topology(link);
 
-       return is_local_sink_detect_success && !is_remote_sink_detect_required;
+       return is_local_sink_detect_success && !is_delegated_to_mst_top_mgr;
 }
 
 bool dc_link_get_hpd_state(struct dc_link *dc_link)
index a5497ba..b71b5fb 100644 (file)
@@ -113,7 +113,7 @@ bool dm_helpers_dp_mst_start_top_mgr(
                const struct dc_link *link,
                bool boot);
 
-void dm_helpers_dp_mst_stop_top_mgr(
+bool dm_helpers_dp_mst_stop_top_mgr(
                struct dc_context *ctx,
                struct dc_link *link);
 /**