dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: ainux.wang@gmail.com, airlied@redhat.com, airlied@linux.ie,
	daniel@ffwll.ch
Cc: sterlingteng@gmail.com, chenhuacai@kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/ast: Add detect function support
Date: Wed, 26 May 2021 09:17:18 +0200	[thread overview]
Message-ID: <49faa0db-2c6b-1915-7b21-e98349062db2@suse.de> (raw)
In-Reply-To: <20210525015520.8327-1-ainux.wang@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2323 bytes --]

Hi,

thanks for the patch.

Am 25.05.21 um 03:55 schrieb ainux.wang@gmail.com:
> From: Ainux <ainux.wang@gmail.com>
> 
> The existence of the connector cannot be detected,
> so add the detect function to support.
> 
> Signed-off-by: Ainux <ainux.wang@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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

      reply	other threads:[~2021-05-26  7:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25  1:55 [PATCH] drm/ast: Add detect function support ainux.wang
2021-05-26  7:17 ` Thomas Zimmermann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49faa0db-2c6b-1915-7b21-e98349062db2@suse.de \
    --to=tzimmermann@suse.de \
    --cc=ainux.wang@gmail.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=chenhuacai@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sterlingteng@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox