bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0636-media-v4l2-ctrls-Add-V4L2_CID_NOTIFY_GAINS-control.patch
1 From fa9c40c42f2db87e80ac4a89df6a5ecab1b98031 Mon Sep 17 00:00:00 2001
2 From: David Plowman <david.plowman@raspberrypi.com>
3 Date: Mon, 16 Aug 2021 13:39:08 +0200
4 Subject: [PATCH] media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAINS control
5
6 commit a9c80593ff80ddb7c6496624e5384e1ea3460a72 upstream.
7
8 We add a new control V4L2_CID_NOTIFY_GAINS which allows the sensor to
9 be notified what gains will be applied to the different colour
10 channels by subsequent processing (such as by an ISP), even though the
11 sensor will not apply any of these gains itself.
12
13 For Bayer sensors this will be an array control taking 4 values which
14 are the 4 gains arranged in the fixed order B, Gb, Gr and R,
15 irrespective of the exact Bayer order of the sensor itself. The use of
16 an array makes it straightforward to extend this control to non-Bayer
17 sensors (for example, sensors with an RGBW pattern) in future.
18
19 The units are in all cases linear with the default value indicating a
20 gain of exactly 1.0. For example, if the default value were reported as
21 128 then the value 192 would represent a gain of exactly 1.5.
22
23 Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
24 Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
25 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
26 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
27 ---
28 drivers/media/v4l2-core/v4l2-ctrls-defs.c | 1 +
29 include/uapi/linux/v4l2-controls.h | 1 +
30 2 files changed, 2 insertions(+)
31
32 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
33 +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
34 @@ -1109,6 +1109,7 @@ const char *v4l2_ctrl_get_name(u32 id)
35 case V4L2_CID_TEST_PATTERN_GREENR: return "Green (Red) Pixel Value";
36 case V4L2_CID_TEST_PATTERN_BLUE: return "Blue Pixel Value";
37 case V4L2_CID_TEST_PATTERN_GREENB: return "Green (Blue) Pixel Value";
38 + case V4L2_CID_NOTIFY_GAINS: return "Notify Gains";
39
40 /* Image processing controls */
41 /* Keep the order of the 'case's the same as in v4l2-controls.h! */
42 --- a/include/uapi/linux/v4l2-controls.h
43 +++ b/include/uapi/linux/v4l2-controls.h
44 @@ -1123,6 +1123,7 @@ enum v4l2_jpeg_chroma_subsampling {
45 #define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)
46 #define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)
47 #define V4L2_CID_UNIT_CELL_SIZE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 8)
48 +#define V4L2_CID_NOTIFY_GAINS (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 9)
49
50
51 /* Image processing controls */