video-interfaces.txt 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. Common bindings for video receiver and transmitter interfaces
  2. General concept
  3. ---------------
  4. Video data pipelines usually consist of external devices, e.g. camera sensors,
  5. controlled over an I2C, SPI or UART bus, and SoC internal IP blocks, including
  6. video DMA engines and video data processors.
  7. SoC internal blocks are described by DT nodes, placed similarly to other SoC
  8. blocks. External devices are represented as child nodes of their respective
  9. bus controller nodes, e.g. I2C.
  10. Data interfaces on all video devices are described by their child 'port' nodes.
  11. Configuration of a port depends on other devices participating in the data
  12. transfer and is described by 'endpoint' subnodes.
  13. device {
  14. ...
  15. ports {
  16. #address-cells = <1>;
  17. #size-cells = <0>;
  18. port@0 {
  19. ...
  20. endpoint@0 { ... };
  21. endpoint@1 { ... };
  22. };
  23. port@1 { ... };
  24. };
  25. };
  26. If a port can be configured to work with more than one remote device on the same
  27. bus, an 'endpoint' child node must be provided for each of them. If more than
  28. one port is present in a device node or there is more than one endpoint at a
  29. port, or port node needs to be associated with a selected hardware interface,
  30. a common scheme using '#address-cells', '#size-cells' and 'reg' properties is
  31. used.
  32. All 'port' nodes can be grouped under optional 'ports' node, which allows to
  33. specify #address-cells, #size-cells properties independently for the 'port'
  34. and 'endpoint' nodes and any child device nodes a device might have.
  35. Two 'endpoint' nodes are linked with each other through their 'remote-endpoint'
  36. phandles. An endpoint subnode of a device contains all properties needed for
  37. configuration of this device for data exchange with other device. In most
  38. cases properties at the peer 'endpoint' nodes will be identical, however they
  39. might need to be different when there is any signal modifications on the bus
  40. between two devices, e.g. there are logic signal inverters on the lines.
  41. It is allowed for multiple endpoints at a port to be active simultaneously,
  42. where supported by a device. For example, in case where a data interface of
  43. a device is partitioned into multiple data busses, e.g. 16-bit input port
  44. divided into two separate ITU-R BT.656 8-bit busses. In such case bus-width
  45. and data-shift properties can be used to assign physical data lines to each
  46. endpoint node (logical bus).
  47. Required properties
  48. -------------------
  49. If there is more than one 'port' or more than one 'endpoint' node or 'reg'
  50. property is present in port and/or endpoint nodes the following properties
  51. are required in a relevant parent node:
  52. - #address-cells : number of cells required to define port/endpoint
  53. identifier, should be 1.
  54. - #size-cells : should be zero.
  55. Optional endpoint properties
  56. ----------------------------
  57. - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
  58. - slave-mode: a boolean property indicating that the link is run in slave mode.
  59. The default when this property is not specified is master mode. In the slave
  60. mode horizontal and vertical synchronization signals are provided to the
  61. slave device (data source) by the master device (data sink). In the master
  62. mode the data source device is also the source of the synchronization signals.
  63. - bus-width: number of data lines actively used, valid for the parallel busses.
  64. - data-shift: on the parallel data busses, if bus-width is used to specify the
  65. number of data lines, data-shift can be used to specify which data lines are
  66. used, e.g. "bus-width=<8>; data-shift=<2>;" means, that lines 9:2 are used.
  67. - hsync-active: active state of the HSYNC signal, 0/1 for LOW/HIGH respectively.
  68. - vsync-active: active state of the VSYNC signal, 0/1 for LOW/HIGH respectively.
  69. Note, that if HSYNC and VSYNC polarities are not specified, embedded
  70. synchronization may be required, where supported.
  71. - data-active: similar to HSYNC and VSYNC, specifies data line polarity.
  72. - field-even-active: field signal level during the even field data transmission.
  73. - pclk-sample: sample data on rising (1) or falling (0) edge of the pixel clock
  74. signal.
  75. - sync-on-green-active: active state of Sync-on-green (SoG) signal, 0/1 for
  76. LOW/HIGH respectively.
  77. - data-lanes: an array of physical data lane indexes. Position of an entry
  78. determines the logical lane number, while the value of an entry indicates
  79. physical lane, e.g. for 2-lane MIPI CSI-2 bus we could have
  80. "data-lanes = <1 2>;", assuming the clock lane is on hardware lane 0.
  81. This property is valid for serial busses only (e.g. MIPI CSI-2).
  82. - clock-lanes: an array of physical clock lane indexes. Position of an entry
  83. determines the logical lane number, while the value of an entry indicates
  84. physical lane, e.g. for a MIPI CSI-2 bus we could have "clock-lanes = <0>;",
  85. which places the clock lane on hardware lane 0. This property is valid for
  86. serial busses only (e.g. MIPI CSI-2). Note that for the MIPI CSI-2 bus this
  87. array contains only one entry.
  88. - clock-noncontinuous: a boolean property to allow MIPI CSI-2 non-continuous
  89. clock mode.
  90. - link-frequencies: Allowed data bus frequencies. For MIPI CSI-2, for
  91. instance, this is the actual frequency of the bus, not bits per clock per
  92. lane value. An array of 64-bit unsigned integers.
  93. - lane-polarities: an array of polarities of the lanes starting from the clock
  94. lane and followed by the data lanes in the same order as in data-lanes.
  95. Valid values are 0 (normal) and 1 (inverted). The length of the array
  96. should be the combined length of data-lanes and clock-lanes properties.
  97. If the lane-polarities property is omitted, the value must be interpreted
  98. as 0 (normal). This property is valid for serial busses only.
  99. Example
  100. -------
  101. The example snippet below describes two data pipelines. ov772x and imx074 are
  102. camera sensors with a parallel and serial (MIPI CSI-2) video bus respectively.
  103. Both sensors are on the I2C control bus corresponding to the i2c0 controller
  104. node. ov772x sensor is linked directly to the ceu0 video host interface.
  105. imx074 is linked to ceu0 through the MIPI CSI-2 receiver (csi2). ceu0 has a
  106. (single) DMA engine writing captured data to memory. ceu0 node has a single
  107. 'port' node which may indicate that at any time only one of the following data
  108. pipelines can be active: ov772x -> ceu0 or imx074 -> csi2 -> ceu0.
  109. ceu0: ceu@0xfe910000 {
  110. compatible = "renesas,sh-mobile-ceu";
  111. reg = <0xfe910000 0xa0>;
  112. interrupts = <0x880>;
  113. mclk: master_clock {
  114. compatible = "renesas,ceu-clock";
  115. #clock-cells = <1>;
  116. clock-frequency = <50000000>; /* Max clock frequency */
  117. clock-output-names = "mclk";
  118. };
  119. port {
  120. #address-cells = <1>;
  121. #size-cells = <0>;
  122. /* Parallel bus endpoint */
  123. ceu0_1: endpoint@1 {
  124. reg = <1>; /* Local endpoint # */
  125. remote = <&ov772x_1_1>; /* Remote phandle */
  126. bus-width = <8>; /* Used data lines */
  127. data-shift = <2>; /* Lines 9:2 are used */
  128. /* If hsync-active/vsync-active are missing,
  129. embedded BT.656 sync is used */
  130. hsync-active = <0>; /* Active low */
  131. vsync-active = <0>; /* Active low */
  132. data-active = <1>; /* Active high */
  133. pclk-sample = <1>; /* Rising */
  134. };
  135. /* MIPI CSI-2 bus endpoint */
  136. ceu0_0: endpoint@0 {
  137. reg = <0>;
  138. remote = <&csi2_2>;
  139. };
  140. };
  141. };
  142. i2c0: i2c@0xfff20000 {
  143. ...
  144. ov772x_1: camera@0x21 {
  145. compatible = "ovti,ov772x";
  146. reg = <0x21>;
  147. vddio-supply = <&regulator1>;
  148. vddcore-supply = <&regulator2>;
  149. clock-frequency = <20000000>;
  150. clocks = <&mclk 0>;
  151. clock-names = "xclk";
  152. port {
  153. /* With 1 endpoint per port no need for addresses. */
  154. ov772x_1_1: endpoint {
  155. bus-width = <8>;
  156. remote-endpoint = <&ceu0_1>;
  157. hsync-active = <1>;
  158. vsync-active = <0>; /* Who came up with an
  159. inverter here ?... */
  160. data-active = <1>;
  161. pclk-sample = <1>;
  162. };
  163. };
  164. };
  165. imx074: camera@0x1a {
  166. compatible = "sony,imx074";
  167. reg = <0x1a>;
  168. vddio-supply = <&regulator1>;
  169. vddcore-supply = <&regulator2>;
  170. clock-frequency = <30000000>; /* Shared clock with ov772x_1 */
  171. clocks = <&mclk 0>;
  172. clock-names = "sysclk"; /* Assuming this is the
  173. name in the datasheet */
  174. port {
  175. imx074_1: endpoint {
  176. clock-lanes = <0>;
  177. data-lanes = <1 2>;
  178. remote-endpoint = <&csi2_1>;
  179. };
  180. };
  181. };
  182. };
  183. csi2: csi2@0xffc90000 {
  184. compatible = "renesas,sh-mobile-csi2";
  185. reg = <0xffc90000 0x1000>;
  186. interrupts = <0x17a0>;
  187. #address-cells = <1>;
  188. #size-cells = <0>;
  189. port@1 {
  190. compatible = "renesas,csi2c"; /* One of CSI2I and CSI2C. */
  191. reg = <1>; /* CSI-2 PHY #1 of 2: PHY_S,
  192. PHY_M has port address 0,
  193. is unused. */
  194. csi2_1: endpoint {
  195. clock-lanes = <0>;
  196. data-lanes = <2 1>;
  197. remote-endpoint = <&imx074_1>;
  198. };
  199. };
  200. port@2 {
  201. reg = <2>; /* port 2: link to the CEU */
  202. csi2_2: endpoint {
  203. remote-endpoint = <&ceu0_0>;
  204. };
  205. };
  206. };