video-interface-devices.yaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/media/video-interface-devices.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: Common Properties for Video Receiver and Transmitter Devices
  7. maintainers:
  8. - Jacopo Mondi <jacopo@jmondi.org>
  9. - Sakari Ailus <sakari.ailus@linux.intel.com>
  10. properties:
  11. flash-leds:
  12. $ref: /schemas/types.yaml#/definitions/phandle-array
  13. description:
  14. An array of phandles, each referring to a flash LED, a sub-node of the LED
  15. driver device node.
  16. lens-focus:
  17. $ref: /schemas/types.yaml#/definitions/phandle
  18. description:
  19. A phandle to the node of the focus lens controller.
  20. rotation:
  21. $ref: /schemas/types.yaml#/definitions/uint32
  22. enum: [ 0, 90, 180, 270 ]
  23. description: |
  24. The camera rotation is expressed as the angular difference in degrees
  25. between two reference systems, one relative to the camera module, and one
  26. defined on the external world scene to be captured when projected on the
  27. image sensor pixel array.
  28. A camera sensor has a 2-dimensional reference system 'Rc' defined by its
  29. pixel array read-out order. The origin is set to the first pixel being
  30. read out, the X-axis points along the column read-out direction towards
  31. the last columns, and the Y-axis along the row read-out direction towards
  32. the last row.
  33. A typical example for a sensor with a 2592x1944 pixel array matrix
  34. observed from the front is:
  35. 2591 X-axis 0
  36. <------------------------+ 0
  37. .......... ... ..........!
  38. .......... ... ..........! Y-axis
  39. ... !
  40. .......... ... ..........!
  41. .......... ... ..........! 1943
  42. V
  43. The external world scene reference system 'Rs' is a 2-dimensional
  44. reference system on the focal plane of the camera module. The origin is
  45. placed on the top-left corner of the visible scene, the X-axis points
  46. towards the right, and the Y-axis points towards the bottom of the scene.
  47. The top, bottom, left and right directions are intentionally not defined
  48. and depend on the environment in which the camera is used.
  49. A typical example of a (very common) picture of a shark swimming from left
  50. to right, as seen from the camera, is:
  51. 0 X-axis
  52. 0 +------------------------------------->
  53. !
  54. !
  55. !
  56. ! |\____)\___
  57. ! ) _____ __`<
  58. ! |/ )/
  59. !
  60. !
  61. !
  62. V
  63. Y-axis
  64. with the reference system 'Rs' placed on the camera focal plane:
  65. ¸.·˙!
  66. ¸.·˙ !
  67. _ ¸.·˙ !
  68. +-/ \-+¸.·˙ !
  69. | (o) | ! Camera focal plane
  70. +-----+˙·.¸ !
  71. ˙·.¸ !
  72. ˙·.¸ !
  73. ˙·.¸!
  74. When projected on the sensor's pixel array, the image and the associated
  75. reference system 'Rs' are typically (but not always) inverted, due to the
  76. camera module's lens optical inversion effect.
  77. Assuming the above represented scene of the swimming shark, the lens
  78. inversion projects the scene and its reference system onto the sensor
  79. pixel array, seen from the front of the camera sensor, as follows:
  80. Y-axis
  81. ^
  82. !
  83. !
  84. !
  85. ! |\_____)\__
  86. ! ) ____ ___.<
  87. ! |/ )/
  88. !
  89. !
  90. !
  91. 0 +------------------------------------->
  92. 0 X-axis
  93. Note the shark being upside-down.
  94. The resulting projected reference system is named 'Rp'.
  95. The camera rotation property is then defined as the angular difference in
  96. the counter-clockwise direction between the camera reference system 'Rc'
  97. and the projected scene reference system 'Rp'. It is expressed in degrees
  98. as a number in the range [0, 360[.
  99. Examples
  100. 0 degrees camera rotation:
  101. Y-Rp
  102. ^
  103. Y-Rc !
  104. ^ !
  105. ! !
  106. ! !
  107. ! !
  108. ! !
  109. ! !
  110. ! !
  111. ! !
  112. ! 0 +------------------------------------->
  113. ! 0 X-Rp
  114. 0 +------------------------------------->
  115. 0 X-Rc
  116. X-Rc 0
  117. <------------------------------------+ 0
  118. X-Rp 0 !
  119. <------------------------------------+ 0 !
  120. ! !
  121. ! !
  122. ! !
  123. ! !
  124. ! !
  125. ! !
  126. ! !
  127. ! V
  128. ! Y-Rc
  129. V
  130. Y-Rp
  131. 90 degrees camera rotation:
  132. 0 Y-Rc
  133. 0 +-------------------->
  134. ! Y-Rp
  135. ! ^
  136. ! !
  137. ! !
  138. ! !
  139. ! !
  140. ! !
  141. ! !
  142. ! !
  143. ! !
  144. ! !
  145. ! 0 +------------------------------------->
  146. ! 0 X-Rp
  147. !
  148. !
  149. !
  150. !
  151. V
  152. X-Rc
  153. 180 degrees camera rotation:
  154. 0
  155. <------------------------------------+ 0
  156. X-Rc !
  157. Y-Rp !
  158. ^ !
  159. ! !
  160. ! !
  161. ! !
  162. ! !
  163. ! !
  164. ! !
  165. ! V
  166. ! Y-Rc
  167. 0 +------------------------------------->
  168. 0 X-Rp
  169. 270 degrees camera rotation:
  170. 0 Y-Rc
  171. 0 +-------------------->
  172. ! 0
  173. ! <-----------------------------------+ 0
  174. ! X-Rp !
  175. ! !
  176. ! !
  177. ! !
  178. ! !
  179. ! !
  180. ! !
  181. ! !
  182. ! !
  183. ! V
  184. ! Y-Rp
  185. !
  186. !
  187. !
  188. !
  189. V
  190. X-Rc
  191. Example one - Webcam
  192. A camera module installed on the user facing part of a laptop screen
  193. casing used for video calls. The captured images are meant to be displayed
  194. in landscape mode (width > height) on the laptop screen.
  195. The camera is typically mounted upside-down to compensate the lens optical
  196. inversion effect:
  197. Y-Rp
  198. Y-Rc ^
  199. ^ !
  200. ! !
  201. ! ! |\_____)\__
  202. ! ! ) ____ ___.<
  203. ! ! |/ )/
  204. ! !
  205. ! !
  206. ! !
  207. ! 0 +------------------------------------->
  208. ! 0 X-Rp
  209. 0 +------------------------------------->
  210. 0 X-Rc
  211. The two reference systems are aligned, the resulting camera rotation is
  212. 0 degrees, no rotation correction needs to be applied to the resulting
  213. image once captured to memory buffers to correctly display it to users:
  214. +--------------------------------------+
  215. ! !
  216. ! !
  217. ! !
  218. ! |\____)\___ !
  219. ! ) _____ __`< !
  220. ! |/ )/ !
  221. ! !
  222. ! !
  223. ! !
  224. +--------------------------------------+
  225. If the camera sensor is not mounted upside-down to compensate for the lens
  226. optical inversion, the two reference systems will not be aligned, with
  227. 'Rp' being rotated 180 degrees relatively to 'Rc':
  228. X-Rc 0
  229. <------------------------------------+ 0
  230. !
  231. Y-Rp !
  232. ^ !
  233. ! !
  234. ! |\_____)\__ !
  235. ! ) ____ ___.< !
  236. ! |/ )/ !
  237. ! !
  238. ! !
  239. ! V
  240. ! Y-Rc
  241. 0 +------------------------------------->
  242. 0 X-Rp
  243. The image once captured to memory will then be rotated by 180 degrees:
  244. +--------------------------------------+
  245. ! !
  246. ! !
  247. ! !
  248. ! __/(_____/| !
  249. ! >.___ ____ ( !
  250. ! \( \| !
  251. ! !
  252. ! !
  253. ! !
  254. +--------------------------------------+
  255. A software rotation correction of 180 degrees should be applied to
  256. correctly display the image:
  257. +--------------------------------------+
  258. ! !
  259. ! !
  260. ! !
  261. ! |\____)\___ !
  262. ! ) _____ __`< !
  263. ! |/ )/ !
  264. ! !
  265. ! !
  266. ! !
  267. +--------------------------------------+
  268. Example two - Phone camera
  269. A camera installed on the back side of a mobile device facing away from
  270. the user. The captured images are meant to be displayed in portrait mode
  271. (height > width) to match the device screen orientation and the device
  272. usage orientation used when taking the picture.
  273. The camera sensor is typically mounted with its pixel array longer side
  274. aligned to the device longer side, upside-down mounted to compensate for
  275. the lens optical inversion effect:
  276. 0 Y-Rc
  277. 0 +-------------------->
  278. ! Y-Rp
  279. ! ^
  280. ! !
  281. ! !
  282. ! !
  283. ! ! |\_____)\__
  284. ! ! ) ____ ___.<
  285. ! ! |/ )/
  286. ! !
  287. ! !
  288. ! !
  289. ! 0 +------------------------------------->
  290. ! 0 X-Rp
  291. !
  292. !
  293. !
  294. !
  295. V
  296. X-Rc
  297. The two reference systems are not aligned and the 'Rp' reference system is
  298. rotated by 90 degrees in the counter-clockwise direction relatively to the
  299. 'Rc' reference system.
  300. The image once captured to memory will be rotated:
  301. +-------------------------------------+
  302. | _ _ |
  303. | \ / |
  304. | | | |
  305. | | | |
  306. | | > |
  307. | < | |
  308. | | | |
  309. | . |
  310. | V |
  311. +-------------------------------------+
  312. A correction of 90 degrees in counter-clockwise direction has to be
  313. applied to correctly display the image in portrait mode on the device
  314. screen:
  315. +--------------------+
  316. | |
  317. | |
  318. | |
  319. | |
  320. | |
  321. | |
  322. | |\____)\___ |
  323. | ) _____ __`< |
  324. | |/ )/ |
  325. | |
  326. | |
  327. | |
  328. | |
  329. | |
  330. +--------------------+
  331. orientation:
  332. description:
  333. The orientation of a device (typically an image sensor or a flash LED)
  334. describing its mounting position relative to the usage orientation of the
  335. system where the device is installed on.
  336. $ref: /schemas/types.yaml#/definitions/uint32
  337. enum:
  338. # Front. The device is mounted on the front facing side of the system. For
  339. # mobile devices such as smartphones, tablets and laptops the front side
  340. # is the user facing side.
  341. - 0
  342. # Back. The device is mounted on the back side of the system, which is
  343. # defined as the opposite side of the front facing one.
  344. - 1
  345. # External. The device is not attached directly to the system but is
  346. # attached in a way that allows it to move freely.
  347. - 2
  348. additionalProperties: true
  349. ...