132e2eae2SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0 232e2eae2SMauro Carvalho Chehab 332e2eae2SMauro Carvalho Chehabi.MX7 Video Capture Driver 432e2eae2SMauro Carvalho Chehab========================== 532e2eae2SMauro Carvalho Chehab 632e2eae2SMauro Carvalho ChehabIntroduction 732e2eae2SMauro Carvalho Chehab------------ 832e2eae2SMauro Carvalho Chehab 932e2eae2SMauro Carvalho ChehabThe i.MX7 contrary to the i.MX5/6 family does not contain an Image Processing 1032e2eae2SMauro Carvalho ChehabUnit (IPU); because of that the capabilities to perform operations or 1132e2eae2SMauro Carvalho Chehabmanipulation of the capture frames are less feature rich. 1232e2eae2SMauro Carvalho Chehab 1332e2eae2SMauro Carvalho ChehabFor image capture the i.MX7 has three units: 1432e2eae2SMauro Carvalho Chehab- CMOS Sensor Interface (CSI) 1532e2eae2SMauro Carvalho Chehab- Video Multiplexer 1632e2eae2SMauro Carvalho Chehab- MIPI CSI-2 Receiver 1732e2eae2SMauro Carvalho Chehab 1832e2eae2SMauro Carvalho Chehab.. code-block:: none 1932e2eae2SMauro Carvalho Chehab 2032e2eae2SMauro Carvalho Chehab MIPI Camera Input ---> MIPI CSI-2 --- > |\ 2132e2eae2SMauro Carvalho Chehab | \ 2232e2eae2SMauro Carvalho Chehab | \ 2332e2eae2SMauro Carvalho Chehab | M | 2432e2eae2SMauro Carvalho Chehab | U | ------> CSI ---> Capture 2532e2eae2SMauro Carvalho Chehab | X | 2632e2eae2SMauro Carvalho Chehab | / 2732e2eae2SMauro Carvalho Chehab Parallel Camera Input ----------------> | / 2832e2eae2SMauro Carvalho Chehab |/ 2932e2eae2SMauro Carvalho Chehab 3032e2eae2SMauro Carvalho ChehabFor additional information, please refer to the latest versions of the i.MX7 3132e2eae2SMauro Carvalho Chehabreference manual [#f1]_. 3232e2eae2SMauro Carvalho Chehab 3332e2eae2SMauro Carvalho ChehabEntities 3432e2eae2SMauro Carvalho Chehab-------- 3532e2eae2SMauro Carvalho Chehab 36*5b21b566SJacopo Mondiimx-mipi-csi2 3732e2eae2SMauro Carvalho Chehab-------------- 3832e2eae2SMauro Carvalho Chehab 3932e2eae2SMauro Carvalho ChehabThis is the MIPI CSI-2 receiver entity. It has one sink pad to receive the pixel 4032e2eae2SMauro Carvalho Chehabdata from MIPI CSI-2 camera sensor. It has one source pad, corresponding to the 4132e2eae2SMauro Carvalho Chehabvirtual channel 0. This module is compliant to previous version of Samsung 4232e2eae2SMauro Carvalho ChehabD-phy, and supports two D-PHY Rx Data lanes. 4332e2eae2SMauro Carvalho Chehab 4432e2eae2SMauro Carvalho Chehabcsi-mux 4532e2eae2SMauro Carvalho Chehab------- 4632e2eae2SMauro Carvalho Chehab 4732e2eae2SMauro Carvalho ChehabThis is the video multiplexer. It has two sink pads to select from either camera 4832e2eae2SMauro Carvalho Chehabsensor with a parallel interface or from MIPI CSI-2 virtual channel 0. It has 4932e2eae2SMauro Carvalho Chehaba single source pad that routes to the CSI. 5032e2eae2SMauro Carvalho Chehab 5132e2eae2SMauro Carvalho Chehabcsi 5232e2eae2SMauro Carvalho Chehab--- 5332e2eae2SMauro Carvalho Chehab 5432e2eae2SMauro Carvalho ChehabThe CSI enables the chip to connect directly to external CMOS image sensor. CSI 5532e2eae2SMauro Carvalho Chehabcan interface directly with Parallel and MIPI CSI-2 buses. It has 256 x 64 FIFO 5632e2eae2SMauro Carvalho Chehabto store received image pixel data and embedded DMA controllers to transfer data 5732e2eae2SMauro Carvalho Chehabfrom the FIFO through AHB bus. 5832e2eae2SMauro Carvalho Chehab 5932e2eae2SMauro Carvalho ChehabThis entity has one sink pad that receives from the csi-mux entity and a single 6032e2eae2SMauro Carvalho Chehabsource pad that routes video frames directly to memory buffers. This pad is 6132e2eae2SMauro Carvalho Chehabrouted to a capture device node. 6232e2eae2SMauro Carvalho Chehab 6332e2eae2SMauro Carvalho ChehabUsage Notes 6432e2eae2SMauro Carvalho Chehab----------- 6532e2eae2SMauro Carvalho Chehab 6632e2eae2SMauro Carvalho ChehabTo aid in configuration and for backward compatibility with V4L2 applications 6732e2eae2SMauro Carvalho Chehabthat access controls only from video device nodes, the capture device interfaces 6832e2eae2SMauro Carvalho Chehabinherit controls from the active entities in the current pipeline, so controls 6932e2eae2SMauro Carvalho Chehabcan be accessed either directly from the subdev or from the active capture 7032e2eae2SMauro Carvalho Chehabdevice interface. For example, the sensor controls are available either from the 7132e2eae2SMauro Carvalho Chehabsensor subdevs or from the active capture device. 7232e2eae2SMauro Carvalho Chehab 7332e2eae2SMauro Carvalho ChehabWarp7 with OV2680 7432e2eae2SMauro Carvalho Chehab----------------- 7532e2eae2SMauro Carvalho Chehab 7632e2eae2SMauro Carvalho ChehabOn this platform an OV2680 MIPI CSI-2 module is connected to the internal MIPI 7732e2eae2SMauro Carvalho ChehabCSI-2 receiver. The following example configures a video capture pipeline with 7832e2eae2SMauro Carvalho Chehaban output of 800x600, and BGGR 10 bit bayer format: 7932e2eae2SMauro Carvalho Chehab 8032e2eae2SMauro Carvalho Chehab.. code-block:: none 8132e2eae2SMauro Carvalho Chehab 8232e2eae2SMauro Carvalho Chehab # Setup links 8332e2eae2SMauro Carvalho Chehab media-ctl -l "'ov2680 1-0036':0 -> 'imx7-mipi-csis.0':0[1]" 8432e2eae2SMauro Carvalho Chehab media-ctl -l "'imx7-mipi-csis.0':1 -> 'csi-mux':1[1]" 8532e2eae2SMauro Carvalho Chehab media-ctl -l "'csi-mux':2 -> 'csi':0[1]" 8632e2eae2SMauro Carvalho Chehab media-ctl -l "'csi':1 -> 'csi capture':0[1]" 8732e2eae2SMauro Carvalho Chehab 8832e2eae2SMauro Carvalho Chehab # Configure pads for pipeline 8932e2eae2SMauro Carvalho Chehab media-ctl -V "'ov2680 1-0036':0 [fmt:SBGGR10_1X10/800x600 field:none]" 9032e2eae2SMauro Carvalho Chehab media-ctl -V "'csi-mux':1 [fmt:SBGGR10_1X10/800x600 field:none]" 9132e2eae2SMauro Carvalho Chehab media-ctl -V "'csi-mux':2 [fmt:SBGGR10_1X10/800x600 field:none]" 9232e2eae2SMauro Carvalho Chehab media-ctl -V "'imx7-mipi-csis.0':0 [fmt:SBGGR10_1X10/800x600 field:none]" 9332e2eae2SMauro Carvalho Chehab media-ctl -V "'csi':0 [fmt:SBGGR10_1X10/800x600 field:none]" 9432e2eae2SMauro Carvalho Chehab 9532e2eae2SMauro Carvalho ChehabAfter this streaming can start. The v4l2-ctl tool can be used to select any of 9632e2eae2SMauro Carvalho Chehabthe resolutions supported by the sensor. 9732e2eae2SMauro Carvalho Chehab 9832e2eae2SMauro Carvalho Chehab.. code-block:: none 9932e2eae2SMauro Carvalho Chehab 10032e2eae2SMauro Carvalho Chehab # media-ctl -p 10132e2eae2SMauro Carvalho Chehab Media controller API version 5.2.0 10232e2eae2SMauro Carvalho Chehab 10332e2eae2SMauro Carvalho Chehab Media device information 10432e2eae2SMauro Carvalho Chehab ------------------------ 10532e2eae2SMauro Carvalho Chehab driver imx7-csi 10632e2eae2SMauro Carvalho Chehab model imx-media 10732e2eae2SMauro Carvalho Chehab serial 10832e2eae2SMauro Carvalho Chehab bus info 10932e2eae2SMauro Carvalho Chehab hw revision 0x0 11032e2eae2SMauro Carvalho Chehab driver version 5.2.0 11132e2eae2SMauro Carvalho Chehab 11232e2eae2SMauro Carvalho Chehab Device topology 11332e2eae2SMauro Carvalho Chehab - entity 1: csi (2 pads, 2 links) 11432e2eae2SMauro Carvalho Chehab type V4L2 subdev subtype Unknown flags 0 11532e2eae2SMauro Carvalho Chehab device node name /dev/v4l-subdev0 11632e2eae2SMauro Carvalho Chehab pad0: Sink 11732e2eae2SMauro Carvalho Chehab [fmt:SBGGR10_1X10/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range] 11832e2eae2SMauro Carvalho Chehab <- "csi-mux":2 [ENABLED] 11932e2eae2SMauro Carvalho Chehab pad1: Source 12032e2eae2SMauro Carvalho Chehab [fmt:SBGGR10_1X10/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range] 12132e2eae2SMauro Carvalho Chehab -> "csi capture":0 [ENABLED] 12232e2eae2SMauro Carvalho Chehab 12332e2eae2SMauro Carvalho Chehab - entity 4: csi capture (1 pad, 1 link) 12432e2eae2SMauro Carvalho Chehab type Node subtype V4L flags 0 12532e2eae2SMauro Carvalho Chehab device node name /dev/video0 12632e2eae2SMauro Carvalho Chehab pad0: Sink 12732e2eae2SMauro Carvalho Chehab <- "csi":1 [ENABLED] 12832e2eae2SMauro Carvalho Chehab 12932e2eae2SMauro Carvalho Chehab - entity 10: csi-mux (3 pads, 2 links) 13032e2eae2SMauro Carvalho Chehab type V4L2 subdev subtype Unknown flags 0 13132e2eae2SMauro Carvalho Chehab device node name /dev/v4l-subdev1 13232e2eae2SMauro Carvalho Chehab pad0: Sink 13332e2eae2SMauro Carvalho Chehab [fmt:Y8_1X8/1x1 field:none] 13432e2eae2SMauro Carvalho Chehab pad1: Sink 13532e2eae2SMauro Carvalho Chehab [fmt:SBGGR10_1X10/800x600 field:none] 13632e2eae2SMauro Carvalho Chehab <- "imx7-mipi-csis.0":1 [ENABLED] 13732e2eae2SMauro Carvalho Chehab pad2: Source 13832e2eae2SMauro Carvalho Chehab [fmt:SBGGR10_1X10/800x600 field:none] 13932e2eae2SMauro Carvalho Chehab -> "csi":0 [ENABLED] 14032e2eae2SMauro Carvalho Chehab 14132e2eae2SMauro Carvalho Chehab - entity 14: imx7-mipi-csis.0 (2 pads, 2 links) 14232e2eae2SMauro Carvalho Chehab type V4L2 subdev subtype Unknown flags 0 14332e2eae2SMauro Carvalho Chehab device node name /dev/v4l-subdev2 14432e2eae2SMauro Carvalho Chehab pad0: Sink 14532e2eae2SMauro Carvalho Chehab [fmt:SBGGR10_1X10/800x600 field:none] 14632e2eae2SMauro Carvalho Chehab <- "ov2680 1-0036":0 [ENABLED] 14732e2eae2SMauro Carvalho Chehab pad1: Source 14832e2eae2SMauro Carvalho Chehab [fmt:SBGGR10_1X10/800x600 field:none] 14932e2eae2SMauro Carvalho Chehab -> "csi-mux":1 [ENABLED] 15032e2eae2SMauro Carvalho Chehab 15132e2eae2SMauro Carvalho Chehab - entity 17: ov2680 1-0036 (1 pad, 1 link) 15232e2eae2SMauro Carvalho Chehab type V4L2 subdev subtype Sensor flags 0 15332e2eae2SMauro Carvalho Chehab device node name /dev/v4l-subdev3 15432e2eae2SMauro Carvalho Chehab pad0: Source 15532e2eae2SMauro Carvalho Chehab [fmt:SBGGR10_1X10/800x600@1/30 field:none colorspace:srgb] 15632e2eae2SMauro Carvalho Chehab -> "imx7-mipi-csis.0":0 [ENABLED] 15732e2eae2SMauro Carvalho Chehab 1581e6494daSFabio Estevami.MX6ULL-EVK with OV5640 1591e6494daSFabio Estevam------------------------ 1601e6494daSFabio Estevam 1611e6494daSFabio EstevamOn this platform a parallel OV5640 sensor is connected to the CSI port. 1621e6494daSFabio EstevamThe following example configures a video capture pipeline with an output 1631e6494daSFabio Estevamof 640x480 and UYVY8_2X8 format: 1641e6494daSFabio Estevam 1651e6494daSFabio Estevam.. code-block:: none 1661e6494daSFabio Estevam 1671e6494daSFabio Estevam # Setup links 1681e6494daSFabio Estevam media-ctl -l "'ov5640 1-003c':0 -> 'csi':0[1]" 1691e6494daSFabio Estevam media-ctl -l "'csi':1 -> 'csi capture':0[1]" 1701e6494daSFabio Estevam 1711e6494daSFabio Estevam # Configure pads for pipeline 1721e6494daSFabio Estevam media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_2X8/640x480 field:none]" 1731e6494daSFabio Estevam 1741e6494daSFabio EstevamAfter this streaming can start: 1751e6494daSFabio Estevam 1761e6494daSFabio Estevam.. code-block:: none 1771e6494daSFabio Estevam 1781e6494daSFabio Estevam gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-raw,format=UYVY,width=640,height=480 ! v4l2convert ! fbdevsink 1791e6494daSFabio Estevam 1801e6494daSFabio Estevam.. code-block:: none 1811e6494daSFabio Estevam 1821e6494daSFabio Estevam # media-ctl -p 1831e6494daSFabio Estevam Media controller API version 5.14.0 1841e6494daSFabio Estevam 1851e6494daSFabio Estevam Media device information 1861e6494daSFabio Estevam ------------------------ 1871e6494daSFabio Estevam driver imx7-csi 1881e6494daSFabio Estevam model imx-media 1891e6494daSFabio Estevam serial 1901e6494daSFabio Estevam bus info 1911e6494daSFabio Estevam hw revision 0x0 1921e6494daSFabio Estevam driver version 5.14.0 1931e6494daSFabio Estevam 1941e6494daSFabio Estevam Device topology 1951e6494daSFabio Estevam - entity 1: csi (2 pads, 2 links) 1961e6494daSFabio Estevam type V4L2 subdev subtype Unknown flags 0 1971e6494daSFabio Estevam device node name /dev/v4l-subdev0 1981e6494daSFabio Estevam pad0: Sink 1991e6494daSFabio Estevam [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range] 2001e6494daSFabio Estevam <- "ov5640 1-003c":0 [ENABLED,IMMUTABLE] 2011e6494daSFabio Estevam pad1: Source 2021e6494daSFabio Estevam [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range] 2031e6494daSFabio Estevam -> "csi capture":0 [ENABLED,IMMUTABLE] 2041e6494daSFabio Estevam 2051e6494daSFabio Estevam - entity 4: csi capture (1 pad, 1 link) 2061e6494daSFabio Estevam type Node subtype V4L flags 0 2071e6494daSFabio Estevam device node name /dev/video1 2081e6494daSFabio Estevam pad0: Sink 2091e6494daSFabio Estevam <- "csi":1 [ENABLED,IMMUTABLE] 2101e6494daSFabio Estevam 2111e6494daSFabio Estevam - entity 10: ov5640 1-003c (1 pad, 1 link) 2121e6494daSFabio Estevam type V4L2 subdev subtype Sensor flags 0 2131e6494daSFabio Estevam device node name /dev/v4l-subdev1 2141e6494daSFabio Estevam pad0: Source 2151e6494daSFabio Estevam [fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range] 2161e6494daSFabio Estevam -> "csi":0 [ENABLED,IMMUTABLE] 2171e6494daSFabio Estevam 21832e2eae2SMauro Carvalho ChehabReferences 21932e2eae2SMauro Carvalho Chehab---------- 22032e2eae2SMauro Carvalho Chehab 22132e2eae2SMauro Carvalho Chehab.. [#f1] https://www.nxp.com/docs/en/reference-manual/IMX7SRM.pdf 222