1 From 8c51a9a891458e5d66cfedea84b1a38ceb01b7ae Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 25 Jun 2020 17:51:03 +0100
4 Subject: [PATCH] media: Add a pixel format for MIPI packed 14bit
7 This is the format used by monochrome 14bit image sensors.
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 Documentation/media/uapi/v4l/pixfmt-y14p.rst | 54 ++++++++++++++++++++
12 Documentation/media/uapi/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, 57 insertions(+)
16 create mode 100644 Documentation/media/uapi/v4l/pixfmt-y14p.rst
19 +++ b/Documentation/media/uapi/v4l/pixfmt-y14p.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-Y14P:
32 +**************************
33 +V4L2_PIX_FMT_Y14P ('Y14P')
34 +**************************
36 +Grey-scale image as a MIPI RAW14 packed array
42 +This is a packed grey-scale image format with a depth of 14 bits per
43 +pixel. Every four consecutive samples are packed into seven bytes. Each
44 +of the first four bytes contain the eight high order bits of the pixels,
45 +and the three following bytes contains the six least significants bits of
46 +each pixel, in the same order.
49 +Each cell is one byte.
51 +.. tabularcolumns:: |p{1.8cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.1cm}|p{3.3cm}|p{3.3cm}|p{3.3cm}|
56 + :widths: 2 1 1 1 1 3 3 3
64 + - Y'\ :sub:`01low bits 1--0`\ (bits 7--6)
66 + Y'\ :sub:`00low bits 5--0`\ (bits 5--0)
68 + - Y'\ :sub:`02low bits 3--0`\ (bits 7--4)
70 + Y'\ :sub:`01low bits 5--2`\ (bits 3--0)
72 + - Y'\ :sub:`03low bits 5--0`\ (bits 7--2)
74 + Y'\ :sub:`02low bits 5--4`\ (bits 1--0)
75 --- a/Documentation/media/uapi/v4l/yuv-formats.rst
76 +++ b/Documentation/media/uapi/v4l/yuv-formats.rst
77 @@ -37,6 +37,7 @@ to brightness information.
85 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
86 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
87 @@ -1218,6 +1218,7 @@ static void v4l_fill_fmtdesc(struct v4l2
88 case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break;
89 case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break;
90 case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break;
91 + case V4L2_PIX_FMT_Y14P: descr = "14-bit Greyscale (MIPI Packed)"; break;
92 case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break;
93 case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break;
94 case V4L2_PIX_FMT_Z16: descr = "16-bit Depth"; break;
95 --- a/include/uapi/linux/videodev2.h
96 +++ b/include/uapi/linux/videodev2.h
97 @@ -577,6 +577,7 @@ struct v4l2_pix_format {
98 #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
99 #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */
100 #define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */
101 +#define V4L2_PIX_FMT_Y14P v4l2_fourcc('Y', '1', '4', 'P') /* 14 Greyscale, MIPI RAW12 packed */
103 /* Palette formats */
104 #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */