[PATCH v2 4/9] drm/ast: astdp: Transparently handle BMC support

Jocelyn Falempe jfalempe at redhat.com
Tue Aug 13 13:19:25 UTC 2024


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 at redhat.com>


> Signed-off-by: Thomas Zimmermann <tzimmermann at 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 = {



More information about the dri-devel mailing list