Skip to contentSkip to conversation

drm/sti: set connector status and create fbdev at binding

PATCH In review Vincent Abriou 2 participants 5 messages Jan 4, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/sti: set connector status and create fbdev at binding

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(-)
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/2 drm/sti: set initial connectors status at binding

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

---
 drivers/gpu/drm/sti/sti_dvo.c  | 3 +++
 drivers/gpu/drm/sti/sti_hdmi.c | 3 +++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/sti/sti_dvo.c +3 -0
index e8c1ed0..0e73541 100644
@@ -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");
drivers/gpu/drm/sti/sti_hdmi.c +3 -0
index 9c0025e..2c949bc 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Re: [PATCH 1/2] drm/sti: set initial connectors status at binding

Quoted 4 lines · Vincent Abriou

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

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

Quoted 40 lines
---
 drivers/gpu/drm/sti/sti_dvo.c  | 3 +++
 drivers/gpu/drm/sti/sti_hdmi.c | 3 +++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/sti/sti_dvo.c +3 -0
index e8c1ed0..0e73541 100644
@@ -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");
drivers/gpu/drm/sti/sti_hdmi.c +3 -0
index 9c0025e..2c949bc 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH 1/2] drm/sti: set initial connectors status at binding

Quoted 11 lines · Daniel Vetter
Quoted 4 lines · Vincent Abriou

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

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

Quoted 32 lines
Quoted 32 lines
---
 drivers/gpu/drm/sti/sti_dvo.c  | 3 +++
 drivers/gpu/drm/sti/sti_hdmi.c | 3 +++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/sti/sti_dvo.c +3 -0
index e8c1ed0..0e73541 100644
@@ -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");
drivers/gpu/drm/sti/sti_hdmi.c +3 -0
index 9c0025e..2c949bc 100644
@@ -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;
 
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/sti/sti_hdmi.c +0 -1
 	err = drm_mode_connector_attach_encoder(drm_connector, encoder);
--

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

PATCH 2/2 drm/sti: create fbdev at binding

In reply to Vincent Abriou

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

---
 drivers/gpu/drm/sti/sti_drv.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/gpu/drm/sti/sti_drv.c +14 -13
index ff71e25..c584d4d 100644
@@ -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:
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel