[PATCH v12 33/86] media: uapi: Add new controls for camera sensor FLL and LLP

Sakari Ailus
2026-04-09T20:15:34Z

Add new controls for camera sensors, V4L2_CID_LINE_LENGTH_PIXELS and
V4L2_CID_FRAME_LENGTH_LINES, to convey the combined size of the analogue
crop rectangle and horizontal and vertical blanking.

The reason for adding the new controls is that they're much easier to use
as the user doesn't have to be concerned of the analogue crop in the same
context. Secondarily, the newly added common raw sensor model uses
different values for the same.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
.../userspace-api/media/v4l/ext-ctrls-image-source.rst | 10 ++++++++++
drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++
include/uapi/linux/v4l2-controls.h | 3 +++
3 files changed, 15 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 63e53c883db6..fb4dee1b4f94 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst
@@ -201,3 +201,13 @@ For instance, a value of ``0x0001000300020003`` indicates binning by 3
Sub-sampling is used to downscale an image, horizontally and vertically, by
discarding a part of the image data. Typically sub-sampling produces lower
quality images than binning.
+
+.. _image_source_control_frame_length:
+
+``V4L2_CID_FRAME_LENGTH_LINES (integer)``
+ Frame length in lines. The value of the control is the number of lines
+ captured in the sensor's pixel array added to the vertical blanking.
+
+``V4L2_CID_LINE_LENGTH_PIXELS (integer)``
+ Line length in pixels. The value of the control is the number of pixels per
+ line captured in the sensor's pixel array added to the horizontal blanking.
diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index 227bcb5a549d..bd23c5640722 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -1163,6 +1163,8 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_BINNING_FACTORS: return "Binning Factors";
case V4L2_CID_SUBSAMPLING_HORIZONTAL: return "Sub-Sampling Factor, Horizontal";
case V4L2_CID_SUBSAMPLING_VERTICAL: return "Sub-Sampling Factor, Vertical";
+ case V4L2_CID_FRAME_LENGTH_LINES: return "Frame Length in Lines";
+ case V4L2_CID_LINE_LENGTH_PIXELS: return "Line Length in Pixels";

/* 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 acb6f9ad4d1b..60f0fb599926 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1253,6 +1253,9 @@ enum v4l2_jpeg_chroma_subsampling {
#define V4L2_CID_SUBSAMPLING_HORIZONTAL (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 14)
#define V4L2_CID_SUBSAMPLING_VERTICAL (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 15)

+#define V4L2_CID_FRAME_LENGTH_LINES (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 16)
+#define V4L2_CID_LINE_LENGTH_PIXELS (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 17)
+
/* Image processing controls */

#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
--
2.47.3