大家好，这篇博文我们会先介绍下DB410c camera subsystem相关的硬件知识点，有助于我们理清楚camera work的flow，对后续的debug和optimization有章可循。
The Linaro Debian releases for the DragonBoard 410c include drivers for:
OV5645 camera sensor
Qualcomm Camera Subsystem (CAMSS)
Qualcomm Camera Control Interface (CCI)
The OV5645 is a 5MP MIPI CSI2 camera sensor. The driver supports three sensor modes:
2592x1944 15fps (full frame)
1920x1080 30fps (cropped from full frame)
The driver was accepted upstream and is expected in the Linux Kernel v4.13. It is also backported in the Linaro releases kernel branches.
The Camera Subsystem hardware found on 8x16 processors consists of:
2 CSIPHY modules. They handle the Physical layer of the CSI2 receivers. A separate camera sensor can be connected to each of the CSIPHY module;
2 CSID (CSI Decoder) modules. They handle the Protocol and Application layer of the CSI2 receivers. A CSID can decode data stream from any of the CSIPHY. Each CSID also contains a TG (Test Generator) block which can generate artificial input data for test purposes;
ISPIF (ISP Interface) module. Handles the routing of the data streams from the CSIDs to the inputs of the VFE;
VFE (Video Front End) module. Contains a pipeline of image processing hardware blocks. The VFE has different input interfaces. The PIX input interface feeds the input data to the image processing pipeline. The image processing pipeline contains also a scale and crop module at the end. Three RDI input interfaces bypass the image processing pipeline. The VFE also contains the AXI bus interface which writes the output data to memory.
The driver implements the V4L2 subdev interface and Media Controller API. With the goal to model the hardware links between the modules and to expose a clean, logical and usable interface, the driver is split into V4L2 sub-devices as follows:
2 CSIPHY sub-devices - each CSIPHY is represented by a single sub-device;
2 CSID sub-devices - each CSID is represented by a single sub-device;
2 ISPIF sub-devices - ISPIF is represented by a number of sub-devices equal to the number of CSID sub-devices;
4 VFE sub-devices - VFE is represented by a number of sub-devices equal to the number of the input interfaces (3 RDI and 1 PIX).
The driver supports:
Input from a camera sensor via CSIPHY
Generation of test input data by the TG in CSID
RDI interface of VFE - raw dump of the input data to memory. Supported formats:
YUYV/UYVY/YVYU/VYUY (packed YUV 4:2:2)
MIPI RAW8 (8bit Bayer RAW)
MIPI RAW10 (10bit packed Bayer RAW)
MIPI RAW12 (12bit packed Bayer RAW)
PIX interface of VFE
Format conversion of the input data
Supported input formats:
YUYV/UYVY/YVYU/VYUY (packed YUV 4:2:2).
Format conversion of the iut data
Supported ouput formats:
NV12/NV21 (two plane YUV 4:2:0);
NV16/NV61 (two plane YUV 4:2:2).
Scaling. Configuration of the VFE Encoder Scale module for downscalling with ratio up to 16x.
Cropping. Configuration of the VFE Encoder Crop module.
Concurrent and independent usage of two data inputs - could be camera sensors and/or TG.
The driver is under review in linux-media upstreaming list.
The CCI is a I2C controller dedicated for camera control.
The current driver is a version which originates from QC Android camera driver and is now separated from the CAMSS driver and compiled on Linux. For this another V4L2 driver and media device are created - this is only a temporary work to enable control on the camera sensor. Proper implementation will follow.