407 lines · yaml
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)2%YAML 1.23---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 Devices8 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-array16 description:17 An array of phandles, each referring to a flash LED, a sub-node of the LED18 driver device node.19 20 lens-focus:21 $ref: /schemas/types.yaml#/definitions/phandle22 description:23 A phandle to the node of the focus lens controller.24 25 rotation:26 $ref: /schemas/types.yaml#/definitions/uint3227 enum: [ 0, 90, 180, 270 ]28 description: |29 The camera rotation is expressed as the angular difference in degrees30 between two reference systems, one relative to the camera module, and one31 defined on the external world scene to be captured when projected on the32 image sensor pixel array.33 34 A camera sensor has a 2-dimensional reference system 'Rc' defined by its35 pixel array read-out order. The origin is set to the first pixel being36 read out, the X-axis points along the column read-out direction towards37 the last columns, and the Y-axis along the row read-out direction towards38 the last row.39 40 A typical example for a sensor with a 2592x1944 pixel array matrix41 observed from the front is:42 43 2591 X-axis 044 <------------------------+ 045 .......... ... ..........!46 .......... ... ..........! Y-axis47 ... !48 .......... ... ..........!49 .......... ... ..........! 194350 V51 52 The external world scene reference system 'Rs' is a 2-dimensional53 reference system on the focal plane of the camera module. The origin is54 placed on the top-left corner of the visible scene, the X-axis points55 towards the right, and the Y-axis points towards the bottom of the scene.56 The top, bottom, left and right directions are intentionally not defined57 and depend on the environment in which the camera is used.58 59 A typical example of a (very common) picture of a shark swimming from left60 to right, as seen from the camera, is:61 62 0 X-axis63 0 +------------------------------------->64 !65 !66 !67 ! |\____)\___68 ! ) _____ __`<69 ! |/ )/70 !71 !72 !73 V74 Y-axis75 76 with the reference system 'Rs' placed on the camera focal plane:77 78 ¸.·˙!79 ¸.·˙ !80 _ ¸.·˙ !81 +-/ \-+¸.·˙ !82 | (o) | ! Camera focal plane83 +-----+˙·.¸ !84 ˙·.¸ !85 ˙·.¸ !86 ˙·.¸!87 88 When projected on the sensor's pixel array, the image and the associated89 reference system 'Rs' are typically (but not always) inverted, due to the90 camera module's lens optical inversion effect.91 92 Assuming the above represented scene of the swimming shark, the lens93 inversion projects the scene and its reference system onto the sensor94 pixel array, seen from the front of the camera sensor, as follows:95 96 Y-axis97 ^98 !99 !100 !101 ! |\_____)\__102 ! ) ____ ___.<103 ! |/ )/104 !105 !106 !107 0 +------------------------------------->108 0 X-axis109 110 Note the shark being upside-down.111 112 The resulting projected reference system is named 'Rp'.113 114 The camera rotation property is then defined as the angular difference in115 the counter-clockwise direction between the camera reference system 'Rc'116 and the projected scene reference system 'Rp'. It is expressed in degrees117 as a number in the range [0, 360[.118 119 Examples120 121 0 degrees camera rotation:122 123 124 Y-Rp125 ^126 Y-Rc !127 ^ !128 ! !129 ! !130 ! !131 ! !132 ! !133 ! !134 ! !135 ! 0 +------------------------------------->136 ! 0 X-Rp137 0 +------------------------------------->138 0 X-Rc139 140 141 X-Rc 0142 <------------------------------------+ 0143 X-Rp 0 !144 <------------------------------------+ 0 !145 ! !146 ! !147 ! !148 ! !149 ! !150 ! !151 ! !152 ! V153 ! Y-Rc154 V155 Y-Rp156 157 90 degrees camera rotation:158 159 0 Y-Rc160 0 +-------------------->161 ! Y-Rp162 ! ^163 ! !164 ! !165 ! !166 ! !167 ! !168 ! !169 ! !170 ! !171 ! !172 ! 0 +------------------------------------->173 ! 0 X-Rp174 !175 !176 !177 !178 V179 X-Rc180 181 180 degrees camera rotation:182 183 0184 <------------------------------------+ 0185 X-Rc !186 Y-Rp !187 ^ !188 ! !189 ! !190 ! !191 ! !192 ! !193 ! !194 ! V195 ! Y-Rc196 0 +------------------------------------->197 0 X-Rp198 199 270 degrees camera rotation:200 201 0 Y-Rc202 0 +-------------------->203 ! 0204 ! <-----------------------------------+ 0205 ! X-Rp !206 ! !207 ! !208 ! !209 ! !210 ! !211 ! !212 ! !213 ! !214 ! V215 ! Y-Rp216 !217 !218 !219 !220 V221 X-Rc222 223 224 Example one - Webcam225 226 A camera module installed on the user facing part of a laptop screen227 casing used for video calls. The captured images are meant to be displayed228 in landscape mode (width > height) on the laptop screen.229 230 The camera is typically mounted upside-down to compensate the lens optical231 inversion effect:232 233 Y-Rp234 Y-Rc ^235 ^ !236 ! !237 ! ! |\_____)\__238 ! ! ) ____ ___.<239 ! ! |/ )/240 ! !241 ! !242 ! !243 ! 0 +------------------------------------->244 ! 0 X-Rp245 0 +------------------------------------->246 0 X-Rc247 248 The two reference systems are aligned, the resulting camera rotation is249 0 degrees, no rotation correction needs to be applied to the resulting250 image once captured to memory buffers to correctly display it to users:251 252 +--------------------------------------+253 ! !254 ! !255 ! !256 ! |\____)\___ !257 ! ) _____ __`< !258 ! |/ )/ !259 ! !260 ! !261 ! !262 +--------------------------------------+263 264 If the camera sensor is not mounted upside-down to compensate for the lens265 optical inversion, the two reference systems will not be aligned, with266 'Rp' being rotated 180 degrees relatively to 'Rc':267 268 269 X-Rc 0270 <------------------------------------+ 0271 !272 Y-Rp !273 ^ !274 ! !275 ! |\_____)\__ !276 ! ) ____ ___.< !277 ! |/ )/ !278 ! !279 ! !280 ! V281 ! Y-Rc282 0 +------------------------------------->283 0 X-Rp284 285 The image once captured to memory will then be rotated by 180 degrees:286 287 +--------------------------------------+288 ! !289 ! !290 ! !291 ! __/(_____/| !292 ! >.___ ____ ( !293 ! \( \| !294 ! !295 ! !296 ! !297 +--------------------------------------+298 299 A software rotation correction of 180 degrees should be applied to300 correctly display the image:301 302 +--------------------------------------+303 ! !304 ! !305 ! !306 ! |\____)\___ !307 ! ) _____ __`< !308 ! |/ )/ !309 ! !310 ! !311 ! !312 +--------------------------------------+313 314 Example two - Phone camera315 316 A camera installed on the back side of a mobile device facing away from317 the user. The captured images are meant to be displayed in portrait mode318 (height > width) to match the device screen orientation and the device319 usage orientation used when taking the picture.320 321 The camera sensor is typically mounted with its pixel array longer side322 aligned to the device longer side, upside-down mounted to compensate for323 the lens optical inversion effect:324 325 0 Y-Rc326 0 +-------------------->327 ! Y-Rp328 ! ^329 ! !330 ! !331 ! !332 ! ! |\_____)\__333 ! ! ) ____ ___.<334 ! ! |/ )/335 ! !336 ! !337 ! !338 ! 0 +------------------------------------->339 ! 0 X-Rp340 !341 !342 !343 !344 V345 X-Rc346 347 The two reference systems are not aligned and the 'Rp' reference system is348 rotated by 90 degrees in the counter-clockwise direction relatively to the349 'Rc' reference system.350 351 The image once captured to memory will be rotated:352 353 +-------------------------------------+354 | _ _ |355 | \ / |356 | | | |357 | | | |358 | | > |359 | < | |360 | | | |361 | . |362 | V |363 +-------------------------------------+364 365 A correction of 90 degrees in counter-clockwise direction has to be366 applied to correctly display the image in portrait mode on the device367 screen:368 369 +--------------------+370 | |371 | |372 | |373 | |374 | |375 | |376 | |\____)\___ |377 | ) _____ __`< |378 | |/ )/ |379 | |380 | |381 | |382 | |383 | |384 +--------------------+385 386 orientation:387 description:388 The orientation of a device (typically an image sensor or a flash LED)389 describing its mounting position relative to the usage orientation of the390 system where the device is installed on.391 $ref: /schemas/types.yaml#/definitions/uint32392 enum:393 # Front. The device is mounted on the front facing side of the system. For394 # mobile devices such as smartphones, tablets and laptops the front side395 # is the user facing side.396 - 0397 # Back. The device is mounted on the back side of the system, which is398 # defined as the opposite side of the front facing one.399 - 1400 # External. The device is not attached directly to the system but is401 # attached in a way that allows it to move freely.402 - 2403 404additionalProperties: true405 406...407