Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GPL-2.0
0002 
0003 i.MX7 Video Capture Driver
0004 ==========================
0005 
0006 Introduction
0007 ------------
0008 
0009 The i.MX7 contrary to the i.MX5/6 family does not contain an Image Processing
0010 Unit (IPU); because of that the capabilities to perform operations or
0011 manipulation of the capture frames are less feature rich.
0012 
0013 For image capture the i.MX7 has three units:
0014 - CMOS Sensor Interface (CSI)
0015 - Video Multiplexer
0016 - MIPI CSI-2 Receiver
0017 
0018 .. code-block:: none
0019 
0020    MIPI Camera Input ---> MIPI CSI-2 --- > |\
0021                                            | \
0022                                            |  \
0023                                            | M |
0024                                            | U | ------>  CSI ---> Capture
0025                                            | X |
0026                                            |  /
0027    Parallel Camera Input ----------------> | /
0028                                            |/
0029 
0030 For additional information, please refer to the latest versions of the i.MX7
0031 reference manual [#f1]_.
0032 
0033 Entities
0034 --------
0035 
0036 imx-mipi-csi2
0037 --------------
0038 
0039 This is the MIPI CSI-2 receiver entity. It has one sink pad to receive the pixel
0040 data from MIPI CSI-2 camera sensor. It has one source pad, corresponding to the
0041 virtual channel 0. This module is compliant to previous version of Samsung
0042 D-phy, and supports two D-PHY Rx Data lanes.
0043 
0044 csi-mux
0045 -------
0046 
0047 This is the video multiplexer. It has two sink pads to select from either camera
0048 sensor with a parallel interface or from MIPI CSI-2 virtual channel 0.  It has
0049 a single source pad that routes to the CSI.
0050 
0051 csi
0052 ---
0053 
0054 The CSI enables the chip to connect directly to external CMOS image sensor. CSI
0055 can interface directly with Parallel and MIPI CSI-2 buses. It has 256 x 64 FIFO
0056 to store received image pixel data and embedded DMA controllers to transfer data
0057 from the FIFO through AHB bus.
0058 
0059 This entity has one sink pad that receives from the csi-mux entity and a single
0060 source pad that routes video frames directly to memory buffers. This pad is
0061 routed to a capture device node.
0062 
0063 Usage Notes
0064 -----------
0065 
0066 To aid in configuration and for backward compatibility with V4L2 applications
0067 that access controls only from video device nodes, the capture device interfaces
0068 inherit controls from the active entities in the current pipeline, so controls
0069 can be accessed either directly from the subdev or from the active capture
0070 device interface. For example, the sensor controls are available either from the
0071 sensor subdevs or from the active capture device.
0072 
0073 Warp7 with OV2680
0074 -----------------
0075 
0076 On this platform an OV2680 MIPI CSI-2 module is connected to the internal MIPI
0077 CSI-2 receiver. The following example configures a video capture pipeline with
0078 an output of 800x600, and BGGR 10 bit bayer format:
0079 
0080 .. code-block:: none
0081 
0082    # Setup links
0083    media-ctl -l "'ov2680 1-0036':0 -> 'imx7-mipi-csis.0':0[1]"
0084    media-ctl -l "'imx7-mipi-csis.0':1 -> 'csi-mux':1[1]"
0085    media-ctl -l "'csi-mux':2 -> 'csi':0[1]"
0086    media-ctl -l "'csi':1 -> 'csi capture':0[1]"
0087 
0088    # Configure pads for pipeline
0089    media-ctl -V "'ov2680 1-0036':0 [fmt:SBGGR10_1X10/800x600 field:none]"
0090    media-ctl -V "'csi-mux':1 [fmt:SBGGR10_1X10/800x600 field:none]"
0091    media-ctl -V "'csi-mux':2 [fmt:SBGGR10_1X10/800x600 field:none]"
0092    media-ctl -V "'imx7-mipi-csis.0':0 [fmt:SBGGR10_1X10/800x600 field:none]"
0093    media-ctl -V "'csi':0 [fmt:SBGGR10_1X10/800x600 field:none]"
0094 
0095 After this streaming can start. The v4l2-ctl tool can be used to select any of
0096 the resolutions supported by the sensor.
0097 
0098 .. code-block:: none
0099 
0100         # media-ctl -p
0101         Media controller API version 5.2.0
0102 
0103         Media device information
0104         ------------------------
0105         driver          imx7-csi
0106         model           imx-media
0107         serial
0108         bus info
0109         hw revision     0x0
0110         driver version  5.2.0
0111 
0112         Device topology
0113         - entity 1: csi (2 pads, 2 links)
0114                     type V4L2 subdev subtype Unknown flags 0
0115                     device node name /dev/v4l-subdev0
0116                 pad0: Sink
0117                         [fmt:SBGGR10_1X10/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
0118                         <- "csi-mux":2 [ENABLED]
0119                 pad1: Source
0120                         [fmt:SBGGR10_1X10/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
0121                         -> "csi capture":0 [ENABLED]
0122 
0123         - entity 4: csi capture (1 pad, 1 link)
0124                     type Node subtype V4L flags 0
0125                     device node name /dev/video0
0126                 pad0: Sink
0127                         <- "csi":1 [ENABLED]
0128 
0129         - entity 10: csi-mux (3 pads, 2 links)
0130                      type V4L2 subdev subtype Unknown flags 0
0131                      device node name /dev/v4l-subdev1
0132                 pad0: Sink
0133                         [fmt:Y8_1X8/1x1 field:none]
0134                 pad1: Sink
0135                        [fmt:SBGGR10_1X10/800x600 field:none]
0136                         <- "imx7-mipi-csis.0":1 [ENABLED]
0137                 pad2: Source
0138                         [fmt:SBGGR10_1X10/800x600 field:none]
0139                         -> "csi":0 [ENABLED]
0140 
0141         - entity 14: imx7-mipi-csis.0 (2 pads, 2 links)
0142                      type V4L2 subdev subtype Unknown flags 0
0143                      device node name /dev/v4l-subdev2
0144                 pad0: Sink
0145                         [fmt:SBGGR10_1X10/800x600 field:none]
0146                         <- "ov2680 1-0036":0 [ENABLED]
0147                 pad1: Source
0148                         [fmt:SBGGR10_1X10/800x600 field:none]
0149                         -> "csi-mux":1 [ENABLED]
0150 
0151         - entity 17: ov2680 1-0036 (1 pad, 1 link)
0152                      type V4L2 subdev subtype Sensor flags 0
0153                      device node name /dev/v4l-subdev3
0154                 pad0: Source
0155                         [fmt:SBGGR10_1X10/800x600@1/30 field:none colorspace:srgb]
0156                         -> "imx7-mipi-csis.0":0 [ENABLED]
0157 
0158 i.MX6ULL-EVK with OV5640
0159 ------------------------
0160 
0161 On this platform a parallel OV5640 sensor is connected to the CSI port.
0162 The following example configures a video capture pipeline with an output
0163 of 640x480 and UYVY8_2X8 format:
0164 
0165 .. code-block:: none
0166 
0167    # Setup links
0168    media-ctl -l "'ov5640 1-003c':0 -> 'csi':0[1]"
0169    media-ctl -l "'csi':1 -> 'csi capture':0[1]"
0170 
0171    # Configure pads for pipeline
0172    media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_2X8/640x480 field:none]"
0173 
0174 After this streaming can start:
0175 
0176 .. code-block:: none
0177 
0178    gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-raw,format=UYVY,width=640,height=480 ! v4l2convert ! fbdevsink
0179 
0180 .. code-block:: none
0181 
0182         # media-ctl -p
0183         Media controller API version 5.14.0
0184 
0185         Media device information
0186         ------------------------
0187         driver          imx7-csi
0188         model           imx-media
0189         serial
0190         bus info
0191         hw revision     0x0
0192         driver version  5.14.0
0193 
0194         Device topology
0195         - entity 1: csi (2 pads, 2 links)
0196                     type V4L2 subdev subtype Unknown flags 0
0197                     device node name /dev/v4l-subdev0
0198                 pad0: Sink
0199                         [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
0200                         <- "ov5640 1-003c":0 [ENABLED,IMMUTABLE]
0201                 pad1: Source
0202                         [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
0203                         -> "csi capture":0 [ENABLED,IMMUTABLE]
0204 
0205         - entity 4: csi capture (1 pad, 1 link)
0206                     type Node subtype V4L flags 0
0207                     device node name /dev/video1
0208                 pad0: Sink
0209                         <- "csi":1 [ENABLED,IMMUTABLE]
0210 
0211         - entity 10: ov5640 1-003c (1 pad, 1 link)
0212                      type V4L2 subdev subtype Sensor flags 0
0213                      device node name /dev/v4l-subdev1
0214                 pad0: Source
0215                         [fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
0216                         -> "csi":0 [ENABLED,IMMUTABLE]
0217 
0218 References
0219 ----------
0220 
0221 .. [#f1] https://www.nxp.com/docs/en/reference-manual/IMX7SRM.pdf