mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 03/10] video: ipuv3: imx-ldb: Support video modes in ldb node
Date: Wed, 23 Sep 2015 13:47:24 +0200	[thread overview]
Message-ID: <1443008851-26596-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1443008851-26596-1-git-send-email-s.hauer@pengutronix.de>

We used to support video modes directly in the ldb device node, that
was lost in: 5bda17e video: ipuv3: Replace ipu_output with VPL.
Add this support back. Also drop duplicate vpl ioctl forwarding for
several calls.

With this patch modes can either be retrieved from the ldb node as
originally done or from the panel remote port.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/imx-ipu-v3/imx-ldb.c | 55 +++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/drivers/video/imx-ipu-v3/imx-ldb.c b/drivers/video/imx-ipu-v3/imx-ldb.c
index 2f49ed2..1e9231f 100644
--- a/drivers/video/imx-ipu-v3/imx-ldb.c
+++ b/drivers/video/imx-ipu-v3/imx-ldb.c
@@ -143,20 +143,7 @@ static int imx_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, struct fb_videomo
 
 	writel(ldb->ldb_ctrl, ldb->base);
 
-	return vpl_ioctl(&imx_ldb_ch->vpl, imx_ldb_ch->output_port,
-			VPL_PREPARE, NULL);
-}
-
-static int imx_ldb_enable(struct imx_ldb_channel *imx_ldb_ch, int di)
-{
-	return vpl_ioctl(&imx_ldb_ch->vpl, imx_ldb_ch->output_port,
-				VPL_ENABLE, NULL);
-}
-
-static int imx_ldb_disable(struct imx_ldb_channel *imx_ldb_ch, int di)
-{
-	return vpl_ioctl(&imx_ldb_ch->vpl, imx_ldb_ch->output_port,
-			VPL_DISABLE, NULL);
+	return 0;
 }
 
 static int imx6q_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di)
@@ -260,20 +247,14 @@ static int imx_ldb_ioctl(struct vpl *vpl, unsigned int port,
 
 	switch (cmd) {
 	case VPL_ENABLE:
-		ret = vpl_ioctl(vpl, imx_ldb_ch->output_port, cmd, data);
-		if (ret)
-			return ret;
-		return imx_ldb_enable(imx_ldb_ch, port);
+		break;
 	case VPL_DISABLE:
-		ret = vpl_ioctl(vpl, imx_ldb_ch->output_port, cmd, data);
-		if (ret)
-			return ret;
-		return imx_ldb_disable(imx_ldb_ch, port);
+		break;
 	case VPL_PREPARE:
-		ret = vpl_ioctl(vpl, imx_ldb_ch->output_port, cmd, data);
+		ret = imx_ldb_prepare(imx_ldb_ch, data, port);
 		if (ret)
 			return ret;
-		return imx_ldb_prepare(imx_ldb_ch, data, port);
+		break;
 	case IMX_IPU_VPL_DI_MODE:
 		mode = data;
 
@@ -282,9 +263,22 @@ static int imx_ldb_ioctl(struct vpl *vpl, unsigned int port,
 			V4L2_PIX_FMT_RGB24 : V4L2_PIX_FMT_BGR666;
 
 		return 0;
-	default:
-		return vpl_ioctl(vpl, imx_ldb_ch->output_port, cmd, data);
+	case VPL_GET_VIDEOMODES:
+		if (imx_ldb_ch->modes) {
+			struct display_timings *timings = data;
+			timings->num_modes = imx_ldb_ch->modes->num_modes;
+			timings->modes = imx_ldb_ch->modes->modes;
+			dev_dbg(imx_ldb_ch->ldb->dev, "Using ldb provided timings\n");
+			return 0;
+		}
+
+		break;
 	}
+
+	if (imx_ldb_ch->output_port > 0)
+		return vpl_ioctl(vpl, imx_ldb_ch->output_port, cmd, data);
+
+	return 0;
 }
 
 static int imx_ldb_probe(struct device_d *dev)
@@ -326,10 +320,15 @@ static int imx_ldb_probe(struct device_d *dev)
 		channel->chno = i;
 		channel->output_port = imx_ldb->soc_data->have_mux ? 4 : 1;
 
+		channel->modes = of_get_display_timings(child);
+
 		/* The output port is port@4 with mux or port@1 without mux */
 		port = of_graph_get_port_by_id(child, channel->output_port);
-		if (!port) {
-			dev_warn(dev, "No port found for %s\n", child->full_name);
+		if (!port)
+			channel->output_port = -1;
+
+		if (!channel->modes && !port) {
+			dev_err(dev, "Neither display timings in ldb node nor remote panel found\n");
 			continue;
 		}
 
-- 
2.5.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-09-23 11:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 11:47 [PATCH v2] video: imx-ipu-v3: ldb fixes Sascha Hauer
2015-09-23 11:47 ` [PATCH 01/10] video: ipuv3: Do not crash when no mode is found Sascha Hauer
2015-09-23 11:47 ` [PATCH 02/10] video: ipuv3: imx-ldb: remove unused variable Sascha Hauer
2015-09-23 11:47 ` Sascha Hauer [this message]
2015-09-23 11:47 ` [PATCH 04/10] video: simple-panel: Add debug/error messages Sascha Hauer
2015-09-23 11:47 ` [PATCH 05/10] video: simple-panel: Add support for device tree provided nodes Sascha Hauer
2015-09-23 11:47 ` [PATCH 06/10] video: ipuv3: print error message when no modes are found Sascha Hauer
2015-09-23 11:47 ` [PATCH 07/10] video: backlight-pwm: Add error message Sascha Hauer
2015-09-23 11:47 ` [PATCH 08/10] video: backlight-pwm: Add regulator support Sascha Hauer
2015-09-23 11:47 ` [PATCH 09/10] ARM: i.MX: GuF Santaro: enable PWM Sascha Hauer
2015-09-23 11:47 ` [PATCH 10/10] ARM: i.MX: GuF Santaro: Fix panel support Sascha Hauer

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=1443008851-26596-4-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox