All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Boris Brezillon <bbrezillon@kernel.org>,
	Sean Paul <sean@poorly.run>,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH v3 21/50] drm/omap: Use the drm_panel_bridge API
Date: Wed, 11 Dec 2019 00:57:21 +0200	[thread overview]
Message-ID: <20191210225750.15709-22-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20191210225750.15709-1-laurent.pinchart@ideasonboard.com>

Replace the manual panel handling code by a drm_panel_bridge. This
simplifies the driver and allows all components in the display pipeline
to be treated as bridges, paving the way to generic connector handling.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
Changes since v1:

- Keep #include <drm/drm_panel.h>
---
 drivers/gpu/drm/omapdrm/dss/base.c       | 12 ++++-----
 drivers/gpu/drm/omapdrm/dss/output.c     | 31 +++++++++++++++++++++---
 drivers/gpu/drm/omapdrm/omap_connector.c | 10 --------
 drivers/gpu/drm/omapdrm/omap_drv.c       | 13 ----------
 drivers/gpu/drm/omapdrm/omap_encoder.c   | 13 ----------
 5 files changed, 32 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index cae5687822e2..80d48936d177 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -149,8 +149,7 @@ struct omap_dss_device *omapdss_device_next_output(struct omap_dss_device *from)
 			goto done;
 		}
 
-		if (dssdev->id &&
-		    (dssdev->next || dssdev->bridge || dssdev->panel))
+		if (dssdev->id && (dssdev->next || dssdev->bridge))
 			goto done;
 	}
 
@@ -185,11 +184,10 @@ int omapdss_device_connect(struct dss_device *dss,
 	if (!dst) {
 		/*
 		 * The destination is NULL when the source is connected to a
-		 * bridge or panel instead of a DSS device. Stop here, we will
-		 * attach the bridge or panel later when we will have a DRM
-		 * encoder.
+		 * bridge instead of a DSS device. Stop here, we will attach
+		 * the bridge later when we will have a DRM encoder.
 		 */
-		return src && (src->bridge || src->panel) ? 0 : -EINVAL;
+		return src && src->bridge ? 0 : -EINVAL;
 	}
 
 	if (omapdss_device_is_connected(dst))
@@ -217,7 +215,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
 		dst ? dev_name(dst->dev) : "NULL");
 
 	if (!dst) {
-		WARN_ON(!src->bridge && !src->panel);
+		WARN_ON(!src->bridge);
 		return;
 	}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 0693d34fca1b..99a253a424c1 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -21,6 +21,7 @@
 int omapdss_device_init_output(struct omap_dss_device *out)
 {
 	struct device_node *remote_node;
+	int ret;
 
 	remote_node = of_graph_get_remote_node(out->dev->of_node,
 					       ffs(out->of_ports) - 1, 0);
@@ -39,17 +40,39 @@ int omapdss_device_init_output(struct omap_dss_device *out)
 
 	if (out->next && out->type != out->next->type) {
 		dev_err(out->dev, "output type and display type don't match\n");
-		omapdss_device_put(out->next);
-		out->next = NULL;
-		return -EINVAL;
+		ret = -EINVAL;
+		goto error;
 	}
 
-	return out->next || out->bridge || out->panel ? 0 : -EPROBE_DEFER;
+	if (out->panel) {
+		struct drm_bridge *bridge;
+
+		bridge = drm_panel_bridge_add(out->panel);
+		if (IS_ERR(bridge)) {
+			dev_err(out->dev,
+				"unable to create panel bridge (%ld)\n",
+				PTR_ERR(bridge));
+			ret = PTR_ERR(bridge);
+			goto error;
+		}
+
+		out->bridge = bridge;
+	}
+
+	return out->next || out->bridge ? 0 : -EPROBE_DEFER;
+
+error:
+	omapdss_device_put(out->next);
+	out->next = NULL;
+	return ret;
 }
 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);
