Skip to content

Commit 2a2391f

Browse files
author
Thomas Zimmermann
committed
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 <[email protected]> Reviewed-by: Jocelyn Falempe <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d20c2f8 commit 2a2391f

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

drivers/gpu/drm/ast/ast_vga.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@ static const struct drm_encoder_funcs ast_vga_encoder_funcs = {
2121
* Connector
2222
*/
2323

24+
static int ast_vga_connector_helper_get_modes(struct drm_connector *connector)
25+
{
26+
struct ast_connector *ast_connector = to_ast_connector(connector);
27+
int count;
28+
29+
if (ast_connector->physical_status == connector_status_connected) {
30+
count = drm_connector_helper_get_modes(connector);
31+
} else {
32+
/*
33+
* There's no EDID data without a connected monitor. Set BMC-
34+
* compatible modes in this case. The XGA default resolution
35+
* should work well for all BMCs.
36+
*/
37+
count = drm_add_modes_noedid(connector, 4096, 4096);
38+
if (count)
39+
drm_set_preferred_mode(connector, 1024, 768);
40+
}
41+
42+
return count;
43+
}
44+
2445
static int ast_vga_connector_helper_detect_ctx(struct drm_connector *connector,
2546
struct drm_modeset_acquire_ctx *ctx,
2647
bool force)
@@ -30,13 +51,15 @@ static int ast_vga_connector_helper_detect_ctx(struct drm_connector *connector,
3051

3152
status = drm_connector_helper_detect_from_ddc(connector, ctx, force);
3253

54+
if (status != ast_connector->physical_status)
55+
++connector->epoch_counter;
3356
ast_connector->physical_status = status;
3457

35-
return status;
58+
return connector_status_connected;
3659
}
3760

3861
static const struct drm_connector_helper_funcs ast_vga_connector_helper_funcs = {
39-
.get_modes = drm_connector_helper_get_modes,
62+
.get_modes = ast_vga_connector_helper_get_modes,
4063
.detect_ctx = ast_vga_connector_helper_detect_ctx,
4164
};
4265

0 commit comments

Comments
 (0)