Amlogic C3 Image Signal Processing (C3ISP) driver
Introduction #
This file documents the Amlogic C3ISP driver located under drivers/media/platform/amlogic/c3/isp.
The current version of the driver supports the C3ISP found on Amlogic C308L processor.
The driver implements V4L2, Media controller and V4L2 subdev interfaces. Camera sensor using V4L2 subdev interface in the kernel is supported.
The driver has been tested on AW419-C308L-Socket platform.
Amlogic C3 ISP #
The Camera hardware found on C308L processors and supported by the driver consists of:
-
1 MIPI-CSI-2 module: handles the physical layer of the MIPI CSI-2 receiver and receives data from the connected camera sensor.
-
1 MIPI-ADAPTER module: organizes MIPI data to meet ISP input requirements and send MIPI data to ISP.
-
1 ISP (Image Signal Processing) module: contains a pipeline of image processing hardware blocks. The ISP pipeline contains three resizers at the end each of them connected to a DMA interface which writes the output data to memory.
A high-level functional view of the C3 ISP is presented below.:
+----------+ +-------+
| Resizer |--->| WRMIF |
+---------+ +------------+ +--------------+ +-------+ |----------+ +-------+
| Sensor |--->| MIPI CSI-2 |--->| MIPI ADAPTER |--->| ISP |---|----------+ +-------+
+---------+ +------------+ +--------------+ +-------+ | Resizer |--->| WRMIF |
+----------+ +-------+
|----------+ +-------+
| Resizer |--->| WRMIF |
+----------+ +-------+
Driver architecture and design #
With the goal to model the hardware links between the modules and to expose a clean, logical and usable interface, the driver registers the following V4L2 sub-devices:
-
1
c3-mipi-csi2sub-device - the MIPI CSI-2 receiver -
1
c3-mipi-adaptersub-device - the MIPI adapter -
1
c3-isp-coresub-device - the ISP core -
3
c3-isp-resizersub-devices - the ISP resizers
The c3-isp-core sub-device is linked to 2 video device nodes for statistics capture and parameters programming:
-
the
c3-isp-statscapture video device node for statistics capture -
the
c3-isp-paramsoutput video device for parameters programming
Each c3-isp-resizer sub-device is linked to a capture video device node where frames are captured from:
-
c3-isp-resizer0is linked to thec3-isp-cap0capture video device -
c3-isp-resizer1is linked to thec3-isp-cap1capture video device -
c3-isp-resizer2is linked to thec3-isp-cap2capture video device
The media controller pipeline graph is as follows (with connected a IMX290 camera sensor):
flowchart TB n0["pad 0<br/>pad 1<br/>c3-isp-core<br/>/dev/v4l-subdev0<br/>pad 2<br/>pad 3<br/>pad 4<br/>pad 5"] n1["pad 0<br/>c3-isp-resizer0<br/>/dev/v4l-subdev1<br/>pad 1"] n2["pad 0<br/>c3-isp-resizer1<br/>/dev/v4l-subdev2<br/>pad 1"] n3["pad 0<br/>c3-isp-resizer2<br/>/dev/v4l-subdev3<br/>pad 1"] n4["c3-isp-stats<br/>/dev/video3"] n5["c3-isp-cap0<br/>/dev/video0"] n6["c3-isp-cap1<br/>/dev/video1"] n7["c3-isp-cap2<br/>/dev/video2"] n8["pad 0<br/>c3-mipi-adapter<br/>/dev/v4l-subdev4<br/>pad 1"] n9["pad 0<br/>c3-mipi-csi2<br/>/dev/v4l-subdev5<br/>pad 1"] n10["c3-isp-params<br/>/dev/video4"] n11["imx290 2-001a<br/>/dev/v4l-subdev6<br/>pad 0"] n0 -->|"pad 3 → pad 0"| n1 n0 -->|"pad 4 → pad 0"| n2 n0 -->|"pad 5 → pad 0"| n3 n0 -->|"from pad 2"| n4 n1 -->|"from pad 1"| n5 n2 -->|"from pad 1"| n6 n3 -->|"from pad 1"| n7 n8 -->|"pad 1 → pad 0"| n0 n9 -->|"pad 1 → pad 0"| n8 n10 -->|"to pad 1"| n0 n11 -->|"pad 0 → pad 0"| n9 style n0 fill:green,color:#111 style n1 fill:green,color:#111 style n2 fill:green,color:#111 style n3 fill:green,color:#111 style n4 fill:yellow,color:#111 style n5 fill:yellow,color:#111 style n6 fill:yellow,color:#111 style n7 fill:yellow,color:#111 style n8 fill:green,color:#111 style n9 fill:green,color:#111 style n10 fill:yellow,color:#111 style n11 fill:green,color:#111 linkStyle 4 stroke-width:3px linkStyle 5 stroke-width:3px linkStyle 6 stroke-width:3px linkStyle 7 stroke-width:3px linkStyle 8 stroke-width:3px linkStyle 10 stroke-width:3px
c3-isp.dot
Media pipeline topology
Implementation #
Runtime configuration of the ISP hardware is performed on the c3-isp-params video device node using the V4L2_META_FMT_C3ISP_PARAMS as data format. The buffer structure is defined by c3_isp_params_cfg.
Statistics are captured from the c3-isp-stats video device node using the V4L2_META_FMT_C3ISP_STATS data format.
The final picture size and format is configured using the V4L2 video capture interface on the c3-isp-cap[0, 2] video device nodes.
The Amlogic C3 ISP is supported by libcamera with a dedicated pipeline handler and algorithms that perform run-time image correction and enhancement.