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