1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef __UAPI_CAM_DEFS_H__
20 #define __UAPI_CAM_DEFS_H__
21 #include <linux/videodev2.h>
22 #include <linux/types.h>
23 #include <linux/ioctl.h>
24 #define CAM_COMMON_OPCODE_BASE 0x100
25 #define CAM_QUERY_CAP (CAM_COMMON_OPCODE_BASE + 0x1)
26 #define CAM_ACQUIRE_DEV (CAM_COMMON_OPCODE_BASE + 0x2)
27 #define CAM_START_DEV (CAM_COMMON_OPCODE_BASE + 0x3)
28 #define CAM_STOP_DEV (CAM_COMMON_OPCODE_BASE + 0x4)
29 #define CAM_CONFIG_DEV (CAM_COMMON_OPCODE_BASE + 0x5)
30 #define CAM_RELEASE_DEV (CAM_COMMON_OPCODE_BASE + 0x6)
31 #define CAM_SD_SHUTDOWN (CAM_COMMON_OPCODE_BASE + 0x7)
32 #define CAM_FLUSH_REQ (CAM_COMMON_OPCODE_BASE + 0x8)
33 #define CAM_COMMON_OPCODE_MAX (CAM_COMMON_OPCODE_BASE + 0x9)
34 #define CAM_EXT_OPCODE_BASE 0x200
35 #define CAM_CONFIG_DEV_EXTERNAL (CAM_EXT_OPCODE_BASE + 0x1)
36 #define CAM_HANDLE_USER_POINTER 1
37 #define CAM_HANDLE_MEM_HANDLE 2
38 #define CAM_GENERIC_BLOB_CMDBUFFER_SIZE_MASK 0xFFFFFF00
39 #define CAM_GENERIC_BLOB_CMDBUFFER_SIZE_SHIFT 8
40 #define CAM_GENERIC_BLOB_CMDBUFFER_TYPE_MASK 0xFF
41 #define CAM_GENERIC_BLOB_CMDBUFFER_TYPE_SHIFT 0
42 #define CAM_CMD_BUF_DMI 0x1
43 #define CAM_CMD_BUF_DMI16 0x2
44 #define CAM_CMD_BUF_DMI32 0x3
45 #define CAM_CMD_BUF_DMI64 0x4
46 #define CAM_CMD_BUF_DIRECT 0x5
47 #define CAM_CMD_BUF_INDIRECT 0x6
48 #define CAM_CMD_BUF_I2C 0x7
49 #define CAM_CMD_BUF_FW 0x8
50 #define CAM_CMD_BUF_GENERIC 0x9
51 #define CAM_CMD_BUF_LEGACY 0xA
52 enum flush_type_t {
53   CAM_FLUSH_TYPE_REQ,
54   CAM_FLUSH_TYPE_ALL,
55   CAM_FLUSH_TYPE_MAX
56 };
57 struct cam_control {
58   uint32_t op_code;
59   uint32_t size;
60   uint32_t handle_type;
61   uint32_t reserved;
62   uint64_t handle;
63 };
64 #define VIDIOC_CAM_CONTROL _IOWR('V', BASE_VIDIOC_PRIVATE, struct cam_control)
65 struct cam_hw_version {
66   uint32_t major;
67   uint32_t minor;
68   uint32_t incr;
69   uint32_t reserved;
70 };
71 struct cam_iommu_handle {
72   int32_t non_secure;
73   int32_t secure;
74 };
75 #define CAM_SECURE_MODE_NON_SECURE 0
76 #define CAM_SECURE_MODE_SECURE 1
77 #define CAM_FORMAT_BASE 0
78 #define CAM_FORMAT_MIPI_RAW_6 1
79 #define CAM_FORMAT_MIPI_RAW_8 2
80 #define CAM_FORMAT_MIPI_RAW_10 3
81 #define CAM_FORMAT_MIPI_RAW_12 4
82 #define CAM_FORMAT_MIPI_RAW_14 5
83 #define CAM_FORMAT_MIPI_RAW_16 6
84 #define CAM_FORMAT_MIPI_RAW_20 7
85 #define CAM_FORMAT_QTI_RAW_8 8
86 #define CAM_FORMAT_QTI_RAW_10 9
87 #define CAM_FORMAT_QTI_RAW_12 10
88 #define CAM_FORMAT_QTI_RAW_14 11
89 #define CAM_FORMAT_PLAIN8 12
90 #define CAM_FORMAT_PLAIN16_8 13
91 #define CAM_FORMAT_PLAIN16_10 14
92 #define CAM_FORMAT_PLAIN16_12 15
93 #define CAM_FORMAT_PLAIN16_14 16
94 #define CAM_FORMAT_PLAIN16_16 17
95 #define CAM_FORMAT_PLAIN32_20 18
96 #define CAM_FORMAT_PLAIN64 19
97 #define CAM_FORMAT_PLAIN128 20
98 #define CAM_FORMAT_ARGB 21
99 #define CAM_FORMAT_ARGB_10 22
100 #define CAM_FORMAT_ARGB_12 23
101 #define CAM_FORMAT_ARGB_14 24
102 #define CAM_FORMAT_DPCM_10_6_10 25
103 #define CAM_FORMAT_DPCM_10_8_10 26
104 #define CAM_FORMAT_DPCM_12_6_12 27
105 #define CAM_FORMAT_DPCM_12_8_12 28
106 #define CAM_FORMAT_DPCM_14_8_14 29
107 #define CAM_FORMAT_DPCM_14_10_14 30
108 #define CAM_FORMAT_NV21 31
109 #define CAM_FORMAT_NV12 32
110 #define CAM_FORMAT_TP10 33
111 #define CAM_FORMAT_YUV422 34
112 #define CAM_FORMAT_PD8 35
113 #define CAM_FORMAT_PD10 36
114 #define CAM_FORMAT_UBWC_NV12 37
115 #define CAM_FORMAT_UBWC_NV12_4R 38
116 #define CAM_FORMAT_UBWC_TP10 39
117 #define CAM_FORMAT_UBWC_P010 40
118 #define CAM_FORMAT_PLAIN8_SWAP 41
119 #define CAM_FORMAT_PLAIN8_10 42
120 #define CAM_FORMAT_PLAIN8_10_SWAP 43
121 #define CAM_FORMAT_YV12 44
122 #define CAM_FORMAT_Y_ONLY 45
123 #define CAM_FORMAT_MAX 46
124 #define CAM_ROTATE_CW_0_DEGREE 0
125 #define CAM_ROTATE_CW_90_DEGREE 1
126 #define CAM_RORATE_CW_180_DEGREE 2
127 #define CAM_ROTATE_CW_270_DEGREE 3
128 #define CAM_COLOR_SPACE_BASE 0
129 #define CAM_COLOR_SPACE_BT601_FULL 1
130 #define CAM_COLOR_SPACE_BT601625 2
131 #define CAM_COLOR_SPACE_BT601525 3
132 #define CAM_COLOR_SPACE_BT709 4
133 #define CAM_COLOR_SPACE_DEPTH 5
134 #define CAM_COLOR_SPACE_MAX 6
135 #define CAM_BUF_INPUT 1
136 #define CAM_BUF_OUTPUT 2
137 #define CAM_BUF_IN_OUT 3
138 #define CAM_PACKET_DEV_BASE 0
139 #define CAM_PACKET_DEV_IMG_SENSOR 1
140 #define CAM_PACKET_DEV_ACTUATOR 2
141 #define CAM_PACKET_DEV_COMPANION 3
142 #define CAM_PACKET_DEV_EEPOM 4
143 #define CAM_PACKET_DEV_CSIPHY 5
144 #define CAM_PACKET_DEV_OIS 6
145 #define CAM_PACKET_DEV_FLASH 7
146 #define CAM_PACKET_DEV_FD 8
147 #define CAM_PACKET_DEV_JPEG_ENC 9
148 #define CAM_PACKET_DEV_JPEG_DEC 10
149 #define CAM_PACKET_DEV_VFE 11
150 #define CAM_PACKET_DEV_CPP 12
151 #define CAM_PACKET_DEV_CSID 13
152 #define CAM_PACKET_DEV_ISPIF 14
153 #define CAM_PACKET_DEV_IFE 15
154 #define CAM_PACKET_DEV_ICP 16
155 #define CAM_PACKET_DEV_LRME 17
156 #define CAM_PACKET_DEV_MAX 18
157 #define CAM_PACKET_MAX_PLANES 3
158 struct cam_plane_cfg {
159   uint32_t width;
160   uint32_t height;
161   uint32_t plane_stride;
162   uint32_t slice_height;
163   uint32_t meta_stride;
164   uint32_t meta_size;
165   uint32_t meta_offset;
166   uint32_t packer_config;
167   uint32_t mode_config;
168   uint32_t tile_config;
169   uint32_t h_init;
170   uint32_t v_init;
171 };
172 struct cam_cmd_buf_desc {
173   int32_t mem_handle;
174   uint32_t offset;
175   uint32_t size;
176   uint32_t length;
177   uint32_t type;
178   uint32_t meta_data;
179 };
180 struct cam_buf_io_cfg {
181   int32_t mem_handle[CAM_PACKET_MAX_PLANES];
182   uint32_t offsets[CAM_PACKET_MAX_PLANES];
183   struct cam_plane_cfg planes[CAM_PACKET_MAX_PLANES];
184   uint32_t format;
185   uint32_t color_space;
186   uint32_t color_pattern;
187   uint32_t bpp;
188   uint32_t rotation;
189   uint32_t resource_type;
190   int32_t fence;
191   int32_t early_fence;
192   struct cam_cmd_buf_desc aux_cmd_buf;
193   uint32_t direction;
194   uint32_t batch_size;
195   uint32_t subsample_pattern;
196   uint32_t subsample_period;
197   uint32_t framedrop_pattern;
198   uint32_t framedrop_period;
199   uint32_t flag;
200   uint32_t padding;
201 };
202 struct cam_packet_header {
203   uint32_t op_code;
204   uint32_t size;
205   uint64_t request_id;
206   uint32_t flags;
207   uint32_t padding;
208 };
209 struct cam_patch_desc {
210   int32_t dst_buf_hdl;
211   uint32_t dst_offset;
212   int32_t src_buf_hdl;
213   uint32_t src_offset;
214 };
215 struct cam_packet {
216   struct cam_packet_header header;
217   uint32_t cmd_buf_offset;
218   uint32_t num_cmd_buf;
219   uint32_t io_configs_offset;
220   uint32_t num_io_configs;
221   uint32_t patch_offset;
222   uint32_t num_patches;
223   uint32_t kmd_cmd_buf_index;
224   uint32_t kmd_cmd_buf_offset;
225   uint64_t payload[1];
226 };
227 struct cam_release_dev_cmd {
228   int32_t session_handle;
229   int32_t dev_handle;
230 };
231 struct cam_start_stop_dev_cmd {
232   int32_t session_handle;
233   int32_t dev_handle;
234 };
235 struct cam_config_dev_cmd {
236   int32_t session_handle;
237   int32_t dev_handle;
238   uint64_t offset;
239   uint64_t packet_handle;
240 };
241 struct cam_query_cap_cmd {
242   uint32_t size;
243   uint32_t handle_type;
244   uint64_t caps_handle;
245 };
246 struct cam_acquire_dev_cmd {
247   int32_t session_handle;
248   int32_t dev_handle;
249   uint32_t handle_type;
250   uint32_t num_resources;
251   uint64_t resource_hdl;
252 };
253 struct cam_flush_dev_cmd {
254   uint64_t version;
255   int32_t session_handle;
256   int32_t dev_handle;
257   uint32_t flush_type;
258   uint32_t reserved;
259   int64_t req_id;
260 };
261 #endif
262 
263