xref: /linux/drivers/media/platform/raspberrypi/rp1-cfe/cfe.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * RP1 CFE Driver
4  *
5  * Copyright (c) 2021-2024 Raspberry Pi Ltd.
6  * Copyright (c) 2023-2024 Ideas on Board Oy
7  */
8 #ifndef _RP1_CFE_
9 #define _RP1_CFE_
10 
11 #include <linux/media-bus-format.h>
12 #include <linux/types.h>
13 #include <linux/videodev2.h>
14 
15 extern bool cfe_debug_verbose;
16 
17 enum cfe_remap_types {
18 	CFE_REMAP_16BIT,
19 	CFE_REMAP_COMPRESSED,
20 	CFE_NUM_REMAP,
21 };
22 
23 #define CFE_FORMAT_FLAG_META_OUT	BIT(0)
24 #define CFE_FORMAT_FLAG_META_CAP	BIT(1)
25 #define CFE_FORMAT_FLAG_FE_OUT		BIT(2)
26 
27 struct cfe_fmt {
28 	u32 fourcc;
29 	u32 code;
30 	u8 depth;
31 	u8 csi_dt;
32 	u32 remap[CFE_NUM_REMAP];
33 	u32 flags;
34 };
35 
36 extern const struct v4l2_mbus_framefmt cfe_default_format;
37 
38 const struct cfe_fmt *find_format_by_code(u32 code);
39 const struct cfe_fmt *find_format_by_pix(u32 pixelformat);
40 u32 cfe_find_16bit_code(u32 code);
41 u32 cfe_find_compressed_code(u32 code);
42 
43 #endif
44