Re: [PATCH] drm/ast: Add detect function support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

thanks for the patch.

Am 25.05.21 um 03:55 schrieb ainux.wang@xxxxxxxxx:
From: Ainux <ainux.wang@xxxxxxxxx>

The existence of the connector cannot be detected,
so add the detect function to support.

Signed-off-by: Ainux <ainux.wang@xxxxxxxxx>
---
  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: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux