dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/sti: set connector status and create fbdev at binding
@ 2017-01-04  9:15 Vincent Abriou
  2017-01-04  9:15 ` [PATCH 1/2] drm/sti: set initial connectors status " Vincent Abriou
  2017-01-04  9:15 ` [PATCH 2/2] drm/sti: create fbdev " Vincent Abriou
  0 siblings, 2 replies; 5+ messages in thread
From: Vincent Abriou @ 2017-01-04  9:15 UTC (permalink / raw)
  To: dri-devel; +Cc: Vincent Abriou, Fabien Dessenne

While binding the sti drm driver the initial connectors status are set and the
fbdev is created.

Vincent Abriou (2):
  drm/sti: set initial connectors status at binding
  drm/sti: create fbdev at binding

 drivers/gpu/drm/sti/sti_drv.c  | 27 ++++++++++++++-------------
 drivers/gpu/drm/sti/sti_dvo.c  |  3 +++
 drivers/gpu/drm/sti/sti_hdmi.c |  3 +++
 3 files changed, 20 insertions(+), 13 deletions(-)

-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 1/2] drm/sti: set initial connectors status at binding
  2017-01-04  9:15 [PATCH 0/2] drm/sti: set connector status and create fbdev at binding Vincent Abriou
@ 2017-01-04  9:15 ` Vincent Abriou
  2017-01-04  9:39   ` Daniel Vetter
  2017-01-04  9:15 ` [PATCH 2/2] drm/sti: create fbdev " Vincent Abriou
  1 sibling, 1 reply; 5+ messages in thread
From: Vincent Abriou @ 2017-01-04  9:15 UTC (permalink / raw)
  To: dri-devel; +Cc: Vincent Abriou, Fabien Dessenne

This avoid to have an "unknown" connector status after the sti driver is
registered.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
---
 drivers/gpu/drm/sti/sti_dvo.c  | 3 +++
 drivers/gpu/drm/sti/sti_hdmi.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index e8c1ed0..0e73541 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -498,6 +498,9 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
 	drm_connector_helper_add(drm_connector,
 				 &sti_dvo_connector_helper_funcs);
 
+	/* set initial status */
+	drm_connector->status = sti_dvo_connector_detect(drm_connector, false);
+
 	err = drm_mode_connector_attach_encoder(drm_connector, encoder);
 	if (err) {
 		DRM_ERROR("Failed to attach a connector to a encoder\n");
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 9c0025e..2c949bc 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -1322,6 +1322,9 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
 	/* initialise property */
 	sti_hdmi_connector_init_property(drm_dev, drm_connector);
 
+	/* set initial status */
+	drm_connector->status = sti_hdmi_connector_detect(drm_connector, false);
+
 	hdmi->drm_connector = drm_connector;
 
 	err = drm_mode_connector_attach_encoder(drm_connector, encoder);
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 2/2] drm/sti: create fbdev at binding
  2017-01-04  9:15 [PATCH 0/2] drm/sti: set connector status and create fbdev at binding Vincent Abriou
  2017-01-04  9:15 ` [PATCH 1/2] drm/sti: set initial connectors status " Vincent Abriou
@ 2017-01-04  9:15 ` Vincent Abriou
  1 sibling, 0 replies; 5+ messages in thread
From: Vincent Abriou @ 2017-01-04  9:15 UTC (permalink / raw)
  To: dri-devel; +Cc: Vincent Abriou, Fabien Dessenne

Do not wait for a hot plug event to create fbdev.

Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
---
 drivers/gpu/drm/sti/sti_drv.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index ff71e25..c584d4d 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -252,19 +252,7 @@ static void sti_output_poll_changed(struct drm_device *ddev)
 {
 	struct sti_private *private = ddev->dev_private;
 
-	if (!ddev->mode_config.num_connector)
-		return;
-
-	if (private->fbdev) {
-		drm_fbdev_cma_hotplug_event(private->fbdev);
-		return;
-	}
-
-	private->fbdev = drm_fbdev_cma_init(ddev, 32,
-					    ddev->mode_config.num_crtc,
-					    ddev->mode_config.num_connector);
-	if (IS_ERR(private->fbdev))
-		private->fbdev = NULL;
+	drm_fbdev_cma_hotplug_event(private->fbdev);
 }
 
 static const struct drm_mode_config_funcs sti_mode_config_funcs = {
@@ -382,6 +370,8 @@ static void sti_cleanup(struct drm_device *ddev)
 static int sti_bind(struct device *dev)
 {
 	struct drm_device *ddev;
+	struct sti_private *private;
+	struct drm_fbdev_cma *fbdev;
 	int ret;
 
 	ddev = drm_dev_alloc(&sti_driver, dev);
@@ -404,6 +394,17 @@ static int sti_bind(struct device *dev)
 
 	drm_mode_config_reset(ddev);
 
+	private = ddev->dev_private;
+	if (ddev->mode_config.num_connector) {
+		fbdev = drm_fbdev_cma_init(ddev, 32, ddev->mode_config.num_crtc,
+					   ddev->mode_config.num_connector);
+		if (IS_ERR(fbdev)) {
+			DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
+			fbdev = NULL;
+		}
+		private->fbdev = fbdev;
+	}
+
 	return 0;
 
 err_register:
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm/sti: set initial connectors status at binding
  2017-01-04  9:15 ` [PATCH 1/2] drm/sti: set initial connectors status " Vincent Abriou
