[PATCH v12 03/86] media: uapi: Add new media bus codes for generic raw formats

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

Add new media bus codes for generic raw formats that are not specific to
the colour filter array but that simply specify the bit depth. The layout
(packing) of the data is interface specific.

The rest of the properties of the format are specified with controls in
the image source.

The mbus codes added by this patch have bit depth of 8, 10, 12 and 14.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
.../media/v4l/subdev-formats.rst | 27 +++++++++++++++++++
include/uapi/linux/media-bus-format.h | 6 +++++
2 files changed, 33 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/subdev-formats.rst b/Documentation/userspace-api/media/v4l/subdev-formats.rst
index c9999b929773..fecb786cb8af 100644
--- a/Documentation/userspace-api/media/v4l/subdev-formats.rst
+++ b/Documentation/userspace-api/media/v4l/subdev-formats.rst
@@ -3855,6 +3855,33 @@ organization is given as an example for the first pixel only.

\endgroup

+Generic raw formats on serial interfaces
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Those formats transfer raw pixel data typically from raw camera sensors using
+Bayer and other Colour Filter Arrays (CFAs) on serial interfaces. The packing of
+the data on the bus is determined by the hardware, however the bit depth is
+still specific to the format.
+
+.. tabularcolumns:: |p{2.0cm}|p{4.0cm}|p{11.3cm}|
+
+.. cssclass:: longtable
+
+.. flat-table:: Generic raw formats on serial buses
+ :header-rows: 1
+ :stub-columns: 0
+ :widths: 1 1
+
+ * - Format name
+ - Bit depth
+ * - MEDIA_BUS_FMT_RAW_8
+ - 8
+ * - MEDIA_BUS_FMT_RAW_10
+ - 10
+ * - MEDIA_BUS_FMT_RAW_12
+ - 12
+ * - MEDIA_BUS_FMT_RAW_14
+ - 14

Packed YUV Formats
^^^^^^^^^^^^^^^^^^
diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h
index 6005f033e62c..83feeae6a31e 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -190,4 +190,10 @@
#define MEDIA_BUS_FMT_META_20 0x8006
#define MEDIA_BUS_FMT_META_24 0x8007

+/* Generic (CFA independent) pixel data formats. Next is 0x9005. */
+#define MEDIA_BUS_FMT_RAW_8 0x9001
+#define MEDIA_BUS_FMT_RAW_10 0x9002
+#define MEDIA_BUS_FMT_RAW_12 0x9003
+#define MEDIA_BUS_FMT_RAW_14 0x9004
+
#endif /* __LINUX_MEDIA_BUS_FORMAT_H */
--
2.47.3