[PATCH] drm/ast: Add detect function support

Thomas Zimmermann tzimmermann at suse.de
Wed May 26 07:17:18 UTC 2021


Hi,

thanks for the patch.

Am 25.05.21 um 03:55 schrieb ainux.wang at gmail.com:
> From: Ainux <ainux.wang at gmail.com>
> 
> The existence of the connector cannot be detected,
> so add the detect function to support.
> 
> Signed-off-by: Ainux <ainux.wang at gmail.com>
> ---
>   drivers/gpu/drm/ast/ast_drv.c  |  2 ++
>   drivers/gpu/drm/ast/ast_mode.c | 19 ++++++++++++++++++-
>   2 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index 5aa452b4efe6..6698bbc405e3 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -128,6 +128,8 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   
>   	drm_fbdev_generic_setup(dev, 32);
>   
> +	drm_kms_helper_poll_init(dev);
> +

I think this is too late. Rather put it at the end of 
ast_mode_config_init(). [1]

>   	return 0;
>   }
>   
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 36d9575aa27b..b4dd4c29b353 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -1293,6 +1293,21 @@ static enum drm_mode_status ast_mode_valid(struct drm_connector *connector,
>   	return flags;
>   }
>   
> +static enum drm_connector_status ast_connector_detect(struct drm_connector
> +						   *connector, bool force)
> +{
> +	int r;
> +	enum drm_connector_status ret = connector_status_connected;
> +
> +	r = ast_get_modes(connector);
> +	if (r)
> +		ret = connector_status_connected;
> +	else
> +		ret = connector_status_disconnected;
> +
> +	return ret;


As a side note: VGA is not hotplug-able, but expected to always be 
connected. Ideally we could detect this, but it's unreliable AFAIK.


Rather use:

  r = ast_get_modes()
  if (r < 0)
     return connector_status_disconnected

   return connector_status_connected

So it's disconnected if there was an error in ast_get_modes().

Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v5.12/source/drivers/gpu/drm/ast/ast_mode.c#L1171

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210526/f08d4358/attachment.sig>


More information about the dri-devel mailing list