← Documents Documentation/admin-guide/media/imx7.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Media

i.MX7 Video Capture Driver

i.MX7의 MIPI·parallel camera 입력, CSI mux, DMA capture와 Warp7·i.MX6ULL pipeline 설정을 설명합니다.

Source pathDocumentation/admin-guide/media/imx7.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

i.MX7 capture architecture

imx7.rst:1-221

IPU가 없는 i.MX7 capture path를 Media Controller entity와 pad 관점에서 정리하고, OV2680 MIPI input과 OV5640 parallel input의 실제 `media-ctl` 구성을 연결해 설명합니다.

i.MX7 input 선택과 capture
MIPI cameraimx-mipi-csi2csi-muxcsicsi capture
parallel cameracsi-muxcsicsi capture

MIPI path와 parallel path는 mux/CSI 단계에서 합류해 memory capture node로 이어집니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

i.MX7 Video Capture Driver

1-5

이 문서는 GPL-2.0 라이선스를 따르는 i.MX7 video capture driver 안내입니다.

소개와 capture block

6-32

i.MX7은 i.MX5/6 계열과 달리 Image Processing Unit(IPU)을 포함하지 않습니다. 따라서 capture frame을 연산하거나 조작하는 기능은 i.MX5/6보다 제한적입니다.

i.MX7의 image capture에는 다음 세 unit이 사용됩니다.

  • CMOS Sensor Interface(CSI)
  • Video Multiplexer
  • MIPI CSI-2 Receiver
i.MX7 camera input topology
MIPI cameraimx-mipi-csi2csi-muxcsicsi capture
parallel cameracsi-muxcsicsi capture

MIPI input은 MIPI CSI-2 receiver를 거친 뒤 mux로 들어가며, parallel input은 mux로 직접 들어갑니다. 선택된 input은 CSI를 통해 memory capture로 전달됩니다.

추가 정보는 최신 i.MX7 reference manual `f1`을 참조하십시오.

Media entity 구성

33-35

Driver는 MIPI receiver, video multiplexer, CSI를 Media Controller entity로 노출합니다.

imx-mipi-csi2 entity

36-43

`imx-mipi-csi2`는 MIPI CSI-2 receiver entity입니다. MIPI CSI-2 camera sensor의 pixel data를 받는 sink pad 하나와 virtual channel 0에 해당하는 source pad 하나를 가집니다.

이 module은 이전 Samsung D-PHY version과 호환되며 D-PHY Rx data lane 두 개를 지원합니다.

csi-mux entity

44-50

`csi-mux`는 video multiplexer입니다. Parallel interface camera sensor와 MIPI CSI-2 virtual channel 0 중 하나를 선택하는 sink pad 두 개를 가지며, CSI로 route하는 source pad 하나를 가집니다.

csi entity

51-62

CSI를 사용하면 chip을 외부 CMOS image sensor에 직접 연결할 수 있습니다. CSI는 parallel bus와 MIPI CSI-2 bus에 직접 interface할 수 있습니다.

수신한 image pixel data를 저장하는 256 x 64 FIFO와 FIFO의 data를 AHB bus로 전송하는 내장 DMA controller를 갖습니다.

이 entity는 `csi-mux`에서 frame을 받는 sink pad 하나와 video frame을 memory buffer로 직접 route하는 source pad 하나를 가집니다. Source pad는 capture device node로 연결됩니다.

Control 접근과 호환성

63-72

설정을 돕고 video device node에서만 control에 접근하는 기존 V4L2 application과 호환되도록 capture device interface는 현재 pipeline의 활성 entity에서 control을 상속합니다.

따라서 control은 subdev에서 직접 접근하거나 활성 capture device interface에서 접근할 수 있습니다. 예를 들어 sensor control은 sensor subdev와 활성 capture device 양쪽에서 사용할 수 있습니다.

Warp7과 OV2680

73-157

이 platform에서는 OV2680 MIPI CSI-2 module이 내부 MIPI CSI-2 receiver에 연결됩니다. 다음 예는 800x600 output과 10-bit BGGR Bayer format을 사용하는 video capture pipeline을 구성합니다.

# Setup links
media-ctl -l "'ov2680 1-0036':0 -> 'imx7-mipi-csis.0':0[1]"
media-ctl -l "'imx7-mipi-csis.0':1 -> 'csi-mux':1[1]"
media-ctl -l "'csi-mux':2 -> 'csi':0[1]"
media-ctl -l "'csi':1 -> 'csi capture':0[1]"

# Configure pads for pipeline
media-ctl -V "'ov2680 1-0036':0 [fmt:SBGGR10_1X10/800x600 field:none]"
media-ctl -V "'csi-mux':1 [fmt:SBGGR10_1X10/800x600 field:none]"
media-ctl -V "'csi-mux':2 [fmt:SBGGR10_1X10/800x600 field:none]"
media-ctl -V "'imx7-mipi-csis.0':0 [fmt:SBGGR10_1X10/800x600 field:none]"
media-ctl -V "'csi':0 [fmt:SBGGR10_1X10/800x600 field:none]"
Warp7 OV2680 pipeline
ov2680 1-0036:0imx7-mipi-csis.0:0→1csi-mux:1→2csi:0→1csi capture /dev/video0

OV2680 virtual channel 0은 MIPI receiver와 mux를 거쳐 CSI capture node `/dev/video0`에 도달합니다.

구성이 끝나면 streaming을 시작할 수 있습니다. `v4l2-ctl`을 사용해 sensor가 지원하는 resolution 중 하나를 선택할 수 있습니다.

# media-ctl -p
Media controller API version 5.2.0

Media device information
------------------------
driver          imx7-csi
model           imx-media
serial
bus info
hw revision     0x0
driver version  5.2.0

Device topology
- entity 1: csi (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:SBGGR10_1X10/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
                <- "csi-mux":2 [ENABLED]
        pad1: Source
                [fmt:SBGGR10_1X10/800x600 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
                -> "csi capture":0 [ENABLED]

- entity 4: csi capture (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "csi":1 [ENABLED]

- entity 10: csi-mux (3 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev1
        pad0: Sink
                [fmt:Y8_1X8/1x1 field:none]
        pad1: Sink
               [fmt:SBGGR10_1X10/800x600 field:none]
                <- "imx7-mipi-csis.0":1 [ENABLED]
        pad2: Source
                [fmt:SBGGR10_1X10/800x600 field:none]
                -> "csi":0 [ENABLED]

- entity 14: imx7-mipi-csis.0 (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev2
        pad0: Sink
                [fmt:SBGGR10_1X10/800x600 field:none]
                <- "ov2680 1-0036":0 [ENABLED]
        pad1: Source
                [fmt:SBGGR10_1X10/800x600 field:none]
                -> "csi-mux":1 [ENABLED]

- entity 17: ov2680 1-0036 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev3
        pad0: Source
                [fmt:SBGGR10_1X10/800x600@1/30 field:none colorspace:srgb]
                -> "imx7-mipi-csis.0":0 [ENABLED]

`media-ctl -p` 출력은 `csi`, `csi capture`, `csi-mux`, `imx7-mipi-csis.0`, `ov2680 1-0036`의 pad format과 enabled link를 보여 줍니다. 전체 pipeline은 `SBGGR10_1X10/800x600` format을 유지하며 capture node는 `/dev/video0`입니다.

Warp7 media entity와 pad 연결
ov2680:0imx7-mipi-csis.0:0
imx7-mipi-csis.0:1csi-mux:1
csi-mux:2csi:0
csi:1csi capture:0

각 source pad의 format이 다음 entity의 sink pad로 그대로 전달됩니다.

i.MX6ULL-EVK와 OV5640

158-217

이 platform에서는 parallel OV5640 sensor가 CSI port에 연결됩니다. 다음 예는 640x480 output과 `UYVY8_2X8` format을 사용하는 video capture pipeline을 구성합니다.

# Setup links
media-ctl -l "'ov5640 1-003c':0 -> 'csi':0[1]"
media-ctl -l "'csi':1 -> 'csi capture':0[1]"

# Configure pads for pipeline
media-ctl -v -V "'ov5640 1-003c':0 [fmt:UYVY8_2X8/640x480 field:none]"
i.MX6ULL parallel OV5640 pipeline
ov5640 1-003c:0csi:0→1csi capture /dev/video1

Parallel sensor는 MIPI receiver와 selectable mux stage 없이 CSI와 immutable link로 직접 연결됩니다.

구성이 끝나면 다음 GStreamer pipeline으로 streaming을 시작할 수 있습니다.

gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-raw,format=UYVY,width=640,height=480 ! v4l2convert ! fbdevsink
# media-ctl -p
Media controller API version 5.14.0

Media device information
------------------------
driver          imx7-csi
model           imx-media
serial
bus info
hw revision     0x0
driver version  5.14.0

Device topology
- entity 1: csi (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
                <- "ov5640 1-003c":0 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
        pad0: Sink
                <- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: ov5640 1-003c (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev1
        pad0: Source
                [fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:full-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

`media-ctl -p` 출력에서 OV5640 source pad와 CSI sink pad, CSI source pad와 capture sink pad는 모두 `ENABLED,IMMUTABLE` link입니다. Pipeline은 `UYVY8_2X8/640x480` format을 유지하며 capture node는 `/dev/video1`입니다.

i.MX6ULL media entity와 immutable link
ov5640:0csi:0ENABLED,IMMUTABLE
csi:1csi capture:0ENABLED,IMMUTABLE

OV5640부터 memory capture node까지 두 link가 고정되어 있습니다.

Reference manual

218-221