summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2024-08-15 17:18:52 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2024-08-22 09:13:17 +0200
commit2a2391f857cdc5cf16f8df030944cef8d3d2bc30 (patch)
treefb3327ef89df97e90d3f7f2ab01549e312630b1d
parentd20c2f8464280550aeabd2766728590cf0ca8a4d (diff)
drm/ast: vga: Transparently handle BMC support
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. v3: - use struct ast_connector.physical_status to handle BMC Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240815151953.184679-11-tzimmermann@suse.de
-rw-r--r--drivers/gpu/drm/ast/ast_vga.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/gpu/drm/ast/ast_vga.c b/drivers/gpu/drm/ast/ast_vga.c
index fdbd0daca7dc..3e815da43fbd 100644
--- a/drivers/gpu/drm/ast/ast_vga.c
+++ b/drivers/gpu/drm/ast/ast_vga.c
@@ -21,6 +21,27 @@ static const struct drm_encoder_funcs ast_vga_encoder_funcs = {
* Connector
*/
+static int ast_vga_connector_helper_get_modes(struct drm_connector *connector)
+{
+ struct ast_connector *ast_connector = to_ast_connector(connector);
+ int count;
+
+ if (ast_connector->physical_status == connector_status_connected) {
+ count = drm_connector_helper_get_modes(connector);
+ } else {
+ /*
+ * 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;
+}
+
static int ast_vga_connector_helper_detect_ctx(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx,
bool force)
@@ -30,13 +51,15 @@ static int ast_vga_connector_helper_detect_ctx(struct drm_connector *connector,
status = drm_connector_helper_detect_from_ddc(connector, ctx, force);
+ if (status != ast_connector->physical_status)
+ ++connector->epoch_counter;
ast_connector->physical_status = status;
- return status;
+ return connector_status_connected;
}
static const struct drm_connector_helper_funcs ast_vga_connector_helper_funcs = {
- .get_modes = drm_connector_helper_get_modes,
+ .get_modes = ast_vga_connector_helper_get_modes,
.detect_ctx = ast_vga_connector_helper_detect_ctx,
};