Hi Jacopo, On Fri, Feb 09, 2024 at 05:48:16PM +0100, Jacopo Mondi wrote: > From: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx> > > This is the format used by monochrome 12bit image sensors. > > Signed-off-by: Dave Stevenson <dave.stevenson@xxxxxxxxxxxxxxx> > Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx> > --- > .../userspace-api/media/v4l/pixfmt-y12p.rst | 38 +++++++++++++++++++ > .../userspace-api/media/v4l/yuv-formats.rst | 1 + > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 1 + > 4 files changed, 41 insertions(+) > create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > new file mode 100644 > index 000000000000..b2eb4a72724d > --- /dev/null > +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > @@ -0,0 +1,38 @@ > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later > + > +.. _V4L2-PIX-FMT-Y12P: > + > +****************************** > +V4L2_PIX_FMT_Y12P ('Y12P') > +****************************** You have extra asterisks here. > + > +Grey-scale image as a MIPI RAW12 packed array I think you may mention it aligns with MIPI CSI-2 but the same packing may be used elsewhere, it's fairly trivial. The similar Bayer format definitions don't mention this. > + > + > +Description > +=========== > + > +This is a packed grey-scale image format with a depth of 12 bits per > +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes > +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 > +least significants bits of each pixel, in the same order. > + > +**Byte Order.** > +Each cell is one byte. > + > +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}| > + > + > +.. flat-table:: > + :header-rows: 0 > + :stub-columns: 0 > + :widths: 2 1 1 1 > + > + > + - - start + 0: > + - Y'\ :sub:`00high` > + - Y'\ :sub:`01high` > + - Y'\ :sub:`01low`\ (bits 7--4) > + Is the newline here intentional? > + Y'\ :sub:`00low`\ (bits 3--0) > + > diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst > index 24b34cdfa6fe..7c9ccfdd94cd 100644 > --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst > +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst > @@ -267,6 +267,7 @@ image. > pixfmt-packed-yuv > pixfmt-yuv-planar > pixfmt-yuv-luma > + pixfmt-y12p > pixfmt-y8i > pixfmt-y12i > pixfmt-uv8 > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 33076af4dfdb..483498c55899 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1311,6 +1311,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; > case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; > case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; > + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break; > case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; > case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; > case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index a8015e5e7fa4..11ebf9b22ccb 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -598,6 +598,7 @@ struct v4l2_pix_format { > /* Grey bit-packed formats */ > #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ > #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ > +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ > #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ > > /* Palette formats */ -- Regards, Sakari Ailus