[PATCH 1/7] drm/amd/display: Create dc_sink when EDID fail

2021-08-13 Thread Wayne Lin
[Why]
While reading remote EDID via Startech 1-to-4 hub, occasionally we
won't get response in time and won't light up corresponding monitor.

Ideally, we can still add generic modes for userspace to choose to try
to light up the monitor and which is done in
drm_helper_probe_single_connector_modes(). So the main problem here is
that we fail .mode_valid since we don't create remote dc_sink for this
case.

[How]
Also add default dc_sink if we can't get the EDID.

Reviewed-by: Nicholas Kazlauskas 
Acked-by: Wayne Lin 
Signed-off-by: Wayne Lin 
---
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 5568d4e518e6..1bcba6943fd7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -213,6 +213,29 @@ static int dm_dp_mst_get_modes(struct drm_connector 
*connector)
drm_connector_update_edid_property(
>base,
NULL);
+
+   DRM_DEBUG_KMS("Can't get EDID of %s. Add default remote 
sink.", connector->name);
+   if (!aconnector->dc_sink) {
+   struct dc_sink *dc_sink;
+   struct dc_sink_init_data init_params = {
+   .link = aconnector->dc_link,
+   .sink_signal = 
SIGNAL_TYPE_DISPLAY_PORT_MST };
+
+   dc_sink = dc_link_add_remote_sink(
+   aconnector->dc_link,
+   NULL,
+   0,
+   _params);
+
+   if (!dc_sink) {
+   DRM_ERROR("Unable to add a remote 
sink\n");
+   return 0;
+   }
+
+   dc_sink->priv = aconnector;
+   aconnector->dc_sink = dc_sink;
+   }
+
return ret;
}
 
-- 
2.25.1



[PATCH 1/7] drm/amd/display: Create dc_sink when EDID fail

2021-08-13 Thread Wayne Lin
[Why]
While reading remote EDID via Startech 1-to-4 hub, occasionally we
won't get response in time and won't light up corresponding monitor.

Ideally, we can still add generic modes for userspace to choose to try
to light up the monitor and which is done in
drm_helper_probe_single_connector_modes(). So the main problem here is
that we fail .mode_valid since we don't create remote dc_sink for this
case.

[How]
Also add default dc_sink if we can't get the EDID.

Reviewed-by: Nicholas Kazlauskas 
Acked-by: Wayne Lin 
Signed-off-by: Wayne Lin 
---
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index 5568d4e518e6..1bcba6943fd7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -213,6 +213,29 @@ static int dm_dp_mst_get_modes(struct drm_connector 
*connector)
drm_connector_update_edid_property(
>base,
NULL);
+
+   DRM_DEBUG_KMS("Can't get EDID of %s. Add default remote 
sink.", connector->name);
+   if (!aconnector->dc_sink) {
+   struct dc_sink *dc_sink;
+   struct dc_sink_init_data init_params = {
+   .link = aconnector->dc_link,
+   .sink_signal = 
SIGNAL_TYPE_DISPLAY_PORT_MST };
+
+   dc_sink = dc_link_add_remote_sink(
+   aconnector->dc_link,
+   NULL,
+   0,
+   _params);
+
+   if (!dc_sink) {
+   DRM_ERROR("Unable to add a remote 
sink\n");
+   return 0;
+   }
+
+   dc_sink->priv = aconnector;
+   aconnector->dc_sink = dc_sink;
+   }
+
return ret;
}
 
-- 
2.25.1