1 From 85e4a24a7f8fd96cc765c038bbae601ca69daa39 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 7 May 2020 16:59:03 +0100
4 Subject: [PATCH] media: Add a pixel format for MIPI packed 12bit luma
7 This is the format used by monochrome 12bit image sensors.
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 .../userspace-api/media/v4l/pixfmt-y12p.rst | 45 +++++++++++++++++++
12 .../userspace-api/media/v4l/yuv-formats.rst | 1 +
13 drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
14 include/uapi/linux/videodev2.h | 1 +
15 4 files changed, 48 insertions(+)
16 create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst
19 +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst
21 +.. Permission is granted to copy, distribute and/or modify this
22 +.. document under the terms of the GNU Free Documentation License,
23 +.. Version 1.1 or any later version published by the Free Software
24 +.. Foundation, with no Invariant Sections, no Front-Cover Texts
25 +.. and no Back-Cover Texts. A copy of the license is included at
26 +.. Documentation/media/uapi/fdl-appendix.rst.
28 +.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
30 +.. _V4L2-PIX-FMT-Y12P:
32 +******************************
33 +V4L2_PIX_FMT_Y12P ('Y12P')
34 +******************************
36 +Grey-scale image as a MIPI RAW12 packed array
42 +This is a packed grey-scale image format with a depth of 12 bits per
43 +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes
44 +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4
45 +least significants bits of each pixel, in the same order.
48 +Each cell is one byte.
50 +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}|
62 + - Y'\ :sub:`01low`\ (bits 7--4)
64 + Y'\ :sub:`00low`\ (bits 3--0)
66 --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst
67 +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst
68 @@ -28,6 +28,7 @@ to brightness information.
76 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
77 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
78 @@ -1283,6 +1283,7 @@ static void v4l_fill_fmtdesc(struct v4l2
79 case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break;
80 case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break;
81 case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break;
82 + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break;
83 case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break;
84 case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break;
85 case V4L2_PIX_FMT_Z16: descr = "16-bit Depth"; break;
86 --- a/include/uapi/linux/videodev2.h
87 +++ b/include/uapi/linux/videodev2.h
88 @@ -580,6 +580,7 @@ struct v4l2_pix_format {
89 /* Grey bit-packed formats */
90 #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
91 #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */
92 +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */
95 #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */