Skip to content

Commit bbad009

Browse files
author
Thomas Zimmermann
committed
drm/ast: astdp: 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 770a961 commit bbad009

File tree

1 file changed

+31
-12
lines changed

1 file changed

+31
-12
lines changed

drivers/gpu/drm/ast/ast_dp.c

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,15 @@ static void ast_astdp_encoder_helper_atomic_enable(struct drm_encoder *encoder,
319319
{
320320
struct drm_device *dev = encoder->dev;
321321
struct ast_device *ast = to_ast_device(dev);
322+
struct ast_connector *ast_connector = &ast->output.astdp.connector;
322323

323-
ast_dp_power_on_off(dev, AST_DP_POWER_ON);
324-
ast_dp_link_training(ast);
324+
if (ast_connector->physical_status == connector_status_connected) {
325+
ast_dp_power_on_off(dev, AST_DP_POWER_ON);
326+
ast_dp_link_training(ast);
325327

326-
ast_wait_for_vretrace(ast);
327-
ast_dp_set_on_off(dev, 1);
328+
ast_wait_for_vretrace(ast);
329+
ast_dp_set_on_off(dev, 1);
330+
}
328331
}
329332

330333
static void ast_astdp_encoder_helper_atomic_disable(struct drm_encoder *encoder,
@@ -348,15 +351,29 @@ static const struct drm_encoder_helper_funcs ast_astdp_encoder_helper_funcs = {
348351

349352
static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)
350353
{
351-
struct drm_device *dev = connector->dev;
352-
struct ast_device *ast = to_ast_device(dev);
353-
const struct drm_edid *drm_edid;
354+
struct ast_connector *ast_connector = to_ast_connector(connector);
354355
int count;
355356

356-
drm_edid = drm_edid_read_custom(connector, ast_astdp_read_edid_block, ast);
357-
drm_edid_connector_update(connector, drm_edid);
358-
count = drm_edid_connector_add_modes(connector);
359-
drm_edid_free(drm_edid);
357+
if (ast_connector->physical_status == connector_status_connected) {
358+
struct ast_device *ast = to_ast_device(connector->dev);
359+
const struct drm_edid *drm_edid;
360+
361+
drm_edid = drm_edid_read_custom(connector, ast_astdp_read_edid_block, ast);
362+
drm_edid_connector_update(connector, drm_edid);
363+
count = drm_edid_connector_add_modes(connector);
364+
drm_edid_free(drm_edid);
365+
} else {
366+
drm_edid_connector_update(connector, NULL);
367+
368+
/*
369+
* There's no EDID data without a connected monitor. Set BMC-
370+
* compatible modes in this case. The XGA default resolution
371+
* should work well for all BMCs.
372+
*/
373+
count = drm_add_modes_noedid(connector, 4096, 4096);
374+
if (count)
375+
drm_set_preferred_mode(connector, 1024, 768);
376+
}
360377

361378
return count;
362379
}
@@ -385,9 +402,11 @@ static int ast_astdp_connector_helper_detect_ctx(struct drm_connector *connector
385402

386403
mutex_unlock(&ast->modeset_lock);
387404

405+
if (status != ast_connector->physical_status)
406+
++connector->epoch_counter;
388407
ast_connector->physical_status = status;
389408

390-
return status;
409+
return connector_status_connected;
391410
}
392411

393412
static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = {

0 commit comments

Comments
 (0)