Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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 Y-Rp
132 ^
133 Y-Rc !
134 ^ !
135 ! !
136 ! !
137 ! !
138 ! !
139 ! !
140 ! !
141 ! !
142 ! 0 +------------------------------------->
143 ! 0 X-Rp
144 0 +------------------------------------->
145 0 X-Rc
146
147 X-Rc 0
148 <------------------------------------+ 0
149 X-Rp 0 !
150 <------------------------------------+ 0 !
151 ! !
152 ! !
153 ! !
154 ! !
155 ! !
156 ! !
157 ! !
158 ! V
159 ! Y-Rc
160 V
161 Y-Rp
162
163 90 degrees camera rotation:
164
165 0 Y-Rc
166 0 +-------------------->
167 ! Y-Rp
168 ! ^
169 ! !
170 ! !
171 ! !
172 ! !
173 ! !
174 ! !
175 ! !
176 ! !
177 ! !
178 ! 0 +------------------------------------->
179 ! 0 X-Rp
180 !
181 !
182 !
183 !
184 V
185 X-Rc
186
187 180 degrees camera rotation:
188
189 0
190 <------------------------------------+ 0
191 X-Rc !
192 Y-Rp !
193 ^ !
194 ! !
195 ! !
196 ! !
197 ! !
198 ! !
199 ! !
200 ! V
201 ! Y-Rc
202 0 +------------------------------------->
203 0 X-Rp
204
205 270 degrees camera rotation:
206
207 0 Y-Rc
208 0 +-------------------->
209 ! 0
210 ! <-----------------------------------+ 0
211 ! X-Rp !
212 ! !
213 ! !
214 ! !
215 ! !
216 ! !
217 ! !
218 ! !
219 ! !
220 ! V
221 ! Y-Rp
222 !
223 !
224 !
225 !
226 V
227 X-Rc
228
229 Example one - Webcam
230
231 A camera module installed on the user facing part of a laptop screen
232 casing used for video calls. The captured images are meant to be displayed
233 in landscape mode (width > height) on the laptop screen.
234
235 The camera is typically mounted upside-down to compensate the lens optical
236 inversion effect:
237
238 Y-Rp
239 Y-Rc ^
240 ^ !
241 ! !
242 ! ! |\_____)\__
243 ! ! ) ____ ___.<
244 ! ! |/ )/
245 ! !
246 ! !
247 ! !
248 ! 0 +------------------------------------->
249 ! 0 X-Rp
250 0 +------------------------------------->
251 0 X-Rc
252
253 The two reference systems are aligned, the resulting camera rotation is
254 0 degrees, no rotation correction needs to be applied to the resulting
255 image once captured to memory buffers to correctly display it to users:
256
257 +--------------------------------------+
258 ! !
259 ! !
260 ! !
261 ! |\____)\___ !
262 ! ) _____ __`< !
263 ! |/ )/ !
264 ! !
265 ! !
266 ! !
267 +--------------------------------------+
268
269 If the camera sensor is not mounted upside-down to compensate for the lens
270 optical inversion, the two reference systems will not be aligned, with
271 'Rp' being rotated 180 degrees relatively to 'Rc':
272
273 X-Rc 0
274 <------------------------------------+ 0
275 !
276 Y-Rp !
277 ^ !
278 ! !
279 ! |\_____)\__ !
280 ! ) ____ ___.< !
281 ! |/ )/ !
282 ! !
283 ! !
284 ! V
285 ! Y-Rc
286 0 +------------------------------------->
287 0 X-Rp
288
289 The image once captured to memory will then be rotated by 180 degrees:
290
291 +--------------------------------------+
292 ! !
293 ! !
294 ! !
295 ! __/(_____/| !
296 ! >.___ ____ ( !
297 ! \( \| !
298 ! !
299 ! !
300 ! !
301 +--------------------------------------+
302
303 A software rotation correction of 180 degrees should be applied to
304 correctly display the image:
305
306 +--------------------------------------+
307 ! !
308 ! !
309 ! !
310 ! |\____)\___ !
311 ! ) _____ __`< !
312 ! |/ )/ !
313 ! !
314 ! !
315 ! !
316 +--------------------------------------+
317
318 Example two - Phone camera
319
320 A camera installed on the back side of a mobile device facing away from
321 the user. The captured images are meant to be displayed in portrait mode
322 (height > width) to match the device screen orientation and the device
323 usage orientation used when taking the picture.
324
325 The camera sensor is typically mounted with its pixel array longer side
326 aligned to the device longer side, upside-down mounted to compensate for
327 the lens optical inversion effect:
328
329 0 Y-Rc
330 0 +-------------------->
331 ! Y-Rp
332 ! ^
333 ! !
334 ! !
335 ! !
336 ! ! |\_____)\__
337 ! ! ) ____ ___.<
338 ! ! |/ )/
339 ! !
340 ! !
341 ! !
342 ! 0 +------------------------------------->
343 ! 0 X-Rp
344 !
345 !
346 !
347 !
348 V
349 X-Rc
350
351 The two reference systems are not aligned and the 'Rp' reference system is
352 rotated by 90 degrees in the counter-clockwise direction relatively to the
353 'Rc' reference system.
354
355 The image once captured to memory will be rotated:
356
357 +-------------------------------------+
358 | _ _ |
359 | \ / |
360 | | | |
361 | | | |
362 | | > |
363 | < | |
364 | | | |
365 | . |
366 | V |
367 +-------------------------------------+
368
369 A correction of 90 degrees in counter-clockwise direction has to be
370 applied to correctly display the image in portrait mode on the device
371 screen:
372
373 +--------------------+
374 | |
375 | |
376 | |
377 | |
378 | |
379 | |
380 | |\____)\___ |
381 | ) _____ __`< |
382 | |/ )/ |
383 | |
384 | |
385 | |
386 | |
387 | |
388 +--------------------+
389
390 orientation:
391 description:
392 The orientation of a device (typically an image sensor or a flash LED)
393 describing its mounting position relative to the usage orientation of the
394 system where the device is installed on.
395 $ref: /schemas/types.yaml#/definitions/uint32
396 enum:
397 # Front. The device is mounted on the front facing side of the system. For
398 # mobile devices such as smartphones, tablets and laptops the front side
399 # is the user facing side.
400 - 0
401 # Back. The device is mounted on the back side of the system, which is
402 # defined as the opposite side of the front facing one.
403 - 1
404 # External. The device is not attached directly to the system but is
405 # attached in a way that allows it to move freely.
406 - 2
407
408additionalProperties: true
409
410...