Skip to contentSkip to conversation

i.MX: IPUv3: Add parallel display support

RFC In review Philippe Leduc 2 participants 3 messages Feb 25, 2016 – Mar 14, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 i.MX: IPUv3: Add parallel display support

Add a driver compatible with "fsl,imx-parallel-display" in order to enable parallel display with the i.MX IPUv3.

--

drivers/video/imx-ipu-v3/Kconfig +4 -0
index b5ee4ef..5ec8031 100644
@@ -15,5 +15,9 @@ config DRIVER_VIDEO_IMX_IPUV3_HDMI
 	bool "IPUv3 HDMI support"
 	depends on DRIVER_VIDEO_EDID
 	select OFDEVICE
+
+config DRIVER_VIDEO_IMX_IPUV3_PARALLEL
+	bool "IPUv3 parallel display support"
+	select OFDEVICE
 
 endif
drivers/video/imx-ipu-v3/Makefile +1 -0
index 2bc0aec..1f68120 100644
@@ -3,3 +3,4 @@ obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3) += ipu-dp.o ipuv3-plane.o ipufb.o
 obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3) += ipu-dc.o
 obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3_LVDS) += imx-ldb.o
 obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3_HDMI) += imx-hdmi.o
+obj-$(CONFIG_DRIVER_VIDEO_IMX_IPUV3_PARALLEL) += imx-pd.o
drivers/video/imx-ipu-v3/imx-pd.c new file +111 -0

111 lines not on this page · raw message

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

maintainer
#1 lore raw

Hi Philippe,

Looks good overall, some small points.

Quoted 5 lines · Philippe Leduc

Add a driver compatible with "fsl,imx-parallel-display" in order to enable parallel display with the i.MX IPUv3.

--

drivers/video/imx-ipu-v3/imx-pd.c line 37

Quoted 9 lines
drivers/video/imx-ipu-v3/imx-pd.c new file +9 -0
+struct imx_pd {
+	struct device_d *dev;
+	struct display_timings *timings;
+	u32 interface_pix_fmt;
+	struct vpl vpl;
+};
+
+
+

Plese drop multiple blank lines here.

