[PATCH v3 01/23] drm/omap: Pass both output and display omap_dss_device to connector init

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

 



The drm_connector implementation requires access to the omap_dss_device
corresponding to the display, which is passed to its initialization
function and stored internally. Refactoring of the timings operations
will require access to the output omap_dss_device. To prepare for that,
pass it to the connector initialization function and store it internally
as well.

Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
Reviewed-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 30 +++++++++++++++++-------------
 drivers/gpu/drm/omapdrm/omap_connector.h |  4 ++--
 drivers/gpu/drm/omapdrm/omap_drv.c       |  3 ++-
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 5091991363d6..92fea0085a9c 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -29,7 +29,8 @@
 
 struct omap_connector {
 	struct drm_connector base;
-	struct omap_dss_device *dssdev;
+	struct omap_dss_device *output;
+	struct omap_dss_device *display;
 	struct omap_dss_device *hpd;
 	bool hdmi_mode;
 };
@@ -104,7 +105,7 @@ omap_connector_find_device(struct drm_connector *connector,
 	struct omap_connector *omap_connector = to_omap_connector(connector);
 	struct omap_dss_device *dssdev;
 
-	for (dssdev = omap_connector->dssdev; dssdev; dssdev = dssdev->src) {
+	for (dssdev = omap_connector->display; dssdev; dssdev = dssdev->src) {
 		if (dssdev->ops_flags & op)
 			return dssdev;
 	}
@@ -129,7 +130,7 @@ static enum drm_connector_status omap_connector_detect(
 
 		omap_connector_hpd_notify(connector, dssdev->src, status);
 	} else {
-		switch (omap_connector->dssdev->type) {
+		switch (omap_connector->display->type) {
 		case OMAP_DISPLAY_TYPE_DPI:
 		case OMAP_DISPLAY_TYPE_DBI:
 		case OMAP_DISPLAY_TYPE_SDI:
@@ -142,7 +143,7 @@ static enum drm_connector_status omap_connector_detect(
 		}
 	}
 
-	VERB("%s: %d (force=%d)", omap_connector->dssdev->name, status, force);
+	VERB("%s: %d (force=%d)", omap_connector->display->name, status, force);
 
 	return status;
 }
@@ -151,7 +152,7 @@ static void omap_connector_destroy(struct drm_connector *connector)
 {
 	struct omap_connector *omap_connector = to_omap_connector(connector);
 
-	DBG("%s", omap_connector->dssdev->name);
+	DBG("%s", omap_connector->display->name);
 
 	if (omap_connector->hpd) {
 		struct omap_dss_device *hpd = omap_connector->hpd;
@@ -165,7 +166,8 @@ static void omap_connector_destroy(struct drm_connector *connector)
 	drm_connector_cleanup(connector);
 	kfree(omap_connector);
 
-	omapdss_device_put(omap_connector->dssdev);
+	omapdss_device_put(omap_connector->output);
+	omapdss_device_put(omap_connector->display);
 }
 
 #define MAX_EDID  512
@@ -212,7 +214,7 @@ static int omap_connector_get_modes(struct drm_connector *connector)
 	struct drm_display_mode *mode;
 	struct videomode vm = {0};
 
-	DBG("%s", omap_connector->dssdev->name);
+	DBG("%s", omap_connector->display->name);
 
 	/*
 	 * If display exposes EDID, then we parse that in the normal way to
@@ -229,7 +231,7 @@ static int omap_connector_get_modes(struct drm_connector *connector)
 	if (!mode)
 		return 0;
 
-	dssdev = omap_connector->dssdev;
+	dssdev = omap_connector->display;
 	dssdev->ops->get_timings(dssdev, &vm);
 
 	drm_display_mode_from_videomode(&vm, mode);
@@ -250,7 +252,7 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
 				 struct drm_display_mode *mode)
 {
 	struct omap_connector *omap_connector = to_omap_connector(connector);
-	struct omap_dss_device *dssdev = omap_connector->dssdev;
+	struct omap_dss_device *dssdev = omap_connector->display;
 	struct videomode vm = {0};
 	struct drm_device *dev = connector->dev;
 	struct drm_display_mode *new_mode;
@@ -325,19 +327,21 @@ static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
 
 /* initialize connector */
 struct drm_connector *omap_connector_init(struct drm_device *dev,
-		int connector_type, struct omap_dss_device *dssdev,
-		struct drm_encoder *encoder)
+		int connector_type, struct omap_dss_device *output,
+		struct omap_dss_device *display, struct drm_encoder *encoder)
 {
 	struct drm_connector *connector = NULL;
 	struct omap_connector *omap_connector;
+	struct omap_dss_device *dssdev;
 
-	DBG("%s", dssdev->name);
+	DBG("%s", display->name);
 
 	omap_connector = kzalloc(sizeof(*omap_connector), GFP_KERNEL);
 	if (!omap_connector)
 		goto fail;
 
-	omap_connector->dssdev = omapdss_device_get(dssdev);
+	omap_connector->output = omapdss_device_get(output);
+	omap_connector->display = omapdss_device_get(display);
 
 	connector = &omap_connector->base;
 	connector->interlace_allowed = 1;
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.h b/drivers/gpu/drm/omapdrm/omap_connector.h
index 465b3c9499d5..42ff0a106179 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.h
+++ b/drivers/gpu/drm/omapdrm/omap_connector.h
@@ -28,8 +28,8 @@ struct drm_encoder;
 struct omap_dss_device;
 
 struct drm_connector *omap_connector_init(struct drm_device *dev,
-		int connector_type, struct omap_dss_device *dssdev,
-		struct drm_encoder *encoder);
+		int connector_type, struct omap_dss_device *output,
+		struct omap_dss_device *display, struct drm_encoder *encoder);
 struct drm_encoder *omap_connector_attached_encoder(
 		struct drm_connector *connector);
 bool omap_connector_get_hdmi_mode(struct drm_connector *connector);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 174bf498f4e5..03771f818eaa 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -323,7 +323,8 @@ static int omap_modeset_init(struct drm_device *dev)
 			return -ENOMEM;
 
 		connector = omap_connector_init(dev,
-				get_connector_type(display), display, encoder);
+				get_connector_type(display), pipe->output,
+				display, encoder);
 		if (!connector)
 			return -ENOMEM;
 
-- 
Regards,

Laurent Pinchart

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




[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