firmware-utils: bump to git HEAD
[openwrt/staging/ldir.git] / target / linux / bcm27xx / patches-5.4 / 950-0845-media-v4l-Add-14-bit-raw-greyscale-pixel-format.patch
1 From 363792f3fff5f4f79e2ac08ccfcc21c05216787a Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= <dg@emlix.com>
3 Date: Mon, 24 Feb 2020 18:52:21 +0100
4 Subject: [PATCH] media: v4l: Add 14-bit raw greyscale pixel format
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Commit ae9753a04cfc8e41262605875e531b6ea5e3d0ac upstream.
10
11 The new format is called V4L2_PIX_FMT_Y14. Like V4L2_PIX_FMT_Y10 and
12 V4L2_PIX_FMT_Y12 it is stored in two bytes per pixel but has only two
13 unused bits at the top.
14
15 Signed-off-by: Daniel Glöckner <dg@emlix.com>
16 Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
17 Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
18 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
19 ---
20 Documentation/media/uapi/v4l/pixfmt-y14.rst | 72 ++++++++++++++++++++
21 Documentation/media/uapi/v4l/yuv-formats.rst | 1 +
22 drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
23 include/uapi/linux/videodev2.h | 1 +
24 4 files changed, 75 insertions(+)
25 create mode 100644 Documentation/media/uapi/v4l/pixfmt-y14.rst
26
27 --- /dev/null
28 +++ b/Documentation/media/uapi/v4l/pixfmt-y14.rst
29 @@ -0,0 +1,72 @@
30 +.. Permission is granted to copy, distribute and/or modify this
31 +.. document under the terms of the GNU Free Documentation License,
32 +.. Version 1.1 or any later version published by the Free Software
33 +.. Foundation, with no Invariant Sections, no Front-Cover Texts
34 +.. and no Back-Cover Texts. A copy of the license is included at
35 +.. Documentation/media/uapi/fdl-appendix.rst.
36 +..
37 +.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
38 +
39 +.. _V4L2-PIX-FMT-Y14:
40 +
41 +*************************
42 +V4L2_PIX_FMT_Y14 ('Y14 ')
43 +*************************
44 +
45 +
46 +Grey-scale image
47 +
48 +
49 +Description
50 +===========
51 +
52 +This is a grey-scale image with a depth of 14 bits per pixel. Pixels are
53 +stored in 16-bit words with unused high bits padded with 0. The least
54 +significant byte is stored at lower memory addresses (little-endian).
55 +
56 +**Byte Order.**
57 +Each cell is one byte.
58 +
59 +
60 +
61 +
62 +.. flat-table::
63 + :header-rows: 0
64 + :stub-columns: 0
65 +
66 + * - start + 0:
67 + - Y'\ :sub:`00low`
68 + - Y'\ :sub:`00high`
69 + - Y'\ :sub:`01low`
70 + - Y'\ :sub:`01high`
71 + - Y'\ :sub:`02low`
72 + - Y'\ :sub:`02high`
73 + - Y'\ :sub:`03low`
74 + - Y'\ :sub:`03high`
75 + * - start + 8:
76 + - Y'\ :sub:`10low`
77 + - Y'\ :sub:`10high`
78 + - Y'\ :sub:`11low`
79 + - Y'\ :sub:`11high`
80 + - Y'\ :sub:`12low`
81 + - Y'\ :sub:`12high`
82 + - Y'\ :sub:`13low`
83 + - Y'\ :sub:`13high`
84 + * - start + 16:
85 + - Y'\ :sub:`20low`
86 + - Y'\ :sub:`20high`
87 + - Y'\ :sub:`21low`
88 + - Y'\ :sub:`21high`
89 + - Y'\ :sub:`22low`
90 + - Y'\ :sub:`22high`
91 + - Y'\ :sub:`23low`
92 + - Y'\ :sub:`23high`
93 + * - start + 24:
94 + - Y'\ :sub:`30low`
95 + - Y'\ :sub:`30high`
96 + - Y'\ :sub:`31low`
97 + - Y'\ :sub:`31high`
98 + - Y'\ :sub:`32low`
99 + - Y'\ :sub:`32high`
100 + - Y'\ :sub:`33low`
101 + - Y'\ :sub:`33high`
102 --- a/Documentation/media/uapi/v4l/yuv-formats.rst
103 +++ b/Documentation/media/uapi/v4l/yuv-formats.rst
104 @@ -35,6 +35,7 @@ to brightness information.
105 pixfmt-grey
106 pixfmt-y10
107 pixfmt-y12
108 + pixfmt-y14
109 pixfmt-y10b
110 pixfmt-y10p
111 pixfmt-y16
112 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
113 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
114 @@ -1212,6 +1212,7 @@ static void v4l_fill_fmtdesc(struct v4l2
115 case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break;
116 case V4L2_PIX_FMT_Y10: descr = "10-bit Greyscale"; break;
117 case V4L2_PIX_FMT_Y12: descr = "12-bit Greyscale"; break;
118 + case V4L2_PIX_FMT_Y14: descr = "14-bit Greyscale"; break;
119 case V4L2_PIX_FMT_Y16: descr = "16-bit Greyscale"; break;
120 case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break;
121 case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break;
122 --- a/include/uapi/linux/videodev2.h
123 +++ b/include/uapi/linux/videodev2.h
124 @@ -569,6 +569,7 @@ struct v4l2_pix_format {
125 #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
126 #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
127 #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */
128 +#define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 Greyscale */
129 #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
130 #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */
131