Merge tag '4.21-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
[sfrench/cifs-2.6.git] / Documentation / media / v4l-drivers / imx.rst
1 .. SPDX-License-Identifier: GPL-2.0
2
3 i.MX Video Capture Driver
4 =========================
5
6 Introduction
7 ------------
8
9 The Freescale i.MX5/6 contains an Image Processing Unit (IPU), which
10 handles the flow of image frames to and from capture devices and
11 display devices.
12
13 For image capture, the IPU contains the following internal subunits:
14
15 - Image DMA Controller (IDMAC)
16 - Camera Serial Interface (CSI)
17 - Image Converter (IC)
18 - Sensor Multi-FIFO Controller (SMFC)
19 - Image Rotator (IRT)
20 - Video De-Interlacing or Combining Block (VDIC)
21
22 The IDMAC is the DMA controller for transfer of image frames to and from
23 memory. Various dedicated DMA channels exist for both video capture and
24 display paths. During transfer, the IDMAC is also capable of vertical
25 image flip, 8x8 block transfer (see IRT description), pixel component
26 re-ordering (for example UYVY to YUYV) within the same colorspace, and
27 even packed <--> planar conversion. It can also perform a simple
28 de-interlacing by interleaving even and odd lines during transfer
29 (without motion compensation which requires the VDIC).
30
31 The CSI is the backend capture unit that interfaces directly with
32 camera sensors over Parallel, BT.656/1120, and MIPI CSI-2 busses.
33
34 The IC handles color-space conversion, resizing (downscaling and
35 upscaling), horizontal flip, and 90/270 degree rotation operations.
36
37 There are three independent "tasks" within the IC that can carry out
38 conversions concurrently: pre-process encoding, pre-process viewfinder,
39 and post-processing. Within each task, conversions are split into three
40 sections: downsizing section, main section (upsizing, flip, colorspace
41 conversion, and graphics plane combining), and rotation section.
42
43 The IPU time-shares the IC task operations. The time-slice granularity
44 is one burst of eight pixels in the downsizing section, one image line
45 in the main processing section, one image frame in the rotation section.
46
47 The SMFC is composed of four independent FIFOs that each can transfer
48 captured frames from sensors directly to memory concurrently via four
49 IDMAC channels.
50
51 The IRT carries out 90 and 270 degree image rotation operations. The
52 rotation operation is carried out on 8x8 pixel blocks at a time. This
53 operation is supported by the IDMAC which handles the 8x8 block transfer
54 along with block reordering, in coordination with vertical flip.
55
56 The VDIC handles the conversion of interlaced video to progressive, with
57 support for different motion compensation modes (low, medium, and high
58 motion). The deinterlaced output frames from the VDIC can be sent to the
59 IC pre-process viewfinder task for further conversions. The VDIC also
60 contains a Combiner that combines two image planes, with alpha blending
61 and color keying.
62
63 In addition to the IPU internal subunits, there are also two units
64 outside the IPU that are also involved in video capture on i.MX:
65
66 - MIPI CSI-2 Receiver for camera sensors with the MIPI CSI-2 bus
67   interface. This is a Synopsys DesignWare core.
68 - Two video multiplexers for selecting among multiple sensor inputs
69   to send to a CSI.
70
71 For more info, refer to the latest versions of the i.MX5/6 reference
72 manuals [#f1]_ and [#f2]_.
73
74
75 Features
76 --------
77
78 Some of the features of this driver include:
79
80 - Many different pipelines can be configured via media controller API,
81   that correspond to the hardware video capture pipelines supported in
82   the i.MX.
83
84 - Supports parallel, BT.565, and MIPI CSI-2 interfaces.
85
86 - Concurrent independent streams, by configuring pipelines to multiple
87   video capture interfaces using independent entities.
88
89 - Scaling, color-space conversion, horizontal and vertical flip, and
90   image rotation via IC task subdevs.
91
92 - Many pixel formats supported (RGB, packed and planar YUV, partial
93   planar YUV).
94
95 - The VDIC subdev supports motion compensated de-interlacing, with three
96   motion compensation modes: low, medium, and high motion. Pipelines are
97   defined that allow sending frames to the VDIC subdev directly from the
98   CSI. There is also support in the future for sending frames to the
99   VDIC from memory buffers via a output/mem2mem devices.
100
101 - Includes a Frame Interval Monitor (FIM) that can correct vertical sync
102   problems with the ADV718x video decoders.
103
104
105 Entities
106 --------
107
108 imx6-mipi-csi2
109 --------------
110
111 This is the MIPI CSI-2 receiver entity. It has one sink pad to receive
112 the MIPI CSI-2 stream (usually from a MIPI CSI-2 camera sensor). It has
113 four source pads, corresponding to the four MIPI CSI-2 demuxed virtual
114 channel outputs. Multiple source pads can be enabled to independently
115 stream from multiple virtual channels.
116
117 This entity actually consists of two sub-blocks. One is the MIPI CSI-2
118 core. This is a Synopsys Designware MIPI CSI-2 core. The other sub-block
119 is a "CSI-2 to IPU gasket". The gasket acts as a demultiplexer of the
120 four virtual channels streams, providing four separate parallel buses
121 containing each virtual channel that are routed to CSIs or video
122 multiplexers as described below.
123
124 On i.MX6 solo/dual-lite, all four virtual channel buses are routed to
125 two video multiplexers. Both CSI0 and CSI1 can receive any virtual
126 channel, as selected by the video multiplexers.
127
128 On i.MX6 Quad, virtual channel 0 is routed to IPU1-CSI0 (after selected
129 by a video mux), virtual channels 1 and 2 are hard-wired to IPU1-CSI1
130 and IPU2-CSI0, respectively, and virtual channel 3 is routed to
131 IPU2-CSI1 (again selected by a video mux).
132
133 ipuX_csiY_mux
134 -------------
135
136 These are the video multiplexers. They have two or more sink pads to
137 select from either camera sensors with a parallel interface, or from
138 MIPI CSI-2 virtual channels from imx6-mipi-csi2 entity. They have a
139 single source pad that routes to a CSI (ipuX_csiY entities).
140
141 On i.MX6 solo/dual-lite, there are two video mux entities. One sits
142 in front of IPU1-CSI0 to select between a parallel sensor and any of
143 the four MIPI CSI-2 virtual channels (a total of five sink pads). The
144 other mux sits in front of IPU1-CSI1, and again has five sink pads to
145 select between a parallel sensor and any of the four MIPI CSI-2 virtual
146 channels.
147
148 On i.MX6 Quad, there are two video mux entities. One sits in front of
149 IPU1-CSI0 to select between a parallel sensor and MIPI CSI-2 virtual
150 channel 0 (two sink pads). The other mux sits in front of IPU2-CSI1 to
151 select between a parallel sensor and MIPI CSI-2 virtual channel 3 (two
152 sink pads).
153
154 ipuX_csiY
155 ---------
156
157 These are the CSI entities. They have a single sink pad receiving from
158 either a video mux or from a MIPI CSI-2 virtual channel as described
159 above.
160
161 This entity has two source pads. The first source pad can link directly
162 to the ipuX_vdic entity or the ipuX_ic_prp entity, using hardware links
163 that require no IDMAC memory buffer transfer.
164
165 When the direct source pad is routed to the ipuX_ic_prp entity, frames
166 from the CSI can be processed by one or both of the IC pre-processing
167 tasks.
168
169 When the direct source pad is routed to the ipuX_vdic entity, the VDIC
170 will carry out motion-compensated de-interlace using "high motion" mode
171 (see description of ipuX_vdic entity).
172
173 The second source pad sends video frames directly to memory buffers
174 via the SMFC and an IDMAC channel, bypassing IC pre-processing. This
175 source pad is routed to a capture device node, with a node name of the
176 format "ipuX_csiY capture".
177
178 Note that since the IDMAC source pad makes use of an IDMAC channel, it
179 can do pixel reordering within the same colorspace. For example, the
180 sink pad can take UYVY2X8, but the IDMAC source pad can output YUYV2X8.
181 If the sink pad is receiving YUV, the output at the capture device can
182 also be converted to a planar YUV format such as YUV420.
183
184 It will also perform simple de-interlace without motion compensation,
185 which is activated if the sink pad's field type is an interlaced type,
186 and the IDMAC source pad field type is set to none.
187
188 This subdev can generate the following event when enabling the second
189 IDMAC source pad:
190
191 - V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR
192
193 The user application can subscribe to this event from the ipuX_csiY
194 subdev node. This event is generated by the Frame Interval Monitor
195 (see below for more on the FIM).
196
197 Cropping in ipuX_csiY
198 ---------------------
199
200 The CSI supports cropping the incoming raw sensor frames. This is
201 implemented in the ipuX_csiY entities at the sink pad, using the
202 crop selection subdev API.
203
204 The CSI also supports fixed divide-by-two downscaling indepently in
205 width and height. This is implemented in the ipuX_csiY entities at
206 the sink pad, using the compose selection subdev API.
207
208 The output rectangle at the ipuX_csiY source pad is the same as
209 the compose rectangle at the sink pad. So the source pad rectangle
210 cannot be negotiated, it must be set using the compose selection
211 API at sink pad (if /2 downscale is desired, otherwise source pad
212 rectangle is equal to incoming rectangle).
213
214 To give an example of crop and /2 downscale, this will crop a
215 1280x960 input frame to 640x480, and then /2 downscale in both
216 dimensions to 320x240 (assumes ipu1_csi0 is linked to ipu1_csi0_mux):
217
218 .. code-block:: none
219
220    media-ctl -V "'ipu1_csi0_mux':2[fmt:UYVY2X8/1280x960]"
221    media-ctl -V "'ipu1_csi0':0[crop:(0,0)/640x480]"
222    media-ctl -V "'ipu1_csi0':0[compose:(0,0)/320x240]"
223
224 Frame Skipping in ipuX_csiY
225 ---------------------------
226
227 The CSI supports frame rate decimation, via frame skipping. Frame
228 rate decimation is specified by setting the frame intervals at
229 sink and source pads. The ipuX_csiY entity then applies the best
230 frame skip setting to the CSI to achieve the desired frame rate
231 at the source pad.
232
233 The following example reduces an assumed incoming 60 Hz frame
234 rate by half at the IDMAC output source pad:
235
236 .. code-block:: none
237
238    media-ctl -V "'ipu1_csi0':0[fmt:UYVY2X8/640x480@1/60]"
239    media-ctl -V "'ipu1_csi0':2[fmt:UYVY2X8/640x480@1/30]"
240
241 Frame Interval Monitor in ipuX_csiY
242 -----------------------------------
243
244 The adv718x decoders can occasionally send corrupt fields during
245 NTSC/PAL signal re-sync (too little or too many video lines). When
246 this happens, the IPU triggers a mechanism to re-establish vertical
247 sync by adding 1 dummy line every frame, which causes a rolling effect
248 from image to image, and can last a long time before a stable image is
249 recovered. Or sometimes the mechanism doesn't work at all, causing a
250 permanent split image (one frame contains lines from two consecutive
251 captured images).
252
253 From experiment it was found that during image rolling, the frame
254 intervals (elapsed time between two EOF's) drop below the nominal
255 value for the current standard, by about one frame time (60 usec),
256 and remain at that value until rolling stops.
257
258 While the reason for this observation isn't known (the IPU dummy
259 line mechanism should show an increase in the intervals by 1 line
260 time every frame, not a fixed value), we can use it to detect the
261 corrupt fields using a frame interval monitor. If the FIM detects a
262 bad frame interval, the ipuX_csiY subdev will send the event
263 V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR. Userland can register with
264 the FIM event notification on the ipuX_csiY subdev device node.
265 Userland can issue a streaming restart when this event is received
266 to correct the rolling/split image.
267
268 The ipuX_csiY subdev includes custom controls to tweak some dials for
269 FIM. If one of these controls is changed during streaming, the FIM will
270 be reset and will continue at the new settings.
271
272 - V4L2_CID_IMX_FIM_ENABLE
273
274 Enable/disable the FIM.
275
276 - V4L2_CID_IMX_FIM_NUM
277
278 How many frame interval measurements to average before comparing against
279 the nominal frame interval reported by the sensor. This can reduce noise
280 caused by interrupt latency.
281
282 - V4L2_CID_IMX_FIM_TOLERANCE_MIN
283
284 If the averaged intervals fall outside nominal by this amount, in
285 microseconds, the V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR event is sent.
286
287 - V4L2_CID_IMX_FIM_TOLERANCE_MAX
288
289 If any intervals are higher than this value, those samples are
290 discarded and do not enter into the average. This can be used to
291 discard really high interval errors that might be due to interrupt
292 latency from high system load.
293
294 - V4L2_CID_IMX_FIM_NUM_SKIP
295
296 How many frames to skip after a FIM reset or stream restart before
297 FIM begins to average intervals.
298
299 - V4L2_CID_IMX_FIM_ICAP_CHANNEL
300 - V4L2_CID_IMX_FIM_ICAP_EDGE
301
302 These controls will configure an input capture channel as the method
303 for measuring frame intervals. This is superior to the default method
304 of measuring frame intervals via EOF interrupt, since it is not subject
305 to uncertainty errors introduced by interrupt latency.
306
307 Input capture requires hardware support. A VSYNC signal must be routed
308 to one of the i.MX6 input capture channel pads.
309
310 V4L2_CID_IMX_FIM_ICAP_CHANNEL configures which i.MX6 input capture
311 channel to use. This must be 0 or 1.
312
313 V4L2_CID_IMX_FIM_ICAP_EDGE configures which signal edge will trigger
314 input capture events. By default the input capture method is disabled
315 with a value of IRQ_TYPE_NONE. Set this control to IRQ_TYPE_EDGE_RISING,
316 IRQ_TYPE_EDGE_FALLING, or IRQ_TYPE_EDGE_BOTH to enable input capture,
317 triggered on the given signal edge(s).
318
319 When input capture is disabled, frame intervals will be measured via
320 EOF interrupt.
321
322
323 ipuX_vdic
324 ---------
325
326 The VDIC carries out motion compensated de-interlacing, with three
327 motion compensation modes: low, medium, and high motion. The mode is
328 specified with the menu control V4L2_CID_DEINTERLACING_MODE. It has
329 two sink pads and a single source pad.
330
331 The direct sink pad receives from an ipuX_csiY direct pad. With this
332 link the VDIC can only operate in high motion mode.
333
334 When the IDMAC sink pad is activated, it receives from an output
335 or mem2mem device node. With this pipeline, it can also operate
336 in low and medium modes, because these modes require receiving
337 frames from memory buffers. Note that an output or mem2mem device
338 is not implemented yet, so this sink pad currently has no links.
339
340 The source pad routes to the IC pre-processing entity ipuX_ic_prp.
341
342 ipuX_ic_prp
343 -----------
344
345 This is the IC pre-processing entity. It acts as a router, routing
346 data from its sink pad to one or both of its source pads.
347
348 It has a single sink pad. The sink pad can receive from the ipuX_csiY
349 direct pad, or from ipuX_vdic.
350
351 This entity has two source pads. One source pad routes to the
352 pre-process encode task entity (ipuX_ic_prpenc), the other to the
353 pre-process viewfinder task entity (ipuX_ic_prpvf). Both source pads
354 can be activated at the same time if the sink pad is receiving from
355 ipuX_csiY. Only the source pad to the pre-process viewfinder task entity
356 can be activated if the sink pad is receiving from ipuX_vdic (frames
357 from the VDIC can only be processed by the pre-process viewfinder task).
358
359 ipuX_ic_prpenc
360 --------------
361
362 This is the IC pre-processing encode entity. It has a single sink
363 pad from ipuX_ic_prp, and a single source pad. The source pad is
364 routed to a capture device node, with a node name of the format
365 "ipuX_ic_prpenc capture".
366
367 This entity performs the IC pre-process encode task operations:
368 color-space conversion, resizing (downscaling and upscaling),
369 horizontal and vertical flip, and 90/270 degree rotation. Flip
370 and rotation are provided via standard V4L2 controls.
371
372 Like the ipuX_csiY IDMAC source, it can also perform simple de-interlace
373 without motion compensation, and pixel reordering.
374
375 ipuX_ic_prpvf
376 -------------
377
378 This is the IC pre-processing viewfinder entity. It has a single sink
379 pad from ipuX_ic_prp, and a single source pad. The source pad is routed
380 to a capture device node, with a node name of the format
381 "ipuX_ic_prpvf capture".
382
383 It is identical in operation to ipuX_ic_prpenc, with the same resizing
384 and CSC operations and flip/rotation controls. It will receive and
385 process de-interlaced frames from the ipuX_vdic if ipuX_ic_prp is
386 receiving from ipuX_vdic.
387
388 Like the ipuX_csiY IDMAC source, it can perform simple de-interlace
389 without motion compensation. However, note that if the ipuX_vdic is
390 included in the pipeline (ipuX_ic_prp is receiving from ipuX_vdic),
391 it's not possible to use simple de-interlace in ipuX_ic_prpvf, since
392 the ipuX_vdic has already carried out de-interlacing (with motion
393 compensation) and therefore the field type output from ipuX_ic_prp can
394 only be none.
395
396 Capture Pipelines
397 -----------------
398
399 The following describe the various use-cases supported by the pipelines.
400
401 The links shown do not include the backend sensor, video mux, or mipi
402 csi-2 receiver links. This depends on the type of sensor interface
403 (parallel or mipi csi-2). So these pipelines begin with:
404
405 sensor -> ipuX_csiY_mux -> ...
406
407 for parallel sensors, or:
408
409 sensor -> imx6-mipi-csi2 -> (ipuX_csiY_mux) -> ...
410
411 for mipi csi-2 sensors. The imx6-mipi-csi2 receiver may need to route
412 to the video mux (ipuX_csiY_mux) before sending to the CSI, depending
413 on the mipi csi-2 virtual channel, hence ipuX_csiY_mux is shown in
414 parenthesis.
415
416 Unprocessed Video Capture:
417 --------------------------
418
419 Send frames directly from sensor to camera device interface node, with
420 no conversions, via ipuX_csiY IDMAC source pad:
421
422 -> ipuX_csiY:2 -> ipuX_csiY capture
423
424 IC Direct Conversions:
425 ----------------------
426
427 This pipeline uses the preprocess encode entity to route frames directly
428 from the CSI to the IC, to carry out scaling up to 1024x1024 resolution,
429 CSC, flipping, and image rotation:
430
431 -> ipuX_csiY:1 -> 0:ipuX_ic_prp:1 -> 0:ipuX_ic_prpenc:1 -> ipuX_ic_prpenc capture
432
433 Motion Compensated De-interlace:
434 --------------------------------
435
436 This pipeline routes frames from the CSI direct pad to the VDIC entity to
437 support motion-compensated de-interlacing (high motion mode only),
438 scaling up to 1024x1024, CSC, flip, and rotation:
439
440 -> ipuX_csiY:1 -> 0:ipuX_vdic:2 -> 0:ipuX_ic_prp:2 -> 0:ipuX_ic_prpvf:1 -> ipuX_ic_prpvf capture
441
442
443 Usage Notes
444 -----------
445
446 To aid in configuration and for backward compatibility with V4L2
447 applications that access controls only from video device nodes, the
448 capture device interfaces inherit controls from the active entities
449 in the current pipeline, so controls can be accessed either directly
450 from the subdev or from the active capture device interface. For
451 example, the FIM controls are available either from the ipuX_csiY
452 subdevs or from the active capture device.
453
454 The following are specific usage notes for the Sabre* reference
455 boards:
456
457
458 SabreLite with OV5642 and OV5640
459 --------------------------------
460
461 This platform requires the OmniVision OV5642 module with a parallel
462 camera interface, and the OV5640 module with a MIPI CSI-2
463 interface. Both modules are available from Boundary Devices:
464
465 - https://boundarydevices.com/product/nit6x_5mp
466 - https://boundarydevices.com/product/nit6x_5mp_mipi
467
468 Note that if only one camera module is available, the other sensor
469 node can be disabled in the device tree.
470
471 The OV5642 module is connected to the parallel bus input on the i.MX
472 internal video mux to IPU1 CSI0. It's i2c bus connects to i2c bus 2.
473
474 The MIPI CSI-2 OV5640 module is connected to the i.MX internal MIPI CSI-2
475 receiver, and the four virtual channel outputs from the receiver are
476 routed as follows: vc0 to the IPU1 CSI0 mux, vc1 directly to IPU1 CSI1,
477 vc2 directly to IPU2 CSI0, and vc3 to the IPU2 CSI1 mux. The OV5640 is
478 also connected to i2c bus 2 on the SabreLite, therefore the OV5642 and
479 OV5640 must not share the same i2c slave address.
480
481 The following basic example configures unprocessed video capture
482 pipelines for both sensors. The OV5642 is routed to ipu1_csi0, and
483 the OV5640, transmitting on MIPI CSI-2 virtual channel 1 (which is
484 imx6-mipi-csi2 pad 2), is routed to ipu1_csi1. Both sensors are
485 configured to output 640x480, and the OV5642 outputs YUYV2X8, the
486 OV5640 UYVY2X8:
487
488 .. code-block:: none
489
490    # Setup links for OV5642
491    media-ctl -l "'ov5642 1-0042':0 -> 'ipu1_csi0_mux':1[1]"
492    media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
493    media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
494    # Setup links for OV5640
495    media-ctl -l "'ov5640 1-0040':0 -> 'imx6-mipi-csi2':0[1]"
496    media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]"
497    media-ctl -l "'ipu1_csi1':2 -> 'ipu1_csi1 capture':0[1]"
498    # Configure pads for OV5642 pipeline
499    media-ctl -V "'ov5642 1-0042':0 [fmt:YUYV2X8/640x480 field:none]"
500    media-ctl -V "'ipu1_csi0_mux':2 [fmt:YUYV2X8/640x480 field:none]"
501    media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/640x480 field:none]"
502    # Configure pads for OV5640 pipeline
503    media-ctl -V "'ov5640 1-0040':0 [fmt:UYVY2X8/640x480 field:none]"
504    media-ctl -V "'imx6-mipi-csi2':2 [fmt:UYVY2X8/640x480 field:none]"
505    media-ctl -V "'ipu1_csi1':2 [fmt:AYUV32/640x480 field:none]"
506
507 Streaming can then begin independently on the capture device nodes
508 "ipu1_csi0 capture" and "ipu1_csi1 capture". The v4l2-ctl tool can
509 be used to select any supported YUV pixelformat on the capture device
510 nodes, including planar.
511
512 SabreAuto with ADV7180 decoder
513 ------------------------------
514
515 On the SabreAuto, an on-board ADV7180 SD decoder is connected to the
516 parallel bus input on the internal video mux to IPU1 CSI0.
517
518 The following example configures a pipeline to capture from the ADV7180
519 video decoder, assuming NTSC 720x480 input signals, with Motion
520 Compensated de-interlacing. Pad field types assume the adv7180 outputs
521 "interlaced". $outputfmt can be any format supported by the ipu1_ic_prpvf
522 entity at its output pad:
523
524 .. code-block:: none
525
526    # Setup links
527    media-ctl -l "'adv7180 3-0021':0 -> 'ipu1_csi0_mux':1[1]"
528    media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
529    media-ctl -l "'ipu1_csi0':1 -> 'ipu1_vdic':0[1]"
530    media-ctl -l "'ipu1_vdic':2 -> 'ipu1_ic_prp':0[1]"
531    media-ctl -l "'ipu1_ic_prp':2 -> 'ipu1_ic_prpvf':0[1]"
532    media-ctl -l "'ipu1_ic_prpvf':1 -> 'ipu1_ic_prpvf capture':0[1]"
533    # Configure pads
534    media-ctl -V "'adv7180 3-0021':0 [fmt:UYVY2X8/720x480]"
535    media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x480 field:interlaced]"
536    media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/720x480 field:interlaced]"
537    media-ctl -V "'ipu1_vdic':2 [fmt:AYUV32/720x480 field:none]"
538    media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x480 field:none]"
539    media-ctl -V "'ipu1_ic_prpvf':1 [fmt:$outputfmt field:none]"
540
541 Streaming can then begin on the capture device node at
542 "ipu1_ic_prpvf capture". The v4l2-ctl tool can be used to select any
543 supported YUV or RGB pixelformat on the capture device node.
544
545 This platform accepts Composite Video analog inputs to the ADV7180 on
546 Ain1 (connector J42).
547
548 SabreSD with MIPI CSI-2 OV5640
549 ------------------------------
550
551 Similarly to SabreLite, the SabreSD supports a parallel interface
552 OV5642 module on IPU1 CSI0, and a MIPI CSI-2 OV5640 module. The OV5642
553 connects to i2c bus 1 and the OV5640 to i2c bus 2.
554
555 The device tree for SabreSD includes OF graphs for both the parallel
556 OV5642 and the MIPI CSI-2 OV5640, but as of this writing only the MIPI
557 CSI-2 OV5640 has been tested, so the OV5642 node is currently disabled.
558 The OV5640 module connects to MIPI connector J5 (sorry I don't have the
559 compatible module part number or URL).
560
561 The following example configures a direct conversion pipeline to capture
562 from the OV5640, transmitting on MIPI CSI-2 virtual channel 1. $sensorfmt
563 can be any format supported by the OV5640. $sensordim is the frame
564 dimension part of $sensorfmt (minus the mbus pixel code). $outputfmt can
565 be any format supported by the ipu1_ic_prpenc entity at its output pad:
566
567 .. code-block:: none
568
569    # Setup links
570    media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
571    media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]"
572    media-ctl -l "'ipu1_csi1':1 -> 'ipu1_ic_prp':0[1]"
573    media-ctl -l "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]"
574    media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]"
575    # Configure pads
576    media-ctl -V "'ov5640 1-003c':0 [fmt:$sensorfmt field:none]"
577    media-ctl -V "'imx6-mipi-csi2':2 [fmt:$sensorfmt field:none]"
578    media-ctl -V "'ipu1_csi1':1 [fmt:AYUV32/$sensordim field:none]"
579    media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/$sensordim field:none]"
580    media-ctl -V "'ipu1_ic_prpenc':1 [fmt:$outputfmt field:none]"
581
582 Streaming can then begin on "ipu1_ic_prpenc capture" node. The v4l2-ctl
583 tool can be used to select any supported YUV or RGB pixelformat on the
584 capture device node.
585
586
587 Known Issues
588 ------------
589
590 1. When using 90 or 270 degree rotation control at capture resolutions
591    near the IC resizer limit of 1024x1024, and combined with planar
592    pixel formats (YUV420, YUV422p), frame capture will often fail with
593    no end-of-frame interrupts from the IDMAC channel. To work around
594    this, use lower resolution and/or packed formats (YUYV, RGB3, etc.)
595    when 90 or 270 rotations are needed.
596
597
598 File list
599 ---------
600
601 drivers/staging/media/imx/
602 include/media/imx.h
603 include/linux/imx-media.h
604
605 References
606 ----------
607
608 .. [#f1] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6DQRM.pdf
609 .. [#f2] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6SDLRM.pdf
610
611
612 Authors
613 -------
614
615 - Steve Longerbeam <steve_longerbeam@mentor.com>
616 - Philipp Zabel <kernel@pengutronix.de>
617 - Russell King <linux@armlinux.org.uk>
618
619 Copyright (C) 2012-2017 Mentor Graphics Inc.