+
 	if (out->next)
 		omapdss_device_put(out->next);
 }
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 38c7a79c5d4a..b0cb2ecb30ab 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -6,7 +6,6 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
-#include <drm/drm_panel.h>
 #include <drm/drm_probe_helper.h>
 
 #include "omap_drv.h"
@@ -190,7 +189,6 @@ static int omap_connector_get_modes_edid(struct drm_connector *connector,
 
 static int omap_connector_get_modes(struct drm_connector *connector)
 {
-	struct omap_connector *omap_connector = to_omap_connector(connector);
 	struct omap_dss_device *dssdev;
 
 	DBG("%s", connector->name);
@@ -213,14 +211,6 @@ static int omap_connector_get_modes(struct drm_connector *connector)
 	if (dssdev)
 		return dssdev->ops->get_modes(dssdev, connector);
 
-	/*
-	 * Otherwise if the display pipeline uses a drm_panel, we delegate the
-	 * operation to the panel API.
-	 */
-	if (omap_connector->output->panel)
-		return drm_panel_get_modes(omap_connector->output->panel,
-					   connector);
-
 	/*
 	 * We can't retrieve modes, which can happen for instance for a DVI or
 	 * VGA output with the DDC bus unconnected. The KMS core will add the
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 390e0662a8b8..aefcf86d4045 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -16,7 +16,6 @@
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
-#include <drm/drm_panel.h>
 #include <drm/drm_prime.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_vblank.h>
@@ -134,9 +133,6 @@ static void omap_disconnect_pipelines(struct drm_device *ddev)
 	for (i = 0; i < priv->num_pipes; i++) {
 		struct omap_drm_pipeline *pipe = &priv->pipes[i];
 
-		if (pipe->output->panel)
-			drm_panel_detach(pipe->output->panel);
-
 		omapdss_device_disconnect(NULL, pipe->output);
 
 		omapdss_device_put(pipe->output);
@@ -221,8 +217,6 @@ static int omap_display_id(struct omap_dss_device *output)
 			bridge = drm_bridge_get_next_bridge(bridge);
 
 		node = bridge->of_node;
-	} else if (output->panel) {
-		node = output->panel->dev->of_node;
 	}
 
 	return node ? of_alias_get_id(node, "display") : -ENODEV;
@@ -337,13 +331,6 @@ static int omap_modeset_init(struct drm_device *dev)
 				return -ENOMEM;
 
 			drm_connector_attach_encoder(pipe->connector, encoder);
-
-			if (pipe->output->panel) {
-				ret = drm_panel_attach(pipe->output->panel,
-						       pipe->connector);
-				if (ret < 0)
-					return ret;
-			}
 		}
 
 		crtc = omap_crtc_init(dev, pipe, priv->planes[i]);
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c
index cb5aa01d2f87..a270173a2411 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -10,7 +10,6 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_edid.h>
-#include <drm/drm_panel.h>
 
 #include "omap_drv.h"
 
@@ -157,12 +156,6 @@ static void omap_encoder_disable(struct drm_encoder *encoder)
 
 	dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
 
-	/* Disable the panel if present. */
-	if (dssdev->panel) {
-		drm_panel_disable(dssdev->panel);
-		drm_panel_unprepare(dssdev->panel);
-	}
-
 	/*
 	 * Disable the chain of external devices, starting at the one at the
 	 * internal encoder's output.
@@ -212,12 +205,6 @@ static void omap_encoder_enable(struct drm_encoder *encoder)
 	 * internal encoder's output.
 	 */
 	omapdss_device_enable(dssdev->next);
-
-	/* Enable the panel if present. */
-	if (dssdev->panel) {
-		drm_panel_prepare(dssdev->panel);
-		drm_panel_enable(dssdev->panel);
-	}
 }
 
 static int omap_encoder_atomic_check(struct drm_encoder *encoder,
-- 
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-12-10 22:58 UTC|newest]

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

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=20191210225750.15709-22-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=bbrezillon@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sam@ravnborg.org \
    --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.