[PATCH v3 33/61] drm/omap: dss: Store dss_device pointer in omap_dss_device

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Aug 6 00:27:13 UTC 2018


Storing the dss_device pointer in the omap_dss_device structure will
allow accessing the dss_device from the dss_mgr API functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel at collabora.co.uk>
---
 drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c      |  2 +-
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c            |  2 +-
 drivers/gpu/drm/omapdrm/displays/connector-hdmi.c           |  2 +-
 drivers/gpu/drm/omapdrm/displays/encoder-opa362.c           |  2 +-
 drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c           |  2 +-
 drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c        |  2 +-
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c                |  2 +-
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c             |  2 +-
 drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c |  2 +-
 drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c     |  2 +-
 drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  |  2 +-
 drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c     |  2 +-
 drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c     |  2 +-
 drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/base.c                          | 11 +++++++++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h                       |  4 +++-
 drivers/gpu/drm/omapdrm/omap_drv.c                          |  2 +-
 17 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
index 0eacd2dc302d..e416e9e1566a 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
@@ -53,7 +53,7 @@ static int tvc_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
index 754f15bc0115..a35d39f6cca9 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
@@ -67,7 +67,7 @@ static int dvic_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index e05f2964f8e1..dd6e67f9ae47 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -63,7 +63,7 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
index f665f2caea22..41a51364c985 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
@@ -43,7 +43,7 @@ static int opa362_connect(struct omap_dss_device *dssdev,
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
index 11c123ca7916..cadb8f52aa88 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
@@ -39,7 +39,7 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
index eb2d5af34a35..4f671dc272a0 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
@@ -48,7 +48,7 @@ static int tpd_connect(struct omap_dss_device *dssdev,
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index 64eab64e5f0d..c03986d7df73 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -45,7 +45,7 @@ static int panel_dpi_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index bd9401c1c11e..aeeec81f8fcf 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -769,7 +769,7 @@ static int dsicm_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		dev_err(dev, "Failed to connect to video source\n");
 		goto err_connect;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
index 9f9caeadf5dd..d4a7925e3f16 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
@@ -127,7 +127,7 @@ static int lb035q02_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
index d07c955ea06f..b0fe60aba729 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
@@ -122,7 +122,7 @@ static int nec_8048_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
index d02f22a858e2..d96eb1a1397f 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
@@ -68,7 +68,7 @@ static int sharp_ls_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
index a98c1181887a..65068eea0647 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
@@ -517,7 +517,7 @@ static int acx565akm_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
index 07c3f8143e4c..96e2e30dd999 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
@@ -176,7 +176,7 @@ static int td028ttec1_panel_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
index c32ab872e9f9..5845f9e6c6ba 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
@@ -347,7 +347,7 @@ static int tpo_td043_connect(struct omap_dss_device *dssdev)
 		return PTR_ERR(src);
 	}
 
-	r = omapdss_device_connect(src, dssdev);
+	r = omapdss_device_connect(dssdev->dss, src, dssdev);
 	if (r) {
 		omapdss_device_put(src);
 		return r;
diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 08846eea5a53..991c424960c7 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -177,7 +177,8 @@ struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
 }
 EXPORT_SYMBOL(omapdss_device_get_next);
 
-int omapdss_device_connect(struct omap_dss_device *src,
+int omapdss_device_connect(struct dss_device *dss,
+			   struct omap_dss_device *src,
 			   struct omap_dss_device *dst)
 {
 	int ret;
@@ -187,13 +188,17 @@ int omapdss_device_connect(struct omap_dss_device *src,
 	if (omapdss_device_is_connected(src))
 		return -EBUSY;
 
+	src->dss = dss;
+
 	if (src->driver)
 		ret = src->driver->connect(src);
 	else
 		ret = src->ops->connect(src, dst);
 
-	if (ret < 0)
+	if (ret < 0) {
+		src->dss = NULL;
 		return ret;
+	}
 
 	if (dst) {
 		dst->src = src;
@@ -226,6 +231,8 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 		src->driver->disconnect(src);
 	else
 		src->ops->disconnect(src, dst);
+
+	src->dss = NULL;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 96011e42da05..4befe8aab333 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -391,6 +391,7 @@ struct omap_dss_device {
 
 	struct module *owner;
 
+	struct dss_device *dss;
 	struct omap_dss_device *src;
 	struct omap_dss_device *dst;
 
@@ -498,7 +499,8 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
 						    unsigned int port);
 struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
 						bool display_only);
-int omapdss_device_connect(struct omap_dss_device *src,
+int omapdss_device_connect(struct dss_device *dss,
+			   struct omap_dss_device *src,
 			   struct omap_dss_device *dst);
 void omapdss_device_disconnect(struct omap_dss_device *src,
 			       struct omap_dss_device *dst);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index a3b7dbf1b92b..95ebb6b1fc36 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -189,7 +189,7 @@ static int omap_connect_dssdevs(struct drm_device *ddev)
 		return -EPROBE_DEFER;
 
 	for_each_dss_display(dssdev) {
-		r = omapdss_device_connect(dssdev, NULL);
+		r = omapdss_device_connect(priv->dss, dssdev, NULL);
 		if (r == -EPROBE_DEFER) {
 			omapdss_device_put(dssdev);
 			goto cleanup;
-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list