[PATCH 3/3] media: uapi: videodev2: Add 28-bit Bayer formats
From: Niklas Söderlund
Date: Thu Sep 10 2026 - 13:56:01 EST
Add 28-bit Bayer formats and documentation.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
---
.../userspace-api/media/v4l/pixfmt-bayer.rst | 1 +
.../userspace-api/media/v4l/pixfmt-srggb28.rst | 102 +++++++++++++++++++++
drivers/media/v4l2-core/v4l2-ioctl.c | 4 +
include/uapi/linux/videodev2.h | 4 +
4 files changed, 111 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
index 9d76def66648..ca915889199e 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-bayer.rst
@@ -35,3 +35,4 @@ orders. See also `the Wikipedia article on Bayer filter
pixfmt-srggb16
pixfmt-srggb20
pixfmt-srggb24
+ pixfmt-srggb28
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-srggb28.rst b/Documentation/userspace-api/media/v4l/pixfmt-srggb28.rst
new file mode 100644
index 000000000000..34133d430436
--- /dev/null
+++ b/Documentation/userspace-api/media/v4l/pixfmt-srggb28.rst
@@ -0,0 +1,102 @@
+.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+.. c:namespace:: V4L
+
+.. _V4L2-PIX-FMT-SRGGB28:
+.. _v4l2-pix-fmt-sbggr28:
+.. _v4l2-pix-fmt-sgbrg28:
+.. _v4l2-pix-fmt-sgrbg28:
+
+***************************************************************************************************************************
+V4L2_PIX_FMT_SBGGR28 ('BG28'), V4L2_PIX_FMT_SGBRG28 ('GB28'), V4L2_PIX_FMT_SGRBG28 ('GR28'), V4L2_PIX_FMT_SRGGB28 ('RG28'),
+***************************************************************************************************************************
+
+
+====================
+28-bit Bayer formats
+====================
+
+
+Description
+===========
+
+These four pixel formats are raw sRGB / Bayer formats with 28 bits per
+sample. Each sample is stored in a 32-bit word. Each n-pixel row contains
+n/2 green samples and n/2 blue or red samples, with alternating red and blue
+rows. Bytes are stored in memory in little endian order. They are
+conventionally described as GRGR... BGBG..., RGRG... GBGB..., etc. Below is
+an example of one sample.
+
+.. cssclass: longtable
+
+.. flat-table:: 28-bit Bayer Formats
+ :header-rows: 2
+ :stub-columns: 0
+
+ * -
+ - :cspan:`31` Sample organization
+ * - Bit
+ - 31
+ - 30
+ - 29
+ - 28
+ - 27
+ - 26
+ - 25
+ - 24
+ - 23
+ - 22
+ - 21
+ - 20
+ - 19
+ - 18
+ - 17
+ - 16
+ - 15
+ - 14
+ - 13
+ - 12
+ - 11
+ - 10
+ - 9
+ - 8
+ - 7
+ - 6
+ - 5
+ - 4
+ - 3
+ - 2
+ - 1
+ - 0
+ * -
+ - *
+ - *
+ - *
+ - *
+ - P\ :sub:`27`
+ - P\ :sub:`26`
+ - P\ :sub:`25`
+ - P\ :sub:`24`
+ - P\ :sub:`23`
+ - P\ :sub:`22`
+ - P\ :sub:`21`
+ - P\ :sub:`20`
+ - P\ :sub:`19`
+ - P\ :sub:`18`
+ - P\ :sub:`17`
+ - P\ :sub:`16`
+ - P\ :sub:`15`
+ - P\ :sub:`14`
+ - P\ :sub:`13`
+ - P\ :sub:`12`
+ - P\ :sub:`11`
+ - P\ :sub:`10`
+ - P\ :sub:`9`
+ - P\ :sub:`8`
+ - P\ :sub:`7`
+ - P\ :sub:`6`
+ - P\ :sub:`5`
+ - P\ :sub:`4`
+ - P\ :sub:`3`
+ - P\ :sub:`2`
+ - P\ :sub:`1`
+ - P\ :sub:`0`
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index cf2831cbdbc8..e14542ad3228 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1442,6 +1442,10 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_SGBRG24: descr = "24-bit Bayer GBGB/RGRG"; break;
case V4L2_PIX_FMT_SGRBG24: descr = "24-bit Bayer GRGR/BGBG"; break;
case V4L2_PIX_FMT_SRGGB24: descr = "24-bit Bayer RGRG/GBGB"; break;
+ case V4L2_PIX_FMT_SBGGR28: descr = "28-bit Bayer BGBG/GRGR"; break;
+ case V4L2_PIX_FMT_SGBRG28: descr = "28-bit Bayer GBGB/RGRG"; break;
+ case V4L2_PIX_FMT_SGRBG28: descr = "28-bit Bayer GRGR/BGBG"; break;
+ case V4L2_PIX_FMT_SRGGB28: descr = "28-bit Bayer RGRG/GBGB"; break;
case V4L2_PIX_FMT_RAW_CRU20: descr = "14-bit Raw CRU Packed"; break;
case V4L2_PIX_FMT_SN9C20X_I420: descr = "GSPCA SN9C20X I420"; break;
case V4L2_PIX_FMT_SPCA501: descr = "GSPCA SPCA501"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 027c7c7a352c..0611ba1e5fd9 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -752,6 +752,10 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SGBRG24 v4l2_fourcc('G', 'B', '2', '4') /* 24 GBGB.. RGRG.. */
#define V4L2_PIX_FMT_SGRBG24 v4l2_fourcc('G', 'R', '2', '4') /* 24 GRGR.. BGBG.. */
#define V4L2_PIX_FMT_SRGGB24 v4l2_fourcc('R', 'G', '2', '4') /* 24 RGRG.. GBGB.. */
+#define V4L2_PIX_FMT_SBGGR28 v4l2_fourcc('B', 'G', '2', '8') /* 28 BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG28 v4l2_fourcc('G', 'B', '2', '8') /* 28 GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG28 v4l2_fourcc('G', 'R', '2', '8') /* 28 GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB28 v4l2_fourcc('R', 'G', '2', '8') /* 28 RGRG.. GBGB.. */
/* HSV formats */
#define V4L2_PIX_FMT_HSV24 v4l2_fourcc('H', 'S', 'V', '3')
--
2.55.0