Merge tag 'v5.15.57' into rpi-5.15.y
[platform/kernel/linux-rpi.git] / Documentation / admin-guide / media / bcm2835-isp.rst
1 .. SPDX-License-Identifier: GPL-2.0
2
3 BCM2835 ISP Driver
4 ==================
5
6 Introduction
7 ------------
8
9 The BCM2835 Image Sensor Pipeline (ISP) is a fixed function hardware pipeline
10 for performing image processing operations.  Images are fed to the input
11 of the ISP through memory frame buffers.  These images may be in various YUV,
12 RGB, or Bayer formats.  A typical use case would have Bayer images obtained from
13 an image sensor by the BCM2835 Unicam peripheral, written to a memory
14 frame buffer, and finally fed into the input of the ISP.  Two concurrent output
15 images may be generated in YUV or RGB format at different resolutions.
16 Statistics output is also generated for Bayer input images.
17
18 The bcm2835-isp driver exposes the following media pads as V4L2 device nodes:
19
20 .. tabularcolumns:: |l|l|l|l|
21
22 .. cssclass: longtable
23
24 .. flat-table::
25
26     * - *Pad*
27       - *Direction*
28       - *Purpose*
29       - *Formats*
30
31     * - "bcm2835-isp0-output0"
32       - sink
33       - Accepts Bayer, RGB or YUV format frame buffers as input to the ISP HW
34         pipeline.
35       - :ref:`RAW8 <V4L2-PIX-FMT-SRGGB8>`,
36         :ref:`RAW10P <V4L2-PIX-FMT-SRGGB10P>`,
37         :ref:`RAW12P <V4L2-PIX-FMT-SRGGB12P>`,
38         :ref:`RAW14P <V4L2-PIX-FMT-SRGGB14P>`,
39         :ref:`RAW16 <V4L2-PIX-FMT-SRGGB16>`,
40         :ref:`RGB24/BGR24 <V4L2-PIX-FMT-RGB24>`,
41         :ref:`YUYV <V4L2-PIX-FMT-YUYV>`,
42         :ref:`YVYU <V4L2-PIX-FMT-YVYU>`,
43         :ref:`UYVY <V4L2-PIX-FMT-UYVY>`,
44         :ref:`VYUY <V4L2-PIX-FMT-VYUY>`,
45         :ref:`YUV420/YVU420 <V4L2-PIX-FMT-YUV420>`
46
47     * - "bcm2835-isp0-capture1"
48       - source
49       - High resolution YUV or RGB processed output from the ISP.
50       - :ref:`RGB565 <V4L2-PIX-FMT-RGB565>`,
51         :ref:`RGB24/BGR24 <V4L2-PIX-FMT-RGB24>`,
52         :ref:`ABGR32 <V4L2-PIX-FMT-ABGR32>`,
53         :ref:`YUYV <V4L2-PIX-FMT-YUYV>`,
54         :ref:`YVYU <V4L2-PIX-FMT-YVYU>`,
55         :ref:`UYVY <V4L2-PIX-FMT-UYVY>`,
56         :ref:`VYUY <V4L2-PIX-FMT-VYUY>`.
57         :ref:`YUV420/YVU420 <V4L2-PIX-FMT-YUV420>`,
58         :ref:`NV12/NV21 <V4L2-PIX-FMT-NV12>`,
59
60     * - "bcm2835-isp0-capture2"
61       - source
62       - Low resolution YUV processed output from the ISP. The output of
63         this pad cannot have a resolution larger than the "bcm2835-isp0-capture1" pad in any dimension.
64       - :ref:`YUYV <V4L2-PIX-FMT-YUYV>`,
65         :ref:`YVYU <V4L2-PIX-FMT-YVYU>`,
66         :ref:`UYVY <V4L2-PIX-FMT-UYVY>`,
67         :ref:`VYUY <V4L2-PIX-FMT-VYUY>`.
68         :ref:`YUV420/YVU420 <V4L2-PIX-FMT-YUV420>`,
69         :ref:`NV12/NV21 <V4L2-PIX-FMT-NV12>`,
70
71     * - "bcm2835-isp0-capture1"
72       - source
73       - Image statistics calculated from the input image provided on the
74         "bcm2835-isp0-output0" pad.  Statistics are only available for Bayer
75         format input images.
76       - :ref:`v4l2-meta-fmt-bcm2835-isp-stats`.
77
78 Pipeline Configuration
79 ----------------------
80
81 The ISP pipeline can be configure through user-space by calling
82 :ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` on the “bcm2835-isp0-output0”
83 node with the appropriate parameters as shown in the table below.
84
85 .. tabularcolumns:: |p{2cm}|p{5.0cm}|
86
87 .. cssclass: longtable
88
89 .. flat-table::
90
91     * - *id*
92       - *Parameter*
93
94     * - ``V4L2_CID_USER_BCM2835_ISP_CC_MATRIX``
95       - struct :c:type:`bcm2835_isp_custom_ccm`
96
97     * - ``V4L2_CID_USER_BCM2835_ISP_LENS_SHADING``
98       - struct :c:type:`bcm2835_isp_lens_shading`
99
100     * - ``V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL``
101       - struct :c:type:`bcm2835_isp_black_level`
102
103     * - ``V4L2_CID_USER_BCM2835_ISP_GEQ``
104       - struct :c:type:`bcm2835_isp_geq`
105
106     * - ``V4L2_CID_USER_BCM2835_ISP_GAMMA``
107       - struct :c:type:`bcm2835_isp_gamma`
108
109     * - ``V4L2_CID_USER_BCM2835_ISP_DENOISE``
110       - struct :c:type:`bcm2835_isp_denoise`
111
112     * - ``V4L2_CID_USER_BCM2835_ISP_SHARPEN``
113       - struct :c:type:`bcm2835_isp_sharpen`
114
115     * - ``V4L2_CID_USER_BCM2835_ISP_DPC``
116       - struct :c:type:`bcm2835_isp_dpc`
117
118 ++++++++++++++++++++++++
119 Configuration Parameters
120 ++++++++++++++++++++++++
121
122 .. kernel-doc:: include/uapi/linux/bcm2835-isp.h
123    :functions: bcm2835_isp_rational bcm2835_isp_ccm bcm2835_isp_custom_ccm
124                 bcm2835_isp_gain_format bcm2835_isp_lens_shading
125                 bcm2835_isp_black_level bcm2835_isp_geq bcm2835_isp_gamma
126                 bcm2835_isp_denoise bcm2835_isp_sharpen
127                 bcm2835_isp_dpc_mode bcm2835_isp_dpc