linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] New V4L2 controls V4L2_CID_NOTIFY_GAIN_XXX
@ 2021-05-25 15:44 David Plowman
  2021-05-25 15:44 ` [PATCH v2 1/2] media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAIN_XXX controls David Plowman
  2021-05-25 15:44 ` [PATCH v2 2/2] media: v4l2-ctrls: Document " David Plowman
  0 siblings, 2 replies; 3+ messages in thread
From: David Plowman @ 2021-05-25 15:44 UTC (permalink / raw)
  To: linux-media; +Cc: David Plowman

Hi

Here's a second version of this patch set. The only difference is in
the second of the two patches which updates the documentation (and
therefore also the semantics of the controls) according to people's
suggestions, so thanks for those!

The controls are now necessarily linear, with a default unity gain. I
also went with the approach of documenting the first 3 controls as
"refer to the final one", so as to be less repetitive. If anyone has
any ideas to improve the formatting, that would of course be great!

Thanks again and best regards
David

David Plowman (2):
  media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAIN_XXX controls
  media: v4l2-ctrls: Document V4L2_CID_NOTIFY_GAIN_XXX controls

 .../media/v4l/ext-ctrls-image-source.rst      | 25 +++++++++++++++++++
 drivers/media/v4l2-core/v4l2-ctrls.c          |  4 +++
 include/uapi/linux/v4l2-controls.h            |  4 +++
 3 files changed, 33 insertions(+)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAIN_XXX controls
  2021-05-25 15:44 [PATCH v2 0/2] New V4L2 controls V4L2_CID_NOTIFY_GAIN_XXX David Plowman
@ 2021-05-25 15:44 ` David Plowman
  2021-05-25 15:44 ` [PATCH v2 2/2] media: v4l2-ctrls: Document " David Plowman
  1 sibling, 0 replies; 3+ messages in thread
From: David Plowman @ 2021-05-25 15:44 UTC (permalink / raw)
  To: linux-media; +Cc: David Plowman

We add new controls, one for each of the four usual Bayer channels:

V4L2_CID_NOTIFY_GAIN_RED
V4L2_CID_NOTIFY_GAIN_GREENR
V4L2_CID_NOTIFY_GAIN_BLUE
V4L2_CID_NOTIFY_GAIN_GREENB

These are provided for sensors that need to know what colour gains
will be applied to the Bayer channel by subsequent processing (such as
by an ISP), even though the sensor will not apply this gain itself.

The units, as with analogue gain, are determined by the driver.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++++
 include/uapi/linux/v4l2-controls.h   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 0d7fe1bd975a..2f4436e04cf9 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1150,6 +1150,10 @@ const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_TEST_PATTERN_GREENR:	return "Green (Red) Pixel Value";
 	case V4L2_CID_TEST_PATTERN_BLUE:	return "Blue Pixel Value";
 	case V4L2_CID_TEST_PATTERN_GREENB:	return "Green (Blue) Pixel Value";
+	case V4L2_CID_NOTIFY_GAIN_RED:		return "Notify Red Gain";
+	case V4L2_CID_NOTIFY_GAIN_GREENR:	return "Notify Green (Red) Gain";
+	case V4L2_CID_NOTIFY_GAIN_BLUE:		return "Notify Blue Gain";
+	case V4L2_CID_NOTIFY_GAIN_GREENB:	return "Notify Green (Blue) Gain";
 
 	/* Image processing controls */
 	/* Keep the order of the 'case's the same as in v4l2-controls.h! */
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index d43bec5f1afd..dff5f0d26d4a 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1116,6 +1116,10 @@ enum v4l2_jpeg_chroma_subsampling {
 #define V4L2_CID_TEST_PATTERN_BLUE		(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)
 #define V4L2_CID_TEST_PATTERN_GREENB		(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)
 #define V4L2_CID_UNIT_CELL_SIZE			(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 8)
+#define V4L2_CID_NOTIFY_GAIN_RED		(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 9)
+#define V4L2_CID_NOTIFY_GAIN_GREENR		(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 10)
+#define V4L2_CID_NOTIFY_GAIN_BLUE		(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 11)
+#define V4L2_CID_NOTIFY_GAIN_GREENB		(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 12)
 
 
 /* Image processing controls */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] media: v4l2-ctrls: Document V4L2_CID_NOTIFY_GAIN_XXX controls
  2021-05-25 15:44 [PATCH v2 0/2] New V4L2 controls V4L2_CID_NOTIFY_GAIN_XXX David Plowman
  2021-05-25 15:44 ` [PATCH v2 1/2] media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAIN_XXX controls David Plowman
@ 2021-05-25 15:44 ` David Plowman
  1 sibling, 0 replies; 3+ messages in thread
From: David Plowman @ 2021-05-25 15:44 UTC (permalink / raw)
  To: linux-media; +Cc: David Plowman

Add documentation for each of the controls

V4L2_CID_NOTIFY_GAIN_RED
V4L2_CID_NOTIFY_GAIN_GREENR
V4L2_CID_NOTIFY_GAIN_BLUE
V4L2_CID_NOTIFY_GAIN_GREENB

These controls are required by sensors that need to know what colour
gains will be applied to pixels by downstream processing (such as by
an ISP), though the sensor does not apply these gains itself.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 .../media/v4l/ext-ctrls-image-source.rst      | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst
index de43f5c8486d..d50b56156a8e 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst
@@ -72,3 +72,28 @@ Image Source Control IDs
     * - __u32
       - ``height``
       - Height of the area.
+
+``V4L2_CID_NOTIFY_GAIN_RED (integer)``
+    Please refer to ``V4L2_CID_NOTIFY_GAIN_GREENB`` below.
+
+``V4L2_CID_NOTIFY_GAIN_GREENR (integer)``
+    Please refer to ``V4L2_CID_NOTIFY_GAIN_GREENB`` below.
+
+``V4L2_CID_NOTIFY_GAIN_BLUE (integer)``
+    Please refer to ``V4L2_CID_NOTIFY_GAIN_GREENB`` below.
+
+``V4L2_CID_NOTIFY_GAIN_GREENB (integer)``
+    Note: this description covers all four ``V4L2_CID_NOTIFY_GAIN``
+    controls, according to the Bayer channel indicated at the end of
+    the control name.
+
+    The sensor is notified what gain will be applied to this Bayer
+    channel by subsequent processing (such as by an ISP). The sensor
+    is merely informed of this value in case it performs processing
+    that requires it, but it does not apply it to the output pixels
+    themselves.
+
+    The units for the gain value are linear, with the default value
+    being shared between all four controls and representing a gain of
+    exactly 1. Other control properties, such as ranges, should also
+    be common.
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-25 15:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 15:44 [PATCH v2 0/2] New V4L2 controls V4L2_CID_NOTIFY_GAIN_XXX David Plowman
2021-05-25 15:44 ` [PATCH v2 1/2] media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAIN_XXX controls David Plowman
2021-05-25 15:44 ` [PATCH v2 2/2] media: v4l2-ctrls: Document " David Plowman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).