@@ -2174,7 +2174,8 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend)
} else {
ret = drm_dp_mst_topology_mgr_resume(mgr, true);
if (ret < 0) {
- drm_dp_mst_topology_mgr_set_mst(mgr, false);
+ dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx,
+ aconnector->dc_link);
need_hotplug = true;
}
}
@@ -10216,7 +10217,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
* added MST connectors not found in existing crtc_state in the chained mode
* TODO: need to dig out the root cause of that
*/
- if (!aconnector || (!aconnector->dc_sink && aconnector->mst_port))
+ if (!aconnector)
goto skip_modeset;
if (modereset_required(new_crtc_state))
@@ -456,7 +456,6 @@ void dm_helpers_dp_mst_stop_top_mgr(
struct dc_link *link)
{
struct amdgpu_dm_connector *aconnector = link->priv;
- uint8_t i;
if (!aconnector) {
DRM_ERROR("Failed to find connector for link!");
@@ -468,22 +467,7 @@ void dm_helpers_dp_mst_stop_top_mgr(
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;
- }
- }
- }
+ link->cur_link_settings.lane_count = 0;
}
}
@@ -154,11 +154,28 @@ amdgpu_dm_mst_connector_late_register(struct drm_connector *connector)
static void
amdgpu_dm_mst_connector_early_unregister(struct drm_connector *connector)
{
- struct amdgpu_dm_connector *amdgpu_dm_connector =
+ struct amdgpu_dm_connector *aconnector =
to_amdgpu_dm_connector(connector);
- struct drm_dp_mst_port *port = amdgpu_dm_connector->port;
+ struct drm_dp_mst_port *port = aconnector->port;
+ struct amdgpu_dm_connector *root = aconnector->mst_port;
+ struct dc_link *dc_link = aconnector->dc_link;
+ struct dc_sink *dc_sink = aconnector->dc_sink;
drm_dp_mst_connector_early_unregister(connector, port);
+
+ /*
+ * Release dc_sink for connector which its attached port is
+ * no longer in the mst topology
+ */
+ drm_modeset_lock(&root->mst_mgr.base.lock, NULL);
+ if (dc_sink) {
+ if (dc_link->sink_count)
+ dc_link_remove_remote_sink(dc_link, dc_sink);
+
+ dc_sink_release(dc_sink);
+ aconnector->dc_sink = NULL;
+ }
+ drm_modeset_unlock(&root->mst_mgr.base.lock);
}
static const struct drm_connector_funcs dm_dp_mst_connector_funcs = {
@@ -342,7 +359,7 @@ dm_dp_mst_detect(struct drm_connector *connector,
return connector_status_disconnected;
connection_status = drm_dp_mst_detect_port(connector, ctx, &master->mst_mgr,
- aconnector->port);
+ aconnector->port);
if (port->pdt != DP_PEER_DEVICE_NONE && !port->dpcd_rev) {
uint8_t dpcd_rev;
@@ -376,6 +393,17 @@ dm_dp_mst_detect(struct drm_connector *connector,
port->dpcd_rev = 0;
}
+ /*
+ * Release dc_sink for connector which unplug event is notified by CSN msg
+ */
+ if (connection_status == connector_status_disconnected && aconnector->dc_sink) {
+ if (aconnector->dc_link->sink_count)
+ dc_link_remove_remote_sink(aconnector->dc_link, aconnector->dc_sink);
+
+ dc_sink_release(aconnector->dc_sink);
+ aconnector->dc_sink = NULL;
+ }
+
return connection_status;
}