mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* video: imx-ipu-v3: ldb fixes
@ 2015-09-22  7:19 Sascha Hauer
  2015-09-22  7:19 ` [PATCH 1/3] video: ipuv3: Do not crash when no mode is found Sascha Hauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-09-22  7:19 UTC (permalink / raw)
  To: Barebox List

As Holger noted the ldb no longer supports modes directly in the ldb
device node, instead barebox crashes when the IPU driver tries to
enable a non existent mode. This series replaces the crash with an
error message and brings back the mode support to the ldb driver.

Holger, please test. I did not have a board which uses the ldb handy,
so I had to fake it. I verified that the mode is read from the device
tree, but could not see if it's really used.

Sascha

----------------------------------------------------------------
Sascha Hauer (3):
      video: ipuv3: Do not crash when no mode is found
      video: ipuv3: imx-ldb: remove unused variable
      video: ipuv3: imx-ldb: Support video modes in ldb node

 drivers/video/imx-ipu-v3/imx-ldb.c | 31 ++++++++++++++++++++-----------
 drivers/video/imx-ipu-v3/ipufb.c   |  5 +++++
 2 files changed, 25 insertions(+), 11 deletions(-)

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] video: ipuv3: Do not crash when no mode is found
  2015-09-22  7:19 video: imx-ipu-v3: ldb fixes Sascha Hauer
@ 2015-09-22  7:19 ` Sascha Hauer
  2015-09-22  7:19 ` [PATCH 2/3] video: ipuv3: imx-ldb: remove unused variable Sascha Hauer
  2015-09-22  7:19 ` [PATCH 3/3] video: ipuv3: imx-ldb: Support video modes in ldb node Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-09-22  7:19 UTC (permalink / raw)
  To: Barebox List

When something is missing in the device tree or not all necessary
drivers are compiled in it may happen that no valid mode is found.
Do not crash in this case but print an error message.

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

diff --git a/drivers/video/imx-ipu-v3/ipufb.c b/drivers/video/imx-ipu-v3/ipufb.c
index ea2e83b..401f8f7 100644
--- a/drivers/video/imx-ipu-v3/ipufb.c
+++ b/drivers/video/imx-ipu-v3/ipufb.c
@@ -189,6 +189,11 @@ static void ipufb_enable_controller(struct fb_info *info)
 {
 	struct ipufb_info *fbi = container_of(info, struct ipufb_info, info);
 
+	if (!info->mode) {
+		dev_err(fbi->dev, "No valid mode found\n");
+		return;
+	}
+
 	vpl_ioctl_prepare(&fbi->vpl, 2 + fbi->dino, info->mode);
 
 	ipu_crtc_mode_set(fbi, info->mode, 0, 0);
-- 
2.5.1


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] video: ipuv3: imx-ldb: remove unused variable
  2015-09-22  7:19 video: imx-ipu-v3: ldb fixes Sascha Hauer
  2015-09-22  7:19 ` [PATCH 1/3] video: ipuv3: Do not crash when no mode is found Sascha Hauer
@ 2015-09-22  7:19 ` Sascha Hauer
  2015-09-22  7:19 ` [PATCH 3/3] video: ipuv3: imx-ldb: Support video modes in ldb node Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-09-22  7:19 UTC (permalink / raw)
  To: Barebox List

endpoint is set but not used. Remove the code.

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

diff --git a/drivers/video/imx-ipu-v3/imx-ldb.c b/drivers/video/imx-ipu-v3/imx-ldb.c
index db5f8b6..2f49ed2 100644
--- a/drivers/video/imx-ipu-v3/imx-ldb.c
+++ b/drivers/video/imx-ipu-v3/imx-ldb.c
@@ -308,7 +308,6 @@ static int imx_ldb_probe(struct device_d *dev)
 	for_each_child_of_node(np, child) {
 		struct imx_ldb_channel *channel;
 		struct device_node *port;
-		struct device_node *endpoint;
 
 		ret = of_property_read_u32(child, "reg", &i);
 		if (ret || i < 0 || i > 1)
@@ -334,12 +333,6 @@ static int imx_ldb_probe(struct device_d *dev)
 			continue;
 		}
 
-		endpoint = of_get_child_by_name(port, "endpoint");
-		if (!endpoint) {
-			dev_warn(dev, "No endpoint found on %s\n", port->full_name);
-			continue;
-		}
-
 		channel->vpl.node = child;
 		channel->vpl.ioctl = &imx_ldb_ioctl;
 		ret = vpl_register(&channel->vpl);
-- 
2.5.1


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] video: ipuv3: imx-ldb: Support video modes in ldb node
  2015-09-22  7:19 video: imx-ipu-v3: ldb fixes Sascha Hauer
  2015-09-22  7:19 ` [PATCH 1/3] video: ipuv3: Do not crash when no mode is found Sascha Hauer
  2015-09-22  7:19 ` [PATCH 2/3] video: ipuv3: imx-ldb: remove unused variable Sascha Hauer
@ 2015-09-22  7:19 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-09-22  7:19 UTC (permalink / raw)
  To: Barebox List

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.

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

diff --git a/drivers/video/imx-ipu-v3/imx-ldb.c b/drivers/video/imx-ipu-v3/imx-ldb.c
index 2f49ed2..f502f19 100644
--- a/drivers/video/imx-ipu-v3/imx-ldb.c
+++ b/drivers/video/imx-ipu-v3/imx-ldb.c
@@ -282,9 +282,18 @@ 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;
+			return 0;
+		}
+
+		break;
 	}
+
+	return vpl_ioctl(vpl, imx_ldb_ch->output_port, cmd, data);
 }
 
 static int imx_ldb_probe(struct device_d *dev)
@@ -329,8 +338,15 @@ static int imx_ldb_probe(struct device_d *dev)
 		/* 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);
-			continue;
+			/*
+			 * No output port found, see if we can get modes from the
+			 * ldb node.
+			 */
+			channel->modes = of_get_display_timings(child);
+			if (!channel->modes) {
+				dev_warn(dev, "No port found for %s\n", child->full_name);
+				continue;
+			}
 		}
 
 		channel->vpl.node = child;
-- 
2.5.1


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-22  7:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-22  7:19 video: imx-ipu-v3: ldb fixes Sascha Hauer
2015-09-22  7:19 ` [PATCH 1/3] video: ipuv3: Do not crash when no mode is found Sascha Hauer
2015-09-22  7:19 ` [PATCH 2/3] video: ipuv3: imx-ldb: remove unused variable Sascha Hauer
2015-09-22  7:19 ` [PATCH 3/3] video: ipuv3: imx-ldb: Support video modes in ldb node Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox