xref: /linux/drivers/media/platform/raspberrypi/rp1-cfe/cfe-fmts.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * RP1 Camera Front End formats definition
4  *
5  * Copyright (C) 2021-2024 - Raspberry Pi Ltd.
6  */
7 #ifndef _CFE_FMTS_H_
8 #define _CFE_FMTS_H_
9 
10 #include "cfe.h"
11 #include <media/mipi-csi2.h>
12 
13 static const struct cfe_fmt formats[] = {
14 	/* YUV Formats */
15 	{
16 		.fourcc = V4L2_PIX_FMT_YUYV,
17 		.code = MEDIA_BUS_FMT_YUYV8_1X16,
18 		.depth = 16,
19 		.csi_dt = MIPI_CSI2_DT_YUV422_8B,
20 	},
21 	{
22 		.fourcc = V4L2_PIX_FMT_UYVY,
23 		.code = MEDIA_BUS_FMT_UYVY8_1X16,
24 		.depth = 16,
25 		.csi_dt = MIPI_CSI2_DT_YUV422_8B,
26 	},
27 	{
28 		.fourcc = V4L2_PIX_FMT_YVYU,
29 		.code = MEDIA_BUS_FMT_YVYU8_1X16,
30 		.depth = 16,
31 		.csi_dt = MIPI_CSI2_DT_YUV422_8B,
32 	},
33 	{
34 		.fourcc = V4L2_PIX_FMT_VYUY,
35 		.code = MEDIA_BUS_FMT_VYUY8_1X16,
36 		.depth = 16,
37 		.csi_dt = MIPI_CSI2_DT_YUV422_8B,
38 	},
39 	{
40 		/* RGB Formats */
41 		.fourcc = V4L2_PIX_FMT_RGB565, /* gggbbbbb rrrrrggg */
42 		.code = MEDIA_BUS_FMT_RGB565_2X8_LE,
43 		.depth = 16,
44 		.csi_dt = MIPI_CSI2_DT_RGB565,
45 	},
46 	{	.fourcc = V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */
47 		.code = MEDIA_BUS_FMT_RGB565_2X8_BE,
48 		.depth = 16,
49 		.csi_dt = MIPI_CSI2_DT_RGB565,
50 	},
51 	{
52 		.fourcc = V4L2_PIX_FMT_RGB555, /* gggbbbbb arrrrrgg */
53 		.code = MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE,
54 		.depth = 16,
55 		.csi_dt = MIPI_CSI2_DT_RGB555,
56 	},
57 	{
58 		.fourcc = V4L2_PIX_FMT_RGB555X, /* arrrrrgg gggbbbbb */
59 		.code = MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE,
60 		.depth = 16,
61 		.csi_dt = MIPI_CSI2_DT_RGB555,
62 	},
63 	{
64 		.fourcc = V4L2_PIX_FMT_RGB24, /* rgb */
65 		.code = MEDIA_BUS_FMT_RGB888_1X24,
66 		.depth = 24,
67 		.csi_dt = MIPI_CSI2_DT_RGB888,
68 	},
69 	{
70 		.fourcc = V4L2_PIX_FMT_BGR24, /* bgr */
71 		.code = MEDIA_BUS_FMT_BGR888_1X24,
72 		.depth = 24,
73 		.csi_dt = MIPI_CSI2_DT_RGB888,
74 	},
75 	{
76 		.fourcc = V4L2_PIX_FMT_RGB32, /* argb */
77 		.code = MEDIA_BUS_FMT_ARGB8888_1X32,
78 		.depth = 32,
79 		.csi_dt = 0x0,
80 	},
81 
82 	/* Bayer Formats */
83 	{
84 		.fourcc = V4L2_PIX_FMT_SBGGR8,
85 		.code = MEDIA_BUS_FMT_SBGGR8_1X8,
86 		.depth = 8,
87 		.csi_dt = MIPI_CSI2_DT_RAW8,
88 		.remap = { V4L2_PIX_FMT_SBGGR16, V4L2_PIX_FMT_PISP_COMP1_BGGR },
89 	},
90 	{
91 		.fourcc = V4L2_PIX_FMT_SGBRG8,
92 		.code = MEDIA_BUS_FMT_SGBRG8_1X8,
93 		.depth = 8,
94 		.csi_dt = MIPI_CSI2_DT_RAW8,
95 		.remap = { V4L2_PIX_FMT_SGBRG16, V4L2_PIX_FMT_PISP_COMP1_GBRG },
96 	},
97 	{
98 		.fourcc = V4L2_PIX_FMT_SGRBG8,
99 		.code = MEDIA_BUS_FMT_SGRBG8_1X8,
100 		.depth = 8,
101 		.csi_dt = MIPI_CSI2_DT_RAW8,
102 		.remap = { V4L2_PIX_FMT_SGRBG16, V4L2_PIX_FMT_PISP_COMP1_GRBG },
103 	},
104 	{
105 		.fourcc = V4L2_PIX_FMT_SRGGB8,
106 		.code = MEDIA_BUS_FMT_SRGGB8_1X8,
107 		.depth = 8,
108 		.csi_dt = MIPI_CSI2_DT_RAW8,
109 		.remap = { V4L2_PIX_FMT_SRGGB16, V4L2_PIX_FMT_PISP_COMP1_RGGB },
110 	},
111 	{
112 		.fourcc = V4L2_PIX_FMT_SBGGR10P,
113 		.code = MEDIA_BUS_FMT_SBGGR10_1X10,
114 		.depth = 10,
115 		.csi_dt = MIPI_CSI2_DT_RAW10,
116 		.remap = { V4L2_PIX_FMT_SBGGR16, V4L2_PIX_FMT_PISP_COMP1_BGGR },
117 	},
118 	{
119 		.fourcc = V4L2_PIX_FMT_SGBRG10P,
120 		.code = MEDIA_BUS_FMT_SGBRG10_1X10,
121 		.depth = 10,
122 		.csi_dt = MIPI_CSI2_DT_RAW10,
123 		.remap = { V4L2_PIX_FMT_SGBRG16, V4L2_PIX_FMT_PISP_COMP1_GBRG },
124 	},
125 	{
126 		.fourcc = V4L2_PIX_FMT_SGRBG10P,
127 		.code = MEDIA_BUS_FMT_SGRBG10_1X10,
128 		.depth = 10,
129 		.csi_dt = MIPI_CSI2_DT_RAW10,
130 		.remap = { V4L2_PIX_FMT_SGRBG16, V4L2_PIX_FMT_PISP_COMP1_GRBG },
131 	},
132 	{
133 		.fourcc = V4L2_PIX_FMT_SRGGB10P,
134 		.code = MEDIA_BUS_FMT_SRGGB10_1X10,
135 		.depth = 10,
136 		.csi_dt = MIPI_CSI2_DT_RAW10,
137 		.remap = { V4L2_PIX_FMT_SRGGB16, V4L2_PIX_FMT_PISP_COMP1_RGGB },
138 	},
139 	{
140 		.fourcc = V4L2_PIX_FMT_SBGGR12P,
141 		.code = MEDIA_BUS_FMT_SBGGR12_1X12,
142 		.depth = 12,
143 		.csi_dt = MIPI_CSI2_DT_RAW12,
144 		.remap = { V4L2_PIX_FMT_SBGGR16, V4L2_PIX_FMT_PISP_COMP1_BGGR },
145 	},
146 	{
147 		.fourcc = V4L2_PIX_FMT_SGBRG12P,
148 		.code = MEDIA_BUS_FMT_SGBRG12_1X12,
149 		.depth = 12,
150 		.csi_dt = MIPI_CSI2_DT_RAW12,
151 		.remap = { V4L2_PIX_FMT_SGBRG16, V4L2_PIX_FMT_PISP_COMP1_GBRG },
152 	},
153 	{
154 		.fourcc = V4L2_PIX_FMT_SGRBG12P,
155 		.code = MEDIA_BUS_FMT_SGRBG12_1X12,
156 		.depth = 12,
157 		.csi_dt = MIPI_CSI2_DT_RAW12,
158 		.remap = { V4L2_PIX_FMT_SGRBG16, V4L2_PIX_FMT_PISP_COMP1_GRBG },
159 	},
160 	{
161 		.fourcc = V4L2_PIX_FMT_SRGGB12P,
162 		.code = MEDIA_BUS_FMT_SRGGB12_1X12,
163 		.depth = 12,
164 		.csi_dt = MIPI_CSI2_DT_RAW12,
165 		.remap = { V4L2_PIX_FMT_SRGGB16, V4L2_PIX_FMT_PISP_COMP1_RGGB },
166 	},
167 	{
168 		.fourcc = V4L2_PIX_FMT_SBGGR14P,
169 		.code = MEDIA_BUS_FMT_SBGGR14_1X14,
170 		.depth = 14,
171 		.csi_dt = MIPI_CSI2_DT_RAW14,
172 		.remap = { V4L2_PIX_FMT_SBGGR16, V4L2_PIX_FMT_PISP_COMP1_BGGR },
173 	},
174 	{
175 		.fourcc = V4L2_PIX_FMT_SGBRG14P,
176 		.code = MEDIA_BUS_FMT_SGBRG14_1X14,
177 		.depth = 14,
178 		.csi_dt = MIPI_CSI2_DT_RAW14,
179 		.remap = { V4L2_PIX_FMT_SGBRG16, V4L2_PIX_FMT_PISP_COMP1_GBRG },
180 	},
181 	{
182 		.fourcc = V4L2_PIX_FMT_SGRBG14P,
183 		.code = MEDIA_BUS_FMT_SGRBG14_1X14,
184 		.depth = 14,
185 		.csi_dt = MIPI_CSI2_DT_RAW14,
186 		.remap = { V4L2_PIX_FMT_SGRBG16, V4L2_PIX_FMT_PISP_COMP1_GRBG },
187 	},
188 	{
189 		.fourcc = V4L2_PIX_FMT_SRGGB14P,
190 		.code = MEDIA_BUS_FMT_SRGGB14_1X14,
191 		.depth = 14,
192 		.csi_dt = MIPI_CSI2_DT_RAW14,
193 		.remap = { V4L2_PIX_FMT_SRGGB16, V4L2_PIX_FMT_PISP_COMP1_RGGB },
194 	},
195 	{
196 		.fourcc = V4L2_PIX_FMT_SBGGR16,
197 		.code = MEDIA_BUS_FMT_SBGGR16_1X16,
198 		.depth = 16,
199 		.csi_dt = MIPI_CSI2_DT_RAW16,
200 		.flags = CFE_FORMAT_FLAG_FE_OUT,
201 		.remap = { V4L2_PIX_FMT_SBGGR16, V4L2_PIX_FMT_PISP_COMP1_BGGR },
202 	},
203 	{
204 		.fourcc = V4L2_PIX_FMT_SGBRG16,
205 		.code = MEDIA_BUS_FMT_SGBRG16_1X16,
206 		.depth = 16,
207 		.csi_dt = MIPI_CSI2_DT_RAW16,
208 		.flags = CFE_FORMAT_FLAG_FE_OUT,
209 		.remap = { V4L2_PIX_FMT_SGBRG16, V4L2_PIX_FMT_PISP_COMP1_GBRG },
210 	},
211 	{
212 		.fourcc = V4L2_PIX_FMT_SGRBG16,
213 		.code = MEDIA_BUS_FMT_SGRBG16_1X16,
214 		.depth = 16,
215 		.csi_dt = MIPI_CSI2_DT_RAW16,
216 		.flags = CFE_FORMAT_FLAG_FE_OUT,
217 		.remap = { V4L2_PIX_FMT_SGRBG16, V4L2_PIX_FMT_PISP_COMP1_GRBG },
218 	},
219 	{
220 		.fourcc = V4L2_PIX_FMT_SRGGB16,
221 		.code = MEDIA_BUS_FMT_SRGGB16_1X16,
222 		.depth = 16,
223 		.csi_dt = MIPI_CSI2_DT_RAW16,
224 		.flags = CFE_FORMAT_FLAG_FE_OUT,
225 		.remap = { V4L2_PIX_FMT_SRGGB16, V4L2_PIX_FMT_PISP_COMP1_RGGB },
226 	},
227 	/* PiSP Compressed Mode 1 */
228 	{
229 		.fourcc = V4L2_PIX_FMT_PISP_COMP1_RGGB,
230 		.code = MEDIA_BUS_FMT_SRGGB16_1X16,
231 		.depth = 8,
232 		.flags = CFE_FORMAT_FLAG_FE_OUT,
233 	},
234 	{
235 		.fourcc = V4L2_PIX_FMT_PISP_COMP1_BGGR,
236 		.code = MEDIA_BUS_FMT_SBGGR16_1X16,
237 		.depth = 8,
238 		.flags = CFE_FORMAT_FLAG_FE_OUT,
239 	},
240 	{
241 		.fourcc = V4L2_PIX_FMT_PISP_COMP1_GBRG,
242 		.code = MEDIA_BUS_FMT_SGBRG16_1X16,
243 		.depth = 8,
244 		.flags = CFE_FORMAT_FLAG_FE_OUT,
245 	},
246 	{
247 		.fourcc = V4L2_PIX_FMT_PISP_COMP1_GRBG,
248 		.code = MEDIA_BUS_FMT_SGRBG16_1X16,
249 		.depth = 8,
250 		.flags = CFE_FORMAT_FLAG_FE_OUT,
251 	},
252 	/* Greyscale format */
253 	{
254 		.fourcc = V4L2_PIX_FMT_GREY,
255 		.code = MEDIA_BUS_FMT_Y8_1X8,
256 		.depth = 8,
257 		.csi_dt = MIPI_CSI2_DT_RAW8,
258 		.remap = { V4L2_PIX_FMT_Y16, V4L2_PIX_FMT_PISP_COMP1_MONO },
259 	},
260 	{
261 		.fourcc = V4L2_PIX_FMT_Y10P,
262 		.code = MEDIA_BUS_FMT_Y10_1X10,
263 		.depth = 10,
264 		.csi_dt = MIPI_CSI2_DT_RAW10,
265 		.remap = { V4L2_PIX_FMT_Y16, V4L2_PIX_FMT_PISP_COMP1_MONO },
266 	},
267 	{
268 		.fourcc = V4L2_PIX_FMT_Y12P,
269 		.code = MEDIA_BUS_FMT_Y12_1X12,
270 		.depth = 12,
271 		.csi_dt = MIPI_CSI2_DT_RAW12,
272 		.remap = { V4L2_PIX_FMT_Y16, V4L2_PIX_FMT_PISP_COMP1_MONO },
273 	},
274 	{
275 		.fourcc = V4L2_PIX_FMT_Y14P,
276 		.code = MEDIA_BUS_FMT_Y14_1X14,
277 		.depth = 14,
278 		.csi_dt = MIPI_CSI2_DT_RAW14,
279 		.remap = { V4L2_PIX_FMT_Y16, V4L2_PIX_FMT_PISP_COMP1_MONO },
280 	},
281 	{
282 		.fourcc = V4L2_PIX_FMT_Y16,
283 		.code = MEDIA_BUS_FMT_Y16_1X16,
284 		.depth = 16,
285 		.csi_dt = MIPI_CSI2_DT_RAW16,
286 		.flags = CFE_FORMAT_FLAG_FE_OUT,
287 		.remap = { V4L2_PIX_FMT_Y16, V4L2_PIX_FMT_PISP_COMP1_MONO },
288 	},
289 	{
290 		.fourcc = V4L2_PIX_FMT_PISP_COMP1_MONO,
291 		.code = MEDIA_BUS_FMT_Y16_1X16,
292 		.depth = 8,
293 		.flags = CFE_FORMAT_FLAG_FE_OUT,
294 	},
295 
296 	/* Embedded data formats */
297 	{
298 		.fourcc = V4L2_META_FMT_GENERIC_8,
299 		.code = MEDIA_BUS_FMT_META_8,
300 		.depth = 8,
301 		.csi_dt = MIPI_CSI2_DT_EMBEDDED_8B,
302 		.flags = CFE_FORMAT_FLAG_META_CAP,
303 	},
304 	{
305 		.fourcc = V4L2_META_FMT_GENERIC_CSI2_10,
306 		.code = MEDIA_BUS_FMT_META_10,
307 		.depth = 10,
308 		.csi_dt = MIPI_CSI2_DT_EMBEDDED_8B,
309 		.flags = CFE_FORMAT_FLAG_META_CAP,
310 	},
311 	{
312 		.fourcc = V4L2_META_FMT_GENERIC_CSI2_12,
313 		.code = MEDIA_BUS_FMT_META_12,
314 		.depth = 12,
315 		.csi_dt = MIPI_CSI2_DT_EMBEDDED_8B,
316 		.flags = CFE_FORMAT_FLAG_META_CAP,
317 	},
318 
319 	/* Frontend formats */
320 	{
321 		.fourcc = V4L2_META_FMT_RPI_FE_CFG,
322 		.code = MEDIA_BUS_FMT_FIXED,
323 		.flags = CFE_FORMAT_FLAG_META_OUT,
324 	},
325 	{
326 		.fourcc = V4L2_META_FMT_RPI_FE_STATS,
327 		.code = MEDIA_BUS_FMT_FIXED,
328 		.flags = CFE_FORMAT_FLAG_META_CAP,
329 	},
330 };
331 
332 #endif /* _CFE_FMTS_H_ */
333