imx7.rst 7.5 KB

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