[PATCH v2 6/9] drm/ast: dp501: Transparently handle BMC support

Thomas Zimmermann tzimmermann at suse.de
Mon Aug 12 09:30:40 UTC 2024


Permanently set the connector status to 'connected'. Return BMC modes
for connector if no display is attached to the physical DP connector.
Otherwise use EDID modes as before.

If the status of the physical connector changes, the driver still
generates a hotplug event. DRM clients will then reconfigure their
output to a mode appropriate for either physical display or BMC.

Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
---
 drivers/gpu/drm/ast/ast_dp501.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c
index 0dc37b65e1d7..755cbf931b38 100644
--- a/drivers/gpu/drm/ast/ast_dp501.c
+++ b/drivers/gpu/drm/ast/ast_dp501.c
@@ -518,6 +518,17 @@ static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector)
 	count = drm_edid_connector_add_modes(connector);
 	drm_edid_free(drm_edid);
 
+	if (!count) {
+		/*
+		 * There's no EDID data without a connected monitor. Set BMC-
+		 * compatible modes in this case. The XGA default resolution
+		 * should work well for all BMCs.
+		 */
+		count = drm_add_modes_noedid(connector, 4096, 4096);
+		if (count)
+			drm_set_preferred_mode(connector, 1024, 768);
+	}
+
 	return count;
 }
 
@@ -526,10 +537,18 @@ static int ast_dp501_connector_helper_detect_ctx(struct drm_connector *connector
 						 bool force)
 {
 	struct ast_device *ast = to_ast_device(connector->dev);
+	enum drm_connector_status status = connector_status_disconnected;
+	enum drm_connector_status old_status = connector_status_disconnected;
+
+	if (connector->edid_blob_ptr)
+		old_status = connector_status_connected;
 
 	if (ast_dp501_is_connected(ast))
-		return connector_status_connected;
-	return connector_status_disconnected;
+		status = connector_status_connected;
+
+	if (status != old_status)
+		++connector->epoch_counter;
+	return connector_status_connected;
 }
 
 static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs = {
-- 
2.46.0



More information about the dri-devel mailing list