[PATCH v2 32/60] drm/omap: dss: Store dss_device pointer in omap_dss_device

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat May 26 17:24:50 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>
---
 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 a7eb25bd9283..f7250db0f3b7 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 3e71af9ba0c3..b4f84baff144 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 fd0bad4dc7c9..2f8ae93c117a 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 01b00eea3a98..4d7f4dae2c10 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 6f71d2b7de03..833544d8502f 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 8031f2c087f6..3a3c36fef446 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 5306af0206c2..43df4f7c38f0 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 e0a607846284..6090447b66a1 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 015488594de3..5c26e1d19655 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 c23bf5ba0c47..6c30b2078a0e 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 a7c053d031c1..fb40d2c705e5 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 cad158a142d4..a35d4407f2b0 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 cadbbb4dcbd4..d887f12c021c 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 2f70b3c74262..6d333b0aea18 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 4abde473eba7..b4bc58c5134d 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 cf0f76bf5773..042a3ca526ca 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