1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyun 3*4882a593Smuzhiyuni.MX Video Capture Driver 4*4882a593Smuzhiyun========================= 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunIntroduction 7*4882a593Smuzhiyun------------ 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunThe Freescale i.MX5/6 contains an Image Processing Unit (IPU), which 10*4882a593Smuzhiyunhandles the flow of image frames to and from capture devices and 11*4882a593Smuzhiyundisplay devices. 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunFor image capture, the IPU contains the following internal subunits: 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun- Image DMA Controller (IDMAC) 16*4882a593Smuzhiyun- Camera Serial Interface (CSI) 17*4882a593Smuzhiyun- Image Converter (IC) 18*4882a593Smuzhiyun- Sensor Multi-FIFO Controller (SMFC) 19*4882a593Smuzhiyun- Image Rotator (IRT) 20*4882a593Smuzhiyun- Video De-Interlacing or Combining Block (VDIC) 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunThe IDMAC is the DMA controller for transfer of image frames to and from 23*4882a593Smuzhiyunmemory. Various dedicated DMA channels exist for both video capture and 24*4882a593Smuzhiyundisplay paths. During transfer, the IDMAC is also capable of vertical 25*4882a593Smuzhiyunimage flip, 8x8 block transfer (see IRT description), pixel component 26*4882a593Smuzhiyunre-ordering (for example UYVY to YUYV) within the same colorspace, and 27*4882a593Smuzhiyunpacked <--> planar conversion. The IDMAC can also perform a simple 28*4882a593Smuzhiyunde-interlacing by interweaving even and odd lines during transfer 29*4882a593Smuzhiyun(without motion compensation which requires the VDIC). 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunThe CSI is the backend capture unit that interfaces directly with 32*4882a593Smuzhiyuncamera sensors over Parallel, BT.656/1120, and MIPI CSI-2 buses. 33*4882a593Smuzhiyun 34*4882a593SmuzhiyunThe IC handles color-space conversion, resizing (downscaling and 35*4882a593Smuzhiyunupscaling), horizontal flip, and 90/270 degree rotation operations. 36*4882a593Smuzhiyun 37*4882a593SmuzhiyunThere are three independent "tasks" within the IC that can carry out 38*4882a593Smuzhiyunconversions concurrently: pre-process encoding, pre-process viewfinder, 39*4882a593Smuzhiyunand post-processing. Within each task, conversions are split into three 40*4882a593Smuzhiyunsections: downsizing section, main section (upsizing, flip, colorspace 41*4882a593Smuzhiyunconversion, and graphics plane combining), and rotation section. 42*4882a593Smuzhiyun 43*4882a593SmuzhiyunThe IPU time-shares the IC task operations. The time-slice granularity 44*4882a593Smuzhiyunis one burst of eight pixels in the downsizing section, one image line 45*4882a593Smuzhiyunin the main processing section, one image frame in the rotation section. 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunThe SMFC is composed of four independent FIFOs that each can transfer 48*4882a593Smuzhiyuncaptured frames from sensors directly to memory concurrently via four 49*4882a593SmuzhiyunIDMAC channels. 50*4882a593Smuzhiyun 51*4882a593SmuzhiyunThe IRT carries out 90 and 270 degree image rotation operations. The 52*4882a593Smuzhiyunrotation operation is carried out on 8x8 pixel blocks at a time. This 53*4882a593Smuzhiyunoperation is supported by the IDMAC which handles the 8x8 block transfer 54*4882a593Smuzhiyunalong with block reordering, in coordination with vertical flip. 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunThe VDIC handles the conversion of interlaced video to progressive, with 57*4882a593Smuzhiyunsupport for different motion compensation modes (low, medium, and high 58*4882a593Smuzhiyunmotion). The deinterlaced output frames from the VDIC can be sent to the 59*4882a593SmuzhiyunIC pre-process viewfinder task for further conversions. The VDIC also 60*4882a593Smuzhiyuncontains a Combiner that combines two image planes, with alpha blending 61*4882a593Smuzhiyunand color keying. 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunIn addition to the IPU internal subunits, there are also two units 64*4882a593Smuzhiyunoutside the IPU that are also involved in video capture on i.MX: 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun- MIPI CSI-2 Receiver for camera sensors with the MIPI CSI-2 bus 67*4882a593Smuzhiyun interface. This is a Synopsys DesignWare core. 68*4882a593Smuzhiyun- Two video multiplexers for selecting among multiple sensor inputs 69*4882a593Smuzhiyun to send to a CSI. 70*4882a593Smuzhiyun 71*4882a593SmuzhiyunFor more info, refer to the latest versions of the i.MX5/6 reference 72*4882a593Smuzhiyunmanuals [#f1]_ and [#f2]_. 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunFeatures 76*4882a593Smuzhiyun-------- 77*4882a593Smuzhiyun 78*4882a593SmuzhiyunSome of the features of this driver include: 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun- Many different pipelines can be configured via media controller API, 81*4882a593Smuzhiyun that correspond to the hardware video capture pipelines supported in 82*4882a593Smuzhiyun the i.MX. 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun- Supports parallel, BT.565, and MIPI CSI-2 interfaces. 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun- Concurrent independent streams, by configuring pipelines to multiple 87*4882a593Smuzhiyun video capture interfaces using independent entities. 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun- Scaling, color-space conversion, horizontal and vertical flip, and 90*4882a593Smuzhiyun image rotation via IC task subdevs. 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun- Many pixel formats supported (RGB, packed and planar YUV, partial 93*4882a593Smuzhiyun planar YUV). 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun- The VDIC subdev supports motion compensated de-interlacing, with three 96*4882a593Smuzhiyun motion compensation modes: low, medium, and high motion. Pipelines are 97*4882a593Smuzhiyun defined that allow sending frames to the VDIC subdev directly from the 98*4882a593Smuzhiyun CSI. There is also support in the future for sending frames to the 99*4882a593Smuzhiyun VDIC from memory buffers via a output/mem2mem devices. 100*4882a593Smuzhiyun 101*4882a593Smuzhiyun- Includes a Frame Interval Monitor (FIM) that can correct vertical sync 102*4882a593Smuzhiyun problems with the ADV718x video decoders. 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun 105*4882a593SmuzhiyunTopology 106*4882a593Smuzhiyun-------- 107*4882a593Smuzhiyun 108*4882a593SmuzhiyunThe following shows the media topologies for the i.MX6Q SabreSD and 109*4882a593Smuzhiyuni.MX6Q SabreAuto. Refer to these diagrams in the entity descriptions 110*4882a593Smuzhiyunin the next section. 111*4882a593Smuzhiyun 112*4882a593SmuzhiyunThe i.MX5/6 topologies can differ upstream from the IPUv3 CSI video 113*4882a593Smuzhiyunmultiplexers, but the internal IPUv3 topology downstream from there 114*4882a593Smuzhiyunis common to all i.MX5/6 platforms. For example, the SabreSD, with the 115*4882a593SmuzhiyunMIPI CSI-2 OV5640 sensor, requires the i.MX6 MIPI CSI-2 receiver. But 116*4882a593Smuzhiyunthe SabreAuto has only the ADV7180 decoder on a parallel bt.656 bus, and 117*4882a593Smuzhiyuntherefore does not require the MIPI CSI-2 receiver, so it is missing in 118*4882a593Smuzhiyunits graph. 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun.. _imx6q_topology_graph: 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun.. kernel-figure:: imx6q-sabresd.dot 123*4882a593Smuzhiyun :alt: Diagram of the i.MX6Q SabreSD media pipeline topology 124*4882a593Smuzhiyun :align: center 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun Media pipeline graph on i.MX6Q SabreSD 127*4882a593Smuzhiyun 128*4882a593Smuzhiyun.. kernel-figure:: imx6q-sabreauto.dot 129*4882a593Smuzhiyun :alt: Diagram of the i.MX6Q SabreAuto media pipeline topology 130*4882a593Smuzhiyun :align: center 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun Media pipeline graph on i.MX6Q SabreAuto 133*4882a593Smuzhiyun 134*4882a593SmuzhiyunEntities 135*4882a593Smuzhiyun-------- 136*4882a593Smuzhiyun 137*4882a593Smuzhiyunimx6-mipi-csi2 138*4882a593Smuzhiyun-------------- 139*4882a593Smuzhiyun 140*4882a593SmuzhiyunThis is the MIPI CSI-2 receiver entity. It has one sink pad to receive 141*4882a593Smuzhiyunthe MIPI CSI-2 stream (usually from a MIPI CSI-2 camera sensor). It has 142*4882a593Smuzhiyunfour source pads, corresponding to the four MIPI CSI-2 demuxed virtual 143*4882a593Smuzhiyunchannel outputs. Multiple source pads can be enabled to independently 144*4882a593Smuzhiyunstream from multiple virtual channels. 145*4882a593Smuzhiyun 146*4882a593SmuzhiyunThis entity actually consists of two sub-blocks. One is the MIPI CSI-2 147*4882a593Smuzhiyuncore. This is a Synopsys Designware MIPI CSI-2 core. The other sub-block 148*4882a593Smuzhiyunis a "CSI-2 to IPU gasket". The gasket acts as a demultiplexer of the 149*4882a593Smuzhiyunfour virtual channels streams, providing four separate parallel buses 150*4882a593Smuzhiyuncontaining each virtual channel that are routed to CSIs or video 151*4882a593Smuzhiyunmultiplexers as described below. 152*4882a593Smuzhiyun 153*4882a593SmuzhiyunOn i.MX6 solo/dual-lite, all four virtual channel buses are routed to 154*4882a593Smuzhiyuntwo video multiplexers. Both CSI0 and CSI1 can receive any virtual 155*4882a593Smuzhiyunchannel, as selected by the video multiplexers. 156*4882a593Smuzhiyun 157*4882a593SmuzhiyunOn i.MX6 Quad, virtual channel 0 is routed to IPU1-CSI0 (after selected 158*4882a593Smuzhiyunby a video mux), virtual channels 1 and 2 are hard-wired to IPU1-CSI1 159*4882a593Smuzhiyunand IPU2-CSI0, respectively, and virtual channel 3 is routed to 160*4882a593SmuzhiyunIPU2-CSI1 (again selected by a video mux). 161*4882a593Smuzhiyun 162*4882a593SmuzhiyunipuX_csiY_mux 163*4882a593Smuzhiyun------------- 164*4882a593Smuzhiyun 165*4882a593SmuzhiyunThese are the video multiplexers. They have two or more sink pads to 166*4882a593Smuzhiyunselect from either camera sensors with a parallel interface, or from 167*4882a593SmuzhiyunMIPI CSI-2 virtual channels from imx6-mipi-csi2 entity. They have a 168*4882a593Smuzhiyunsingle source pad that routes to a CSI (ipuX_csiY entities). 169*4882a593Smuzhiyun 170*4882a593SmuzhiyunOn i.MX6 solo/dual-lite, there are two video mux entities. One sits 171*4882a593Smuzhiyunin front of IPU1-CSI0 to select between a parallel sensor and any of 172*4882a593Smuzhiyunthe four MIPI CSI-2 virtual channels (a total of five sink pads). The 173*4882a593Smuzhiyunother mux sits in front of IPU1-CSI1, and again has five sink pads to 174*4882a593Smuzhiyunselect between a parallel sensor and any of the four MIPI CSI-2 virtual 175*4882a593Smuzhiyunchannels. 176*4882a593Smuzhiyun 177*4882a593SmuzhiyunOn i.MX6 Quad, there are two video mux entities. One sits in front of 178*4882a593SmuzhiyunIPU1-CSI0 to select between a parallel sensor and MIPI CSI-2 virtual 179*4882a593Smuzhiyunchannel 0 (two sink pads). The other mux sits in front of IPU2-CSI1 to 180*4882a593Smuzhiyunselect between a parallel sensor and MIPI CSI-2 virtual channel 3 (two 181*4882a593Smuzhiyunsink pads). 182*4882a593Smuzhiyun 183*4882a593SmuzhiyunipuX_csiY 184*4882a593Smuzhiyun--------- 185*4882a593Smuzhiyun 186*4882a593SmuzhiyunThese are the CSI entities. They have a single sink pad receiving from 187*4882a593Smuzhiyuneither a video mux or from a MIPI CSI-2 virtual channel as described 188*4882a593Smuzhiyunabove. 189*4882a593Smuzhiyun 190*4882a593SmuzhiyunThis entity has two source pads. The first source pad can link directly 191*4882a593Smuzhiyunto the ipuX_vdic entity or the ipuX_ic_prp entity, using hardware links 192*4882a593Smuzhiyunthat require no IDMAC memory buffer transfer. 193*4882a593Smuzhiyun 194*4882a593SmuzhiyunWhen the direct source pad is routed to the ipuX_ic_prp entity, frames 195*4882a593Smuzhiyunfrom the CSI can be processed by one or both of the IC pre-processing 196*4882a593Smuzhiyuntasks. 197*4882a593Smuzhiyun 198*4882a593SmuzhiyunWhen the direct source pad is routed to the ipuX_vdic entity, the VDIC 199*4882a593Smuzhiyunwill carry out motion-compensated de-interlace using "high motion" mode 200*4882a593Smuzhiyun(see description of ipuX_vdic entity). 201*4882a593Smuzhiyun 202*4882a593SmuzhiyunThe second source pad sends video frames directly to memory buffers 203*4882a593Smuzhiyunvia the SMFC and an IDMAC channel, bypassing IC pre-processing. This 204*4882a593Smuzhiyunsource pad is routed to a capture device node, with a node name of the 205*4882a593Smuzhiyunformat "ipuX_csiY capture". 206*4882a593Smuzhiyun 207*4882a593SmuzhiyunNote that since the IDMAC source pad makes use of an IDMAC channel, 208*4882a593Smuzhiyunpixel reordering within the same colorspace can be carried out by the 209*4882a593SmuzhiyunIDMAC channel. For example, if the CSI sink pad is receiving in UYVY 210*4882a593Smuzhiyunorder, the capture device linked to the IDMAC source pad can capture 211*4882a593Smuzhiyunin YUYV order. Also, if the CSI sink pad is receiving a packed YUV 212*4882a593Smuzhiyunformat, the capture device can capture a planar YUV format such as 213*4882a593SmuzhiyunYUV420. 214*4882a593Smuzhiyun 215*4882a593SmuzhiyunThe IDMAC channel at the IDMAC source pad also supports simple 216*4882a593Smuzhiyuninterweave without motion compensation, which is activated if the source 217*4882a593Smuzhiyunpad's field type is sequential top-bottom or bottom-top, and the 218*4882a593Smuzhiyunrequested capture interface field type is set to interlaced (t-b, b-t, 219*4882a593Smuzhiyunor unqualified interlaced). The capture interface will enforce the same 220*4882a593Smuzhiyunfield order as the source pad field order (interlaced-bt if source pad 221*4882a593Smuzhiyunis seq-bt, interlaced-tb if source pad is seq-tb). 222*4882a593Smuzhiyun 223*4882a593SmuzhiyunFor events produced by ipuX_csiY, see ref:`imx_api_ipuX_csiY`. 224*4882a593Smuzhiyun 225*4882a593SmuzhiyunCropping in ipuX_csiY 226*4882a593Smuzhiyun--------------------- 227*4882a593Smuzhiyun 228*4882a593SmuzhiyunThe CSI supports cropping the incoming raw sensor frames. This is 229*4882a593Smuzhiyunimplemented in the ipuX_csiY entities at the sink pad, using the 230*4882a593Smuzhiyuncrop selection subdev API. 231*4882a593Smuzhiyun 232*4882a593SmuzhiyunThe CSI also supports fixed divide-by-two downscaling independently in 233*4882a593Smuzhiyunwidth and height. This is implemented in the ipuX_csiY entities at 234*4882a593Smuzhiyunthe sink pad, using the compose selection subdev API. 235*4882a593Smuzhiyun 236*4882a593SmuzhiyunThe output rectangle at the ipuX_csiY source pad is the same as 237*4882a593Smuzhiyunthe compose rectangle at the sink pad. So the source pad rectangle 238*4882a593Smuzhiyuncannot be negotiated, it must be set using the compose selection 239*4882a593SmuzhiyunAPI at sink pad (if /2 downscale is desired, otherwise source pad 240*4882a593Smuzhiyunrectangle is equal to incoming rectangle). 241*4882a593Smuzhiyun 242*4882a593SmuzhiyunTo give an example of crop and /2 downscale, this will crop a 243*4882a593Smuzhiyun1280x960 input frame to 640x480, and then /2 downscale in both 244*4882a593Smuzhiyundimensions to 320x240 (assumes ipu1_csi0 is linked to ipu1_csi0_mux): 245*4882a593Smuzhiyun 246*4882a593Smuzhiyun.. code-block:: none 247*4882a593Smuzhiyun 248*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0_mux':2[fmt:UYVY2X8/1280x960]" 249*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':0[crop:(0,0)/640x480]" 250*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':0[compose:(0,0)/320x240]" 251*4882a593Smuzhiyun 252*4882a593SmuzhiyunFrame Skipping in ipuX_csiY 253*4882a593Smuzhiyun--------------------------- 254*4882a593Smuzhiyun 255*4882a593SmuzhiyunThe CSI supports frame rate decimation, via frame skipping. Frame 256*4882a593Smuzhiyunrate decimation is specified by setting the frame intervals at 257*4882a593Smuzhiyunsink and source pads. The ipuX_csiY entity then applies the best 258*4882a593Smuzhiyunframe skip setting to the CSI to achieve the desired frame rate 259*4882a593Smuzhiyunat the source pad. 260*4882a593Smuzhiyun 261*4882a593SmuzhiyunThe following example reduces an assumed incoming 60 Hz frame 262*4882a593Smuzhiyunrate by half at the IDMAC output source pad: 263*4882a593Smuzhiyun 264*4882a593Smuzhiyun.. code-block:: none 265*4882a593Smuzhiyun 266*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':0[fmt:UYVY2X8/640x480@1/60]" 267*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':2[fmt:UYVY2X8/640x480@1/30]" 268*4882a593Smuzhiyun 269*4882a593SmuzhiyunFrame Interval Monitor in ipuX_csiY 270*4882a593Smuzhiyun----------------------------------- 271*4882a593Smuzhiyun 272*4882a593SmuzhiyunSee ref:`imx_api_FIM`. 273*4882a593Smuzhiyun 274*4882a593SmuzhiyunipuX_vdic 275*4882a593Smuzhiyun--------- 276*4882a593Smuzhiyun 277*4882a593SmuzhiyunThe VDIC carries out motion compensated de-interlacing, with three 278*4882a593Smuzhiyunmotion compensation modes: low, medium, and high motion. The mode is 279*4882a593Smuzhiyunspecified with the menu control V4L2_CID_DEINTERLACING_MODE. The VDIC 280*4882a593Smuzhiyunhas two sink pads and a single source pad. 281*4882a593Smuzhiyun 282*4882a593SmuzhiyunThe direct sink pad receives from an ipuX_csiY direct pad. With this 283*4882a593Smuzhiyunlink the VDIC can only operate in high motion mode. 284*4882a593Smuzhiyun 285*4882a593SmuzhiyunWhen the IDMAC sink pad is activated, it receives from an output 286*4882a593Smuzhiyunor mem2mem device node. With this pipeline, the VDIC can also operate 287*4882a593Smuzhiyunin low and medium modes, because these modes require receiving 288*4882a593Smuzhiyunframes from memory buffers. Note that an output or mem2mem device 289*4882a593Smuzhiyunis not implemented yet, so this sink pad currently has no links. 290*4882a593Smuzhiyun 291*4882a593SmuzhiyunThe source pad routes to the IC pre-processing entity ipuX_ic_prp. 292*4882a593Smuzhiyun 293*4882a593SmuzhiyunipuX_ic_prp 294*4882a593Smuzhiyun----------- 295*4882a593Smuzhiyun 296*4882a593SmuzhiyunThis is the IC pre-processing entity. It acts as a router, routing 297*4882a593Smuzhiyundata from its sink pad to one or both of its source pads. 298*4882a593Smuzhiyun 299*4882a593SmuzhiyunThis entity has a single sink pad. The sink pad can receive from the 300*4882a593SmuzhiyunipuX_csiY direct pad, or from ipuX_vdic. 301*4882a593Smuzhiyun 302*4882a593SmuzhiyunThis entity has two source pads. One source pad routes to the 303*4882a593Smuzhiyunpre-process encode task entity (ipuX_ic_prpenc), the other to the 304*4882a593Smuzhiyunpre-process viewfinder task entity (ipuX_ic_prpvf). Both source pads 305*4882a593Smuzhiyuncan be activated at the same time if the sink pad is receiving from 306*4882a593SmuzhiyunipuX_csiY. Only the source pad to the pre-process viewfinder task entity 307*4882a593Smuzhiyuncan be activated if the sink pad is receiving from ipuX_vdic (frames 308*4882a593Smuzhiyunfrom the VDIC can only be processed by the pre-process viewfinder task). 309*4882a593Smuzhiyun 310*4882a593SmuzhiyunipuX_ic_prpenc 311*4882a593Smuzhiyun-------------- 312*4882a593Smuzhiyun 313*4882a593SmuzhiyunThis is the IC pre-processing encode entity. It has a single sink 314*4882a593Smuzhiyunpad from ipuX_ic_prp, and a single source pad. The source pad is 315*4882a593Smuzhiyunrouted to a capture device node, with a node name of the format 316*4882a593Smuzhiyun"ipuX_ic_prpenc capture". 317*4882a593Smuzhiyun 318*4882a593SmuzhiyunThis entity performs the IC pre-process encode task operations: 319*4882a593Smuzhiyuncolor-space conversion, resizing (downscaling and upscaling), 320*4882a593Smuzhiyunhorizontal and vertical flip, and 90/270 degree rotation. Flip 321*4882a593Smuzhiyunand rotation are provided via standard V4L2 controls. 322*4882a593Smuzhiyun 323*4882a593SmuzhiyunLike the ipuX_csiY IDMAC source, this entity also supports simple 324*4882a593Smuzhiyunde-interlace without motion compensation, and pixel reordering. 325*4882a593Smuzhiyun 326*4882a593SmuzhiyunipuX_ic_prpvf 327*4882a593Smuzhiyun------------- 328*4882a593Smuzhiyun 329*4882a593SmuzhiyunThis is the IC pre-processing viewfinder entity. It has a single sink 330*4882a593Smuzhiyunpad from ipuX_ic_prp, and a single source pad. The source pad is routed 331*4882a593Smuzhiyunto a capture device node, with a node name of the format 332*4882a593Smuzhiyun"ipuX_ic_prpvf capture". 333*4882a593Smuzhiyun 334*4882a593SmuzhiyunThis entity is identical in operation to ipuX_ic_prpenc, with the same 335*4882a593Smuzhiyunresizing and CSC operations and flip/rotation controls. It will receive 336*4882a593Smuzhiyunand process de-interlaced frames from the ipuX_vdic if ipuX_ic_prp is 337*4882a593Smuzhiyunreceiving from ipuX_vdic. 338*4882a593Smuzhiyun 339*4882a593SmuzhiyunLike the ipuX_csiY IDMAC source, this entity supports simple 340*4882a593Smuzhiyuninterweaving without motion compensation. However, note that if the 341*4882a593SmuzhiyunipuX_vdic is included in the pipeline (ipuX_ic_prp is receiving from 342*4882a593SmuzhiyunipuX_vdic), it's not possible to use interweave in ipuX_ic_prpvf, 343*4882a593Smuzhiyunsince the ipuX_vdic has already carried out de-interlacing (with 344*4882a593Smuzhiyunmotion compensation) and therefore the field type output from 345*4882a593SmuzhiyunipuX_vdic can only be none (progressive). 346*4882a593Smuzhiyun 347*4882a593SmuzhiyunCapture Pipelines 348*4882a593Smuzhiyun----------------- 349*4882a593Smuzhiyun 350*4882a593SmuzhiyunThe following describe the various use-cases supported by the pipelines. 351*4882a593Smuzhiyun 352*4882a593SmuzhiyunThe links shown do not include the backend sensor, video mux, or mipi 353*4882a593Smuzhiyuncsi-2 receiver links. This depends on the type of sensor interface 354*4882a593Smuzhiyun(parallel or mipi csi-2). So these pipelines begin with: 355*4882a593Smuzhiyun 356*4882a593Smuzhiyunsensor -> ipuX_csiY_mux -> ... 357*4882a593Smuzhiyun 358*4882a593Smuzhiyunfor parallel sensors, or: 359*4882a593Smuzhiyun 360*4882a593Smuzhiyunsensor -> imx6-mipi-csi2 -> (ipuX_csiY_mux) -> ... 361*4882a593Smuzhiyun 362*4882a593Smuzhiyunfor mipi csi-2 sensors. The imx6-mipi-csi2 receiver may need to route 363*4882a593Smuzhiyunto the video mux (ipuX_csiY_mux) before sending to the CSI, depending 364*4882a593Smuzhiyunon the mipi csi-2 virtual channel, hence ipuX_csiY_mux is shown in 365*4882a593Smuzhiyunparenthesis. 366*4882a593Smuzhiyun 367*4882a593SmuzhiyunUnprocessed Video Capture: 368*4882a593Smuzhiyun-------------------------- 369*4882a593Smuzhiyun 370*4882a593SmuzhiyunSend frames directly from sensor to camera device interface node, with 371*4882a593Smuzhiyunno conversions, via ipuX_csiY IDMAC source pad: 372*4882a593Smuzhiyun 373*4882a593Smuzhiyun-> ipuX_csiY:2 -> ipuX_csiY capture 374*4882a593Smuzhiyun 375*4882a593SmuzhiyunIC Direct Conversions: 376*4882a593Smuzhiyun---------------------- 377*4882a593Smuzhiyun 378*4882a593SmuzhiyunThis pipeline uses the preprocess encode entity to route frames directly 379*4882a593Smuzhiyunfrom the CSI to the IC, to carry out scaling up to 1024x1024 resolution, 380*4882a593SmuzhiyunCSC, flipping, and image rotation: 381*4882a593Smuzhiyun 382*4882a593Smuzhiyun-> ipuX_csiY:1 -> 0:ipuX_ic_prp:1 -> 0:ipuX_ic_prpenc:1 -> ipuX_ic_prpenc capture 383*4882a593Smuzhiyun 384*4882a593SmuzhiyunMotion Compensated De-interlace: 385*4882a593Smuzhiyun-------------------------------- 386*4882a593Smuzhiyun 387*4882a593SmuzhiyunThis pipeline routes frames from the CSI direct pad to the VDIC entity to 388*4882a593Smuzhiyunsupport motion-compensated de-interlacing (high motion mode only), 389*4882a593Smuzhiyunscaling up to 1024x1024, CSC, flip, and rotation: 390*4882a593Smuzhiyun 391*4882a593Smuzhiyun-> ipuX_csiY:1 -> 0:ipuX_vdic:2 -> 0:ipuX_ic_prp:2 -> 0:ipuX_ic_prpvf:1 -> ipuX_ic_prpvf capture 392*4882a593Smuzhiyun 393*4882a593Smuzhiyun 394*4882a593SmuzhiyunUsage Notes 395*4882a593Smuzhiyun----------- 396*4882a593Smuzhiyun 397*4882a593SmuzhiyunTo aid in configuration and for backward compatibility with V4L2 398*4882a593Smuzhiyunapplications that access controls only from video device nodes, the 399*4882a593Smuzhiyuncapture device interfaces inherit controls from the active entities 400*4882a593Smuzhiyunin the current pipeline, so controls can be accessed either directly 401*4882a593Smuzhiyunfrom the subdev or from the active capture device interface. For 402*4882a593Smuzhiyunexample, the FIM controls are available either from the ipuX_csiY 403*4882a593Smuzhiyunsubdevs or from the active capture device. 404*4882a593Smuzhiyun 405*4882a593SmuzhiyunThe following are specific usage notes for the Sabre* reference 406*4882a593Smuzhiyunboards: 407*4882a593Smuzhiyun 408*4882a593Smuzhiyun 409*4882a593Smuzhiyuni.MX6Q SabreLite with OV5642 and OV5640 410*4882a593Smuzhiyun--------------------------------------- 411*4882a593Smuzhiyun 412*4882a593SmuzhiyunThis platform requires the OmniVision OV5642 module with a parallel 413*4882a593Smuzhiyuncamera interface, and the OV5640 module with a MIPI CSI-2 414*4882a593Smuzhiyuninterface. Both modules are available from Boundary Devices: 415*4882a593Smuzhiyun 416*4882a593Smuzhiyun- https://boundarydevices.com/product/nit6x_5mp 417*4882a593Smuzhiyun- https://boundarydevices.com/product/nit6x_5mp_mipi 418*4882a593Smuzhiyun 419*4882a593SmuzhiyunNote that if only one camera module is available, the other sensor 420*4882a593Smuzhiyunnode can be disabled in the device tree. 421*4882a593Smuzhiyun 422*4882a593SmuzhiyunThe OV5642 module is connected to the parallel bus input on the i.MX 423*4882a593Smuzhiyuninternal video mux to IPU1 CSI0. It's i2c bus connects to i2c bus 2. 424*4882a593Smuzhiyun 425*4882a593SmuzhiyunThe MIPI CSI-2 OV5640 module is connected to the i.MX internal MIPI CSI-2 426*4882a593Smuzhiyunreceiver, and the four virtual channel outputs from the receiver are 427*4882a593Smuzhiyunrouted as follows: vc0 to the IPU1 CSI0 mux, vc1 directly to IPU1 CSI1, 428*4882a593Smuzhiyunvc2 directly to IPU2 CSI0, and vc3 to the IPU2 CSI1 mux. The OV5640 is 429*4882a593Smuzhiyunalso connected to i2c bus 2 on the SabreLite, therefore the OV5642 and 430*4882a593SmuzhiyunOV5640 must not share the same i2c slave address. 431*4882a593Smuzhiyun 432*4882a593SmuzhiyunThe following basic example configures unprocessed video capture 433*4882a593Smuzhiyunpipelines for both sensors. The OV5642 is routed to ipu1_csi0, and 434*4882a593Smuzhiyunthe OV5640, transmitting on MIPI CSI-2 virtual channel 1 (which is 435*4882a593Smuzhiyunimx6-mipi-csi2 pad 2), is routed to ipu1_csi1. Both sensors are 436*4882a593Smuzhiyunconfigured to output 640x480, and the OV5642 outputs YUYV2X8, the 437*4882a593SmuzhiyunOV5640 UYVY2X8: 438*4882a593Smuzhiyun 439*4882a593Smuzhiyun.. code-block:: none 440*4882a593Smuzhiyun 441*4882a593Smuzhiyun # Setup links for OV5642 442*4882a593Smuzhiyun media-ctl -l "'ov5642 1-0042':0 -> 'ipu1_csi0_mux':1[1]" 443*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]" 444*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]" 445*4882a593Smuzhiyun # Setup links for OV5640 446*4882a593Smuzhiyun media-ctl -l "'ov5640 1-0040':0 -> 'imx6-mipi-csi2':0[1]" 447*4882a593Smuzhiyun media-ctl -l "'imx6-mipi-csi2':2 -> 'ipu1_csi1':0[1]" 448*4882a593Smuzhiyun media-ctl -l "'ipu1_csi1':2 -> 'ipu1_csi1 capture':0[1]" 449*4882a593Smuzhiyun # Configure pads for OV5642 pipeline 450*4882a593Smuzhiyun media-ctl -V "'ov5642 1-0042':0 [fmt:YUYV2X8/640x480 field:none]" 451*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0_mux':2 [fmt:YUYV2X8/640x480 field:none]" 452*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/640x480 field:none]" 453*4882a593Smuzhiyun # Configure pads for OV5640 pipeline 454*4882a593Smuzhiyun media-ctl -V "'ov5640 1-0040':0 [fmt:UYVY2X8/640x480 field:none]" 455*4882a593Smuzhiyun media-ctl -V "'imx6-mipi-csi2':2 [fmt:UYVY2X8/640x480 field:none]" 456*4882a593Smuzhiyun media-ctl -V "'ipu1_csi1':2 [fmt:AYUV32/640x480 field:none]" 457*4882a593Smuzhiyun 458*4882a593SmuzhiyunStreaming can then begin independently on the capture device nodes 459*4882a593Smuzhiyun"ipu1_csi0 capture" and "ipu1_csi1 capture". The v4l2-ctl tool can 460*4882a593Smuzhiyunbe used to select any supported YUV pixelformat on the capture device 461*4882a593Smuzhiyunnodes, including planar. 462*4882a593Smuzhiyun 463*4882a593Smuzhiyuni.MX6Q SabreAuto with ADV7180 decoder 464*4882a593Smuzhiyun------------------------------------- 465*4882a593Smuzhiyun 466*4882a593SmuzhiyunOn the i.MX6Q SabreAuto, an on-board ADV7180 SD decoder is connected to the 467*4882a593Smuzhiyunparallel bus input on the internal video mux to IPU1 CSI0. 468*4882a593Smuzhiyun 469*4882a593SmuzhiyunThe following example configures a pipeline to capture from the ADV7180 470*4882a593Smuzhiyunvideo decoder, assuming NTSC 720x480 input signals, using simple 471*4882a593Smuzhiyuninterweave (unconverted and without motion compensation). The adv7180 472*4882a593Smuzhiyunmust output sequential or alternating fields (field type 'seq-bt' for 473*4882a593SmuzhiyunNTSC, or 'alternate'): 474*4882a593Smuzhiyun 475*4882a593Smuzhiyun.. code-block:: none 476*4882a593Smuzhiyun 477*4882a593Smuzhiyun # Setup links 478*4882a593Smuzhiyun media-ctl -l "'adv7180 3-0021':0 -> 'ipu1_csi0_mux':1[1]" 479*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]" 480*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]" 481*4882a593Smuzhiyun # Configure pads 482*4882a593Smuzhiyun media-ctl -V "'adv7180 3-0021':0 [fmt:UYVY2X8/720x480 field:seq-bt]" 483*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x480]" 484*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]" 485*4882a593Smuzhiyun # Configure "ipu1_csi0 capture" interface (assumed at /dev/video4) 486*4882a593Smuzhiyun v4l2-ctl -d4 --set-fmt-video=field=interlaced_bt 487*4882a593Smuzhiyun 488*4882a593SmuzhiyunStreaming can then begin on /dev/video4. The v4l2-ctl tool can also be 489*4882a593Smuzhiyunused to select any supported YUV pixelformat on /dev/video4. 490*4882a593Smuzhiyun 491*4882a593SmuzhiyunThis example configures a pipeline to capture from the ADV7180 492*4882a593Smuzhiyunvideo decoder, assuming PAL 720x576 input signals, with Motion 493*4882a593SmuzhiyunCompensated de-interlacing. The adv7180 must output sequential or 494*4882a593Smuzhiyunalternating fields (field type 'seq-tb' for PAL, or 'alternate'). 495*4882a593Smuzhiyun 496*4882a593Smuzhiyun.. code-block:: none 497*4882a593Smuzhiyun 498*4882a593Smuzhiyun # Setup links 499*4882a593Smuzhiyun media-ctl -l "'adv7180 3-0021':0 -> 'ipu1_csi0_mux':1[1]" 500*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]" 501*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0':1 -> 'ipu1_vdic':0[1]" 502*4882a593Smuzhiyun media-ctl -l "'ipu1_vdic':2 -> 'ipu1_ic_prp':0[1]" 503*4882a593Smuzhiyun media-ctl -l "'ipu1_ic_prp':2 -> 'ipu1_ic_prpvf':0[1]" 504*4882a593Smuzhiyun media-ctl -l "'ipu1_ic_prpvf':1 -> 'ipu1_ic_prpvf capture':0[1]" 505*4882a593Smuzhiyun # Configure pads 506*4882a593Smuzhiyun media-ctl -V "'adv7180 3-0021':0 [fmt:UYVY2X8/720x576 field:seq-tb]" 507*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/720x576]" 508*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/720x576]" 509*4882a593Smuzhiyun media-ctl -V "'ipu1_vdic':2 [fmt:AYUV32/720x576 field:none]" 510*4882a593Smuzhiyun media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]" 511*4882a593Smuzhiyun media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]" 512*4882a593Smuzhiyun # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2) 513*4882a593Smuzhiyun v4l2-ctl -d2 --set-fmt-video=field=none 514*4882a593Smuzhiyun 515*4882a593SmuzhiyunStreaming can then begin on /dev/video2. The v4l2-ctl tool can also be 516*4882a593Smuzhiyunused to select any supported YUV pixelformat on /dev/video2. 517*4882a593Smuzhiyun 518*4882a593SmuzhiyunThis platform accepts Composite Video analog inputs to the ADV7180 on 519*4882a593SmuzhiyunAin1 (connector J42). 520*4882a593Smuzhiyun 521*4882a593Smuzhiyuni.MX6DL SabreAuto with ADV7180 decoder 522*4882a593Smuzhiyun-------------------------------------- 523*4882a593Smuzhiyun 524*4882a593SmuzhiyunOn the i.MX6DL SabreAuto, an on-board ADV7180 SD decoder is connected to the 525*4882a593Smuzhiyunparallel bus input on the internal video mux to IPU1 CSI0. 526*4882a593Smuzhiyun 527*4882a593SmuzhiyunThe following example configures a pipeline to capture from the ADV7180 528*4882a593Smuzhiyunvideo decoder, assuming NTSC 720x480 input signals, using simple 529*4882a593Smuzhiyuninterweave (unconverted and without motion compensation). The adv7180 530*4882a593Smuzhiyunmust output sequential or alternating fields (field type 'seq-bt' for 531*4882a593SmuzhiyunNTSC, or 'alternate'): 532*4882a593Smuzhiyun 533*4882a593Smuzhiyun.. code-block:: none 534*4882a593Smuzhiyun 535*4882a593Smuzhiyun # Setup links 536*4882a593Smuzhiyun media-ctl -l "'adv7180 4-0021':0 -> 'ipu1_csi0_mux':4[1]" 537*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0_mux':5 -> 'ipu1_csi0':0[1]" 538*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]" 539*4882a593Smuzhiyun # Configure pads 540*4882a593Smuzhiyun media-ctl -V "'adv7180 4-0021':0 [fmt:UYVY2X8/720x480 field:seq-bt]" 541*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0_mux':5 [fmt:UYVY2X8/720x480]" 542*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':2 [fmt:AYUV32/720x480]" 543*4882a593Smuzhiyun # Configure "ipu1_csi0 capture" interface (assumed at /dev/video0) 544*4882a593Smuzhiyun v4l2-ctl -d0 --set-fmt-video=field=interlaced_bt 545*4882a593Smuzhiyun 546*4882a593SmuzhiyunStreaming can then begin on /dev/video0. The v4l2-ctl tool can also be 547*4882a593Smuzhiyunused to select any supported YUV pixelformat on /dev/video0. 548*4882a593Smuzhiyun 549*4882a593SmuzhiyunThis example configures a pipeline to capture from the ADV7180 550*4882a593Smuzhiyunvideo decoder, assuming PAL 720x576 input signals, with Motion 551*4882a593SmuzhiyunCompensated de-interlacing. The adv7180 must output sequential or 552*4882a593Smuzhiyunalternating fields (field type 'seq-tb' for PAL, or 'alternate'). 553*4882a593Smuzhiyun 554*4882a593Smuzhiyun.. code-block:: none 555*4882a593Smuzhiyun 556*4882a593Smuzhiyun # Setup links 557*4882a593Smuzhiyun media-ctl -l "'adv7180 4-0021':0 -> 'ipu1_csi0_mux':4[1]" 558*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0_mux':5 -> 'ipu1_csi0':0[1]" 559*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0':1 -> 'ipu1_vdic':0[1]" 560*4882a593Smuzhiyun media-ctl -l "'ipu1_vdic':2 -> 'ipu1_ic_prp':0[1]" 561*4882a593Smuzhiyun media-ctl -l "'ipu1_ic_prp':2 -> 'ipu1_ic_prpvf':0[1]" 562*4882a593Smuzhiyun media-ctl -l "'ipu1_ic_prpvf':1 -> 'ipu1_ic_prpvf capture':0[1]" 563*4882a593Smuzhiyun # Configure pads 564*4882a593Smuzhiyun media-ctl -V "'adv7180 4-0021':0 [fmt:UYVY2X8/720x576 field:seq-tb]" 565*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0_mux':5 [fmt:UYVY2X8/720x576]" 566*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/720x576]" 567*4882a593Smuzhiyun media-ctl -V "'ipu1_vdic':2 [fmt:AYUV32/720x576 field:none]" 568*4882a593Smuzhiyun media-ctl -V "'ipu1_ic_prp':2 [fmt:AYUV32/720x576 field:none]" 569*4882a593Smuzhiyun media-ctl -V "'ipu1_ic_prpvf':1 [fmt:AYUV32/720x576 field:none]" 570*4882a593Smuzhiyun # Configure "ipu1_ic_prpvf capture" interface (assumed at /dev/video2) 571*4882a593Smuzhiyun v4l2-ctl -d2 --set-fmt-video=field=none 572*4882a593Smuzhiyun 573*4882a593SmuzhiyunStreaming can then begin on /dev/video2. The v4l2-ctl tool can also be 574*4882a593Smuzhiyunused to select any supported YUV pixelformat on /dev/video2. 575*4882a593Smuzhiyun 576*4882a593SmuzhiyunThis platform accepts Composite Video analog inputs to the ADV7180 on 577*4882a593SmuzhiyunAin1 (connector J42). 578*4882a593Smuzhiyun 579*4882a593Smuzhiyuni.MX6Q SabreSD with MIPI CSI-2 OV5640 580*4882a593Smuzhiyun------------------------------------- 581*4882a593Smuzhiyun 582*4882a593SmuzhiyunSimilarly to i.MX6Q SabreLite, the i.MX6Q SabreSD supports a parallel 583*4882a593Smuzhiyuninterface OV5642 module on IPU1 CSI0, and a MIPI CSI-2 OV5640 584*4882a593Smuzhiyunmodule. The OV5642 connects to i2c bus 1 and the OV5640 to i2c bus 2. 585*4882a593Smuzhiyun 586*4882a593SmuzhiyunThe device tree for SabreSD includes OF graphs for both the parallel 587*4882a593SmuzhiyunOV5642 and the MIPI CSI-2 OV5640, but as of this writing only the MIPI 588*4882a593SmuzhiyunCSI-2 OV5640 has been tested, so the OV5642 node is currently disabled. 589*4882a593SmuzhiyunThe OV5640 module connects to MIPI connector J5. The NXP part number 590*4882a593Smuzhiyunfor the OV5640 module that connects to the SabreSD board is H120729. 591*4882a593Smuzhiyun 592*4882a593SmuzhiyunThe following example configures unprocessed video capture pipeline to 593*4882a593Smuzhiyuncapture from the OV5640, transmitting on MIPI CSI-2 virtual channel 0: 594*4882a593Smuzhiyun 595*4882a593Smuzhiyun.. code-block:: none 596*4882a593Smuzhiyun 597*4882a593Smuzhiyun # Setup links 598*4882a593Smuzhiyun media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]" 599*4882a593Smuzhiyun media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]" 600*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]" 601*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0':2 -> 'ipu1_csi0 capture':0[1]" 602*4882a593Smuzhiyun # Configure pads 603*4882a593Smuzhiyun media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]" 604*4882a593Smuzhiyun media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]" 605*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0_mux':0 [fmt:UYVY2X8/640x480]" 606*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':0 [fmt:AYUV32/640x480]" 607*4882a593Smuzhiyun 608*4882a593SmuzhiyunStreaming can then begin on "ipu1_csi0 capture" node. The v4l2-ctl 609*4882a593Smuzhiyuntool can be used to select any supported pixelformat on the capture 610*4882a593Smuzhiyundevice node. 611*4882a593Smuzhiyun 612*4882a593SmuzhiyunTo determine what is the /dev/video node correspondent to 613*4882a593Smuzhiyun"ipu1_csi0 capture": 614*4882a593Smuzhiyun 615*4882a593Smuzhiyun.. code-block:: none 616*4882a593Smuzhiyun 617*4882a593Smuzhiyun media-ctl -e "ipu1_csi0 capture" 618*4882a593Smuzhiyun /dev/video0 619*4882a593Smuzhiyun 620*4882a593Smuzhiyun/dev/video0 is the streaming element in this case. 621*4882a593Smuzhiyun 622*4882a593SmuzhiyunStarting the streaming via v4l2-ctl: 623*4882a593Smuzhiyun 624*4882a593Smuzhiyun.. code-block:: none 625*4882a593Smuzhiyun 626*4882a593Smuzhiyun v4l2-ctl --stream-mmap -d /dev/video0 627*4882a593Smuzhiyun 628*4882a593SmuzhiyunStarting the streaming via Gstreamer and sending the content to the display: 629*4882a593Smuzhiyun 630*4882a593Smuzhiyun.. code-block:: none 631*4882a593Smuzhiyun 632*4882a593Smuzhiyun gst-launch-1.0 v4l2src device=/dev/video0 ! kmssink 633*4882a593Smuzhiyun 634*4882a593SmuzhiyunThe following example configures a direct conversion pipeline to capture 635*4882a593Smuzhiyunfrom the OV5640, transmitting on MIPI CSI-2 virtual channel 0. It also 636*4882a593Smuzhiyunshows colorspace conversion and scaling at IC output. 637*4882a593Smuzhiyun 638*4882a593Smuzhiyun.. code-block:: none 639*4882a593Smuzhiyun 640*4882a593Smuzhiyun # Setup links 641*4882a593Smuzhiyun media-ctl -l "'ov5640 1-003c':0 -> 'imx6-mipi-csi2':0[1]" 642*4882a593Smuzhiyun media-ctl -l "'imx6-mipi-csi2':1 -> 'ipu1_csi0_mux':0[1]" 643*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0_mux':2 -> 'ipu1_csi0':0[1]" 644*4882a593Smuzhiyun media-ctl -l "'ipu1_csi0':1 -> 'ipu1_ic_prp':0[1]" 645*4882a593Smuzhiyun media-ctl -l "'ipu1_ic_prp':1 -> 'ipu1_ic_prpenc':0[1]" 646*4882a593Smuzhiyun media-ctl -l "'ipu1_ic_prpenc':1 -> 'ipu1_ic_prpenc capture':0[1]" 647*4882a593Smuzhiyun # Configure pads 648*4882a593Smuzhiyun media-ctl -V "'ov5640 1-003c':0 [fmt:UYVY2X8/640x480]" 649*4882a593Smuzhiyun media-ctl -V "'imx6-mipi-csi2':1 [fmt:UYVY2X8/640x480]" 650*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0_mux':2 [fmt:UYVY2X8/640x480]" 651*4882a593Smuzhiyun media-ctl -V "'ipu1_csi0':1 [fmt:AYUV32/640x480]" 652*4882a593Smuzhiyun media-ctl -V "'ipu1_ic_prp':1 [fmt:AYUV32/640x480]" 653*4882a593Smuzhiyun media-ctl -V "'ipu1_ic_prpenc':1 [fmt:ARGB8888_1X32/800x600]" 654*4882a593Smuzhiyun # Set a format at the capture interface 655*4882a593Smuzhiyun v4l2-ctl -d /dev/video1 --set-fmt-video=pixelformat=RGB3 656*4882a593Smuzhiyun 657*4882a593SmuzhiyunStreaming can then begin on "ipu1_ic_prpenc capture" node. 658*4882a593Smuzhiyun 659*4882a593SmuzhiyunTo determine what is the /dev/video node correspondent to 660*4882a593Smuzhiyun"ipu1_ic_prpenc capture": 661*4882a593Smuzhiyun 662*4882a593Smuzhiyun.. code-block:: none 663*4882a593Smuzhiyun 664*4882a593Smuzhiyun media-ctl -e "ipu1_ic_prpenc capture" 665*4882a593Smuzhiyun /dev/video1 666*4882a593Smuzhiyun 667*4882a593Smuzhiyun 668*4882a593Smuzhiyun/dev/video1 is the streaming element in this case. 669*4882a593Smuzhiyun 670*4882a593SmuzhiyunStarting the streaming via v4l2-ctl: 671*4882a593Smuzhiyun 672*4882a593Smuzhiyun.. code-block:: none 673*4882a593Smuzhiyun 674*4882a593Smuzhiyun v4l2-ctl --stream-mmap -d /dev/video1 675*4882a593Smuzhiyun 676*4882a593SmuzhiyunStarting the streaming via Gstreamer and sending the content to the display: 677*4882a593Smuzhiyun 678*4882a593Smuzhiyun.. code-block:: none 679*4882a593Smuzhiyun 680*4882a593Smuzhiyun gst-launch-1.0 v4l2src device=/dev/video1 ! kmssink 681*4882a593Smuzhiyun 682*4882a593SmuzhiyunKnown Issues 683*4882a593Smuzhiyun------------ 684*4882a593Smuzhiyun 685*4882a593Smuzhiyun1. When using 90 or 270 degree rotation control at capture resolutions 686*4882a593Smuzhiyun near the IC resizer limit of 1024x1024, and combined with planar 687*4882a593Smuzhiyun pixel formats (YUV420, YUV422p), frame capture will often fail with 688*4882a593Smuzhiyun no end-of-frame interrupts from the IDMAC channel. To work around 689*4882a593Smuzhiyun this, use lower resolution and/or packed formats (YUYV, RGB3, etc.) 690*4882a593Smuzhiyun when 90 or 270 rotations are needed. 691*4882a593Smuzhiyun 692*4882a593Smuzhiyun 693*4882a593SmuzhiyunFile list 694*4882a593Smuzhiyun--------- 695*4882a593Smuzhiyun 696*4882a593Smuzhiyundrivers/staging/media/imx/ 697*4882a593Smuzhiyuninclude/media/imx.h 698*4882a593Smuzhiyuninclude/linux/imx-media.h 699*4882a593Smuzhiyun 700*4882a593SmuzhiyunReferences 701*4882a593Smuzhiyun---------- 702*4882a593Smuzhiyun 703*4882a593Smuzhiyun.. [#f1] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6DQRM.pdf 704*4882a593Smuzhiyun.. [#f2] http://www.nxp.com/assets/documents/data/en/reference-manuals/IMX6SDLRM.pdf 705*4882a593Smuzhiyun 706*4882a593Smuzhiyun 707*4882a593SmuzhiyunAuthors 708*4882a593Smuzhiyun------- 709*4882a593Smuzhiyun 710*4882a593Smuzhiyun- Steve Longerbeam <steve_longerbeam@mentor.com> 711*4882a593Smuzhiyun- Philipp Zabel <kernel@pengutronix.de> 712*4882a593Smuzhiyun- Russell King <linux@armlinux.org.uk> 713*4882a593Smuzhiyun 714*4882a593SmuzhiyunCopyright (C) 2012-2017 Mentor Graphics Inc. 715