^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) i.MX7 Video Capture Driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) ==========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) Introduction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) ------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) The i.MX7 contrary to the i.MX5/6 family does not contain an Image Processing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) Unit (IPU); because of that the capabilities to perform operations or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) manipulation of the capture frames are less feature rich.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) For image capture the i.MX7 has three units:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) - CMOS Sensor Interface (CSI)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) - Video Multiplexer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) - MIPI CSI-2 Receiver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .. code-block:: none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) MIPI Camera Input ---> MIPI CSI-2 --- > |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) | M |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) | U | ------> CSI ---> Capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) | X |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) | /
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) Parallel Camera Input ----------------> | /
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) |/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) For additional information, please refer to the latest versions of the i.MX7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) reference manual [#f1]_.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Entities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) --------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) imx7-mipi-csi2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) This is the MIPI CSI-2 receiver entity. It has one sink pad to receive the pixel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) data from MIPI CSI-2 camera sensor. It has one source pad, corresponding to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) virtual channel 0. This module is compliant to previous version of Samsung
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) D-phy, and supports two D-PHY Rx Data lanes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) csi-mux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) This is the video multiplexer. It has two sink pads to select from either camera
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) sensor with a parallel interface or from MIPI CSI-2 virtual channel 0. It has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) a single source pad that routes to the CSI.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) csi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ---
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) The CSI enables the chip to connect directly to external CMOS image sensor. CSI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) can interface directly with Parallel and MIPI CSI-2 buses. It has 256 x 64 FIFO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) to store received image pixel data and embedded DMA controllers to transfer data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) from the FIFO through AHB bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) This entity has one sink pad that receives from the csi-mux entity and a single
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) source pad that routes video frames directly to memory buffers. This pad is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) routed to a capture device node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) Usage Notes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) To aid in configuration and for backward compatibility with V4L2 applications
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) that access controls only from video device nodes, the capture device interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) inherit controls from the active entities in the current pipeline, so controls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) can be accessed either directly from the subdev or from the active capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) device interface. For example, the sensor controls are available either from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) sensor subdevs or from the active capture device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) Warp7 with OV2680
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) On this platform an OV2680 MIPI CSI-2 module is connected to the internal MIPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) CSI-2 receiver. The following example configures a video capture pipeline with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) an output of 800x600, and BGGR 10 bit bayer format:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) .. code-block:: none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) # Setup links
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) media-ctl -l "'ov2680 1-0036':0 -> 'imx7-mipi-csis.0':0[1]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) media-ctl -l "'imx7-mipi-csis.0':1 -> 'csi-mux':1[1]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) media-ctl -l "'csi-mux':2 -> 'csi':0[1]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) media-ctl -l "'csi':1 -> 'csi capture':0[1]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) # Configure pads for pipeline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) media-ctl -V "'ov2680 1-0036':0 [fmt:SBGGR10_1X10/800x600 field:none]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) media-ctl -V "'csi-mux':1 [fmt:SBGGR10_1X10/800x600 field:none]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) media-ctl -V "'csi-mux':2 [fmt:SBGGR10_1X10/800x600 field:none]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) media-ctl -V "'imx7-mipi-csis.0':0 [fmt:SBGGR10_1X10/800x600 field:none]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) media-ctl -V "'csi':0 [fmt:SBGGR10_1X10/800x600 field:none]"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) After this streaming can start. The v4l2-ctl tool can be used to select any of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) the resolutions supported by the sensor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) .. code-block:: none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) # media-ctl -p
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) Media controller API version 5.2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) Media device information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) driver imx7-csi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) model imx-media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) serial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) bus info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) hw revision 0x0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) driver version 5.2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) Device topology
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) - entity 1: csi (2 pads, 2 links)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) type V4L2 subdev subtype Unknown flags 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) device node name /dev/v4l-subdev0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) pad0: Sink
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) [fmt:SBGGR10_1X10/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) <- "csi-mux":2 [ENABLED]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) pad1: Source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) [fmt:SBGGR10_1X10/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) -> "csi capture":0 [ENABLED]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) - entity 4: csi capture (1 pad, 1 link)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) type Node subtype V4L flags 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) device node name /dev/video0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) pad0: Sink
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) <- "csi":1 [ENABLED]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) - entity 10: csi-mux (3 pads, 2 links)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) type V4L2 subdev subtype Unknown flags 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) device node name /dev/v4l-subdev1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) pad0: Sink
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) [fmt:Y8_1X8/1x1 field:none]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) pad1: Sink
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) [fmt:SBGGR10_1X10/800x600 field:none]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) <- "imx7-mipi-csis.0":1 [ENABLED]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) pad2: Source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) [fmt:SBGGR10_1X10/800x600 field:none]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) -> "csi":0 [ENABLED]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) - entity 14: imx7-mipi-csis.0 (2 pads, 2 links)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) type V4L2 subdev subtype Unknown flags 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) device node name /dev/v4l-subdev2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) pad0: Sink
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) [fmt:SBGGR10_1X10/800x600 field:none]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) <- "ov2680 1-0036":0 [ENABLED]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) pad1: Source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) [fmt:SBGGR10_1X10/800x600 field:none]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) -> "csi-mux":1 [ENABLED]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) - entity 17: ov2680 1-0036 (1 pad, 1 link)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) type V4L2 subdev subtype Sensor flags 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) device node name /dev/v4l-subdev3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) pad0: Source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) [fmt:SBGGR10_1X10/800x600@1/30 field:none colorspace:srgb]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) -> "imx7-mipi-csis.0":0 [ENABLED]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) References
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) ----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) .. [#f1] https://www.nxp.com/docs/en/reference-manual/IMX7SRM.pdf