← Documents Documentation/userspace-api/media/drivers/ccs.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API / Media / Drivers

MIPI CCS camera sensor driver

CCS pixel array·binner·scaler pipeline, gain model과 shading control을 설명합니다.

Source pathDocumentation/userspace-api/media/drivers/ccs.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

ccs.rst:1-114

CCS driver는 hardware capability에 맞춰 pixel array, binner와 scaler sub-device를 노출합니다. analogue crop은 읽기 전, digital crop은 읽은 뒤 data를 제외하며 두 gain model과 shading correction용 private control을 제공합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0-only
2
3 .. include:: <isonum.txt>
4
5 .. _media-ccs-uapi:
6
7 MIPI CCS camera sensor driver
8 =============================
9
10 The MIPI CCS camera sensor driver is a generic driver for `MIPI CCS
11 <https://www.mipi.org/specifications/camera-command-set>`_ compliant
12 camera sensors. It exposes three sub-devices representing the pixel array,
13 the binner and the scaler.
14
15 As the capabilities of individual devices vary, the driver exposes
16 interfaces based on the capabilities that exist in hardware.
17
18 Also see :ref:`the CCS driver kernel documentation <media-ccs-driver>`.
19
20 Pixel Array sub-device
21 ----------------------
22
23 The pixel array sub-device represents the camera sensor's pixel matrix, as well
24 as analogue crop functionality present in many compliant devices. The analogue
25 crop is configured using the ``V4L2_SEL_TGT_CROP`` on the source pad (0) of the
26 entity. The size of the pixel matrix can be obtained by getting the
27 ``V4L2_SEL_TGT_NATIVE_SIZE`` target.
28
29 Binner
30 ------
31
32 The binner sub-device represents the binning functionality on the sensor. For
33 that purpose, selection target ``V4L2_SEL_TGT_COMPOSE`` is supported on the
34 sink pad (0).
35
36 Additionally, if a device has no scaler or digital crop functionality, the
37 source pad (1) exposes another digital crop selection rectangle that can only
38 crop at the end of the lines and frames.
39
40 Scaler
41 ------
42
43 The scaler sub-device represents the digital crop and scaling functionality of
44 the sensor. The V4L2 selection target ``V4L2_SEL_TGT_CROP`` is used to
45 configure the digital crop on the sink pad (0) when digital crop is supported.
46 Scaling is configured using selection target ``V4L2_SEL_TGT_COMPOSE`` on the
47 sink pad (0) as well.
48
49 Additionally, if the scaler sub-device exists, its source pad (1) exposes
50 another digital crop selection rectangle that can only crop at the end of the
51 lines and frames.
52
53 Digital and analogue crop
54 -------------------------
55
56 Digital crop functionality is referred to as cropping that effectively works by
57 dropping some data on the floor. Analogue crop, on the other hand, means that
58 the cropped information is never retrieved. In case of camera sensors, the
59 analogue data is never read from the pixel matrix that are outside the
60 configured selection rectangle that designates crop. The difference has an
61 effect in device timing and likely also in power consumption.
62
63 Private controls
64 ----------------
65
66 The MIPI CCS driver implements a number of private controls under
67 ``V4L2_CID_USER_BASE_CCS`` to control the MIPI CCS compliant camera sensors.
68
69 Analogue gain model
70 ~~~~~~~~~~~~~~~~~~~
71
72 The CCS defines an analogue gain model where the gain can be calculated using
73 the following formula:
74
75 gain = m0 * x + c0 / (m1 * x + c1)
76
77 Either m0 or c0 will be zero. The constants that are device specific, can be
78 obtained from the following controls:
79
80 V4L2_CID_CCS_ANALOGUE_GAIN_M0
81 V4L2_CID_CCS_ANALOGUE_GAIN_M1
82 V4L2_CID_CCS_ANALOGUE_GAIN_C0
83 V4L2_CID_CCS_ANALOGUE_GAIN_C1
84
85 The analogue gain (``x`` in the formula) is controlled through
86 ``V4L2_CID_ANALOGUE_GAIN`` in this case.
87
88 Alternate analogue gain model
89 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90
91 The CCS defines another analogue gain model called alternate analogue gain. In
92 this case, the formula to calculate actual gain consists of linear and
93 exponential parts:
94
95 gain = linear * 2 ^ exponent
96
97 The ``linear`` and ``exponent`` factors can be set using the
98 ``V4L2_CID_CCS_ANALOGUE_LINEAR_GAIN`` and
99 ``V4L2_CID_CCS_ANALOGUE_EXPONENTIAL_GAIN`` controls, respectively
100
101 Shading correction
102 ~~~~~~~~~~~~~~~~~~
103
104 The CCS standard supports lens shading correction. The feature can be controlled
105 using ``V4L2_CID_CCS_SHADING_CORRECTION``. Additionally, the luminance
106 correction level may be changed using
107 ``V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL``, where value 0 indicates no
108 correction and 128 indicates correcting the luminance in corners to 10 % less
109 than in the centre.
110
111 Shading correction needs to be enabled for luminance correction level to have an
112 effect.
113
114 **Copyright** |copy| 2020 Intel Corporation
115

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Generic CCS driver와 sub-device

1-19

MIPI CCS camera sensor driver는 MIPI Camera Command Set 규격을 따르는 camera sensor용 generic driver입니다.

driver는 pixel array, binner, scaler를 나타내는 세 sub-device를 노출합니다. 개별 device capability가 서로 다르므로 실제 hardware에 존재하는 기능만 interface로 제공합니다.

kernel 내부 구현은 `media-ccs-driver` CCS driver 문서도 참고합니다.

CCS processing entities
Pixel Array sub-deviceBinner sub-deviceScaler sub-deviceSource output

지원 capability에 따라 일부 stage가 생략될 수 있습니다.

.. SPDX-License-Identifier: GPL-2.0-only

.. include:: <isonum.txt>

.. _media-ccs-uapi:

MIPI CCS camera sensor driver
=============================

The MIPI CCS camera sensor driver is a generic driver for `MIPI CCS
<https://www.mipi.org/specifications/camera-command-set>`_ compliant
camera sensors. It exposes three sub-devices representing the pixel array,
the binner and the scaler.

As the capabilities of individual devices vary, the driver exposes
interfaces based on the capabilities that exist in hardware.

Also see :ref:`the CCS driver kernel documentation <media-ccs-driver>`.

Pixel Array sub-device

20-28

pixel array sub-device는 sensor의 pixel matrix와 많은 CCS device에 있는 analogue crop 기능을 나타냅니다.

entity source pad 0의 `V4L2_SEL_TGT_CROP`으로 analogue crop을 구성하고, `V4L2_SEL_TGT_NATIVE_SIZE` target을 조회해 pixel matrix 전체 크기를 얻습니다.

Pixel Array selection
항목설명
V4L2_SEL_TGT_NATIVE_SIZEPixel matrix 전체 크기 조회
V4L2_SEL_TGT_CROPSource pad 0 analogue crop 구성

source pad 0에서 native matrix와 analogue crop을 다룹니다.

Pixel Array sub-device
----------------------

The pixel array sub-device represents the camera sensor's pixel matrix, as well
as analogue crop functionality present in many compliant devices. The analogue
crop is configured using the ``V4L2_SEL_TGT_CROP`` on the source pad (0) of the
entity. The size of the pixel matrix can be obtained by getting the
``V4L2_SEL_TGT_NATIVE_SIZE`` target.

Binner sub-device

29-39

binner sub-device는 sensor의 binning 기능을 나타내며 sink pad 0에서 `V4L2_SEL_TGT_COMPOSE` target을 지원합니다.

device에 scaler나 digital crop 기능이 없으면 source pad 1에 추가 digital crop selection rectangle을 노출합니다. 이 rectangle은 line과 frame 끝부분만 잘라낼 수 있습니다.

Binner pad
PadSelection동작
Sink pad 0V4L2_SEL_TGT_COMPOSEBinning 구성
Source pad 1Digital crop rectangleScaler·digital crop이 없을 때 line/frame 끝 crop

sink의 compose와 조건부 source crop을 구분합니다.

Binner
------

The binner sub-device represents the binning functionality on the sensor. For
that purpose, selection target ``V4L2_SEL_TGT_COMPOSE`` is supported on the
sink pad (0).

Additionally, if a device has no scaler or digital crop functionality, the
source pad (1) exposes another digital crop selection rectangle that can only
crop at the end of the lines and frames.

Scaler sub-device

40-52

scaler sub-device는 sensor의 digital crop과 scaling 기능을 나타냅니다.

digital crop을 지원하면 sink pad 0의 `V4L2_SEL_TGT_CROP`으로 구성하고, scaling도 같은 sink pad의 `V4L2_SEL_TGT_COMPOSE`로 구성합니다.

scaler sub-device가 존재하면 source pad 1에 line과 frame 끝만 자를 수 있는 추가 digital crop selection rectangle도 노출합니다.

Scaler selection
PadSelection동작
Sink pad 0V4L2_SEL_TGT_CROPDigital crop
Sink pad 0V4L2_SEL_TGT_COMPOSEScaling
Source pad 1Digital crop rectangleLine/frame 끝 crop

sink에서 crop·scale을 구성하고 source에서 최종 edge crop을 제공합니다.

Scaler
------

The scaler sub-device represents the digital crop and scaling functionality of
the sensor. The V4L2 selection target ``V4L2_SEL_TGT_CROP`` is used to
configure the digital crop on the sink pad (0) when digital crop is supported.
Scaling is configured using selection target ``V4L2_SEL_TGT_COMPOSE`` on the
sink pad (0) as well.

Additionally, if the scaler sub-device exists, its source pad (1) exposes
another digital crop selection rectangle that can only crop at the end of the
lines and frames.

Digital·analogue crop과 private control

53-68

digital crop은 이미 얻은 data 일부를 버리는 방식입니다. 반면 analogue crop은 crop rectangle 바깥 pixel matrix의 analogue data를 애초에 읽지 않습니다.

이 차이는 device timing과 전력 소비에도 영향을 줄 가능성이 있습니다.

MIPI CCS driver는 `V4L2_CID_USER_BASE_CCS` 아래 여러 private control로 CCS-compliant sensor를 제어합니다.

Crop 방식 비교
방식동작영향
Analogue cropPixel matrix에서 바깥 data를 읽지 않음읽기·timing·power 감소 가능
Digital crop읽은 data를 뒤 단계에서 버림upstream read는 유지

data가 어느 단계에서 제외되는지가 timing과 power에 영향을 줍니다.

Digital and analogue crop
-------------------------

Digital crop functionality is referred to as cropping that effectively works by
dropping some data on the floor. Analogue crop, on the other hand, means that
the cropped information is never retrieved. In case of camera sensors, the
analogue data is never read from the pixel matrix that are outside the
configured selection rectangle that designates crop. The difference has an
effect in device timing and likely also in power consumption.

Private controls
----------------

The MIPI CCS driver implements a number of private controls under
``V4L2_CID_USER_BASE_CCS`` to control the MIPI CCS compliant camera sensors.

Analogue gain model

69-87

CCS analogue gain model의 식은 `gain = m0 * x + c0 / (m1 * x + c1)`입니다. `m0` 또는 `c0` 중 하나는 0입니다.

device-specific 상수는 `V4L2_CID_CCS_ANALOGUE_GAIN_M0`, `V4L2_CID_CCS_ANALOGUE_GAIN_M1`, `V4L2_CID_CCS_ANALOGUE_GAIN_C0`, `V4L2_CID_CCS_ANALOGUE_GAIN_C1` control에서 얻습니다.

식의 `x`, 즉 analogue gain 입력은 `V4L2_CID_ANALOGUE_GAIN`으로 제어합니다.

CCS analogue gain parameter
항목설명
m0V4L2_CID_CCS_ANALOGUE_GAIN_M0
m1V4L2_CID_CCS_ANALOGUE_GAIN_M1
c0V4L2_CID_CCS_ANALOGUE_GAIN_C0
c1V4L2_CID_CCS_ANALOGUE_GAIN_C1
xV4L2_CID_ANALOGUE_GAIN

device 상수 네 개와 userspace gain 입력을 구분합니다.

Analogue gain 계산
m0·m1·c0·c1 조회m0 또는 c0가 0인지 확인V4L2_CID_ANALOGUE_GAIN에서 x 선택m0*x + c0/(m1*x+c1) 계산실제 gain 산출

control 값과 device 상수를 공식에 대입합니다.

Analogue gain model
~~~~~~~~~~~~~~~~~~~

The CCS defines an analogue gain model where the gain can be calculated using
the following formula:

	gain = m0 * x + c0 / (m1 * x + c1)

Either m0 or c0 will be zero. The constants that are device specific, can be
obtained from the following controls:

	V4L2_CID_CCS_ANALOGUE_GAIN_M0
	V4L2_CID_CCS_ANALOGUE_GAIN_M1
	V4L2_CID_CCS_ANALOGUE_GAIN_C0
	V4L2_CID_CCS_ANALOGUE_GAIN_C1

The analogue gain (``x`` in the formula) is controlled through
``V4L2_CID_ANALOGUE_GAIN`` in this case.

Alternate analogue gain model

88-100

alternate analogue gain은 linear와 exponential 부분을 결합하며 식은 `gain = linear * 2 ^ exponent`입니다.

`linear`는 `V4L2_CID_CCS_ANALOGUE_LINEAR_GAIN`, `exponent`는 `V4L2_CID_CCS_ANALOGUE_EXPONENTIAL_GAIN`으로 각각 설정합니다.

Alternate gain factor
항목설명
linearV4L2_CID_CCS_ANALOGUE_LINEAR_GAIN
exponentV4L2_CID_CCS_ANALOGUE_EXPONENTIAL_GAIN
actual gainlinear * 2 ^ exponent

선형 계수와 2의 지수를 독립 control로 제공합니다.

Alternate analogue gain model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The CCS defines another analogue gain model called alternate analogue gain. In
this case, the formula to calculate actual gain consists of linear and
exponential parts:

	gain = linear * 2 ^ exponent

The ``linear`` and ``exponent`` factors can be set using the
``V4L2_CID_CCS_ANALOGUE_LINEAR_GAIN`` and
``V4L2_CID_CCS_ANALOGUE_EXPONENTIAL_GAIN`` controls, respectively

Shading correction

101-114

CCS standard는 lens shading correction을 지원하며 `V4L2_CID_CCS_SHADING_CORRECTION`으로 기능을 제어합니다.

`V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL`로 luminance correction level을 바꿀 수 있습니다. 0은 correction 없음, 128은 corner luminance를 center보다 10% 낮게 보정하는 수준입니다.

luminance correction level이 실제 효과를 가지려면 shading correction이 먼저 enable되어야 합니다.

CCS shading control
항목설명
V4L2_CID_CCS_SHADING_CORRECTIONLens shading correction enable
V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL=0Luminance correction 없음
V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL=128Corner를 center보다 10% 낮게 correction

enable control과 correction level을 함께 사용합니다.

Luminance correction 적용
Shading correction enableLuminance correction level 선택0이면 correction 없음128이면 corner target을 center보다 10% 낮게Lens shading correction 적용

level만 설정해서는 효과가 없으며 shading enable이 선행됩니다.

Copyright 2020 Intel Corporation.

Shading correction
~~~~~~~~~~~~~~~~~~

The CCS standard supports lens shading correction. The feature can be controlled
using ``V4L2_CID_CCS_SHADING_CORRECTION``. Additionally, the luminance
correction level may be changed using
``V4L2_CID_CCS_LUMINANCE_CORRECTION_LEVEL``, where value 0 indicates no
correction and 128 indicates correcting the luminance in corners to 10 % less
than in the centre.

Shading correction needs to be enabled for luminance correction level to have an
effect.

**Copyright** |copy| 2020 Intel Corporation