Lines Matching +full:capture +full:- +full:channels
1 .. SPDX-License-Identifier: GPL-2.0
3 i.MX Video Capture Driver
7 ------------
10 handles the flow of image frames to and from capture devices and
13 For image capture, the IPU contains the following internal subunits:
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)
23 memory. Various dedicated DMA channels exist for both video capture and
26 re-ordering (for example UYVY to YUYV) within the same colorspace, and
27 packed <--> planar conversion. The IDMAC can also perform a simple
28 de-interlacing by interweaving even and odd lines during transfer
31 The CSI is the backend capture unit that interfaces directly with
32 camera sensors over Parallel, BT.656/1120, and MIPI CSI-2 buses.
34 The IC handles color-space conversion, resizing (downscaling and
38 conversions concurrently: pre-process encoding, pre-process viewfinder,
39 and post-processing. Within each task, conversions are split into three
43 The IPU time-shares the IC task operations. The time-slice granularity
49 IDMAC channels.
59 IC pre-process viewfinder task for further conversions. The VDIC also
64 outside the IPU that are also involved in video capture on i.MX:
66 - MIPI CSI-2 Receiver for camera sensors with the MIPI CSI-2 bus
68 - Two video multiplexers for selecting among multiple sensor inputs
76 --------
80 - Many different pipelines can be configured via media controller API,
81 that correspond to the hardware video capture pipelines supported in
84 - Supports parallel, BT.565, and MIPI CSI-2 interfaces.
86 - Concurrent independent streams, by configuring pipelines to multiple
87 video capture interfaces using independent entities.
89 - Scaling, color-space conversion, horizontal and vertical flip, and
92 - Many pixel formats supported (RGB, packed and planar YUV, partial
95 - The VDIC subdev supports motion compensated de-interlacing, with three
101 - Includes a Frame Interval Monitor (FIM) that can correct vertical sync
106 --------
115 MIPI CSI-2 OV5640 sensor, requires the i.MX6 MIPI CSI-2 receiver. But
117 therefore does not require the MIPI CSI-2 receiver, so it is missing in
122 .. kernel-figure:: imx6q-sabresd.dot
128 .. kernel-figure:: imx6q-sabreauto.dot
135 --------
137 imx6-mipi-csi2
138 --------------
140 This is the MIPI CSI-2 receiver entity. It has one sink pad to receive
141 the MIPI CSI-2 stream (usually from a MIPI CSI-2 camera sensor). It has
142 four source pads, corresponding to the four MIPI CSI-2 demuxed virtual
144 stream from multiple virtual channels.
146 This entity actually consists of two sub-blocks. One is the MIPI CSI-2
147 core. This is a Synopsys Designware MIPI CSI-2 core. The other sub-block
148 is a "CSI-2 to IPU gasket". The gasket acts as a demultiplexer of the
149 four virtual channels streams, providing four separate parallel buses
153 On i.MX6 solo/dual-lite, all four virtual channel buses are routed to
157 On i.MX6 Quad, virtual channel 0 is routed to IPU1-CSI0 (after selected
158 by a video mux), virtual channels 1 and 2 are hard-wired to IPU1-CSI1
159 and IPU2-CSI0, respectively, and virtual channel 3 is routed to
160 IPU2-CSI1 (again selected by a video mux).
163 -------------
167 MIPI CSI-2 virtual channels from imx6-mipi-csi2 entity. They have a
170 On i.MX6 solo/dual-lite, there are two video mux entities. One sits
171 in front of IPU1-CSI0 to select between a parallel sensor and any of
172 the four MIPI CSI-2 virtual channels (a total of five sink pads). The
173 other mux sits in front of IPU1-CSI1, and again has five sink pads to
174 select between a parallel sensor and any of the four MIPI CSI-2 virtual
175 channels.
178 IPU1-CSI0 to select between a parallel sensor and MIPI CSI-2 virtual
179 channel 0 (two sink pads). The other mux sits in front of IPU2-CSI1 to
180 select between a parallel sensor and MIPI CSI-2 virtual channel 3 (two
184 ---------
187 either a video mux or from a MIPI CSI-2 virtual channel as described
195 from the CSI can be processed by one or both of the IC pre-processing
199 will carry out motion-compensated de-interlace using "high motion" mode
203 via the SMFC and an IDMAC channel, bypassing IC pre-processing. This
204 source pad is routed to a capture device node, with a node name of the
205 format "ipuX_csiY capture".
210 order, the capture device linked to the IDMAC source pad can capture
212 format, the capture device can capture a planar YUV format such as
217 pad's field type is sequential top-bottom or bottom-top, and the
218 requested capture interface field type is set to interlaced (t-b, b-t,
219 or unqualified interlaced). The capture interface will enforce the same
220 field order as the source pad field order (interlaced-bt if source pad
221 is seq-bt, interlaced-tb if source pad is seq-tb).
226 ---------------------
232 The CSI also supports fixed divide-by-two downscaling independently in
246 .. code-block:: none
248 media-ctl -V "'ipu1_csi0_mux':2[fmt:UYVY2X8/1280x960]"
249 media-ctl -V "'ipu1_csi0':0[crop:(0,0)/640x480]"
250 media-ctl -V "'ipu1_csi0':0[compose:(0,0)/320x240]"
253 ---------------------------
264 .. code-block:: none
266 media-ctl -V "'ipu1_csi0':0[fmt:UYVY2X8/640x480@1/60]"
267 media-ctl -V "'ipu1_csi0':2[fmt:UYVY2X8/640x480@1/30]"
270 -----------------------------------
275 ---------
277 The VDIC carries out motion compensated de-interlacing, with three
291 The source pad routes to the IC pre-processing entity ipuX_ic_prp.
294 -----------
296 This is the IC pre-processing entity. It acts as a router, routing
303 pre-process encode task entity (ipuX_ic_prpenc), the other to the
304 pre-process viewfinder task entity (ipuX_ic_prpvf). Both source pads
306 ipuX_csiY. Only the source pad to the pre-process viewfinder task entity
308 from the VDIC can only be processed by the pre-process viewfinder task).
311 --------------
313 This is the IC pre-processing encode entity. It has a single sink
315 routed to a capture device node, with a node name of the format
316 "ipuX_ic_prpenc capture".
318 This entity performs the IC pre-process encode task operations:
319 color-space conversion, resizing (downscaling and upscaling),
324 de-interlace without motion compensation, and pixel reordering.
327 -------------
329 This is the IC pre-processing viewfinder entity. It has a single sink
331 to a capture device node, with a node name of the format
332 "ipuX_ic_prpvf capture".
336 and process de-interlaced frames from the ipuX_vdic if ipuX_ic_prp is
343 since the ipuX_vdic has already carried out de-interlacing (with
347 Capture Pipelines
348 -----------------
350 The following describe the various use-cases supported by the pipelines.
353 csi-2 receiver links. This depends on the type of sensor interface
354 (parallel or mipi csi-2). So these pipelines begin with:
356 sensor -> ipuX_csiY_mux -> ...
360 sensor -> imx6-mipi-csi2 -> (ipuX_csiY_mux) -> ...
362 for mipi csi-2 sensors. The imx6-mipi-csi2 receiver may need to route
364 on the mipi csi-2 virtual channel, hence ipuX_csiY_mux is shown in
367 Unprocessed Video Capture:
368 --------------------------
373 -> ipuX_csiY:2 -> ipuX_csiY capture
376 ----------------------
382 -> ipuX_csiY:1 -> 0:ipuX_ic_prp:1 -> 0:ipuX_ic_prpenc:1 -> ipuX_ic_prpenc capture
384 Motion Compensated De-interlace:
385 --------------------------------
388 support motion-compensated de-interlacing (high motion mode only),
391 -> ipuX_csiY:1 -> 0:ipuX_vdic:2 -> 0:ipuX_ic_prp:2 -> 0:ipuX_ic_prpvf:1 -> ipuX_ic_prpvf capture
395 -----------
399 capture device interfaces inherit controls from the active entities
401 from the subdev or from the active capture device interface. For
403 subdevs or from the active capture device.
410 ---------------------------------------
413 camera interface, and the OV5640 module with a MIPI CSI-2
416 - https://boundarydevices.com/product/nit6x_5mp
417 - https://boundarydevices.com/product/nit6x_5mp_mipi
425 The MIPI CSI-2 OV5640 module is connected to the i.MX internal MIPI CSI-2
432 The following basic example configures unprocessed video capture
434 the OV5640, transmitting on MIPI CSI-2 virtual channel 1 (which is
435 imx6-mipi-csi2 pad 2), is routed to ipu1_csi1. Both sensors are
439 .. code-block:: none
442 media-ctl -l "'ov5642 1-0042':0 -> 'ipu1_csi0_mux':1[1]"
443 media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
444 media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
446 media-ctl -l "'ov5640 1-0040':0 -> 'imx6-mipi-csi2':0[1]"
447 media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]"
448 media-ctl -l "'ipu1_csi1':2 -> 'ipu1_csi1 capture':0[1]"
450 media-ctl -V "'ov5642 1-0042':0 [fmt:YUYV2X8/640x480 field:none]"
451 media-ctl -V "'ipu1_csi0_mux':2 [fmt:YUYV2X8/640x480 field:none]"
452 media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/640x480 field:none]"
454 media-ctl -V "'ov5640 1-0040':0 [fmt:UYVY2X8/640x480 field:none]"
455 media-ctl -V "'imx6-mipi-csi2':2 [fmt:UYVY2X8/640x480 field:none]"
456 media-ctl -V "'ipu1_csi1':2 [fmt:AYUV32/640x480 field:none]"
458 Streaming can then begin independently on the capture device nodes
459 "ipu1_csi0 capture" and "ipu1_csi1 capture". The v4l2-ctl tool can
460 be used to select any supported YUV pixelformat on the capture device
464 -------------------------------------
466 On the i.MX6Q SabreAuto, an on-board ADV7180 SD decoder is connected to the
469 The following example configures a pipeline to capture from the ADV7180
472 must output sequential or alternating fields (field type 'seq-bt' for
475 .. code-block:: none
478 media-ctl -l "'adv7180 3-0021':0 -> 'ipu1_csi0_mux':1[1]"
479 media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
480 media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
482 media-ctl -V "'adv7180 3-0021':0 [fmt:UYVY2X8/720x480 field:seq-bt]"
483 media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x480]"
484 media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]"
485 # Configure "ipu1_csi0 capture" interface (assumed at /dev/video4)
486 v4l2-ctl -d4 --set-fmt-video=field=interlaced_bt
488 Streaming can then begin on /dev/video4. The v4l2-ctl tool can also be
491 This example configures a pipeline to capture from the ADV7180
493 Compensated de-interlacing. The adv7180 must output sequential or
494 alternating fields (field type 'seq-tb' for PAL, or 'alternate').
496 .. code-block:: none
499 media-ctl -l "'adv7180 3-0021':0 -> 'ipu1_csi0_mux':1[1]"
500 media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
501 media-ctl -l "'ipu1_csi0':1 -> 'ipu1_vdic':0[1]"
502 media-ctl -l "'ipu1_vdic':2 -> 'ipu1_ic_prp':0[1]"
503 media-ctl -l "'ipu1_ic_prp':2 -> 'ipu1_ic_prpvf':0[1]"
504 media-ctl -l "'ipu1_ic_prpvf':1 -> 'ipu1_ic_prpvf capture':0[1]"
506 media-ctl -V "'adv7180 3-0021':0 [fmt:UYVY2X8/720x576 field:seq-tb]"
507 media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x576]"
508 media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/720x576]"
509 media-ctl -V "'ipu1_vdic':2 [fmt:AYUV32/720x576 field:none]"
510 media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]"
511 media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]"
512 # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2)
513 v4l2-ctl -d2 --set-fmt-video=field=none
515 Streaming can then begin on /dev/video2. The v4l2-ctl tool can also be
522 --------------------------------------
524 On the i.MX6DL SabreAuto, an on-board ADV7180 SD decoder is connected to the
527 The following example configures a pipeline to capture from the ADV7180
530 must output sequential or alternating fields (field type 'seq-bt' for
533 .. code-block:: none
536 media-ctl -l "'adv7180 4-0021':0 -> 'ipu1_csi0_mux':4[1]"
537 media-ctl -l "'ipu1_csi0_mux':5 -> 'ipu1_csi0':0[1]"
538 media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
540 media-ctl -V "'adv7180 4-0021':0 [fmt:UYVY2X8/720x480 field:seq-bt]"
541 media-ctl -V "'ipu1_csi0_mux':5 [fmt:UYVY2X8/720x480]"
542 media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]"
543 # Configure "ipu1_csi0 capture" interface (assumed at /dev/video0)
544 v4l2-ctl -d0 --set-fmt-video=field=interlaced_bt
546 Streaming can then begin on /dev/video0. The v4l2-ctl tool can also be
549 This example configures a pipeline to capture from the ADV7180
551 Compensated de-interlacing. The adv7180 must output sequential or
552 alternating fields (field type 'seq-tb' for PAL, or 'alternate').
554 .. code-block:: none
557 media-ctl -l "'adv7180 4-0021':0 -> 'ipu1_csi0_mux':4[1]"
558 media-ctl -l "'ipu1_csi0_mux':5 -> 'ipu1_csi0':0[1]"
559 media-ctl -l "'ipu1_csi0':1 -> 'ipu1_vdic':0[1]"
560 media-ctl -l "'ipu1_vdic':2 -> 'ipu1_ic_prp':0[1]"
561 media-ctl -l "'ipu1_ic_prp':2 -> 'ipu1_ic_prpvf':0[1]"
562 media-ctl -l "'ipu1_ic_prpvf':1 -> 'ipu1_ic_prpvf capture':0[1]"
564 media-ctl -V "'adv7180 4-0021':0 [fmt:UYVY2X8/720x576 field:seq-tb]"
565 media-ctl -V "'ipu1_csi0_mux':5 [fmt:UYVY2X8/720x576]"
566 media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/720x576]"
567 media-ctl -V "'ipu1_vdic':2 [fmt:AYUV32/720x576 field:none]"
568 media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]"
569 media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]"
570 # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2)
571 v4l2-ctl -d2 --set-fmt-video=field=none
573 Streaming can then begin on /dev/video2. The v4l2-ctl tool can also be
579 i.MX6Q SabreSD with MIPI CSI-2 OV5640
580 -------------------------------------
583 interface OV5642 module on IPU1 CSI0, and a MIPI CSI-2 OV5640
587 OV5642 and the MIPI CSI-2 OV5640, but as of this writing only the MIPI
588 CSI-2 OV5640 has been tested, so the OV5642 node is currently disabled.
592 The following example configures unprocessed video capture pipeline to
593 capture from the OV5640, transmitting on MIPI CSI-2 virtual channel 0:
595 .. code-block:: none
598 media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
599 media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]"
600 media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
601 media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
603 media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]"
604 media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]"
605 media-ctl -V "'ipu1_csi0_mux':0 [fmt:UYVY2X8/640x480]"
606 media-ctl -V "'ipu1_csi0':0 [fmt:AYUV32/640x480]"
608 Streaming can then begin on "ipu1_csi0 capture" node. The v4l2-ctl
609 tool can be used to select any supported pixelformat on the capture
613 "ipu1_csi0 capture":
615 .. code-block:: none
617 media-ctl -e "ipu1_csi0 capture"
622 Starting the streaming via v4l2-ctl:
624 .. code-block:: none
626 v4l2-ctl --stream-mmap -d /dev/video0
630 .. code-block:: none
632 gst-launch-1.0 v4l2src device=/dev/video0 ! kmssink
634 The following example configures a direct conversion pipeline to capture
635 from the OV5640, transmitting on MIPI CSI-2 virtual channel 0. It also
638 .. code-block:: none
641 media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
642 media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]"
643 media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
644 media-ctl -l "'ipu1_csi0':1 -> 'ipu1_ic_prp':0[1]"
645 media-ctl -l "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]"
646 media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]"
648 media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]"
649 media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]"
650 media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/640x480]"
651 media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/640x480]"
652 media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/640x480]"
653 media-ctl -V "'ipu1_ic_prpenc':1 [fmt:ARGB8888_1X32/800x600]"
654 # Set a format at the capture interface
655 v4l2-ctl -d /dev/video1 --set-fmt-video=pixelformat=RGB3
657 Streaming can then begin on "ipu1_ic_prpenc capture" node.
660 "ipu1_ic_prpenc capture":
662 .. code-block:: none
664 media-ctl -e "ipu1_ic_prpenc capture"
670 Starting the streaming via v4l2-ctl:
672 .. code-block:: none
674 v4l2-ctl --stream-mmap -d /dev/video1
678 .. code-block:: none
680 gst-launch-1.0 v4l2src device=/dev/video1 ! kmssink
683 ------------
685 1. When using 90 or 270 degree rotation control at capture resolutions
687 pixel formats (YUV420, YUV422p), frame capture will often fail with
688 no end-of-frame interrupts from the IDMAC channel. To work around
694 ---------
698 include/linux/imx-media.h
701 ----------
703 .. [#f1] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6DQRM.pdf
704 .. [#f2] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6SDLRM.pdf
708 -------
710 - Steve Longerbeam <steve_longerbeam@mentor.com>
711 - Philipp Zabel <kernel@pengutronix.de>
712 - Russell King <linux@armlinux.org.uk>
714 Copyright (C) 2012-2017 Mentor Graphics Inc.