Skip to content

Commit 44a37ba

Browse files
author
Thomas Zimmermann
committed
drm/ast: dp501: 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 9e7a74a commit 44a37ba

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

drivers/gpu/drm/ast/ast_dp501.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -509,14 +509,29 @@ static const struct drm_encoder_helper_funcs ast_dp501_encoder_helper_funcs = {
509509

510510
static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector)
511511
{
512-
struct ast_device *ast = to_ast_device(connector->dev);
513-
const struct drm_edid *drm_edid;
512+
struct ast_connector *ast_connector = to_ast_connector(connector);
514513
int count;
515514

516-
drm_edid = drm_edid_read_custom(connector, ast_dp512_read_edid_block, ast);
517-
drm_edid_connector_update(connector, drm_edid);
518-
count = drm_edid_connector_add_modes(connector);
519-
drm_edid_free(drm_edid);
515+
if (ast_connector->physical_status == connector_status_connected) {
516+
struct ast_device *ast = to_ast_device(connector->dev);
517+
const struct drm_edid *drm_edid;
518+
519+
drm_edid = drm_edid_read_custom(connector, ast_dp512_read_edid_block, ast);
520+
drm_edid_connector_update(connector, drm_edid);
521+
count = drm_edid_connector_add_modes(connector);
522+
drm_edid_free(drm_edid);
523+
} else {
524+
drm_edid_connector_update(connector, NULL);
525+
526+
/*
527+
* There's no EDID data without a connected monitor. Set BMC-
528+
* compatible modes in this case. The XGA default resolution
529+
* should work well for all BMCs.
530+
*/
531+
count = drm_add_modes_noedid(connector, 4096, 4096);
532+
if (count)
533+
drm_set_preferred_mode(connector, 1024, 768);
534+
}
520535

521536
return count;
522537
}
@@ -530,11 +545,13 @@ static int ast_dp501_connector_helper_detect_ctx(struct drm_connector *connector
530545
enum drm_connector_status status = connector_status_disconnected;
531546

532547
if (ast_dp501_is_connected(ast))
533-
return connector_status_connected;
548+
status = connector_status_connected;
534549

550+
if (status != ast_connector->physical_status)
551+
++connector->epoch_counter;
535552
ast_connector->physical_status = status;
536553

537-
return status;
554+
return connector_status_connected;
538555
}
539556

540557
static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs = {

0 commit comments

Comments
 (0)