96e6e124af98ad3b423ad4c740bd496c29e09369
[openwrt/staging/981213.git] /
1 From 23afbeb993acfd94fa21341f01819ab6505444d2 Mon Sep 17 00:00:00 2001
2 From: Naushir Patuck <naush@raspberrypi.com>
3 Date: Tue, 21 Apr 2020 15:06:19 +0100
4 Subject: [PATCH] media: uapi: v4l-ctrls: Add CID base for the
5 bcm2835-isp driver
6
7 We are reserving controls for the new bcm2835-isp driver.
8
9 Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
10 ---
11 .../media/v4l-drivers/bcm2835-isp.rst | 127 ++++++++++++++++++
12 Documentation/media/v4l-drivers/index.rst | 1 +
13 include/uapi/linux/v4l2-controls.h | 4 +
14 3 files changed, 132 insertions(+)
15 create mode 100644 Documentation/media/v4l-drivers/bcm2835-isp.rst
16
17 --- /dev/null
18 +++ b/Documentation/media/v4l-drivers/bcm2835-isp.rst
19 @@ -0,0 +1,127 @@
20 +.. SPDX-License-Identifier: GPL-2.0
21 +
22 +BCM2835 ISP Driver
23 +==================
24 +
25 +Introduction
26 +------------
27 +
28 +The BCM2835 Image Sensor Pipeline (ISP) is a fixed function hardware pipeline
29 +for performing image processing operations. Images are fed to the input
30 +of the ISP through memory frame buffers. These images may be in various YUV,
31 +RGB, or Bayer formats. A typical use case would have Bayer images obtained from
32 +an image sensor by the BCM2835 Unicam peripheral, written to a memory
33 +frame buffer, and finally fed into the input of the ISP. Two concurrent output
34 +images may be generated in YUV or RGB format at different resolutions.
35 +Statistics output is also generated for Bayer input images.
36 +
37 +The bcm2835-isp driver exposes the following media pads as V4L2 device nodes:
38 +
39 +.. tabularcolumns:: |l|l|l|l|
40 +
41 +.. cssclass: longtable
42 +
43 +.. flat-table::
44 +
45 + * - *Pad*
46 + - *Direction*
47 + - *Purpose*
48 + - *Formats*
49 +
50 + * - "bcm2835-isp0-output0"
51 + - sink
52 + - Accepts Bayer, RGB or YUV format frame buffers as input to the ISP HW
53 + pipeline.
54 + - :ref:`RAW8 <V4L2-PIX-FMT-SRGGB8>`,
55 + :ref:`RAW10P <V4L2-PIX-FMT-SRGGB10P>`,
56 + :ref:`RAW12P <V4L2-PIX-FMT-SRGGB12P>`,
57 + :ref:`RAW14P <V4L2-PIX-FMT-SRGGB14P>`,
58 + :ref:`RAW16 <V4L2-PIX-FMT-SRGGB16>`,
59 + :ref:`RGB24/BGR24 <V4L2-PIX-FMT-RGB24>`,
60 + :ref:`YUYV <V4L2-PIX-FMT-YUYV>`,
61 + :ref:`YVYU <V4L2-PIX-FMT-YVYU>`,
62 + :ref:`UYVY <V4L2-PIX-FMT-UYVY>`,
63 + :ref:`VYUY <V4L2-PIX-FMT-VYUY>`,
64 + :ref:`YUV420/YVU420 <V4L2-PIX-FMT-YUV420>`
65 +
66 + * - "bcm2835-isp0-capture1"
67 + - source
68 + - High resolution YUV or RGB processed output from the ISP.
69 + - :ref:`RGB565 <V4L2-PIX-FMT-RGB565>`,
70 + :ref:`RGB24/BGR24 <V4L2-PIX-FMT-RGB24>`,
71 + :ref:`ABGR32 <V4L2-PIX-FMT-ABGR32>`,
72 + :ref:`YUYV <V4L2-PIX-FMT-YUYV>`,
73 + :ref:`YVYU <V4L2-PIX-FMT-YVYU>`,
74 + :ref:`UYVY <V4L2-PIX-FMT-UYVY>`,
75 + :ref:`VYUY <V4L2-PIX-FMT-VYUY>`.
76 + :ref:`YUV420/YVU420 <V4L2-PIX-FMT-YUV420>`,
77 + :ref:`NV12/NV21 <V4L2-PIX-FMT-NV12>`,
78 +
79 + * - "bcm2835-isp0-capture2"
80 + - source
81 + - Low resolution YUV processed output from the ISP. The output of
82 + this pad cannot have a resolution larger than the "bcm2835-isp0-capture1" pad in any dimension.
83 + - :ref:`YUYV <V4L2-PIX-FMT-YUYV>`,
84 + :ref:`YVYU <V4L2-PIX-FMT-YVYU>`,
85 + :ref:`UYVY <V4L2-PIX-FMT-UYVY>`,
86 + :ref:`VYUY <V4L2-PIX-FMT-VYUY>`.
87 + :ref:`YUV420/YVU420 <V4L2-PIX-FMT-YUV420>`,
88 + :ref:`NV12/NV21 <V4L2-PIX-FMT-NV12>`,
89 +
90 + * - "bcm2835-isp0-capture1"
91 + - source
92 + - Image statistics calculated from the input image provided on the
93 + "bcm2835-isp0-output0" pad. Statistics are only available for Bayer
94 + format input images.
95 + - :ref:`v4l2-meta-fmt-bcm2835-isp-stats`.
96 +
97 +Pipeline Configuration
98 +----------------------
99 +
100 +The ISP pipeline can be configure through user-space by calling
101 +:ref:`VIDIOC_S_EXT_CTRLS <VIDIOC_G_EXT_CTRLS>` on the “bcm2835-isp0-output0”
102 +node with the appropriate parameters as shown in the table below.
103 +
104 +.. tabularcolumns:: |p{2cm}|p{5.0cm}|
105 +
106 +.. cssclass: longtable
107 +
108 +.. flat-table::
109 +
110 + * - *id*
111 + - *Parameter*
112 +
113 + * - ``V4L2_CID_USER_BCM2835_ISP_CC_MATRIX``
114 + - struct :c:type:`bcm2835_isp_custom_ccm`
115 +
116 + * - ``V4L2_CID_USER_BCM2835_ISP_LENS_SHADING``
117 + - struct :c:type:`bcm2835_isp_lens_shading`
118 +
119 + * - ``V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL``
120 + - struct :c:type:`bcm2835_isp_black_level`
121 +
122 + * - ``V4L2_CID_USER_BCM2835_ISP_GEQ``
123 + - struct :c:type:`bcm2835_isp_geq`
124 +
125 + * - ``V4L2_CID_USER_BCM2835_ISP_GAMMA``
126 + - struct :c:type:`bcm2835_isp_gamma`
127 +
128 + * - ``V4L2_CID_USER_BCM2835_ISP_DENOISE``
129 + - struct :c:type:`bcm2835_isp_denoise`
130 +
131 + * - ``V4L2_CID_USER_BCM2835_ISP_SHARPEN``
132 + - struct :c:type:`bcm2835_isp_sharpen`
133 +
134 + * - ``V4L2_CID_USER_BCM2835_ISP_DPC``
135 + - struct :c:type:`bcm2835_isp_dpc`
136 +
137 +++++++++++++++++++++++++
138 +Configuration Parameters
139 +++++++++++++++++++++++++
140 +
141 +.. kernel-doc:: include/uapi/linux/bcm2835-isp.h
142 + :functions: bcm2835_isp_rational bcm2835_isp_ccm bcm2835_isp_custom_ccm
143 + bcm2835_isp_gain_format bcm2835_isp_lens_shading
144 + bcm2835_isp_black_level bcm2835_isp_geq bcm2835_isp_gamma
145 + bcm2835_isp_denoise bcm2835_isp_sharpen
146 + bcm2835_isp_dpc_mode bcm2835_isp_dpc
147 --- a/Documentation/media/v4l-drivers/index.rst
148 +++ b/Documentation/media/v4l-drivers/index.rst
149 @@ -35,6 +35,7 @@ For more details see the file COPYING in
150 v4l-with-ir
151 tuners
152 cardlist
153 + bcm2835-isp
154 bttv
155 cafe_ccic
156 cpia2
157 --- a/include/uapi/linux/v4l2-controls.h
158 +++ b/include/uapi/linux/v4l2-controls.h
159 @@ -192,6 +192,10 @@ enum v4l2_colorfx {
160 * We reserve 16 controls for this driver. */
161 #define V4L2_CID_USER_IMX_BASE (V4L2_CID_USER_BASE + 0x10b0)
162
163 +/* The base for the bcm2835-isp driver controls.
164 + * We reserve 16 controls for this driver. */
165 +#define V4L2_CID_USER_BCM2835_ISP_BASE (V4L2_CID_USER_BASE + 0x10c0)
166 +
167 /* MPEG-class control IDs */
168 /* The MPEG controls are applicable to all codec controls
169 * and the 'MPEG' part of the define is historical */