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
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Commit ae9753a04cfc8e41262605875e531b6ea5e3d0ac upstream.
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.
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>
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
28 +++ b/Documentation/media/uapi/v4l/pixfmt-y14.rst
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.
37 +.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
39 +.. _V4L2-PIX-FMT-Y14:
41 +*************************
42 +V4L2_PIX_FMT_Y14 ('Y14 ')
43 +*************************
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).
57 +Each cell is one byte.
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.
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 */