Commit e329cb53 authored by Jocelyn Falempe's avatar Jocelyn Falempe

drm/ast: Add BMC virtual connector

Most aspeed devices have a BMC, which allows to remotely see the screen.
Also in the common use case, those servers don't have a display connected.
So add a Virtual connector, to reflect that even if no display is
connected, the framebuffer can still be seen remotely.
This prepares the work to implement a detect_ctx() for the Display port
connector.

v4: call drm_add_modes_noedid() with 4096x4096 (Thomas Zimmermann)
    remove useless struct field init to 0 (Thomas Zimmermann)
    don't use drm_simple_encoder_init() (Thomas Zimmermann)
    inline ast_bmc_connector_init() (Thomas Zimmermann)

Fixes: fae7d186 ("drm/probe-helper: Default to 640x480 if no EDID on DP")
Signed-off-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230713134316.332502-1-jfalempe@redhat.com
parent aaf40405
...@@ -214,6 +214,10 @@ struct ast_device { ...@@ -214,6 +214,10 @@ struct ast_device {
struct drm_encoder encoder; struct drm_encoder encoder;
struct drm_connector connector; struct drm_connector connector;
} astdp; } astdp;
struct {
struct drm_encoder encoder;
struct drm_connector connector;
} bmc;
} output; } output;
bool support_wide_screen; bool support_wide_screen;
......
...@@ -1735,6 +1735,60 @@ static int ast_astdp_output_init(struct ast_device *ast) ...@@ -1735,6 +1735,60 @@ static int ast_astdp_output_init(struct ast_device *ast)
return 0; return 0;
} }
/*
* BMC virtual Connector
*/
static const struct drm_encoder_funcs ast_bmc_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static int ast_bmc_connector_helper_get_modes(struct drm_connector *connector)
{
return drm_add_modes_noedid(connector, 4096, 4096);
}
static const struct drm_connector_helper_funcs ast_bmc_connector_helper_funcs = {
.get_modes = ast_bmc_connector_helper_get_modes,
};
static const struct drm_connector_funcs ast_bmc_connector_funcs = {
.reset = drm_atomic_helper_connector_reset,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = drm_connector_cleanup,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static int ast_bmc_output_init(struct ast_device *ast)
{
struct drm_device *dev = &ast->base;
struct drm_crtc *crtc = &ast->crtc;
struct drm_encoder *encoder = &ast->output.bmc.encoder;
struct drm_connector *connector = &ast->output.bmc.connector;
int ret;
ret = drm_encoder_init(dev, encoder,
&ast_bmc_encoder_funcs,
DRM_MODE_ENCODER_VIRTUAL, "ast_bmc");
if (ret)
return ret;
encoder->possible_crtcs = drm_crtc_mask(crtc);
ret = drm_connector_init(dev, connector, &ast_bmc_connector_funcs,
DRM_MODE_CONNECTOR_VIRTUAL);
if (ret)
return ret;
drm_connector_helper_add(connector, &ast_bmc_connector_helper_funcs);
ret = drm_connector_attach_encoder(connector, encoder);
if (ret)
return ret;
return 0;
}
/* /*
* Mode config * Mode config
*/ */
...@@ -1842,6 +1896,9 @@ int ast_mode_config_init(struct ast_device *ast) ...@@ -1842,6 +1896,9 @@ int ast_mode_config_init(struct ast_device *ast)
if (ret) if (ret)
return ret; return ret;
} }
ret = ast_bmc_output_init(ast);
if (ret)
return ret;
drm_mode_config_reset(dev); drm_mode_config_reset(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment