210c128f43bf618776a807781b4b3a06bddab21b
[openwrt/staging/linusw.git] /
1 From e3da593c79ce8e7ab7072fe1551fc1e8b5494eab 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 luma
5 only.
6
7 This is the format used by monochrome 14bit image sensors.
8
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
10 ---
11 .../userspace-api/media/v4l/pixfmt-y14p.rst | 54 +++++++++++++++++++
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, 57 insertions(+)
16 create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
17
18 --- /dev/null
19 +++ b/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
20 @@ -0,0 +1,54 @@
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.
27 +..
28 +.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
29 +
30 +.. _V4L2-PIX-FMT-Y14P:
31 +
32 +**************************
33 +V4L2_PIX_FMT_Y14P ('Y14P')
34 +**************************
35 +
36 +Grey-scale image as a MIPI RAW14 packed array
37 +
38 +
39 +Description
40 +===========
41 +
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.
47 +
48 +**Byte Order.**
49 +Each cell is one byte.
50 +
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}|
52 +
53 +.. flat-table::
54 + :header-rows: 0
55 + :stub-columns: 0
56 + :widths: 2 1 1 1 1 3 3 3
57 +
58 +
59 + - - start + 0:
60 + - Y'\ :sub:`00high`
61 + - Y'\ :sub:`01high`
62 + - Y'\ :sub:`02high`
63 + - Y'\ :sub:`03high`
64 + - Y'\ :sub:`01low bits 1--0`\ (bits 7--6)
65 +
66 + Y'\ :sub:`00low bits 5--0`\ (bits 5--0)
67 +
68 + - Y'\ :sub:`02low bits 3--0`\ (bits 7--4)
69 +
70 + Y'\ :sub:`01low bits 5--2`\ (bits 3--0)
71 +
72 + - Y'\ :sub:`03low bits 5--0`\ (bits 7--2)
73 +
74 + Y'\ :sub:`02low bits 5--4`\ (bits 1--0)
75 --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst
76 +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst
77 @@ -30,6 +30,7 @@ to brightness information.
78 pixfmt-y12
79 pixfmt-y12p
80 pixfmt-y14
81 + pixfmt-y14p
82 pixfmt-y10b
83 pixfmt-y10p
84 pixfmt-y16
85 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
86 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
87 @@ -1302,6 +1302,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 @@ -581,6 +581,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 */
102
103 /* Palette formats */
104 #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */