All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Sean Paul <sean@poorly.run>,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: [PATCH v2 22/50] drm/omap: Add infrastructure to support drm_bridge local to DSS outputs
Date: Tue, 20 Aug 2019 04:16:53 +0300	[thread overview]
Message-ID: <20190820011721.30136-23-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20190820011721.30136-1-laurent.pinchart@ideasonboard.com>

In order to support drm_bridge-based pipeline, the internal HDMI
encoders will need to expose the EDID read operation through the
drm_bridge API, and thus to expose a drm_bridge instance corresponding
to the encoder. The HDMI encoders are however handled as omap_dss_device
instances, which conflicts with this requirement.

In order to move forward with the drm_bridge transition, add support for
creating drm_bridge instances local to DSS outputs. If a local bridge is
passed to the omapdss_device_init_output() function, it is used as the
first bridge in the chain, and the omap_dss_device.next_bridge field is
set to the next bridge for the use of the internal encoders' bridges.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/dpi.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   |  2 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 +++-
 drivers/gpu/drm/omapdrm/dss/output.c  | 20 ++++++++++++++++----
 drivers/gpu/drm/omapdrm/dss/sdi.c     |  2 +-
 drivers/gpu/drm/omapdrm/dss/venc.c    |  2 +-
 drivers/gpu/drm/omapdrm/omap_drv.c    |  2 +-
 9 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 462ed6f3118a..2d0eb5fcbb5b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -629,7 +629,7 @@ static int dpi_init_output_port(struct dpi_data *dpi, struct device_node *port)
 	out->ops = &dpi_ops;
 	out->owner = THIS_MODULE;
 
-	r = omapdss_device_init_output(out);
+	r = omapdss_device_init_output(out, NULL);
 	if (r < 0)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 0b04a10b8996..989d0d14ed5a 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5122,7 +5122,7 @@ static int dsi_init_output(struct dsi_data *dsi)
 		       | DRM_BUS_FLAG_DE_HIGH
 		       | DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE;
 
-	r = omapdss_device_init_output(out);
+	r = omapdss_device_init_output(out, NULL);
 	if (r < 0)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 44075718407b..dd4a14fe7e59 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -676,7 +676,7 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
 	out->of_port = 0;
 	out->ops_flags = OMAP_DSS_DEVICE_OP_EDID;
 
-	r = omapdss_device_init_output(out);
+	r = omapdss_device_init_output(out, NULL);
 	if (r < 0)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index 1b5bd44ee09d..8e3790dd8b98 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -660,7 +660,7 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
 	out->of_port = 0;
 	out->ops_flags = OMAP_DSS_DEVICE_OP_EDID;
 
-	r = omapdss_device_init_output(out);
+	r = omapdss_device_init_output(out, NULL);
 	if (r < 0)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index b48a51d11310..82e9bfa5530a 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -400,6 +400,7 @@ struct omap_dss_device {
 	struct dss_device *dss;
 	struct omap_dss_device *next;
 	struct drm_bridge *bridge;
+	struct drm_bridge *next_bridge;
 	struct drm_panel *panel;
 
 	struct list_head list;
@@ -488,7 +489,8 @@ int omap_dss_get_num_overlays(void);
 #define for_each_dss_output(d) \
 	while ((d = omapdss_device_next_output(d)) != NULL)
 struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from);
-int omapdss_device_init_output(struct omap_dss_device *out);
+int omapdss_device_init_output(struct omap_dss_device *out,
+			       struct drm_bridge *local_bridge);
 void omapdss_device_cleanup_output(struct omap_dss_device *out);
 
 typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 745afd7d80de..b27739afb335 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -16,7 +16,8 @@
 #include "dss.h"
 #include "omapdss.h"
 
-int omapdss_device_init_output(struct omap_dss_device *out)
+int omapdss_device_init_output(struct omap_dss_device *out,
+			       struct drm_bridge *local_bridge)
 {
 	struct device_node *remote_node;
 	int ret;
@@ -59,10 +60,20 @@ int omapdss_device_init_output(struct omap_dss_device *out)
 		out->bridge = bridge;
 	}
 
-	return out->next || out->bridge ? 0 : -EPROBE_DEFER;
+	if (local_bridge) {
+		out->next_bridge = out->bridge;
+		out->bridge = local_bridge;
+	}
+
+	if (!out->next && !out->bridge) {
+		ret = -EPROBE_DEFER;
+		goto error;
+	}
+
+	return 0;
 
 error:
-	omapdss_device_put(out->next);
+	omapdss_device_cleanup_output(out);
 	out->next = NULL;
 	return ret;
 }
@@ -71,7 +82,8 @@ EXPORT_SYMBOL(omapdss_device_init_output);
 void omapdss_device_cleanup_output(struct omap_dss_device *out)
 {
 	if (out->bridge && out->panel)
-		drm_panel_bridge_remove(out->bridge);
+		drm_panel_bridge_remove(out->next_bridge ?
+					out->next_bridge : out->bridge);
 
 	if (out->next)
 		omapdss_device_put(out->next);
diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c
index 9092ed3d0ef1..11aa2f712ff4 100644
--- a/drivers/gpu/drm/omapdrm/dss/sdi.c
+++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
@@ -271,7 +271,7 @@ static int sdi_init_output(struct sdi_device *sdi)
 	out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE	/* 15.5.9.1.2 */
 		       | DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
 
-	r = omapdss_device_init_output(out);
+	r = omapdss_device_init_output(out, NULL);
 	if (r < 0)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index e2f480f689b8..977d8d525b43 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -757,7 +757,7 @@ static int venc_init_output(struct venc_device *venc)
 	out->of_port = 0;
 	out->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
-	r = omapdss_device_init_output(out);
+	r = omapdss_device_init_output(out, NULL);
 	if (r < 0)
 		return r;
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 72872dfdb73e..de373fd50729 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -323,7 +323,7 @@ static int omap_modeset_init(struct drm_device *dev)
 		struct drm_encoder *encoder = pipe->encoder;
 		struct drm_crtc *crtc;
 
-		if (!pipe->output->bridge) {
+		if (pipe->output->next) {
 			pipe->connector = omap_connector_init(dev, pipe->output,
 							      encoder);
 			if (!pipe->connector)
-- 
Regards,

Laurent Pinchart

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

  parent reply	other threads:[~2019-08-20  1:17 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20  1:16 [PATCH v2 00/50] drm/omap: Replace custom display drivers with drm_bridge and drm_panel Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 01/50] video: hdmi: Change return type of hdmi_avi_infoframe_init() to void Laurent Pinchart
2019-08-20 11:18   ` Bartlomiej Zolnierkiewicz
2019-08-22  9:12   ` Boris Brezillon
2019-08-20  1:16 ` [PATCH v2 02/50] drm/connector: Add helper to get a connector type name Laurent Pinchart
2019-08-22  9:13   ` Boris Brezillon
2019-08-20  1:16 ` [PATCH v2 03/50] drm/edid: Add flag to drm_display_info to identify HDMI sinks Laurent Pinchart
2019-08-22  9:15   ` Boris Brezillon
2019-08-20  1:16 ` [PATCH v2 04/50] drm/bridge: Add connector-related bridge operations and data Laurent Pinchart
2019-08-22 15:24   ` Boris Brezillon
2019-08-22 16:41   ` Boris Brezillon
2019-08-23  0:34     ` Laurent Pinchart
2019-08-23  6:15       ` Boris Brezillon
2019-08-20  1:16 ` [PATCH v2 05/50] drm/bridge: Extend bridge API to disable connector creation Laurent Pinchart
2019-08-22 15:34   ` Boris Brezillon
2019-10-01  7:04   ` Tomi Valkeinen
2019-10-01 19:58     ` Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 06/50] drm/bridge: dumb-vga-dac: Rename internal symbols to simple-bridge Laurent Pinchart
2019-08-22 15:39   ` Boris Brezillon
2019-08-26 11:25   ` Maxime Ripard
2019-08-20  1:16 ` [PATCH v2 07/50] drm/bridge: dumb-vga-dac: Rename driver " Laurent Pinchart
2019-08-22 15:42   ` Boris Brezillon
2019-08-26 11:26   ` Maxime Ripard
2019-08-20  1:16 ` [PATCH v2 08/50] drm/bridge: simple-bridge: Add support for non-VGA bridges Laurent Pinchart
2019-08-22 15:43   ` Boris Brezillon
2019-08-26 11:27   ` Maxime Ripard
2019-08-20  1:16 ` [PATCH v2 09/50] drm/bridge: simple-bridge: Add support for enable GPIO Laurent Pinchart
2019-08-22 15:45   ` Boris Brezillon
2019-08-26 11:33   ` Maxime Ripard
2019-08-20  1:16 ` [PATCH v2 10/50] drm/bridge: simple-bridge: Add support for the TI OP362 Laurent Pinchart
2019-08-22 15:45   ` Boris Brezillon
2019-08-26 11:34   ` Maxime Ripard
2019-08-20  1:16 ` [PATCH v2 11/50] drm/bridge: Add bridge driver for display connectors Laurent Pinchart
2019-08-22 16:05   ` Boris Brezillon
2019-08-22 16:39     ` Laurent Pinchart
2019-08-26 11:36   ` Maxime Ripard
2019-08-20  1:16 ` [PATCH v2 12/50] drm/bridge: Add driver for the TI TPD12S015 HDMI level shifter Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 13/50] drm/bridge: panel: Implement bridge connector operations Laurent Pinchart
2019-08-20 10:37   ` Sam Ravnborg
2019-08-20 16:08     ` Laurent Pinchart
2019-10-03  5:56     ` Tomi Valkeinen
2019-10-09 19:24       ` Sam Ravnborg
2019-12-02 15:24         ` Laurent Pinchart
2019-08-22 16:29   ` Boris Brezillon
2019-08-22 16:35     ` Laurent Pinchart
2019-08-22 18:02       ` Boris Brezillon
2019-08-23  0:39         ` Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 14/50] drm/bridge: tfp410: Don't include drmP.h Laurent Pinchart
2019-08-22 16:11   ` Boris Brezillon
2019-08-20  1:16 ` [PATCH v2 15/50] drm/bridge: tfp410: Replace manual connector handling with bridge Laurent Pinchart
2019-08-22 16:36   ` Boris Brezillon
2019-08-22 16:54     ` Laurent Pinchart
2019-08-22 17:15       ` Boris Brezillon
2019-08-27  7:43   ` Tomi Valkeinen
2019-08-27  8:00     ` Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 16/50] drm/bridge: tfp410: Allow operation without drm_connector Laurent Pinchart
2019-08-22 18:17   ` Boris Brezillon
2019-08-20  1:16 ` [PATCH v2 17/50] drm: Add helper to create a connector for a chain of bridges Laurent Pinchart
2019-08-22 18:31   ` Boris Brezillon
2019-08-20  1:16 ` [PATCH v2 18/50] drm/omap: Simplify HDMI mode and infoframe configuration Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 19/50] drm/omap: Factor out display type to connector type conversion Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 20/50] drm/omap: Use the drm_panel_bridge API Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 21/50] drm/omap: dss: Fix output next device lookup in DT Laurent Pinchart
2019-08-20  1:16 ` Laurent Pinchart [this message]
2019-08-20  1:16 ` [PATCH v2 23/50] drm/omap: dss: Make omap_dss_device_ops optional Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 24/50] drm/omap: hdmi: Allocate EDID in the .read_edid() operation Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 25/50] drm/omap: hdmi4: Rework EDID read to isolate data read Laurent Pinchart
2019-08-26 11:39   ` Tomi Valkeinen
2019-08-26 13:06     ` Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 26/50] drm/omap: hdmi5: " Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 27/50] drm/omap: hdmi4: Register a drm_bridge for EDID read Laurent Pinchart
2019-08-20  1:16 ` [PATCH v2 28/50] drm/omap: hdmi5: " Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 29/50] drm/omap: hdmi4: Move mode set, enable and disable operations to bridge Laurent Pinchart
2019-08-26 11:50   ` Tomi Valkeinen
2019-08-20  1:17 ` [PATCH v2 30/50] drm/omap: hdmi5: " Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 31/50] drm/omap: hdmi4: Implement drm_bridge .hpd_notify() operation Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 32/50] drm/omap: dss: Remove .set_hdmi_mode() and .set_infoframe() operations Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 33/50] drm/omap: venc: Register a drm_bridge Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 34/50] drm/omap: Create connector for bridges Laurent Pinchart
2019-08-22 17:00   ` Boris Brezillon
2019-08-22 23:41     ` Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 35/50] drm/omap: Switch the HDMI and VENC outputs to drm_bridge Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 36/50] drm/omap: Remove HPD, detect and EDID omapdss operations Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 37/50] drm/omap: hdmi: Remove omap_dss_device operations Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 38/50] drm/omap: venc: " Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 39/50] drm/omap: hdmi4: Simplify EDID read Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 40/50] drm/omap: hdmi5: " Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 41/50] drm/omap: dpi: Sort includes alphabetically Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 42/50] drm/omap: dpi: Reorder functions in sections Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 43/50] drm/omap: dpi: Simplify clock setting API Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 44/50] drm/omap: dpi: Register a drm_bridge Laurent Pinchart
2019-08-27  9:07   ` Hans Verkuil
2019-08-27  9:51     ` Laurent Pinchart
2019-08-27 10:48       ` Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 45/50] drm/omap: sdi: Sort includes alphabetically Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 46/50] drm/omap: sdi: Register a drm_bridge Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 47/50] drm/omap: Simplify connector implementation Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 48/50] drm/omap: dss: Remove unused omap_dss_device operations Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 49/50] drm/omap: dss: Inline the omapdss_display_get() function Laurent Pinchart
2019-08-20  1:17 ` [PATCH v2 50/50] drm/omap: dss: Remove unused omapdss_of_find_connected_device() function Laurent Pinchart
2019-08-26 12:15 ` [PATCH v2 00/50] drm/omap: Replace custom display drivers with drm_bridge and drm_panel Tomi Valkeinen
2019-08-26 13:51   ` Laurent Pinchart
2019-08-27  7:34     ` Tomi Valkeinen
2019-08-27  9:29       ` Laurent Pinchart
2019-08-27  9:32         ` Tomi Valkeinen
2019-08-27  9:40           ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190820011721.30136-23-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=sean@poorly.run \
    --cc=sebastian.reichel@collabora.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.