Quoted 36 lines
drivers/video/imx-ipu-v3/imx-pd.c new file +36 -0
+static int imx_pd_ioctl(struct vpl *vpl, unsigned int port,
+		unsigned int cmd, void *data)
+{
+	struct imx_pd *imx_pd = container_of(vpl, struct imx_pd, vpl);
+	struct ipu_di_mode *mode;
+	struct display_timings *timings;
+
+	switch (cmd) {
+	case IMX_IPU_VPL_DI_MODE:
+		mode = data;
+
+		mode->di_clkflags = IPU_DI_CLKMODE_SYNC;
+		mode->interface_pix_fmt = imx_pd->interface_pix_fmt;
+		return 0;
+
+	case VPL_GET_VIDEOMODES:
+		timings = data;
+
+		timings->num_modes   = imx_pd->timings->num_modes;
+		timings->native_mode = imx_pd->timings->native_mode;
+		timings->modes       = imx_pd->timings->modes;
+		timings->edid        = NULL;
+		return 0;
+	}
+
+	return 0;
+}
+
+static int imx_pd_probe(struct device_d *dev)
+{
+	struct device_node *node = dev->device_node;
+	struct imx_pd *imx_pd;
+	const char *fmt;
+	int ret;
+
+	imx_pd = xzalloc(sizeof(*imx_pd));

drivers/video/imx-ipu-v3/imx-pd.c line 83

Quoted 10 lines
drivers/video/imx-ipu-v3/imx-pd.c new file +10 -0
+	imx_pd->dev = dev;
+
+	ret = of_property_read_string(node, "interface-pix-fmt", &fmt);
+	if (!ret) {
+		if (!strcmp(fmt, "rgb24"))
+			imx_pd->interface_pix_fmt = V4L2_PIX_FMT_RGB24;
+		else if (!strcmp(fmt, "rgb565"))
+			imx_pd->interface_pix_fmt = V4L2_PIX_FMT_RGB565;
+		else if (!strcmp(fmt, "bgr666"))
+			imx_pd->interface_pix_fmt = V4L2_PIX_FMT_BGR666;

else? You should probably bail out with an error here.

drivers/video/imx-ipu-v3/imx-pd.c line 86

Quoted 3 lines
drivers/video/imx-ipu-v3/imx-pd.c new file +3 -0
+	}
+
+	imx_pd->timings = of_get_display_timings(node);

You should check the result. If no display timing is found then barebox will crash in the ioctl function.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

Hi,

Thanks for the feedback, I'll fix that ASAP.

Regards,

--
Philippe LEDUC
[email protected]

2016-02-29 7:50 GMT+01:00 Sascha Hauer <[email protected]>:

Quoted 78 lines

Hi Philippe,

Looks good overall, some small points.

Quoted 5 lines · Philippe Leduc

Add a driver compatible with "fsl,imx-parallel-display" in order to enable parallel display with the i.MX IPUv3.

--

drivers/video/imx-ipu-v3/imx-pd.c line 37

Quoted 9 lines
drivers/video/imx-ipu-v3/imx-pd.c new file +9 -0
+struct imx_pd {
+     struct device_d *dev;
+     struct display_timings *timings;
+     u32 interface_pix_fmt;
+     struct vpl vpl;
+};
+
+
+

Plese drop multiple blank lines here.

Quoted 36 lines
drivers/video/imx-ipu-v3/imx-pd.c new file +36 -0
+static int imx_pd_ioctl(struct vpl *vpl, unsigned int port,
+             unsigned int cmd, void *data)
+{
+     struct imx_pd *imx_pd = container_of(vpl, struct imx_pd, vpl);
+     struct ipu_di_mode *mode;
+     struct display_timings *timings;
+
+     switch (cmd) {
+     case IMX_IPU_VPL_DI_MODE:
+             mode = data;
+
+             mode->di_clkflags = IPU_DI_CLKMODE_SYNC;
+             mode->interface_pix_fmt = imx_pd->interface_pix_fmt;
+             return 0;
+
+     case VPL_GET_VIDEOMODES:
+             timings = data;
+
+             timings->num_modes   = imx_pd->timings->num_modes;
+             timings->native_mode = imx_pd->timings->native_mode;
+             timings->modes       = imx_pd->timings->modes;
+             timings->edid        = NULL;
+             return 0;
+     }
+
+     return 0;
+}
+
+static int imx_pd_probe(struct device_d *dev)
+{
+     struct device_node *node = dev->device_node;
+     struct imx_pd *imx_pd;
+     const char *fmt;
+     int ret;
+
+     imx_pd = xzalloc(sizeof(*imx_pd));

drivers/video/imx-ipu-v3/imx-pd.c line 83

Quoted 10 lines
drivers/video/imx-ipu-v3/imx-pd.c new file +10 -0
+     imx_pd->dev = dev;
+
+     ret = of_property_read_string(node, "interface-pix-fmt", &fmt);
+     if (!ret) {
+             if (!strcmp(fmt, "rgb24"))
+                     imx_pd->interface_pix_fmt = V4L2_PIX_FMT_RGB24;
+             else if (!strcmp(fmt, "rgb565"))
+                     imx_pd->interface_pix_fmt = V4L2_PIX_FMT_RGB565;
+             else if (!strcmp(fmt, "bgr666"))
+                     imx_pd->interface_pix_fmt = V4L2_PIX_FMT_BGR666;

else? You should probably bail out with an error here.

drivers/video/imx-ipu-v3/imx-pd.c line 86

Quoted 3 lines
drivers/video/imx-ipu-v3/imx-pd.c new file +3 -0
+     }
+
+     imx_pd->timings = of_get_display_timings(node);

You should check the result. If no display timing is found then barebox will crash in the ioctl function.

Quoted 7 lines

Sascha

--

Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox