forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/Documentation/devicetree/bindings/media/video-interfaces.txt
....@@ -85,10 +85,374 @@
8585
8686 - lens-focus: A phandle to the node of the focus lens controller.
8787
88
-- rotation: The device, typically an image sensor, is not mounted upright,
89
- but a number of degrees counter clockwise. Typical values are 0 and 180
90
- (upside down).
88
+- rotation: The camera rotation is expressed as the angular difference in
89
+ degrees between two reference systems, one relative to the camera module, and
90
+ one defined on the external world scene to be captured when projected on the
91
+ image sensor pixel array.
9192
93
+ A camera sensor has a 2-dimensional reference system 'Rc' defined by
94
+ its pixel array read-out order. The origin is set to the first pixel
95
+ being read out, the X-axis points along the column read-out direction
96
+ towards the last columns, and the Y-axis along the row read-out
97
+ direction towards the last row.
98
+
99
+ A typical example for a sensor with a 2592x1944 pixel array matrix
100
+ observed from the front is:
101
+
102
+ 2591 X-axis 0
103
+ <------------------------+ 0
104
+ .......... ... ..........!
105
+ .......... ... ..........! Y-axis
106
+ ... !
107
+ .......... ... ..........!
108
+ .......... ... ..........! 1943
109
+ V
110
+
111
+ The external world scene reference system 'Rs' is a 2-dimensional
112
+ reference system on the focal plane of the camera module. The origin is
113
+ placed on the top-left corner of the visible scene, the X-axis points
114
+ towards the right, and the Y-axis points towards the bottom of the
115
+ scene. The top, bottom, left and right directions are intentionally not
116
+ defined and depend on the environment in which the camera is used.
117
+
118
+ A typical example of a (very common) picture of a shark swimming from
119
+ left to right, as seen from the camera, is:
120
+
121
+ 0 X-axis
122
+ 0 +------------------------------------->
123
+ !
124
+ !
125
+ !
126
+ ! |\____)\___
127
+ ! ) _____ __`<
128
+ ! |/ )/
129
+ !
130
+ !
131
+ !
132
+ V
133
+ Y-axis
134
+
135
+ with the reference system 'Rs' placed on the camera focal plane:
136
+
137
+ ¸.·˙!
138
+ ¸.·˙ !
139
+ _ ¸.·˙ !
140
+ +-/ \-+¸.·˙ !
141
+ | (o) | ! Camera focal plane
142
+ +-----+˙·.¸ !
143
+ ˙·.¸ !
144
+ ˙·.¸ !
145
+ ˙·.¸!
146
+
147
+ When projected on the sensor's pixel array, the image and the associated
148
+ reference system 'Rs' are typically (but not always) inverted, due to
149
+ the camera module's lens optical inversion effect.
150
+
151
+ Assuming the above represented scene of the swimming shark, the lens
152
+ inversion projects the scene and its reference system onto the sensor
153
+ pixel array, seen from the front of the camera sensor, as follows:
154
+
155
+ Y-axis
156
+ ^
157
+ !
158
+ !
159
+ !
160
+ ! |\_____)\__
161
+ ! ) ____ ___.<
162
+ ! |/ )/
163
+ !
164
+ !
165
+ !
166
+ 0 +------------------------------------->
167
+ 0 X-axis
168
+
169
+ Note the shark being upside-down.
170
+
171
+ The resulting projected reference system is named 'Rp'.
172
+
173
+ The camera rotation property is then defined as the angular difference
174
+ in the counter-clockwise direction between the camera reference system
175
+ 'Rc' and the projected scene reference system 'Rp'. It is expressed in
176
+ degrees as a number in the range [0, 360[.
177
+
178
+ Examples
179
+
180
+ 0 degrees camera rotation:
181
+
182
+
183
+ Y-Rp
184
+ ^
185
+ Y-Rc !
186
+ ^ !
187
+ ! !
188
+ ! !
189
+ ! !
190
+ ! !
191
+ ! !
192
+ ! !
193
+ ! !
194
+ ! 0 +------------------------------------->
195
+ ! 0 X-Rp
196
+ 0 +------------------------------------->
197
+ 0 X-Rc
198
+
199
+
200
+ X-Rc 0
201
+ <------------------------------------+ 0
202
+ X-Rp 0 !
203
+ <------------------------------------+ 0 !
204
+ ! !
205
+ ! !
206
+ ! !
207
+ ! !
208
+ ! !
209
+ ! !
210
+ ! !
211
+ ! V
212
+ ! Y-Rc
213
+ V
214
+ Y-Rp
215
+
216
+ 90 degrees camera rotation:
217
+
218
+ 0 Y-Rc
219
+ 0 +-------------------->
220
+ ! Y-Rp
221
+ ! ^
222
+ ! !
223
+ ! !
224
+ ! !
225
+ ! !
226
+ ! !
227
+ ! !
228
+ ! !
229
+ ! !
230
+ ! !
231
+ ! 0 +------------------------------------->
232
+ ! 0 X-Rp
233
+ !
234
+ !
235
+ !
236
+ !
237
+ V
238
+ X-Rc
239
+
240
+ 180 degrees camera rotation:
241
+
242
+ 0
243
+ <------------------------------------+ 0
244
+ X-Rc !
245
+ Y-Rp !
246
+ ^ !
247
+ ! !
248
+ ! !
249
+ ! !
250
+ ! !
251
+ ! !
252
+ ! !
253
+ ! V
254
+ ! Y-Rc
255
+ 0 +------------------------------------->
256
+ 0 X-Rp
257
+
258
+ 270 degrees camera rotation:
259
+
260
+ 0 Y-Rc
261
+ 0 +-------------------->
262
+ ! 0
263
+ ! <-----------------------------------+ 0
264
+ ! X-Rp !
265
+ ! !
266
+ ! !
267
+ ! !
268
+ ! !
269
+ ! !
270
+ ! !
271
+ ! !
272
+ ! !
273
+ ! V
274
+ ! Y-Rp
275
+ !
276
+ !
277
+ !
278
+ !
279
+ V
280
+ X-Rc
281
+
282
+
283
+ Example one - Webcam
284
+
285
+ A camera module installed on the user facing part of a laptop screen
286
+ casing used for video calls. The captured images are meant to be
287
+ displayed in landscape mode (width > height) on the laptop screen.
288
+
289
+ The camera is typically mounted upside-down to compensate the lens
290
+ optical inversion effect:
291
+
292
+ Y-Rp
293
+ Y-Rc ^
294
+ ^ !
295
+ ! !
296
+ ! ! |\_____)\__
297
+ ! ! ) ____ ___.<
298
+ ! ! |/ )/
299
+ ! !
300
+ ! !
301
+ ! !
302
+ ! 0 +------------------------------------->
303
+ ! 0 X-Rp
304
+ 0 +------------------------------------->
305
+ 0 X-Rc
306
+
307
+ The two reference systems are aligned, the resulting camera rotation is
308
+ 0 degrees, no rotation correction needs to be applied to the resulting
309
+ image once captured to memory buffers to correctly display it to users:
310
+
311
+ +--------------------------------------+
312
+ ! !
313
+ ! !
314
+ ! !
315
+ ! |\____)\___ !
316
+ ! ) _____ __`< !
317
+ ! |/ )/ !
318
+ ! !
319
+ ! !
320
+ ! !
321
+ +--------------------------------------+
322
+
323
+ If the camera sensor is not mounted upside-down to compensate for the
324
+ lens optical inversion, the two reference systems will not be aligned,
325
+ with 'Rp' being rotated 180 degrees relatively to 'Rc':
326
+
327
+
328
+ X-Rc 0
329
+ <------------------------------------+ 0
330
+ !
331
+ Y-Rp !
332
+ ^ !
333
+ ! !
334
+ ! |\_____)\__ !
335
+ ! ) ____ ___.< !
336
+ ! |/ )/ !
337
+ ! !
338
+ ! !
339
+ ! V
340
+ ! Y-Rc
341
+ 0 +------------------------------------->
342
+ 0 X-Rp
343
+
344
+ The image once captured to memory will then be rotated by 180 degrees:
345
+
346
+ +--------------------------------------+
347
+ ! !
348
+ ! !
349
+ ! !
350
+ ! __/(_____/| !
351
+ ! >.___ ____ ( !
352
+ ! \( \| !
353
+ ! !
354
+ ! !
355
+ ! !
356
+ +--------------------------------------+
357
+
358
+ A software rotation correction of 180 degrees should be applied to
359
+ correctly display the image:
360
+
361
+ +--------------------------------------+
362
+ ! !
363
+ ! !
364
+ ! !
365
+ ! |\____)\___ !
366
+ ! ) _____ __`< !
367
+ ! |/ )/ !
368
+ ! !
369
+ ! !
370
+ ! !
371
+ +--------------------------------------+
372
+
373
+ Example two - Phone camera
374
+
375
+ A camera installed on the back side of a mobile device facing away from
376
+ the user. The captured images are meant to be displayed in portrait mode
377
+ (height > width) to match the device screen orientation and the device
378
+ usage orientation used when taking the picture.
379
+
380
+ The camera sensor is typically mounted with its pixel array longer side
381
+ aligned to the device longer side, upside-down mounted to compensate for
382
+ the lens optical inversion effect:
383
+
384
+ 0 Y-Rc
385
+ 0 +-------------------->
386
+ ! Y-Rp
387
+ ! ^
388
+ ! !
389
+ ! !
390
+ ! !
391
+ ! ! |\_____)\__
392
+ ! ! ) ____ ___.<
393
+ ! ! |/ )/
394
+ ! !
395
+ ! !
396
+ ! !
397
+ ! 0 +------------------------------------->
398
+ ! 0 X-Rp
399
+ !
400
+ !
401
+ !
402
+ !
403
+ V
404
+ X-Rc
405
+
406
+ The two reference systems are not aligned and the 'Rp' reference
407
+ system is rotated by 90 degrees in the counter-clockwise direction
408
+ relatively to the 'Rc' reference system.
409
+
410
+ The image once captured to memory will be rotated:
411
+
412
+ +-------------------------------------+
413
+ | _ _ |
414
+ | \ / |
415
+ | | | |
416
+ | | | |
417
+ | | > |
418
+ | < | |
419
+ | | | |
420
+ | . |
421
+ | V |
422
+ +-------------------------------------+
423
+
424
+ A correction of 90 degrees in counter-clockwise direction has to be
425
+ applied to correctly display the image in portrait mode on the device
426
+ screen:
427
+
428
+ +--------------------+
429
+ | |
430
+ | |
431
+ | |
432
+ | |
433
+ | |
434
+ | |
435
+ | |\____)\___ |
436
+ | ) _____ __`< |
437
+ | |/ )/ |
438
+ | |
439
+ | |
440
+ | |
441
+ | |
442
+ | |
443
+ +--------------------+
444
+
445
+- orientation: The orientation of a device (typically an image sensor or a flash
446
+ LED) describing its mounting position relative to the usage orientation of the
447
+ system where the device is installed on.
448
+ Possible values are:
449
+ 0 - Front. The device is mounted on the front facing side of the system.
450
+ For mobile devices such as smartphones, tablets and laptops the front side is
451
+ the user facing side.
452
+ 1 - Back. The device is mounted on the back side of the system, which is
453
+ defined as the opposite side of the front facing one.
454
+ 2 - External. The device is not attached directly to the system but is
455
+ attached in a way that allows it to move freely.
92456
93457 Optional endpoint properties
94458 ----------------------------
....@@ -100,10 +464,12 @@
100464 slave device (data source) by the master device (data sink). In the master
101465 mode the data source device is also the source of the synchronization signals.
102466 - bus-type: data bus type. Possible values are:
103
- 0 - autodetect based on other properties (MIPI CSI-2 D-PHY, parallel or Bt656)
104467 1 - MIPI CSI-2 C-PHY
105468 2 - MIPI CSI1
106469 3 - CCP2
470
+ 4 - MIPI CSI-2 D-PHY
471
+ 5 - Parallel
472
+ 6 - Bt.656
107473 - bus-width: number of data lines actively used, valid for the parallel busses.
108474 - data-shift: on the parallel data busses, if bus-width is used to specify the
109475 number of data lines, data-shift can be used to specify which data lines are