Message ID | 20240812093211.382263-5-tzimmermann@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/ast: Transparently handle BMC in outputs | expand |
On 12/08/2024 11:30, Thomas Zimmermann wrote: > 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. > Thanks, it looks good to me. Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com> > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > --- > drivers/gpu/drm/ast/ast_dp.c | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/ast/ast_dp.c b/drivers/gpu/drm/ast/ast_dp.c > index 22c4f2a126e9..121a76a85554 100644 > --- a/drivers/gpu/drm/ast/ast_dp.c > +++ b/drivers/gpu/drm/ast/ast_dp.c > @@ -355,6 +355,17 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector) > count = drm_edid_connector_add_modes(connector); > drm_edid_free(drm_edid); > > + if (!count) { > + /* > + * 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; > } > > @@ -364,10 +375,14 @@ static int ast_astdp_connector_helper_detect_ctx(struct drm_connector *connector > { > struct drm_device *dev = connector->dev; > struct ast_device *ast = to_ast_device(connector->dev); > + enum drm_connector_status old_status = connector_status_disconnected; > enum drm_connector_status status = connector_status_disconnected; > struct drm_connector_state *connector_state = connector->state; > bool is_active = false; > > + if (connector->edid_blob_ptr) > + old_status = connector_status_connected; > + > mutex_lock(&ast->modeset_lock); > > if (connector_state && connector_state->crtc) { > @@ -390,7 +405,9 @@ static int ast_astdp_connector_helper_detect_ctx(struct drm_connector *connector > > mutex_unlock(&ast->modeset_lock); > > - return status; > + if (status != old_status) > + ++connector->epoch_counter; > + return connector_status_connected; > } > > static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = {
diff --git a/drivers/gpu/drm/ast/ast_dp.c b/drivers/gpu/drm/ast/ast_dp.c index 22c4f2a126e9..121a76a85554 100644 --- a/drivers/gpu/drm/ast/ast_dp.c +++ b/drivers/gpu/drm/ast/ast_dp.c @@ -355,6 +355,17 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector) count = drm_edid_connector_add_modes(connector); drm_edid_free(drm_edid); + if (!count) { + /* + * 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; } @@ -364,10 +375,14 @@ static int ast_astdp_connector_helper_detect_ctx(struct drm_connector *connector { struct drm_device *dev = connector->dev; struct ast_device *ast = to_ast_device(connector->dev); + enum drm_connector_status old_status = connector_status_disconnected; enum drm_connector_status status = connector_status_disconnected; struct drm_connector_state *connector_state = connector->state; bool is_active = false; + if (connector->edid_blob_ptr) + old_status = connector_status_connected; + mutex_lock(&ast->modeset_lock); if (connector_state && connector_state->crtc) { @@ -390,7 +405,9 @@ static int ast_astdp_connector_helper_detect_ctx(struct drm_connector *connector mutex_unlock(&ast->modeset_lock); - return status; + if (status != old_status) + ++connector->epoch_counter; + return connector_status_connected; } static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = {
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. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/gpu/drm/ast/ast_dp.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)