New V4L2 controls V4L2_CID_NOTIFY_GAIN_XXX
v2 cover New V4L2 controls V4L2_CID_NOTIFY_GAIN_XXX
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(+)
Signature · 1 line
2.17.1
PATCH v2 1/2 media: v4l2-ctrls: Add V4L2_CID_NOTIFY_GAIN_XXX controls
We add new controls, one for each of the four usual Bayer channels:
V4L2_CID_NOTIFY_GAIN_REDV4L2_CID_NOTIFY_GAIN_GREENRV4L2_CID_NOTIFY_GAIN_BLUEV4L2_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.
--- drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++++ include/uapi/linux/v4l2-controls.h | 4 ++++ 2 files changed, 8 insertions(+)
drivers/media/v4l2-core/v4l2-ctrls.c +4 -0
@@ -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! */
include/uapi/linux/v4l2-controls.h +4 -0
@@ -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 */
Signature · 1 line
2.17.1
PATCH v2 2/2 media: v4l2-ctrls: Document V4L2_CID_NOTIFY_GAIN_XXX controls
In reply to David PlowmanAdd documentation for each of the controls
V4L2_CID_NOTIFY_GAIN_REDV4L2_CID_NOTIFY_GAIN_GREENRV4L2_CID_NOTIFY_GAIN_BLUEV4L2_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.
--- .../media/v4l/ext-ctrls-image-source.rst | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst +25 -0
@@ -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.
Signature · 1 line
2.17.1