All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH v3 11/23] drm/omap: Query timing information from analog TV encoder
Date: Sun, 19 Aug 2018 16:41:53 +0300	[thread overview]
Message-ID: <20180819134205.31106-12-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <20180819134205.31106-1-laurent.pinchart@ideasonboard.com>

Timings for the TV output are currently reported by the analog TV
connector. This has the disadvantage of having to handle timing-related
operations in a connector omap_dss_device that has, at the hardware
level, no knowledge of any timing information.

Implement the .get_timings() operation in the venc driver, and get
timings from the first component in the pipeline that implements the
operatation. This switches the duty of reporting analog TV timings from
the connector to the encoder.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
 drivers/gpu/drm/omapdrm/dss/venc.c       | 12 +++++++++++
 drivers/gpu/drm/omapdrm/omap_connector.c | 34 +++++++++++++++++++++++---------
 2 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c
index 255bf2cd8afc..09ec8b0eafee 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -568,6 +568,16 @@ static void venc_display_disable(struct omap_dss_device *dssdev)
 	mutex_unlock(&venc->venc_lock);
 }
 
+static void venc_get_timings(struct omap_dss_device *dssdev,
+			     struct videomode *vm)
+{
+	struct venc_device *venc = dssdev_to_venc(dssdev);
+
+	mutex_lock(&venc->venc_lock);
+	*vm = venc->vm;
+	mutex_unlock(&venc->venc_lock);
+}
+
 static void venc_set_timings(struct omap_dss_device *dssdev,
 			     const struct videomode *vm)
 {
@@ -720,6 +730,7 @@ static const struct omap_dss_device_ops venc_ops = {
 	.disable = venc_display_disable,
 
 	.check_timings = venc_check_timings,
+	.get_timings = venc_get_timings,
 	.set_timings = venc_set_timings,
 };
 
@@ -877,6 +888,7 @@ static int venc_probe(struct platform_device *pdev)
 	mutex_init(&venc->venc_lock);
 
 	venc->wss_data = 0;
+	venc->vm = omap_dss_pal_vm;
 
 	venc_mem = platform_get_resource(venc->pdev, IORESOURCE_MEM, 0);
 	venc->base = devm_ioremap_resource(&pdev->dev, venc_mem);
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index 302f2ed245d0..b8317b697083 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -218,20 +218,41 @@ static int omap_connector_get_modes(struct drm_connector *connector)
 
 	/*
 	 * If display exposes EDID, then we parse that in the normal way to
-	 * build table of supported modes. Otherwise (ie. fixed resolution
-	 * LCD panels) we just return a single mode corresponding to the
-	 * currently configured timings.
+	 * build table of supported modes.
 	 */
 	dssdev = omap_connector_find_device(connector,
 					    OMAP_DSS_DEVICE_OP_EDID);
 	if (dssdev)
 		return omap_connector_get_modes_edid(connector, dssdev);
 
+	/*
+	 * Otherwise we have either a fixed resolution panel or an output that
+	 * doesn't support modes discovery (e.g. DVI or VGA with the DDC bus
+	 * unconnected, or analog TV). Start by querying the size.
+	 */
+	dssdev = omap_connector->display;
+	if (dssdev->driver && dssdev->driver->get_size)
+		dssdev->driver->get_size(dssdev,
+					 &connector->display_info.width_mm,
+					 &connector->display_info.height_mm);
+
+	/*
+	 * Iterate over the pipeline to find the first device that can provide
+	 * timing information. If we can't find any, we just let the KMS core
+	 * add the default modes.
+	 */
+	for (dssdev = omap_connector->display; dssdev; dssdev = dssdev->src) {
+		if (dssdev->ops->get_timings)
+			break;
+	}
+	if (!dssdev)
+		return 0;
+
+	/* Add a single mode corresponding to the fixed panel timings. */
 	mode = drm_mode_create(connector->dev);
 	if (!mode)
 		return 0;
 
-	dssdev = omap_connector->display;
 	dssdev->ops->get_timings(dssdev, &vm);
 
 	drm_display_mode_from_videomode(&vm, mode);
@@ -240,11 +261,6 @@ static int omap_connector_get_modes(struct drm_connector *connector)
 	drm_mode_set_name(mode);
 	drm_mode_probed_add(connector, mode);
 
-	if (dssdev->driver && dssdev->driver->get_size)
-		dssdev->driver->get_size(dssdev,
-					 &connector->display_info.width_mm,
-					 &connector->display_info.height_mm);
-
 	return 1;
 }
 
-- 
Regards,

Laurent Pinchart

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

  parent reply	other threads:[~2018-08-19 13:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-19 13:41 [PATCH v3 00/23] omapdrm: Rework the timing-related operations Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 01/23] drm/omap: Pass both output and display omap_dss_device to connector init Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 02/23] drm/omap: Determine connector type directly in omap_connector.c Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 03/23] drm/omap: dss: hdmi: Rename hdmi_display_(set|check)_timing() functions Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 04/23] drm/omap: encoder-tfp410: Don't fix timings in .set_timings() handler Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 05/23] drm/omap: Make the video_mode pointer to .set_timings() const Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 06/23] drm/omap: Remove duplicate calls to .set_timings() operation Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 07/23] drm/omap: Remove unneeded fallback for missing .check_timings() Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 08/23] drm/omap: Don't store video mode internally for external encoders Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 09/23] drm/omap: Store bus flags in the omap_dss_device structure Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 10/23] drm/omap: Don't call .check_timings() operation recursively Laurent Pinchart
2018-08-19 13:41 ` Laurent Pinchart [this message]
2018-08-19 13:41 ` [PATCH v3 12/23] drm/omap: Remove .get_timings() operation from display connectors Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 13/23] drm/omap: panels: Don't modify fixed timings Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 14/23] drm/omap: Move bus flag hack to encoder implementation Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 15/23] drm/omap: Split mode fixup and mode set from encoder enable Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 16/23] drm/omap: Call dispc timings check operation directly Laurent Pinchart
2018-08-19 13:41 ` [PATCH v3 17/23] drm/omap: dpi: Don't fixup video mode in dpi_set_mode() Laurent Pinchart
2018-08-19 13:42 ` [PATCH v3 18/23] drm/omap: dsi: Fixup video mode in .set_config() operation Laurent Pinchart
2018-08-19 13:42 ` [PATCH v3 19/23] drm/omap: hdmi: Constify video mode and related pointers Laurent Pinchart
2018-08-19 13:42 ` [PATCH v3 20/23] drm/omap: sdi: Fixup video mode in .check_timings() operation Laurent Pinchart
2018-08-19 13:42 ` [PATCH v3 21/23] drm/omap: venc: " Laurent Pinchart
2018-08-19 13:42 ` [PATCH v3 22/23] drm/omap: Store CRTC timings in .set_timings() operation Laurent Pinchart
2018-08-19 13:42 ` [PATCH v3 23/23] drm/omap: Don't call .set_timings() operation recursively 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=20180819134205.31106-12-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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.