<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">From 23afbeb993acfd94fa21341f01819ab6505444d2 Mon Sep 17 00:00:00 2001
From: Naushir Patuck &lt;naush@raspberrypi.com&gt;
Date: Tue, 21 Apr 2020 15:06:19 +0100
Subject: [PATCH] media: uapi: v4l-ctrls: Add CID base for the
 bcm2835-isp driver

We are reserving controls for the new bcm2835-isp driver.

Signed-off-by: Naushir Patuck &lt;naush@raspberrypi.com&gt;
---
 .../media/v4l-drivers/bcm2835-isp.rst         | 127 ++++++++++++++++++
 Documentation/media/v4l-drivers/index.rst     |   1 +
 include/uapi/linux/v4l2-controls.h            |   4 +
 3 files changed, 132 insertions(+)
 create mode 100644 Documentation/media/v4l-drivers/bcm2835-isp.rst

--- /dev/null
+++ b/Documentation/media/v4l-drivers/bcm2835-isp.rst
@@ -0,0 +1,127 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+BCM2835 ISP Driver
+==================
+
+Introduction
+------------
+
+The BCM2835 Image Sensor Pipeline (ISP) is a fixed function hardware pipeline
+for performing image processing operations.  Images are fed to the input
+of the ISP through memory frame buffers.  These images may be in various YUV,
+RGB, or Bayer formats.  A typical use case would have Bayer images obtained from
+an image sensor by the BCM2835 Unicam peripheral, written to a memory
+frame buffer, and finally fed into the input of the ISP.  Two concurrent output
+images may be generated in YUV or RGB format at different resolutions.
+Statistics output is also generated for Bayer input images.
+
+The bcm2835-isp driver exposes the following media pads as V4L2 device nodes:
+
+.. tabularcolumns:: |l|l|l|l|
+
+.. cssclass: longtable
+
+.. flat-table::
+
+    * - *Pad*
+      - *Direction*
+      - *Purpose*
+      - *Formats*
+
+    * - "bcm2835-isp0-output0"
+      - sink
+      - Accepts Bayer, RGB or YUV format frame buffers as input to the ISP HW
+        pipeline.
+      - :ref:`RAW8 &lt;V4L2-PIX-FMT-SRGGB8&gt;`,
+        :ref:`RAW10P &lt;V4L2-PIX-FMT-SRGGB10P&gt;`,
+        :ref:`RAW12P &lt;V4L2-PIX-FMT-SRGGB12P&gt;`,
+        :ref:`RAW14P &lt;V4L2-PIX-FMT-SRGGB14P&gt;`,
+        :ref:`RAW16 &lt;V4L2-PIX-FMT-SRGGB16&gt;`,
+        :ref:`RGB24/BGR24 &lt;V4L2-PIX-FMT-RGB24&gt;`,
+        :ref:`YUYV &lt;V4L2-PIX-FMT-YUYV&gt;`,
+        :ref:`YVYU &lt;V4L2-PIX-FMT-YVYU&gt;`,
+        :ref:`UYVY &lt;V4L2-PIX-FMT-UYVY&gt;`,
+        :ref:`VYUY &lt;V4L2-PIX-FMT-VYUY&gt;`,
+        :ref:`YUV420/YVU420 &lt;V4L2-PIX-FMT-YUV420&gt;`
+
+    * - "bcm2835-isp0-capture1"
+      - source
+      - High resolution YUV or RGB processed output from the ISP.
+      - :ref:`RGB565 &lt;V4L2-PIX-FMT-RGB565&gt;`,
+        :ref:`RGB24/BGR24 &lt;V4L2-PIX-FMT-RGB24&gt;`,
+        :ref:`ABGR32 &lt;V4L2-PIX-FMT-ABGR32&gt;`,
+        :ref:`YUYV &lt;V4L2-PIX-FMT-YUYV&gt;`,
+        :ref:`YVYU &lt;V4L2-PIX-FMT-YVYU&gt;`,
+        :ref:`UYVY &lt;V4L2-PIX-FMT-UYVY&gt;`,
+        :ref:`VYUY &lt;V4L2-PIX-FMT-VYUY&gt;`.
+        :ref:`YUV420/YVU420 &lt;V4L2-PIX-FMT-YUV420&gt;`,
+        :ref:`NV12/NV21 &lt;V4L2-PIX-FMT-NV12&gt;`,
+
+    * - "bcm2835-isp0-capture2"
+      - source
+      - Low resolution YUV processed output from the ISP. The output of
+        this pad cannot have a resolution larger than the "bcm2835-isp0-capture1" pad in any dimension.
+      - :ref:`YUYV &lt;V4L2-PIX-FMT-YUYV&gt;`,
+        :ref:`YVYU &lt;V4L2-PIX-FMT-YVYU&gt;`,
+        :ref:`UYVY &lt;V4L2-PIX-FMT-UYVY&gt;`,
+        :ref:`VYUY &lt;V4L2-PIX-FMT-VYUY&gt;`.
+        :ref:`YUV420/YVU420 &lt;V4L2-PIX-FMT-YUV420&gt;`,
+        :ref:`NV12/NV21 &lt;V4L2-PIX-FMT-NV12&gt;`,
+
+    * - "bcm2835-isp0-capture1"
+      - source
+      - Image statistics calculated from the input image provided on the
+        "bcm2835-isp0-output0" pad.  Statistics are only available for Bayer
+        format input images.
+      - :ref:`v4l2-meta-fmt-bcm2835-isp-stats`.
+
+Pipeline Configuration
+----------------------
+
+The ISP pipeline can be configure through user-space by calling
+:ref:`VIDIOC_S_EXT_CTRLS &lt;VIDIOC_G_EXT_CTRLS&gt;` on the â€œbcm2835-isp0-output0â€
+node with the appropriate parameters as shown in the table below.
+
+.. tabularcolumns:: |p{2cm}|p{5.0cm}|
+
+.. cssclass: longtable
+
+.. flat-table::
+
+    * - *id*
+      - *Parameter*
+
+    * - ``V4L2_CID_USER_BCM2835_ISP_CC_MATRIX``
+      - struct :c:type:`bcm2835_isp_custom_ccm`
+
+    * - ``V4L2_CID_USER_BCM2835_ISP_LENS_SHADING``
+      - struct :c:type:`bcm2835_isp_lens_shading`
+
+    * - ``V4L2_CID_USER_BCM2835_ISP_BLACK_LEVEL``
+      - struct :c:type:`bcm2835_isp_black_level`
+
+    * - ``V4L2_CID_USER_BCM2835_ISP_GEQ``
+      - struct :c:type:`bcm2835_isp_geq`
+
+    * - ``V4L2_CID_USER_BCM2835_ISP_GAMMA``
+      - struct :c:type:`bcm2835_isp_gamma`
+
+    * - ``V4L2_CID_USER_BCM2835_ISP_DENOISE``
+      - struct :c:type:`bcm2835_isp_denoise`
+
+    * - ``V4L2_CID_USER_BCM2835_ISP_SHARPEN``
+      - struct :c:type:`bcm2835_isp_sharpen`
+
+    * - ``V4L2_CID_USER_BCM2835_ISP_DPC``
+      - struct :c:type:`bcm2835_isp_dpc`
+
+++++++++++++++++++++++++
+Configuration Parameters
+++++++++++++++++++++++++
+
+.. kernel-doc:: include/uapi/linux/bcm2835-isp.h
+   :functions: bcm2835_isp_rational bcm2835_isp_ccm bcm2835_isp_custom_ccm
+                bcm2835_isp_gain_format bcm2835_isp_lens_shading
+                bcm2835_isp_black_level bcm2835_isp_geq bcm2835_isp_gamma
+                bcm2835_isp_denoise bcm2835_isp_sharpen
+                bcm2835_isp_dpc_mode bcm2835_isp_dpc
--- a/Documentation/media/v4l-drivers/index.rst
+++ b/Documentation/media/v4l-drivers/index.rst
@@ -35,6 +35,7 @@ For more details see the file COPYING in
 	v4l-with-ir
 	tuners
 	cardlist
+	bcm2835-isp
 	bttv
 	cafe_ccic
 	cpia2
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -192,6 +192,10 @@ enum v4l2_colorfx {
  * We reserve 16 controls for this driver. */
 #define V4L2_CID_USER_IMX_BASE			(V4L2_CID_USER_BASE + 0x10b0)
 
+/* The base for the bcm2835-isp driver controls.
+ * We reserve 16 controls for this driver. */
+#define V4L2_CID_USER_BCM2835_ISP_BASE		(V4L2_CID_USER_BASE + 0x10c0)
+
 /* MPEG-class control IDs */
 /* The MPEG controls are applicable to all codec controls
  * and the 'MPEG' part of the define is historical */
</pre></body></html>