[PATCH v12 48/86] media: uapi: Add metadata layout for ov2740 embedded data

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

Add a metadata layout for ov2740 camera sensor embedded data and document
it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
.../media/v4l/ext-ctrls-image-source.rst | 3 +
.../media/v4l/metadata-layouts.rst | 73 +++++++++++++++++++
include/uapi/linux/v4l2-controls.h | 1 +
3 files changed, 77 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 4ed9bea89101..bf208de8e626 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-image-source.rst
@@ -172,6 +172,9 @@ Image Source Control IDs
* - V4L2_METADATA_LAYOUT_CCS
- :ref:`CCS embedded data <media-metadata-layout-ccs>`
- 1
+ * - V4L2_METADATA_LAYOUT_OV2740
+ - :ref:`OV2740 embedded data <media-metadata-layout-ov2740>`
+ - 2

.. _image_source_control_binning_factors:

diff --git a/Documentation/userspace-api/media/v4l/metadata-layouts.rst b/Documentation/userspace-api/media/v4l/metadata-layouts.rst
index 0f8709f2e9af..b4d04d82662b 100644
--- a/Documentation/userspace-api/media/v4l/metadata-layouts.rst
+++ b/Documentation/userspace-api/media/v4l/metadata-layouts.rst
@@ -39,3 +39,76 @@ format" (code ``0xa``) but their use may be extended further in the future, to
cover other CCS embedded data format codes.

Also see :ref:`CCS driver documentation <media-ccs-routes>`.
+
+.. _media-metadata-layout-ov2740:
+
+Omnivision OV2740 Embedded Data Layout (``V4L2_METADATA_LAYOUT_OV2740``)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The Omnivision OV2740 camera sensor produces the following embedded data layout,
+indicated by ``V4L2_METADATA_LAYOUT_OV2740`` metadata layout. The format
+conforms to :ref:`CCS embedded data layout <media-metadata-layout-ccs>` up to
+level 1.
+
+.. flat-table:: Omnivision OV2740 Embedded Data Layout. Octets at indices marked
+ reserved or unused have been omitted from the table. The values
+ are in big endian byte order.
+ :header-rows: 1
+
+ * - Offset
+ - Size in bits (active bits if not the same as size)
+ - Content description
+ * - 4
+ - 16 (10--0)
+ - Analogue gain
+ * - 6
+ - 16
+ - Coarse integration time
+ * - 10
+ - 8
+ - DPC correction threshold bits 9--2
+ * - 15
+ - 16
+ - Output image width
+ * - 17
+ - 16
+ - Output image height
+ * - 23
+ - 8
+ - MIPI header revision number (2)
+ * - 31
+ - 8
+ - Vertical (bit 1) and horizontal flip (bit 0)
+ * - 32
+ - 8
+ - Frame duration A
+ * - 33
+ - 8
+ - Frame duration B
+ * - 34
+ - 8
+ - Context count (2)
+ * - 35
+ - 8
+ - Context select
+ * - 54
+ - 8
+ - Data pedestal bits 9--2
+ * - 63
+ - 8
+ - Frame average bits 9--2
+ * - 64
+ - 16
+ - Digital gain red
+ * - 66
+ - 16
+ - Digital gain greenr
+ * - 68
+ - 16
+ - Digital gain blue
+ * - 70
+ - 16
+ - Digital gain greenb
+ * - 89
+ - 8
+ - Frame counter (starts at 1, wraps to 0 after 255)
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index e27a7ad47c51..b2f1ffd7071c 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1249,6 +1249,7 @@ enum v4l2_jpeg_chroma_subsampling {

#define V4L2_CID_METADATA_LAYOUT (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 12)
#define V4L2_METADATA_LAYOUT_CCS 1U
+#define V4L2_METADATA_LAYOUT_OV2740 2U

#define V4L2_CID_BINNING_FACTORS (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 13)
#define V4L2_BINNING_FACTORS_MAKE(hnum, hdem, vnum, vdem) \
--
2.47.3