← Documents Documentation/admin-guide/media/qcom_camss.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Media

Qualcomm Camera Subsystem Driver

MSM8916/APQ8016과 MSM8996/APQ8096 CAMSS의 CSIPHY·CSID·ISPIF·VFE pipeline, format, subdev graph와 STREAMON 설정을 설명합니다.

Source pathDocumentation/admin-guide/media/qcom_camss.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

CAMSS 구성 비교

qcom_camss.rst:1-185

CAMSS는 CSI2 sensor 또는 TG 입력을 CSIPHY와 CSID에서 받아 ISPIF로 route한 뒤 VFE의 RDI raw path 또는 PIX processing path를 거쳐 memory에 기록합니다. 8x96은 8x16보다 더 많은 receiver와 VFE를 제공하고 일부 추가 format 변환을 지원합니다.

구성8x168x96
Camera sensor / CSIPHY23
CSID / ISPIF subdev2 / 24 / 4
VFE hardware module12
VFE subdev (3 RDI + 1 PIX per VFE)48
Video device node4 (`/dev/video0-3`)8 (`/dev/video0-7`)
동시 독립 입력23

2. 영어 원문 전체

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

원문 전체 펼치기
1 .. SPDX-License-Identifier: GPL-2.0
2
3 .. include:: <isonum.txt>
4
5 Qualcomm Camera Subsystem driver
6 ================================
7
8 Introduction
9 ------------
10
11 This file documents the Qualcomm Camera Subsystem driver located under
12 drivers/media/platform/qcom/camss.
13
14 The current version of the driver supports the Camera Subsystem found on
15 Qualcomm MSM8916/APQ8016 and MSM8996/APQ8096 processors.
16
17 The driver implements V4L2, Media controller and V4L2 subdev interfaces.
18 Camera sensor using V4L2 subdev interface in the kernel is supported.
19
20 The driver is implemented using as a reference the Qualcomm Camera Subsystem
21 driver for Android as found in Code Linaro [#f1]_ [#f2]_.
22
23
24 Qualcomm Camera Subsystem hardware
25 ----------------------------------
26
27 The Camera Subsystem hardware found on 8x16 / 8x96 processors and supported by
28 the driver consists of:
29
30 - 2 / 3 CSIPHY modules. They handle the Physical layer of the CSI2 receivers.
31 A separate camera sensor can be connected to each of the CSIPHY module;
32 - 2 / 4 CSID (CSI Decoder) modules. They handle the Protocol and Application
33 layer of the CSI2 receivers. A CSID can decode data stream from any of the
34 CSIPHY. Each CSID also contains a TG (Test Generator) block which can generate
35 artificial input data for test purposes;
36 - ISPIF (ISP Interface) module. Handles the routing of the data streams from
37 the CSIDs to the inputs of the VFE;
38 - 1 / 2 VFE (Video Front End) module(s). Contain a pipeline of image processing
39 hardware blocks. The VFE has different input interfaces. The PIX (Pixel) input
40 interface feeds the input data to the image processing pipeline. The image
41 processing pipeline contains also a scale and crop module at the end. Three
42 RDI (Raw Dump Interface) input interfaces bypass the image processing
43 pipeline. The VFE also contains the AXI bus interface which writes the output
44 data to memory.
45
46
47 Supported functionality
48 -----------------------
49
50 The current version of the driver supports:
51
52 - Input from camera sensor via CSIPHY;
53 - Generation of test input data by the TG in CSID;
54 - RDI interface of VFE
55
56 - Raw dump of the input data to memory.
57
58 Supported formats:
59
60 - YUYV/UYVY/YVYU/VYUY (packed YUV 4:2:2 - V4L2_PIX_FMT_YUYV /
61 V4L2_PIX_FMT_UYVY / V4L2_PIX_FMT_YVYU / V4L2_PIX_FMT_VYUY);
62 - MIPI RAW8 (8bit Bayer RAW - V4L2_PIX_FMT_SRGGB8 /
63 V4L2_PIX_FMT_SGRBG8 / V4L2_PIX_FMT_SGBRG8 / V4L2_PIX_FMT_SBGGR8);
64 - MIPI RAW10 (10bit packed Bayer RAW - V4L2_PIX_FMT_SBGGR10P /
65 V4L2_PIX_FMT_SGBRG10P / V4L2_PIX_FMT_SGRBG10P / V4L2_PIX_FMT_SRGGB10P /
66 V4L2_PIX_FMT_Y10P);
67 - MIPI RAW12 (12bit packed Bayer RAW - V4L2_PIX_FMT_SRGGB12P /
68 V4L2_PIX_FMT_SGBRG12P / V4L2_PIX_FMT_SGRBG12P / V4L2_PIX_FMT_SRGGB12P).
69 - (8x96 only) MIPI RAW14 (14bit packed Bayer RAW - V4L2_PIX_FMT_SRGGB14P /
70 V4L2_PIX_FMT_SGBRG14P / V4L2_PIX_FMT_SGRBG14P / V4L2_PIX_FMT_SRGGB14P).
71
72 - (8x96 only) Format conversion of the input data.
73
74 Supported input formats:
75
76 - MIPI RAW10 (10bit packed Bayer RAW - V4L2_PIX_FMT_SBGGR10P / V4L2_PIX_FMT_Y10P).
77
78 Supported output formats:
79
80 - Plain16 RAW10 (10bit unpacked Bayer RAW - V4L2_PIX_FMT_SBGGR10 / V4L2_PIX_FMT_Y10).
81
82 - PIX interface of VFE
83
84 - Format conversion of the input data.
85
86 Supported input formats:
87
88 - YUYV/UYVY/YVYU/VYUY (packed YUV 4:2:2 - V4L2_PIX_FMT_YUYV /
89 V4L2_PIX_FMT_UYVY / V4L2_PIX_FMT_YVYU / V4L2_PIX_FMT_VYUY).
90
91 Supported output formats:
92
93 - NV12/NV21 (two plane YUV 4:2:0 - V4L2_PIX_FMT_NV12 / V4L2_PIX_FMT_NV21);
94 - NV16/NV61 (two plane YUV 4:2:2 - V4L2_PIX_FMT_NV16 / V4L2_PIX_FMT_NV61).
95 - (8x96 only) YUYV/UYVY/YVYU/VYUY (packed YUV 4:2:2 - V4L2_PIX_FMT_YUYV /
96 V4L2_PIX_FMT_UYVY / V4L2_PIX_FMT_YVYU / V4L2_PIX_FMT_VYUY).
97
98 - Scaling support. Configuration of the VFE Encoder Scale module
99 for downscalling with ratio up to 16x.
100
101 - Cropping support. Configuration of the VFE Encoder Crop module.
102
103 - Concurrent and independent usage of two (8x96: three) data inputs -
104 could be camera sensors and/or TG.
105
106
107 Driver Architecture and Design
108 ------------------------------
109
110 The driver implements the V4L2 subdev interface. With the goal to model the
111 hardware links between the modules and to expose a clean, logical and usable
112 interface, the driver is split into V4L2 sub-devices as follows (8x16 / 8x96):
113
114 - 2 / 3 CSIPHY sub-devices - each CSIPHY is represented by a single sub-device;
115 - 2 / 4 CSID sub-devices - each CSID is represented by a single sub-device;
116 - 2 / 4 ISPIF sub-devices - ISPIF is represented by a number of sub-devices
117 equal to the number of CSID sub-devices;
118 - 4 / 8 VFE sub-devices - VFE is represented by a number of sub-devices equal to
119 the number of the input interfaces (3 RDI and 1 PIX for each VFE).
120
121 The considerations to split the driver in this particular way are as follows:
122
123 - representing CSIPHY and CSID modules by a separate sub-device for each module
124 allows to model the hardware links between these modules;
125 - representing VFE by a separate sub-devices for each input interface allows
126 to use the input interfaces concurrently and independently as this is
127 supported by the hardware;
128 - representing ISPIF by a number of sub-devices equal to the number of CSID
129 sub-devices allows to create linear media controller pipelines when using two
130 cameras simultaneously. This avoids branches in the pipelines which otherwise
131 will require a) userspace and b) media framework (e.g. power on/off
132 operations) to make assumptions about the data flow from a sink pad to a
133 source pad on a single media entity.
134
135 Each VFE sub-device is linked to a separate video device node.
136
137 The media controller pipeline graph is as follows (with connected two / three
138 OV5645 camera sensors):
139
140 .. _qcom_camss_graph:
141
142 .. kernel-figure:: qcom_camss_graph.dot
143 :alt: qcom_camss_graph.dot
144 :align: center
145
146 Media pipeline graph 8x16
147
148 .. kernel-figure:: qcom_camss_8x96_graph.dot
149 :alt: qcom_camss_8x96_graph.dot
150 :align: center
151
152 Media pipeline graph 8x96
153
154
155 Implementation
156 --------------
157
158 Runtime configuration of the hardware (updating settings while streaming) is
159 not required to implement the currently supported functionality. The complete
160 configuration on each hardware module is applied on STREAMON ioctl based on
161 the current active media links, formats and controls set.
162
163 The output size of the scaler module in the VFE is configured with the actual
164 compose selection rectangle on the sink pad of the 'msm_vfe0_pix' entity.
165
166 The crop output area of the crop module in the VFE is configured with the actual
167 crop selection rectangle on the source pad of the 'msm_vfe0_pix' entity.
168
169
170 Documentation
171 -------------
172
173 APQ8016 Specification:
174 https://developer.qualcomm.com/download/sd410/snapdragon-410-processor-device-specification.pdf
175 Referenced 2016-11-24.
176
177 APQ8096 Specification:
178 https://developer.qualcomm.com/download/sd820e/qualcomm-snapdragon-820e-processor-apq8096sge-device-specification.pdf
179 Referenced 2018-06-22.
180
181 References
182 ----------
183
184 .. [#f1] https://git.codelinaro.org/clo/la/kernel/msm-3.10/
185 .. [#f2] https://git.codelinaro.org/clo/la/kernel/msm-3.18/
186

3. 한국어 전문 번역

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

Qualcomm Camera Subsystem 드라이버

1-23

이 문서는 GPL-2.0 라이선스를 따르며 `drivers/media/platform/qcom/camss`의 Qualcomm Camera Subsystem(CAMSS) 드라이버를 설명합니다.

현재 드라이버는 Qualcomm MSM8916/APQ8016 및 MSM8996/APQ8096 processor의 Camera Subsystem을 지원합니다. V4L2, Media Controller, V4L2 subdev interface를 구현하며 kernel의 V4L2 subdev interface를 사용하는 camera sensor를 지원합니다.

구현은 Code Linaro에서 제공된 Android용 Qualcomm Camera Subsystem 드라이버를 참고했습니다.

CAMSS hardware block

24-46

8x16과 8x96에서 드라이버가 지원하는 Camera Subsystem은 다음 block으로 구성됩니다. 아래 수량은 `8x16 / 8x96` 순서입니다.

Block8x168x96역할
CSIPHY23CSI2 receiver의 Physical layer
CSID24CSI2 Protocol/Application layer와 TG(Test Generator)
ISPIF1 module1 moduleCSID stream을 VFE input으로 route
VFE12PIX image pipeline, 3 RDI, AXI memory output

각 CSIPHY에는 별도 camera sensor를 연결할 수 있고, 각 CSID는 어느 CSIPHY의 stream이든 decode할 수 있습니다. CSID의 TG는 시험용 인공 입력 데이터를 생성합니다.

VFE의 PIX input은 scale과 crop을 포함한 image-processing pipeline으로 데이터를 보내며, 세 RDI input은 이 pipeline을 우회합니다. AXI bus interface는 결과를 memory에 기록합니다.

RDI 기능과 format

47-81

드라이버는 CSIPHY를 통한 camera sensor 입력, CSID TG의 test 입력, VFE RDI interface를 지원합니다. RDI는 입력 데이터를 memory로 raw dump하며 8x96에서는 RAW10을 Plain16 RAW10으로 변환할 수도 있습니다.

동작FormatV4L2 symbol지원 SoC
Raw dumpYUYV/UYVY/YVYU/VYUYV4L2_PIX_FMT_YUYV / V4L2_PIX_FMT_UYVY / V4L2_PIX_FMT_YVYU / V4L2_PIX_FMT_VYUY8x16, 8x96
Raw dumpMIPI RAW8V4L2_PIX_FMT_SRGGB8 / V4L2_PIX_FMT_SGRBG8 / V4L2_PIX_FMT_SGBRG8 / V4L2_PIX_FMT_SBGGR88x16, 8x96
Raw dumpMIPI RAW10V4L2_PIX_FMT_SBGGR10P / V4L2_PIX_FMT_SGBRG10P / V4L2_PIX_FMT_SGRBG10P / V4L2_PIX_FMT_SRGGB10P / V4L2_PIX_FMT_Y10P8x16, 8x96
Raw dumpMIPI RAW12V4L2_PIX_FMT_SRGGB12P / V4L2_PIX_FMT_SGBRG12P / V4L2_PIX_FMT_SGRBG12P / V4L2_PIX_FMT_SRGGB12P8x16, 8x96
Raw dumpMIPI RAW14V4L2_PIX_FMT_SRGGB14P / V4L2_PIX_FMT_SGBRG14P / V4L2_PIX_FMT_SGRBG14P / V4L2_PIX_FMT_SRGGB14P8x96 only
Format conversionMIPI RAW10 → Plain16 RAW10V4L2_PIX_FMT_SBGGR10P / V4L2_PIX_FMT_Y10P → V4L2_PIX_FMT_SBGGR10 / V4L2_PIX_FMT_Y108x96 only

RAW12와 RAW14 symbol 목록은 원문의 표기를 그대로 보존했습니다. 각 목록에서 `V4L2_PIX_FMT_SRGGB12P`와 `V4L2_PIX_FMT_SRGGB14P`가 반복됩니다.

PIX 변환·scale·crop

82-106

VFE PIX interface는 packed YUV 4:2:2 입력을 two-plane YUV 4:2:0 또는 4:2:2로 변환합니다. 8x96에서는 packed YUV 4:2:2 출력도 지원합니다.

방향FormatV4L2 symbol지원 SoC
InputYUYV/UYVY/YVYU/VYUYV4L2_PIX_FMT_YUYV / V4L2_PIX_FMT_UYVY / V4L2_PIX_FMT_YVYU / V4L2_PIX_FMT_VYUY8x16, 8x96
OutputNV12/NV21V4L2_PIX_FMT_NV12 / V4L2_PIX_FMT_NV218x16, 8x96
OutputNV16/NV61V4L2_PIX_FMT_NV16 / V4L2_PIX_FMT_NV618x16, 8x96
OutputYUYV/UYVY/YVYU/VYUYV4L2_PIX_FMT_YUYV / V4L2_PIX_FMT_UYVY / V4L2_PIX_FMT_YVYU / V4L2_PIX_FMT_VYUY8x96 only

VFE Encoder Scale module은 최대 16x downscaling을 지원하고 VFE Encoder Crop module은 cropping을 수행합니다. Camera sensor와 TG를 조합해 8x16에서는 2개, 8x96에서는 3개 입력을 동시에 독립적으로 사용할 수 있습니다.

V4L2 subdev 분할

107-120

Hardware link를 정확히 model하고 논리적이며 사용하기 쉬운 interface를 제공하기 위해 드라이버를 다음 V4L2 sub-device로 분할합니다. 수량은 `8x16 / 8x96` 순서입니다.

Sub-device8x168x96분할 기준
CSIPHY23Hardware module마다 하나
CSID24Hardware module마다 하나
ISPIF24CSID subdev 수와 동일
VFE48VFE마다 3 RDI + 1 PIX input

분할 설계의 이유

121-139
  • CSIPHY와 CSID module마다 별도 sub-device를 두어 module 사이 hardware link를 model합니다.
  • VFE input interface마다 별도 sub-device를 두어 hardware가 지원하는 동시·독립 사용을 노출합니다.
  • CSID 수와 같은 수의 ISPIF sub-device를 두어 카메라 두 대를 동시에 사용할 때 linear Media Controller pipeline을 만듭니다.

Linear pipeline은 하나의 media entity에서 sink pad부터 source pad까지 data flow를 userspace와 media framework의 power on/off 동작이 추측해야 하는 branch 구조를 피합니다. 각 VFE sub-device는 별도 video device node에 연결됩니다.

8x16과 8x96 media graph

140-154

원문 DOT graph는 8x16에서 OV5645 camera sensor 두 대, 8x96에서 세 대를 연결한 Media Controller pipeline을 보여 줍니다. Dashed link는 선택 가능한 내부 route이고, 각 VFE input에서 video node로 가는 link는 실제 output 경로입니다.

CAMSS media pipeline 8x16
OV5645 ×2msm_csiphy0-1msm_csid0-1msm_ispif0-1msm_vfe0_rdi0-2 / pix/dev/video0-3
CSID TGtest streamISPIF routeVFE RDI 또는 PIXmemory

두 sensor stream은 어느 CSID·ISPIF 경로로도 route할 수 있고, VFE0의 RDI0-2 또는 PIX input이 각각 `/dev/video0-3`에 연결됩니다.

CAMSS media pipeline 8x96
OV5645 ×3msm_csiphy0-2msm_csid0-3msm_ispif0-3VFE0/1 rdi0-2 / pix/dev/video0-7
CSID TG4 decoder 중 선택4 ISPIF route8 VFE inputmemory

세 sensor와 네 CSID·ISPIF route가 VFE0·VFE1의 8개 input sub-device를 거쳐 `/dev/video0-7`에 독립적으로 연결됩니다.

STREAMON 시점 설정

155-169

현재 지원 기능에는 streaming 도중 설정을 갱신하는 runtime configuration이 필요하지 않습니다. 각 hardware module의 전체 설정은 현재 active media link, format, control을 기준으로 `STREAMON` `ioctl` 시점에 적용됩니다.

VFE scaler output size는 `msm_vfe0_pix` entity sink pad의 실제 compose selection rectangle로 설정합니다. Crop module의 output area는 같은 entity source pad의 실제 crop selection rectangle로 설정합니다.

사양서와 참고 구현

170-185

SoC 사양서와 구현 참고 자료는 다음과 같습니다.