1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Media Bus API header
4  *
5  * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11 
12 #ifndef __LINUX_V4L2_MEDIABUS_H
13 #define __LINUX_V4L2_MEDIABUS_H
14 
15 #include <linux/media-bus-format.h>
16 #include <linux/types.h>
17 #include <linux/videodev2.h>
18 
19 #define V4L2_MBUS_FRAMEFMT_SET_CSC	0x0001
20 
21 /**
22  * struct v4l2_mbus_framefmt - frame format on the media bus
23  * @width:	image width
24  * @height:	image height
25  * @code:	data format code (from enum v4l2_mbus_pixelcode)
26  * @field:	used interlacing type (from enum v4l2_field)
27  * @colorspace:	colorspace of the data (from enum v4l2_colorspace)
28  * @ycbcr_enc:	YCbCr encoding of the data (from enum v4l2_ycbcr_encoding)
29  * @hsv_enc:	HSV encoding of the data (from enum v4l2_hsv_encoding)
30  * @quantization: quantization of the data (from enum v4l2_quantization)
31  * @xfer_func:  transfer function of the data (from enum v4l2_xfer_func)
32  * @flags:	flags (V4L2_MBUS_FRAMEFMT_*)
33  * @reserved:  reserved bytes that can be later used
34  */
35 struct v4l2_mbus_framefmt {
36 	__u32			width;
37 	__u32			height;
38 	__u32			code;
39 	__u32			field;
40 	__u32			colorspace;
41 	union {
42 		/* enum v4l2_ycbcr_encoding */
43 		__u16			ycbcr_enc;
44 		/* enum v4l2_hsv_encoding */
45 		__u16			hsv_enc;
46 	};
47 	__u16			quantization;
48 	__u16			xfer_func;
49 	__u16			flags;
50 	__u16			reserved[10];
51 };
52 
53 #ifndef __KERNEL__
54 /*
55  * enum v4l2_mbus_pixelcode and its definitions are now deprecated, and
56  * MEDIA_BUS_FMT_ definitions (defined in media-bus-format.h) should be
57  * used instead.
58  *
59  * New defines should only be added to media-bus-format.h. The
60  * v4l2_mbus_pixelcode enum is frozen.
61  */
62 
63 #define V4L2_MBUS_FROM_MEDIA_BUS_FMT(name)	\
64 	V4L2_MBUS_FMT_ ## name = MEDIA_BUS_FMT_ ## name
65 
66 enum v4l2_mbus_pixelcode {
67 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(FIXED),
68 
69 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB444_2X8_PADHI_BE),
70 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB444_2X8_PADHI_LE),
71 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB555_2X8_PADHI_BE),
72 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB555_2X8_PADHI_LE),
73 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(BGR565_2X8_BE),
74 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(BGR565_2X8_LE),
75 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB565_2X8_BE),
76 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB565_2X8_LE),
77 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB666_1X18),
78 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_1X24),
79 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_2X12_BE),
80 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(RGB888_2X12_LE),
81 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(ARGB8888_1X32),
82 
83 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y8_1X8),
84 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(UV8_1X8),
85 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_1_5X8),
86 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_1_5X8),
87 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_1_5X8),
88 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_1_5X8),
89 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_2X8),
90 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_2X8),
91 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_2X8),
92 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_2X8),
93 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y10_1X10),
94 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY10_2X10),
95 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY10_2X10),
96 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV10_2X10),
97 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU10_2X10),
98 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(Y12_1X12),
99 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY8_1X16),
100 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY8_1X16),
101 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV8_1X16),
102 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU8_1X16),
103 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YDYUYDYV8_1X16),
104 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY10_1X20),
105 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY10_1X20),
106 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV10_1X20),
107 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU10_1X20),
108 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUV10_1X30),
109 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(AYUV8_1X32),
110 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY12_2X12),
111 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY12_2X12),
112 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV12_2X12),
113 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU12_2X12),
114 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(UYVY12_1X24),
115 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(VYUY12_1X24),
116 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YUYV12_1X24),
117 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(YVYU12_1X24),
118 
119 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR8_1X8),
120 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG8_1X8),
121 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG8_1X8),
122 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB8_1X8),
123 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_ALAW8_1X8),
124 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_ALAW8_1X8),
125 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_ALAW8_1X8),
126 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_ALAW8_1X8),
127 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_DPCM8_1X8),
128 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_DPCM8_1X8),
129 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_DPCM8_1X8),
130 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_DPCM8_1X8),
131 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADHI_BE),
132 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADHI_LE),
133 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADLO_BE),
134 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_2X8_PADLO_LE),
135 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR10_1X10),
136 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG10_1X10),
137 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG10_1X10),
138 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB10_1X10),
139 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SBGGR12_1X12),
140 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGBRG12_1X12),
141 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SGRBG12_1X12),
142 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(SRGGB12_1X12),
143 
144 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(JPEG_1X8),
145 
146 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(S5C_UYVY_JPEG_1X8),
147 
148 	V4L2_MBUS_FROM_MEDIA_BUS_FMT(AHSV8888_1X32),
149 };
150 #endif /* __KERNEL__ */
151 
152 #endif
153