162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_cii.MX Video Capture Driver
462306a36Sopenharmony_ci=========================
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciIntroduction
762306a36Sopenharmony_ci------------
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciThe Freescale i.MX5/6 contains an Image Processing Unit (IPU), which
1062306a36Sopenharmony_cihandles the flow of image frames to and from capture devices and
1162306a36Sopenharmony_cidisplay devices.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciFor image capture, the IPU contains the following internal subunits:
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci- Image DMA Controller (IDMAC)
1662306a36Sopenharmony_ci- Camera Serial Interface (CSI)
1762306a36Sopenharmony_ci- Image Converter (IC)
1862306a36Sopenharmony_ci- Sensor Multi-FIFO Controller (SMFC)
1962306a36Sopenharmony_ci- Image Rotator (IRT)
2062306a36Sopenharmony_ci- Video De-Interlacing or Combining Block (VDIC)
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciThe IDMAC is the DMA controller for transfer of image frames to and from
2362306a36Sopenharmony_cimemory. Various dedicated DMA channels exist for both video capture and
2462306a36Sopenharmony_cidisplay paths. During transfer, the IDMAC is also capable of vertical
2562306a36Sopenharmony_ciimage flip, 8x8 block transfer (see IRT description), pixel component
2662306a36Sopenharmony_cire-ordering (for example UYVY to YUYV) within the same colorspace, and
2762306a36Sopenharmony_cipacked <--> planar conversion. The IDMAC can also perform a simple
2862306a36Sopenharmony_cide-interlacing by interweaving even and odd lines during transfer
2962306a36Sopenharmony_ci(without motion compensation which requires the VDIC).
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciThe CSI is the backend capture unit that interfaces directly with
3262306a36Sopenharmony_cicamera sensors over Parallel, BT.656/1120, and MIPI CSI-2 buses.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciThe IC handles color-space conversion, resizing (downscaling and
3562306a36Sopenharmony_ciupscaling), horizontal flip, and 90/270 degree rotation operations.
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciThere are three independent "tasks" within the IC that can carry out
3862306a36Sopenharmony_ciconversions concurrently: pre-process encoding, pre-process viewfinder,
3962306a36Sopenharmony_ciand post-processing. Within each task, conversions are split into three
4062306a36Sopenharmony_cisections: downsizing section, main section (upsizing, flip, colorspace
4162306a36Sopenharmony_ciconversion, and graphics plane combining), and rotation section.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciThe IPU time-shares the IC task operations. The time-slice granularity
4462306a36Sopenharmony_ciis one burst of eight pixels in the downsizing section, one image line
4562306a36Sopenharmony_ciin the main processing section, one image frame in the rotation section.
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciThe SMFC is composed of four independent FIFOs that each can transfer
4862306a36Sopenharmony_cicaptured frames from sensors directly to memory concurrently via four
4962306a36Sopenharmony_ciIDMAC channels.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciThe IRT carries out 90 and 270 degree image rotation operations. The
5262306a36Sopenharmony_cirotation operation is carried out on 8x8 pixel blocks at a time. This
5362306a36Sopenharmony_cioperation is supported by the IDMAC which handles the 8x8 block transfer
5462306a36Sopenharmony_cialong with block reordering, in coordination with vertical flip.
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ciThe VDIC handles the conversion of interlaced video to progressive, with
5762306a36Sopenharmony_cisupport for different motion compensation modes (low, medium, and high
5862306a36Sopenharmony_cimotion). The deinterlaced output frames from the VDIC can be sent to the
5962306a36Sopenharmony_ciIC pre-process viewfinder task for further conversions. The VDIC also
6062306a36Sopenharmony_cicontains a Combiner that combines two image planes, with alpha blending
6162306a36Sopenharmony_ciand color keying.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciIn addition to the IPU internal subunits, there are also two units
6462306a36Sopenharmony_cioutside the IPU that are also involved in video capture on i.MX:
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci- MIPI CSI-2 Receiver for camera sensors with the MIPI CSI-2 bus
6762306a36Sopenharmony_ci  interface. This is a Synopsys DesignWare core.
6862306a36Sopenharmony_ci- Two video multiplexers for selecting among multiple sensor inputs
6962306a36Sopenharmony_ci  to send to a CSI.
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ciFor more info, refer to the latest versions of the i.MX5/6 reference
7262306a36Sopenharmony_cimanuals [#f1]_ and [#f2]_.
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciFeatures
7662306a36Sopenharmony_ci--------
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciSome of the features of this driver include:
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci- Many different pipelines can be configured via media controller API,
8162306a36Sopenharmony_ci  that correspond to the hardware video capture pipelines supported in
8262306a36Sopenharmony_ci  the i.MX.
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci- Supports parallel, BT.565, and MIPI CSI-2 interfaces.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci- Concurrent independent streams, by configuring pipelines to multiple
8762306a36Sopenharmony_ci  video capture interfaces using independent entities.
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci- Scaling, color-space conversion, horizontal and vertical flip, and
9062306a36Sopenharmony_ci  image rotation via IC task subdevs.
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci- Many pixel formats supported (RGB, packed and planar YUV, partial
9362306a36Sopenharmony_ci  planar YUV).
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci- The VDIC subdev supports motion compensated de-interlacing, with three
9662306a36Sopenharmony_ci  motion compensation modes: low, medium, and high motion. Pipelines are
9762306a36Sopenharmony_ci  defined that allow sending frames to the VDIC subdev directly from the
9862306a36Sopenharmony_ci  CSI. There is also support in the future for sending frames to the
9962306a36Sopenharmony_ci  VDIC from memory buffers via a output/mem2mem devices.
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci- Includes a Frame Interval Monitor (FIM) that can correct vertical sync
10262306a36Sopenharmony_ci  problems with the ADV718x video decoders.
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ciTopology
10662306a36Sopenharmony_ci--------
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ciThe following shows the media topologies for the i.MX6Q SabreSD and
10962306a36Sopenharmony_cii.MX6Q SabreAuto. Refer to these diagrams in the entity descriptions
11062306a36Sopenharmony_ciin the next section.
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciThe i.MX5/6 topologies can differ upstream from the IPUv3 CSI video
11362306a36Sopenharmony_cimultiplexers, but the internal IPUv3 topology downstream from there
11462306a36Sopenharmony_ciis common to all i.MX5/6 platforms. For example, the SabreSD, with the
11562306a36Sopenharmony_ciMIPI CSI-2 OV5640 sensor, requires the i.MX6 MIPI CSI-2 receiver. But
11662306a36Sopenharmony_cithe SabreAuto has only the ADV7180 decoder on a parallel bt.656 bus, and
11762306a36Sopenharmony_citherefore does not require the MIPI CSI-2 receiver, so it is missing in
11862306a36Sopenharmony_ciits graph.
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci.. _imx6q_topology_graph:
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci.. kernel-figure:: imx6q-sabresd.dot
12362306a36Sopenharmony_ci    :alt:   Diagram of the i.MX6Q SabreSD media pipeline topology
12462306a36Sopenharmony_ci    :align: center
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci    Media pipeline graph on i.MX6Q SabreSD
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci.. kernel-figure:: imx6q-sabreauto.dot
12962306a36Sopenharmony_ci    :alt:   Diagram of the i.MX6Q SabreAuto media pipeline topology
13062306a36Sopenharmony_ci    :align: center
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci    Media pipeline graph on i.MX6Q SabreAuto
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ciEntities
13562306a36Sopenharmony_ci--------
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ciimx6-mipi-csi2
13862306a36Sopenharmony_ci--------------
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ciThis is the MIPI CSI-2 receiver entity. It has one sink pad to receive
14162306a36Sopenharmony_cithe MIPI CSI-2 stream (usually from a MIPI CSI-2 camera sensor). It has
14262306a36Sopenharmony_cifour source pads, corresponding to the four MIPI CSI-2 demuxed virtual
14362306a36Sopenharmony_cichannel outputs. Multiple source pads can be enabled to independently
14462306a36Sopenharmony_cistream from multiple virtual channels.
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ciThis entity actually consists of two sub-blocks. One is the MIPI CSI-2
14762306a36Sopenharmony_cicore. This is a Synopsys Designware MIPI CSI-2 core. The other sub-block
14862306a36Sopenharmony_ciis a "CSI-2 to IPU gasket". The gasket acts as a demultiplexer of the
14962306a36Sopenharmony_cifour virtual channels streams, providing four separate parallel buses
15062306a36Sopenharmony_cicontaining each virtual channel that are routed to CSIs or video
15162306a36Sopenharmony_cimultiplexers as described below.
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ciOn i.MX6 solo/dual-lite, all four virtual channel buses are routed to
15462306a36Sopenharmony_citwo video multiplexers. Both CSI0 and CSI1 can receive any virtual
15562306a36Sopenharmony_cichannel, as selected by the video multiplexers.
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ciOn i.MX6 Quad, virtual channel 0 is routed to IPU1-CSI0 (after selected
15862306a36Sopenharmony_ciby a video mux), virtual channels 1 and 2 are hard-wired to IPU1-CSI1
15962306a36Sopenharmony_ciand IPU2-CSI0, respectively, and virtual channel 3 is routed to
16062306a36Sopenharmony_ciIPU2-CSI1 (again selected by a video mux).
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ciipuX_csiY_mux
16362306a36Sopenharmony_ci-------------
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ciThese are the video multiplexers. They have two or more sink pads to
16662306a36Sopenharmony_ciselect from either camera sensors with a parallel interface, or from
16762306a36Sopenharmony_ciMIPI CSI-2 virtual channels from imx6-mipi-csi2 entity. They have a
16862306a36Sopenharmony_cisingle source pad that routes to a CSI (ipuX_csiY entities).
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ciOn i.MX6 solo/dual-lite, there are two video mux entities. One sits
17162306a36Sopenharmony_ciin front of IPU1-CSI0 to select between a parallel sensor and any of
17262306a36Sopenharmony_cithe four MIPI CSI-2 virtual channels (a total of five sink pads). The
17362306a36Sopenharmony_ciother mux sits in front of IPU1-CSI1, and again has five sink pads to
17462306a36Sopenharmony_ciselect between a parallel sensor and any of the four MIPI CSI-2 virtual
17562306a36Sopenharmony_cichannels.
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ciOn i.MX6 Quad, there are two video mux entities. One sits in front of
17862306a36Sopenharmony_ciIPU1-CSI0 to select between a parallel sensor and MIPI CSI-2 virtual
17962306a36Sopenharmony_cichannel 0 (two sink pads). The other mux sits in front of IPU2-CSI1 to
18062306a36Sopenharmony_ciselect between a parallel sensor and MIPI CSI-2 virtual channel 3 (two
18162306a36Sopenharmony_cisink pads).
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ciipuX_csiY
18462306a36Sopenharmony_ci---------
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ciThese are the CSI entities. They have a single sink pad receiving from
18762306a36Sopenharmony_cieither a video mux or from a MIPI CSI-2 virtual channel as described
18862306a36Sopenharmony_ciabove.
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ciThis entity has two source pads. The first source pad can link directly
19162306a36Sopenharmony_cito the ipuX_vdic entity or the ipuX_ic_prp entity, using hardware links
19262306a36Sopenharmony_cithat require no IDMAC memory buffer transfer.
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ciWhen the direct source pad is routed to the ipuX_ic_prp entity, frames
19562306a36Sopenharmony_cifrom the CSI can be processed by one or both of the IC pre-processing
19662306a36Sopenharmony_citasks.
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ciWhen the direct source pad is routed to the ipuX_vdic entity, the VDIC
19962306a36Sopenharmony_ciwill carry out motion-compensated de-interlace using "high motion" mode
20062306a36Sopenharmony_ci(see description of ipuX_vdic entity).
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ciThe second source pad sends video frames directly to memory buffers
20362306a36Sopenharmony_civia the SMFC and an IDMAC channel, bypassing IC pre-processing. This
20462306a36Sopenharmony_cisource pad is routed to a capture device node, with a node name of the
20562306a36Sopenharmony_ciformat "ipuX_csiY capture".
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ciNote that since the IDMAC source pad makes use of an IDMAC channel,
20862306a36Sopenharmony_cipixel reordering within the same colorspace can be carried out by the
20962306a36Sopenharmony_ciIDMAC channel. For example, if the CSI sink pad is receiving in UYVY
21062306a36Sopenharmony_ciorder, the capture device linked to the IDMAC source pad can capture
21162306a36Sopenharmony_ciin YUYV order. Also, if the CSI sink pad is receiving a packed YUV
21262306a36Sopenharmony_ciformat, the capture device can capture a planar YUV format such as
21362306a36Sopenharmony_ciYUV420.
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ciThe IDMAC channel at the IDMAC source pad also supports simple
21662306a36Sopenharmony_ciinterweave without motion compensation, which is activated if the source
21762306a36Sopenharmony_cipad's field type is sequential top-bottom or bottom-top, and the
21862306a36Sopenharmony_cirequested capture interface field type is set to interlaced (t-b, b-t,
21962306a36Sopenharmony_cior unqualified interlaced). The capture interface will enforce the same
22062306a36Sopenharmony_cifield order as the source pad field order (interlaced-bt if source pad
22162306a36Sopenharmony_ciis seq-bt, interlaced-tb if source pad is seq-tb).
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ciFor events produced by ipuX_csiY, see ref:`imx_api_ipuX_csiY`.
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ciCropping in ipuX_csiY
22662306a36Sopenharmony_ci---------------------
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ciThe CSI supports cropping the incoming raw sensor frames. This is
22962306a36Sopenharmony_ciimplemented in the ipuX_csiY entities at the sink pad, using the
23062306a36Sopenharmony_cicrop selection subdev API.
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ciThe CSI also supports fixed divide-by-two downscaling independently in
23362306a36Sopenharmony_ciwidth and height. This is implemented in the ipuX_csiY entities at
23462306a36Sopenharmony_cithe sink pad, using the compose selection subdev API.
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ciThe output rectangle at the ipuX_csiY source pad is the same as
23762306a36Sopenharmony_cithe compose rectangle at the sink pad. So the source pad rectangle
23862306a36Sopenharmony_cicannot be negotiated, it must be set using the compose selection
23962306a36Sopenharmony_ciAPI at sink pad (if /2 downscale is desired, otherwise source pad
24062306a36Sopenharmony_cirectangle is equal to incoming rectangle).
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ciTo give an example of crop and /2 downscale, this will crop a
24362306a36Sopenharmony_ci1280x960 input frame to 640x480, and then /2 downscale in both
24462306a36Sopenharmony_cidimensions to 320x240 (assumes ipu1_csi0 is linked to ipu1_csi0_mux):
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci.. code-block:: none
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0_mux':2[fmt:UYVY2X8/1280x960]"
24962306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':0[crop:(0,0)/640x480]"
25062306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':0[compose:(0,0)/320x240]"
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ciFrame Skipping in ipuX_csiY
25362306a36Sopenharmony_ci---------------------------
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ciThe CSI supports frame rate decimation, via frame skipping. Frame
25662306a36Sopenharmony_cirate decimation is specified by setting the frame intervals at
25762306a36Sopenharmony_cisink and source pads. The ipuX_csiY entity then applies the best
25862306a36Sopenharmony_ciframe skip setting to the CSI to achieve the desired frame rate
25962306a36Sopenharmony_ciat the source pad.
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ciThe following example reduces an assumed incoming 60 Hz frame
26262306a36Sopenharmony_cirate by half at the IDMAC output source pad:
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci.. code-block:: none
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':0[fmt:UYVY2X8/640x480@1/60]"
26762306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':2[fmt:UYVY2X8/640x480@1/30]"
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ciFrame Interval Monitor in ipuX_csiY
27062306a36Sopenharmony_ci-----------------------------------
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ciSee ref:`imx_api_FIM`.
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ciipuX_vdic
27562306a36Sopenharmony_ci---------
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ciThe VDIC carries out motion compensated de-interlacing, with three
27862306a36Sopenharmony_cimotion compensation modes: low, medium, and high motion. The mode is
27962306a36Sopenharmony_cispecified with the menu control V4L2_CID_DEINTERLACING_MODE. The VDIC
28062306a36Sopenharmony_cihas two sink pads and a single source pad.
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_ciThe direct sink pad receives from an ipuX_csiY direct pad. With this
28362306a36Sopenharmony_cilink the VDIC can only operate in high motion mode.
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ciWhen the IDMAC sink pad is activated, it receives from an output
28662306a36Sopenharmony_cior mem2mem device node. With this pipeline, the VDIC can also operate
28762306a36Sopenharmony_ciin low and medium modes, because these modes require receiving
28862306a36Sopenharmony_ciframes from memory buffers. Note that an output or mem2mem device
28962306a36Sopenharmony_ciis not implemented yet, so this sink pad currently has no links.
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ciThe source pad routes to the IC pre-processing entity ipuX_ic_prp.
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ciipuX_ic_prp
29462306a36Sopenharmony_ci-----------
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ciThis is the IC pre-processing entity. It acts as a router, routing
29762306a36Sopenharmony_cidata from its sink pad to one or both of its source pads.
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ciThis entity has a single sink pad. The sink pad can receive from the
30062306a36Sopenharmony_ciipuX_csiY direct pad, or from ipuX_vdic.
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ciThis entity has two source pads. One source pad routes to the
30362306a36Sopenharmony_cipre-process encode task entity (ipuX_ic_prpenc), the other to the
30462306a36Sopenharmony_cipre-process viewfinder task entity (ipuX_ic_prpvf). Both source pads
30562306a36Sopenharmony_cican be activated at the same time if the sink pad is receiving from
30662306a36Sopenharmony_ciipuX_csiY. Only the source pad to the pre-process viewfinder task entity
30762306a36Sopenharmony_cican be activated if the sink pad is receiving from ipuX_vdic (frames
30862306a36Sopenharmony_cifrom the VDIC can only be processed by the pre-process viewfinder task).
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ciipuX_ic_prpenc
31162306a36Sopenharmony_ci--------------
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ciThis is the IC pre-processing encode entity. It has a single sink
31462306a36Sopenharmony_cipad from ipuX_ic_prp, and a single source pad. The source pad is
31562306a36Sopenharmony_cirouted to a capture device node, with a node name of the format
31662306a36Sopenharmony_ci"ipuX_ic_prpenc capture".
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ciThis entity performs the IC pre-process encode task operations:
31962306a36Sopenharmony_cicolor-space conversion, resizing (downscaling and upscaling),
32062306a36Sopenharmony_cihorizontal and vertical flip, and 90/270 degree rotation. Flip
32162306a36Sopenharmony_ciand rotation are provided via standard V4L2 controls.
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ciLike the ipuX_csiY IDMAC source, this entity also supports simple
32462306a36Sopenharmony_cide-interlace without motion compensation, and pixel reordering.
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ciipuX_ic_prpvf
32762306a36Sopenharmony_ci-------------
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ciThis is the IC pre-processing viewfinder entity. It has a single sink
33062306a36Sopenharmony_cipad from ipuX_ic_prp, and a single source pad. The source pad is routed
33162306a36Sopenharmony_cito a capture device node, with a node name of the format
33262306a36Sopenharmony_ci"ipuX_ic_prpvf capture".
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ciThis entity is identical in operation to ipuX_ic_prpenc, with the same
33562306a36Sopenharmony_ciresizing and CSC operations and flip/rotation controls. It will receive
33662306a36Sopenharmony_ciand process de-interlaced frames from the ipuX_vdic if ipuX_ic_prp is
33762306a36Sopenharmony_cireceiving from ipuX_vdic.
33862306a36Sopenharmony_ci
33962306a36Sopenharmony_ciLike the ipuX_csiY IDMAC source, this entity supports simple
34062306a36Sopenharmony_ciinterweaving without motion compensation. However, note that if the
34162306a36Sopenharmony_ciipuX_vdic is included in the pipeline (ipuX_ic_prp is receiving from
34262306a36Sopenharmony_ciipuX_vdic), it's not possible to use interweave in ipuX_ic_prpvf,
34362306a36Sopenharmony_cisince the ipuX_vdic has already carried out de-interlacing (with
34462306a36Sopenharmony_cimotion compensation) and therefore the field type output from
34562306a36Sopenharmony_ciipuX_vdic can only be none (progressive).
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ciCapture Pipelines
34862306a36Sopenharmony_ci-----------------
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ciThe following describe the various use-cases supported by the pipelines.
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ciThe links shown do not include the backend sensor, video mux, or mipi
35362306a36Sopenharmony_cicsi-2 receiver links. This depends on the type of sensor interface
35462306a36Sopenharmony_ci(parallel or mipi csi-2). So these pipelines begin with:
35562306a36Sopenharmony_ci
35662306a36Sopenharmony_cisensor -> ipuX_csiY_mux -> ...
35762306a36Sopenharmony_ci
35862306a36Sopenharmony_cifor parallel sensors, or:
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_cisensor -> imx6-mipi-csi2 -> (ipuX_csiY_mux) -> ...
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_cifor mipi csi-2 sensors. The imx6-mipi-csi2 receiver may need to route
36362306a36Sopenharmony_cito the video mux (ipuX_csiY_mux) before sending to the CSI, depending
36462306a36Sopenharmony_cion the mipi csi-2 virtual channel, hence ipuX_csiY_mux is shown in
36562306a36Sopenharmony_ciparenthesis.
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ciUnprocessed Video Capture:
36862306a36Sopenharmony_ci--------------------------
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ciSend frames directly from sensor to camera device interface node, with
37162306a36Sopenharmony_cino conversions, via ipuX_csiY IDMAC source pad:
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_ci-> ipuX_csiY:2 -> ipuX_csiY capture
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ciIC Direct Conversions:
37662306a36Sopenharmony_ci----------------------
37762306a36Sopenharmony_ci
37862306a36Sopenharmony_ciThis pipeline uses the preprocess encode entity to route frames directly
37962306a36Sopenharmony_cifrom the CSI to the IC, to carry out scaling up to 1024x1024 resolution,
38062306a36Sopenharmony_ciCSC, flipping, and image rotation:
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_ci-> ipuX_csiY:1 -> 0:ipuX_ic_prp:1 -> 0:ipuX_ic_prpenc:1 -> ipuX_ic_prpenc capture
38362306a36Sopenharmony_ci
38462306a36Sopenharmony_ciMotion Compensated De-interlace:
38562306a36Sopenharmony_ci--------------------------------
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ciThis pipeline routes frames from the CSI direct pad to the VDIC entity to
38862306a36Sopenharmony_cisupport motion-compensated de-interlacing (high motion mode only),
38962306a36Sopenharmony_ciscaling up to 1024x1024, CSC, flip, and rotation:
39062306a36Sopenharmony_ci
39162306a36Sopenharmony_ci-> ipuX_csiY:1 -> 0:ipuX_vdic:2 -> 0:ipuX_ic_prp:2 -> 0:ipuX_ic_prpvf:1 -> ipuX_ic_prpvf capture
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci
39462306a36Sopenharmony_ciUsage Notes
39562306a36Sopenharmony_ci-----------
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ciTo aid in configuration and for backward compatibility with V4L2
39862306a36Sopenharmony_ciapplications that access controls only from video device nodes, the
39962306a36Sopenharmony_cicapture device interfaces inherit controls from the active entities
40062306a36Sopenharmony_ciin the current pipeline, so controls can be accessed either directly
40162306a36Sopenharmony_cifrom the subdev or from the active capture device interface. For
40262306a36Sopenharmony_ciexample, the FIM controls are available either from the ipuX_csiY
40362306a36Sopenharmony_cisubdevs or from the active capture device.
40462306a36Sopenharmony_ci
40562306a36Sopenharmony_ciThe following are specific usage notes for the Sabre* reference
40662306a36Sopenharmony_ciboards:
40762306a36Sopenharmony_ci
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_cii.MX6Q SabreLite with OV5642 and OV5640
41062306a36Sopenharmony_ci---------------------------------------
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ciThis platform requires the OmniVision OV5642 module with a parallel
41362306a36Sopenharmony_cicamera interface, and the OV5640 module with a MIPI CSI-2
41462306a36Sopenharmony_ciinterface. Both modules are available from Boundary Devices:
41562306a36Sopenharmony_ci
41662306a36Sopenharmony_ci- https://boundarydevices.com/product/nit6x_5mp
41762306a36Sopenharmony_ci- https://boundarydevices.com/product/nit6x_5mp_mipi
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ciNote that if only one camera module is available, the other sensor
42062306a36Sopenharmony_cinode can be disabled in the device tree.
42162306a36Sopenharmony_ci
42262306a36Sopenharmony_ciThe OV5642 module is connected to the parallel bus input on the i.MX
42362306a36Sopenharmony_ciinternal video mux to IPU1 CSI0. It's i2c bus connects to i2c bus 2.
42462306a36Sopenharmony_ci
42562306a36Sopenharmony_ciThe MIPI CSI-2 OV5640 module is connected to the i.MX internal MIPI CSI-2
42662306a36Sopenharmony_cireceiver, and the four virtual channel outputs from the receiver are
42762306a36Sopenharmony_cirouted as follows: vc0 to the IPU1 CSI0 mux, vc1 directly to IPU1 CSI1,
42862306a36Sopenharmony_civc2 directly to IPU2 CSI0, and vc3 to the IPU2 CSI1 mux. The OV5640 is
42962306a36Sopenharmony_cialso connected to i2c bus 2 on the SabreLite, therefore the OV5642 and
43062306a36Sopenharmony_ciOV5640 must not share the same i2c slave address.
43162306a36Sopenharmony_ci
43262306a36Sopenharmony_ciThe following basic example configures unprocessed video capture
43362306a36Sopenharmony_cipipelines for both sensors. The OV5642 is routed to ipu1_csi0, and
43462306a36Sopenharmony_cithe OV5640, transmitting on MIPI CSI-2 virtual channel 1 (which is
43562306a36Sopenharmony_ciimx6-mipi-csi2 pad 2), is routed to ipu1_csi1. Both sensors are
43662306a36Sopenharmony_ciconfigured to output 640x480, and the OV5642 outputs YUYV2X8, the
43762306a36Sopenharmony_ciOV5640 UYVY2X8:
43862306a36Sopenharmony_ci
43962306a36Sopenharmony_ci.. code-block:: none
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_ci   # Setup links for OV5642
44262306a36Sopenharmony_ci   media-ctl -l "'ov5642 1-0042':0 -> 'ipu1_csi0_mux':1[1]"
44362306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
44462306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
44562306a36Sopenharmony_ci   # Setup links for OV5640
44662306a36Sopenharmony_ci   media-ctl -l "'ov5640 1-0040':0 -> 'imx6-mipi-csi2':0[1]"
44762306a36Sopenharmony_ci   media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]"
44862306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi1':2 -> 'ipu1_csi1 capture':0[1]"
44962306a36Sopenharmony_ci   # Configure pads for OV5642 pipeline
45062306a36Sopenharmony_ci   media-ctl -V "'ov5642 1-0042':0 [fmt:YUYV2X8/640x480 field:none]"
45162306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0_mux':2 [fmt:YUYV2X8/640x480 field:none]"
45262306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/640x480 field:none]"
45362306a36Sopenharmony_ci   # Configure pads for OV5640 pipeline
45462306a36Sopenharmony_ci   media-ctl -V "'ov5640 1-0040':0 [fmt:UYVY2X8/640x480 field:none]"
45562306a36Sopenharmony_ci   media-ctl -V "'imx6-mipi-csi2':2 [fmt:UYVY2X8/640x480 field:none]"
45662306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi1':2 [fmt:AYUV32/640x480 field:none]"
45762306a36Sopenharmony_ci
45862306a36Sopenharmony_ciStreaming can then begin independently on the capture device nodes
45962306a36Sopenharmony_ci"ipu1_csi0 capture" and "ipu1_csi1 capture". The v4l2-ctl tool can
46062306a36Sopenharmony_cibe used to select any supported YUV pixelformat on the capture device
46162306a36Sopenharmony_cinodes, including planar.
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_cii.MX6Q SabreAuto with ADV7180 decoder
46462306a36Sopenharmony_ci-------------------------------------
46562306a36Sopenharmony_ci
46662306a36Sopenharmony_ciOn the i.MX6Q SabreAuto, an on-board ADV7180 SD decoder is connected to the
46762306a36Sopenharmony_ciparallel bus input on the internal video mux to IPU1 CSI0.
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ciThe following example configures a pipeline to capture from the ADV7180
47062306a36Sopenharmony_civideo decoder, assuming NTSC 720x480 input signals, using simple
47162306a36Sopenharmony_ciinterweave (unconverted and without motion compensation). The adv7180
47262306a36Sopenharmony_cimust output sequential or alternating fields (field type 'seq-bt' for
47362306a36Sopenharmony_ciNTSC, or 'alternate'):
47462306a36Sopenharmony_ci
47562306a36Sopenharmony_ci.. code-block:: none
47662306a36Sopenharmony_ci
47762306a36Sopenharmony_ci   # Setup links
47862306a36Sopenharmony_ci   media-ctl -l "'adv7180 3-0021':0 -> 'ipu1_csi0_mux':1[1]"
47962306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
48062306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
48162306a36Sopenharmony_ci   # Configure pads
48262306a36Sopenharmony_ci   media-ctl -V "'adv7180 3-0021':0 [fmt:UYVY2X8/720x480 field:seq-bt]"
48362306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x480]"
48462306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]"
48562306a36Sopenharmony_ci   # Configure "ipu1_csi0 capture" interface (assumed at /dev/video4)
48662306a36Sopenharmony_ci   v4l2-ctl -d4 --set-fmt-video=field=interlaced_bt
48762306a36Sopenharmony_ci
48862306a36Sopenharmony_ciStreaming can then begin on /dev/video4. The v4l2-ctl tool can also be
48962306a36Sopenharmony_ciused to select any supported YUV pixelformat on /dev/video4.
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ciThis example configures a pipeline to capture from the ADV7180
49262306a36Sopenharmony_civideo decoder, assuming PAL 720x576 input signals, with Motion
49362306a36Sopenharmony_ciCompensated de-interlacing. The adv7180 must output sequential or
49462306a36Sopenharmony_cialternating fields (field type 'seq-tb' for PAL, or 'alternate').
49562306a36Sopenharmony_ci
49662306a36Sopenharmony_ci.. code-block:: none
49762306a36Sopenharmony_ci
49862306a36Sopenharmony_ci   # Setup links
49962306a36Sopenharmony_ci   media-ctl -l "'adv7180 3-0021':0 -> 'ipu1_csi0_mux':1[1]"
50062306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
50162306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0':1 -> 'ipu1_vdic':0[1]"
50262306a36Sopenharmony_ci   media-ctl -l "'ipu1_vdic':2 -> 'ipu1_ic_prp':0[1]"
50362306a36Sopenharmony_ci   media-ctl -l "'ipu1_ic_prp':2 -> 'ipu1_ic_prpvf':0[1]"
50462306a36Sopenharmony_ci   media-ctl -l "'ipu1_ic_prpvf':1 -> 'ipu1_ic_prpvf capture':0[1]"
50562306a36Sopenharmony_ci   # Configure pads
50662306a36Sopenharmony_ci   media-ctl -V "'adv7180 3-0021':0 [fmt:UYVY2X8/720x576 field:seq-tb]"
50762306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x576]"
50862306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/720x576]"
50962306a36Sopenharmony_ci   media-ctl -V "'ipu1_vdic':2 [fmt:AYUV32/720x576 field:none]"
51062306a36Sopenharmony_ci   media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]"
51162306a36Sopenharmony_ci   media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]"
51262306a36Sopenharmony_ci   # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2)
51362306a36Sopenharmony_ci   v4l2-ctl -d2 --set-fmt-video=field=none
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ciStreaming can then begin on /dev/video2. The v4l2-ctl tool can also be
51662306a36Sopenharmony_ciused to select any supported YUV pixelformat on /dev/video2.
51762306a36Sopenharmony_ci
51862306a36Sopenharmony_ciThis platform accepts Composite Video analog inputs to the ADV7180 on
51962306a36Sopenharmony_ciAin1 (connector J42).
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_cii.MX6DL SabreAuto with ADV7180 decoder
52262306a36Sopenharmony_ci--------------------------------------
52362306a36Sopenharmony_ci
52462306a36Sopenharmony_ciOn the i.MX6DL SabreAuto, an on-board ADV7180 SD decoder is connected to the
52562306a36Sopenharmony_ciparallel bus input on the internal video mux to IPU1 CSI0.
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ciThe following example configures a pipeline to capture from the ADV7180
52862306a36Sopenharmony_civideo decoder, assuming NTSC 720x480 input signals, using simple
52962306a36Sopenharmony_ciinterweave (unconverted and without motion compensation). The adv7180
53062306a36Sopenharmony_cimust output sequential or alternating fields (field type 'seq-bt' for
53162306a36Sopenharmony_ciNTSC, or 'alternate'):
53262306a36Sopenharmony_ci
53362306a36Sopenharmony_ci.. code-block:: none
53462306a36Sopenharmony_ci
53562306a36Sopenharmony_ci   # Setup links
53662306a36Sopenharmony_ci   media-ctl -l "'adv7180 4-0021':0 -> 'ipu1_csi0_mux':4[1]"
53762306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0_mux':5 -> 'ipu1_csi0':0[1]"
53862306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
53962306a36Sopenharmony_ci   # Configure pads
54062306a36Sopenharmony_ci   media-ctl -V "'adv7180 4-0021':0 [fmt:UYVY2X8/720x480 field:seq-bt]"
54162306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0_mux':5 [fmt:UYVY2X8/720x480]"
54262306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]"
54362306a36Sopenharmony_ci   # Configure "ipu1_csi0 capture" interface (assumed at /dev/video0)
54462306a36Sopenharmony_ci   v4l2-ctl -d0 --set-fmt-video=field=interlaced_bt
54562306a36Sopenharmony_ci
54662306a36Sopenharmony_ciStreaming can then begin on /dev/video0. The v4l2-ctl tool can also be
54762306a36Sopenharmony_ciused to select any supported YUV pixelformat on /dev/video0.
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_ciThis example configures a pipeline to capture from the ADV7180
55062306a36Sopenharmony_civideo decoder, assuming PAL 720x576 input signals, with Motion
55162306a36Sopenharmony_ciCompensated de-interlacing. The adv7180 must output sequential or
55262306a36Sopenharmony_cialternating fields (field type 'seq-tb' for PAL, or 'alternate').
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_ci.. code-block:: none
55562306a36Sopenharmony_ci
55662306a36Sopenharmony_ci   # Setup links
55762306a36Sopenharmony_ci   media-ctl -l "'adv7180 4-0021':0 -> 'ipu1_csi0_mux':4[1]"
55862306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0_mux':5 -> 'ipu1_csi0':0[1]"
55962306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0':1 -> 'ipu1_vdic':0[1]"
56062306a36Sopenharmony_ci   media-ctl -l "'ipu1_vdic':2 -> 'ipu1_ic_prp':0[1]"
56162306a36Sopenharmony_ci   media-ctl -l "'ipu1_ic_prp':2 -> 'ipu1_ic_prpvf':0[1]"
56262306a36Sopenharmony_ci   media-ctl -l "'ipu1_ic_prpvf':1 -> 'ipu1_ic_prpvf capture':0[1]"
56362306a36Sopenharmony_ci   # Configure pads
56462306a36Sopenharmony_ci   media-ctl -V "'adv7180 4-0021':0 [fmt:UYVY2X8/720x576 field:seq-tb]"
56562306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0_mux':5 [fmt:UYVY2X8/720x576]"
56662306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/720x576]"
56762306a36Sopenharmony_ci   media-ctl -V "'ipu1_vdic':2 [fmt:AYUV32/720x576 field:none]"
56862306a36Sopenharmony_ci   media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]"
56962306a36Sopenharmony_ci   media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]"
57062306a36Sopenharmony_ci   # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2)
57162306a36Sopenharmony_ci   v4l2-ctl -d2 --set-fmt-video=field=none
57262306a36Sopenharmony_ci
57362306a36Sopenharmony_ciStreaming can then begin on /dev/video2. The v4l2-ctl tool can also be
57462306a36Sopenharmony_ciused to select any supported YUV pixelformat on /dev/video2.
57562306a36Sopenharmony_ci
57662306a36Sopenharmony_ciThis platform accepts Composite Video analog inputs to the ADV7180 on
57762306a36Sopenharmony_ciAin1 (connector J42).
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_cii.MX6Q SabreSD with MIPI CSI-2 OV5640
58062306a36Sopenharmony_ci-------------------------------------
58162306a36Sopenharmony_ci
58262306a36Sopenharmony_ciSimilarly to i.MX6Q SabreLite, the i.MX6Q SabreSD supports a parallel
58362306a36Sopenharmony_ciinterface OV5642 module on IPU1 CSI0, and a MIPI CSI-2 OV5640
58462306a36Sopenharmony_cimodule. The OV5642 connects to i2c bus 1 and the OV5640 to i2c bus 2.
58562306a36Sopenharmony_ci
58662306a36Sopenharmony_ciThe device tree for SabreSD includes OF graphs for both the parallel
58762306a36Sopenharmony_ciOV5642 and the MIPI CSI-2 OV5640, but as of this writing only the MIPI
58862306a36Sopenharmony_ciCSI-2 OV5640 has been tested, so the OV5642 node is currently disabled.
58962306a36Sopenharmony_ciThe OV5640 module connects to MIPI connector J5. The NXP part number
59062306a36Sopenharmony_cifor the OV5640 module that connects to the SabreSD board is H120729.
59162306a36Sopenharmony_ci
59262306a36Sopenharmony_ciThe following example configures unprocessed video capture pipeline to
59362306a36Sopenharmony_cicapture from the OV5640, transmitting on MIPI CSI-2 virtual channel 0:
59462306a36Sopenharmony_ci
59562306a36Sopenharmony_ci.. code-block:: none
59662306a36Sopenharmony_ci
59762306a36Sopenharmony_ci   # Setup links
59862306a36Sopenharmony_ci   media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
59962306a36Sopenharmony_ci   media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]"
60062306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
60162306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]"
60262306a36Sopenharmony_ci   # Configure pads
60362306a36Sopenharmony_ci   media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]"
60462306a36Sopenharmony_ci   media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]"
60562306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0_mux':0 [fmt:UYVY2X8/640x480]"
60662306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':0 [fmt:AYUV32/640x480]"
60762306a36Sopenharmony_ci
60862306a36Sopenharmony_ciStreaming can then begin on "ipu1_csi0 capture" node. The v4l2-ctl
60962306a36Sopenharmony_citool can be used to select any supported pixelformat on the capture
61062306a36Sopenharmony_cidevice node.
61162306a36Sopenharmony_ci
61262306a36Sopenharmony_ciTo determine what is the /dev/video node correspondent to
61362306a36Sopenharmony_ci"ipu1_csi0 capture":
61462306a36Sopenharmony_ci
61562306a36Sopenharmony_ci.. code-block:: none
61662306a36Sopenharmony_ci
61762306a36Sopenharmony_ci   media-ctl -e "ipu1_csi0 capture"
61862306a36Sopenharmony_ci   /dev/video0
61962306a36Sopenharmony_ci
62062306a36Sopenharmony_ci/dev/video0 is the streaming element in this case.
62162306a36Sopenharmony_ci
62262306a36Sopenharmony_ciStarting the streaming via v4l2-ctl:
62362306a36Sopenharmony_ci
62462306a36Sopenharmony_ci.. code-block:: none
62562306a36Sopenharmony_ci
62662306a36Sopenharmony_ci   v4l2-ctl --stream-mmap -d /dev/video0
62762306a36Sopenharmony_ci
62862306a36Sopenharmony_ciStarting the streaming via Gstreamer and sending the content to the display:
62962306a36Sopenharmony_ci
63062306a36Sopenharmony_ci.. code-block:: none
63162306a36Sopenharmony_ci
63262306a36Sopenharmony_ci   gst-launch-1.0 v4l2src device=/dev/video0 ! kmssink
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_ciThe following example configures a direct conversion pipeline to capture
63562306a36Sopenharmony_cifrom the OV5640, transmitting on MIPI CSI-2 virtual channel 0. It also
63662306a36Sopenharmony_cishows colorspace conversion and scaling at IC output.
63762306a36Sopenharmony_ci
63862306a36Sopenharmony_ci.. code-block:: none
63962306a36Sopenharmony_ci
64062306a36Sopenharmony_ci   # Setup links
64162306a36Sopenharmony_ci   media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]"
64262306a36Sopenharmony_ci   media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]"
64362306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]"
64462306a36Sopenharmony_ci   media-ctl -l "'ipu1_csi0':1 -> 'ipu1_ic_prp':0[1]"
64562306a36Sopenharmony_ci   media-ctl -l "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]"
64662306a36Sopenharmony_ci   media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]"
64762306a36Sopenharmony_ci   # Configure pads
64862306a36Sopenharmony_ci   media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]"
64962306a36Sopenharmony_ci   media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]"
65062306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/640x480]"
65162306a36Sopenharmony_ci   media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/640x480]"
65262306a36Sopenharmony_ci   media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/640x480]"
65362306a36Sopenharmony_ci   media-ctl -V "'ipu1_ic_prpenc':1 [fmt:ARGB8888_1X32/800x600]"
65462306a36Sopenharmony_ci   # Set a format at the capture interface
65562306a36Sopenharmony_ci   v4l2-ctl -d /dev/video1 --set-fmt-video=pixelformat=RGB3
65662306a36Sopenharmony_ci
65762306a36Sopenharmony_ciStreaming can then begin on "ipu1_ic_prpenc capture" node.
65862306a36Sopenharmony_ci
65962306a36Sopenharmony_ciTo determine what is the /dev/video node correspondent to
66062306a36Sopenharmony_ci"ipu1_ic_prpenc capture":
66162306a36Sopenharmony_ci
66262306a36Sopenharmony_ci.. code-block:: none
66362306a36Sopenharmony_ci
66462306a36Sopenharmony_ci   media-ctl -e "ipu1_ic_prpenc capture"
66562306a36Sopenharmony_ci   /dev/video1
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ci
66862306a36Sopenharmony_ci/dev/video1 is the streaming element in this case.
66962306a36Sopenharmony_ci
67062306a36Sopenharmony_ciStarting the streaming via v4l2-ctl:
67162306a36Sopenharmony_ci
67262306a36Sopenharmony_ci.. code-block:: none
67362306a36Sopenharmony_ci
67462306a36Sopenharmony_ci   v4l2-ctl --stream-mmap -d /dev/video1
67562306a36Sopenharmony_ci
67662306a36Sopenharmony_ciStarting the streaming via Gstreamer and sending the content to the display:
67762306a36Sopenharmony_ci
67862306a36Sopenharmony_ci.. code-block:: none
67962306a36Sopenharmony_ci
68062306a36Sopenharmony_ci   gst-launch-1.0 v4l2src device=/dev/video1 ! kmssink
68162306a36Sopenharmony_ci
68262306a36Sopenharmony_ciKnown Issues
68362306a36Sopenharmony_ci------------
68462306a36Sopenharmony_ci
68562306a36Sopenharmony_ci1. When using 90 or 270 degree rotation control at capture resolutions
68662306a36Sopenharmony_ci   near the IC resizer limit of 1024x1024, and combined with planar
68762306a36Sopenharmony_ci   pixel formats (YUV420, YUV422p), frame capture will often fail with
68862306a36Sopenharmony_ci   no end-of-frame interrupts from the IDMAC channel. To work around
68962306a36Sopenharmony_ci   this, use lower resolution and/or packed formats (YUYV, RGB3, etc.)
69062306a36Sopenharmony_ci   when 90 or 270 rotations are needed.
69162306a36Sopenharmony_ci
69262306a36Sopenharmony_ci
69362306a36Sopenharmony_ciFile list
69462306a36Sopenharmony_ci---------
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_cidrivers/staging/media/imx/
69762306a36Sopenharmony_ciinclude/media/imx.h
69862306a36Sopenharmony_ciinclude/linux/imx-media.h
69962306a36Sopenharmony_ci
70062306a36Sopenharmony_ciReferences
70162306a36Sopenharmony_ci----------
70262306a36Sopenharmony_ci
70362306a36Sopenharmony_ci.. [#f1] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6DQRM.pdf
70462306a36Sopenharmony_ci.. [#f2] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6SDLRM.pdf
70562306a36Sopenharmony_ci
70662306a36Sopenharmony_ci
70762306a36Sopenharmony_ciAuthors
70862306a36Sopenharmony_ci-------
70962306a36Sopenharmony_ci
71062306a36Sopenharmony_ci- Steve Longerbeam <steve_longerbeam@mentor.com>
71162306a36Sopenharmony_ci- Philipp Zabel <kernel@pengutronix.de>
71262306a36Sopenharmony_ci- Russell King <linux@armlinux.org.uk>
71362306a36Sopenharmony_ci
71462306a36Sopenharmony_ciCopyright (C) 2012-2017 Mentor Graphics Inc.
715