@ 2017-01-04  9:39   ` Daniel Vetter
  2017-01-04 10:14     ` Vincent ABRIOU
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2017-01-04  9:39 UTC (permalink / raw)
  To: Vincent Abriou; +Cc: Fabien Dessenne, dri-devel

On Wed, Jan 04, 2017 at 10:15:45AM +0100, Vincent Abriou wrote:
> This avoid to have an "unknown" connector status after the sti driver is
> registered.
> 
> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>

Why is this needed? The fb helpers will probe on their on, your driver
should never need to do this. It also slows down initial boot when you
don't need fbdev ...
-Daniel

> ---
>  drivers/gpu/drm/sti/sti_dvo.c  | 3 +++
>  drivers/gpu/drm/sti/sti_hdmi.c | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index e8c1ed0..0e73541 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -498,6 +498,9 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
>  	drm_connector_helper_add(drm_connector,
>  				 &sti_dvo_connector_helper_funcs);
>  
> +	/* set initial status */
> +	drm_connector->status = sti_dvo_connector_detect(drm_connector, false);
> +
>  	err = drm_mode_connector_attach_encoder(drm_connector, encoder);
>  	if (err) {
>  		DRM_ERROR("Failed to attach a connector to a encoder\n");
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 9c0025e..2c949bc 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -1322,6 +1322,9 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
>  	/* initialise property */
>  	sti_hdmi_connector_init_property(drm_dev, drm_connector);
>  
> +	/* set initial status */
> +	drm_connector->status = sti_hdmi_connector_detect(drm_connector, false);
> +
>  	hdmi->drm_connector = drm_connector;
>  
>  	err = drm_mode_connector_attach_encoder(drm_connector, encoder);
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm/sti: set initial connectors status at binding
  2017-01-04  9:39   ` Daniel Vetter
@ 2017-01-04 10:14     ` Vincent ABRIOU
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent ABRIOU @ 2017-01-04 10:14 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Fabien DESSENNE, dri-devel



On 01/04/2017 10:39 AM, Daniel Vetter wrote:
> On Wed, Jan 04, 2017 at 10:15:45AM +0100, Vincent Abriou wrote:
>> This avoid to have an "unknown" connector status after the sti driver is
>> registered.
>>
>> Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
>
> Why is this needed? The fb helpers will probe on their on, your driver
> should never need to do this. It also slows down initial boot when you
> don't need fbdev ...
> -Daniel
>

Hi Daniel,

This patch is indeed useless.
I will skip it from my pull request.

Thanks
Vincent

>> ---
>>  drivers/gpu/drm/sti/sti_dvo.c  | 3 +++
>>  drivers/gpu/drm/sti/sti_hdmi.c | 3 +++
>>  2 files changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
>> index e8c1ed0..0e73541 100644
>> --- a/drivers/gpu/drm/sti/sti_dvo.c
>> +++ b/drivers/gpu/drm/sti/sti_dvo.c
>> @@ -498,6 +498,9 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
>>  	drm_connector_helper_add(drm_connector,
>>  				 &sti_dvo_connector_helper_funcs);
>>
>> +	/* set initial status */
>> +	drm_connector->status = sti_dvo_connector_detect(drm_connector, false);
>> +
>>  	err = drm_mode_connector_attach_encoder(drm_connector, encoder);
>>  	if (err) {
>>  		DRM_ERROR("Failed to attach a connector to a encoder\n");
>> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
>> index 9c0025e..2c949bc 100644
>> --- a/drivers/gpu/drm/sti/sti_hdmi.c
>> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
>> @@ -1322,6 +1322,9 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
>>  	/* initialise property */
>>  	sti_hdmi_connector_init_property(drm_dev, drm_connector);
>>
>> +	/* set initial status */
>> +	drm_connector->status = sti_hdmi_connector_detect(drm_connector, false);
>> +
>>  	hdmi->drm_connector = drm_connector;
>>
>>  	err = drm_mode_connector_attach_encoder(drm_connector, encoder);
>> --
>> 2.7.4
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2017-01-04 10:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-04  9:15 [PATCH 0/2] drm/sti: set connector status and create fbdev at binding Vincent Abriou
2017-01-04  9:15 ` [PATCH 1/2] drm/sti: set initial connectors status " Vincent Abriou
2017-01-04  9:39   ` Daniel Vetter
2017-01-04 10:14     ` Vincent ABRIOU
2017-01-04  9:15 ` [PATCH 2/2] drm/sti: create fbdev " Vincent Abriou

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).