dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/ast: Add detect function support
@ 2021-05-26 11:15 ainux.wang
  2021-05-26 19:15 ` Thomas Zimmermann
  0 siblings, 1 reply; 3+ messages in thread
From: ainux.wang @ 2021-05-26 11:15 UTC (permalink / raw)
  To: airlied, tzimmermann, airlied, daniel, ainux.wang
  Cc: sterlingteng, chenhuacai, dri-devel

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_mode.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 36d9575aa27b..e5996ae03c49 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -1293,6 +1293,18 @@ 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;
+
+	r = ast_get_modes(connector);
+	if (r < 0)
+		return connector_status_disconnected;
+
+	return connector_status_connected;
+}
+
 static void ast_connector_destroy(struct drm_connector *connector)
 {
 	struct ast_connector *ast_connector = to_ast_connector(connector);
@@ -1307,6 +1319,7 @@ static const struct drm_connector_helper_funcs ast_connector_helper_funcs = {
 
 static const struct drm_connector_funcs ast_connector_funcs = {
 	.reset = drm_atomic_helper_connector_reset,
+	.detect = ast_connector_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
 	.destroy = ast_connector_destroy,
 	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
@@ -1334,7 +1347,8 @@ static int ast_connector_init(struct drm_device *dev)
 	connector->interlace_allowed = 0;
 	connector->doublescan_allowed = 0;
 
-	connector->polled = DRM_CONNECTOR_POLL_CONNECT;
+	connector->polled = DRM_CONNECTOR_POLL_CONNECT |
+						DRM_CONNECTOR_POLL_DISCONNECT;
 
 	drm_connector_attach_encoder(connector, encoder);
 
@@ -1403,6 +1417,8 @@ int ast_mode_config_init(struct ast_private *ast)
 
 	drm_mode_config_reset(dev);
 
+	drm_kms_helper_poll_init(dev);
+
 	return 0;
 }
 
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drm/ast: Add detect function support
  2021-05-26 11:15 [PATCH v2] drm/ast: Add detect function support ainux.wang
@ 2021-05-26 19:15 ` Thomas Zimmermann
  2021-05-27  2:44   ` Ainux Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Zimmermann @ 2021-05-26 19:15 UTC (permalink / raw)
  To: ainux.wang, airlied, airlied, daniel; +Cc: sterlingteng, chenhuacai, dri-devel


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

Hi

Am 26.05.21 um 13:15 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>

Looks good. If no one else comments, I'll merge the patch soon. Thanks a 
lot.

Best regards
Thomas

> ---
>   drivers/gpu/drm/ast/ast_mode.c | 18 +++++++++++++++++-
>   1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index 36d9575aa27b..e5996ae03c49 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -1293,6 +1293,18 @@ 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;
> +
> +	r = ast_get_modes(connector);
> +	if (r < 0)
> +		return connector_status_disconnected;
> +
> +	return connector_status_connected;
> +}
> +
>   static void ast_connector_destroy(struct drm_connector *connector)
>   {
>   	struct ast_connector *ast_connector = to_ast_connector(connector);
> @@ -1307,6 +1319,7 @@ static const struct drm_connector_helper_funcs ast_connector_helper_funcs = {
>   
>   static const struct drm_connector_funcs ast_connector_funcs = {
>   	.reset = drm_atomic_helper_connector_reset,
> +	.detect = ast_connector_detect,
>   	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.destroy = ast_connector_destroy,
>   	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> @@ -1334,7 +1347,8 @@ static int ast_connector_init(struct drm_device *dev)
>   	connector->interlace_allowed = 0;
>   	connector->doublescan_allowed = 0;
>   
> -	connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> +	connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> +						DRM_CONNECTOR_POLL_DISCONNECT;
>   
>   	drm_connector_attach_encoder(connector, encoder);
>   
> @@ -1403,6 +1417,8 @@ int ast_mode_config_init(struct ast_private *ast)
>   
>   	drm_mode_config_reset(dev);
>   
> +	drm_kms_helper_poll_init(dev);
> +
>   	return 0;
>   }
>   
> 

-- 
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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drm/ast: Add detect function support
  2021-05-26 19:15 ` Thomas Zimmermann
@ 2021-05-27  2:44   ` Ainux Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Ainux Wang @ 2021-05-27  2:44 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: airlied, teng sterling, chenhuacai, dri-devel, airlied

You're welcome!

Best regards
Ainux Wang


Thomas Zimmermann <tzimmermann@suse.de> 于2021年5月27日周四 上午3:15写道:
>
> Hi
>
> Am 26.05.21 um 13:15 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>
>
> Looks good. If no one else comments, I'll merge the patch soon. Thanks a
> lot.
>
> Best regards
> Thomas
>
> > ---
> >   drivers/gpu/drm/ast/ast_mode.c | 18 +++++++++++++++++-
> >   1 file changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> > index 36d9575aa27b..e5996ae03c49 100644
> > --- a/drivers/gpu/drm/ast/ast_mode.c
> > +++ b/drivers/gpu/drm/ast/ast_mode.c
> > @@ -1293,6 +1293,18 @@ 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;
> > +
> > +     r = ast_get_modes(connector);
> > +     if (r < 0)
> > +             return connector_status_disconnected;
> > +
> > +     return connector_status_connected;
> > +}
> > +
> >   static void ast_connector_destroy(struct drm_connector *connector)
> >   {
> >       struct ast_connector *ast_connector = to_ast_connector(connector);
> > @@ -1307,6 +1319,7 @@ static const struct drm_connector_helper_funcs ast_connector_helper_funcs = {
> >
> >   static const struct drm_connector_funcs ast_connector_funcs = {
> >       .reset = drm_atomic_helper_connector_reset,
> > +     .detect = ast_connector_detect,
> >       .fill_modes = drm_helper_probe_single_connector_modes,
> >       .destroy = ast_connector_destroy,
> >       .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> > @@ -1334,7 +1347,8 @@ static int ast_connector_init(struct drm_device *dev)
> >       connector->interlace_allowed = 0;
> >       connector->doublescan_allowed = 0;
> >
> > -     connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> > +     connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> > +                                             DRM_CONNECTOR_POLL_DISCONNECT;
> >
> >       drm_connector_attach_encoder(connector, encoder);
> >
> > @@ -1403,6 +1417,8 @@ int ast_mode_config_init(struct ast_private *ast)
> >
> >       drm_mode_config_reset(dev);
> >
> > +     drm_kms_helper_poll_init(dev);
> > +
> >       return 0;
> >   }
> >
> >
>
> --
> 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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-27  2:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 11:15 [PATCH v2] drm/ast: Add detect function support ainux.wang
2021-05-26 19:15 ` Thomas Zimmermann
2021-05-27  2:44   ` Ainux Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).