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