]>
Commit | Line | Data |
---|---|---|
e79753ed PM |
1 | /* |
2 | * Copyright (C) 2008-2009 QUALCOMM Incorporated. | |
3 | */ | |
4 | #ifndef __LINUX_MSM_CAMERA_H | |
5 | #define __LINUX_MSM_CAMERA_H | |
6 | ||
7 | #include <linux/types.h> | |
8 | #include <asm/sizes.h> | |
9 | #include <linux/ioctl.h> | |
10 | ||
11 | #define MSM_CAM_IOCTL_MAGIC 'm' | |
12 | ||
13 | #define MSM_CAM_IOCTL_GET_SENSOR_INFO \ | |
14 | _IOR(MSM_CAM_IOCTL_MAGIC, 1, struct msm_camsensor_info *) | |
15 | ||
16 | #define MSM_CAM_IOCTL_REGISTER_PMEM \ | |
17 | _IOW(MSM_CAM_IOCTL_MAGIC, 2, struct msm_pmem_info *) | |
18 | ||
19 | #define MSM_CAM_IOCTL_UNREGISTER_PMEM \ | |
20 | _IOW(MSM_CAM_IOCTL_MAGIC, 3, unsigned) | |
21 | ||
22 | #define MSM_CAM_IOCTL_CTRL_COMMAND \ | |
23 | _IOW(MSM_CAM_IOCTL_MAGIC, 4, struct msm_ctrl_cmd *) | |
24 | ||
25 | #define MSM_CAM_IOCTL_CONFIG_VFE \ | |
26 | _IOW(MSM_CAM_IOCTL_MAGIC, 5, struct msm_camera_vfe_cfg_cmd *) | |
27 | ||
28 | #define MSM_CAM_IOCTL_GET_STATS \ | |
29 | _IOR(MSM_CAM_IOCTL_MAGIC, 6, struct msm_camera_stats_event_ctrl *) | |
30 | ||
31 | #define MSM_CAM_IOCTL_GETFRAME \ | |
32 | _IOR(MSM_CAM_IOCTL_MAGIC, 7, struct msm_camera_get_frame *) | |
33 | ||
34 | #define MSM_CAM_IOCTL_ENABLE_VFE \ | |
35 | _IOW(MSM_CAM_IOCTL_MAGIC, 8, struct camera_enable_cmd *) | |
36 | ||
37 | #define MSM_CAM_IOCTL_CTRL_CMD_DONE \ | |
38 | _IOW(MSM_CAM_IOCTL_MAGIC, 9, struct camera_cmd *) | |
39 | ||
40 | #define MSM_CAM_IOCTL_CONFIG_CMD \ | |
41 | _IOW(MSM_CAM_IOCTL_MAGIC, 10, struct camera_cmd *) | |
42 | ||
43 | #define MSM_CAM_IOCTL_DISABLE_VFE \ | |
44 | _IOW(MSM_CAM_IOCTL_MAGIC, 11, struct camera_enable_cmd *) | |
45 | ||
46 | #define MSM_CAM_IOCTL_PAD_REG_RESET2 \ | |
47 | _IOW(MSM_CAM_IOCTL_MAGIC, 12, struct camera_enable_cmd *) | |
48 | ||
49 | #define MSM_CAM_IOCTL_VFE_APPS_RESET \ | |
50 | _IOW(MSM_CAM_IOCTL_MAGIC, 13, struct camera_enable_cmd *) | |
51 | ||
52 | #define MSM_CAM_IOCTL_RELEASE_FRAME_BUFFER \ | |
53 | _IOW(MSM_CAM_IOCTL_MAGIC, 14, struct camera_enable_cmd *) | |
54 | ||
55 | #define MSM_CAM_IOCTL_RELEASE_STATS_BUFFER \ | |
56 | _IOW(MSM_CAM_IOCTL_MAGIC, 15, struct msm_stats_buf *) | |
57 | ||
58 | #define MSM_CAM_IOCTL_AXI_CONFIG \ | |
59 | _IOW(MSM_CAM_IOCTL_MAGIC, 16, struct msm_camera_vfe_cfg_cmd *) | |
60 | ||
61 | #define MSM_CAM_IOCTL_GET_PICTURE \ | |
62 | _IOW(MSM_CAM_IOCTL_MAGIC, 17, struct msm_camera_ctrl_cmd *) | |
63 | ||
64 | #define MSM_CAM_IOCTL_SET_CROP \ | |
65 | _IOW(MSM_CAM_IOCTL_MAGIC, 18, struct crop_info *) | |
66 | ||
67 | #define MSM_CAM_IOCTL_PICT_PP \ | |
68 | _IOW(MSM_CAM_IOCTL_MAGIC, 19, uint8_t *) | |
69 | ||
70 | #define MSM_CAM_IOCTL_PICT_PP_DONE \ | |
71 | _IOW(MSM_CAM_IOCTL_MAGIC, 20, struct msm_snapshot_pp_status *) | |
72 | ||
73 | #define MSM_CAM_IOCTL_SENSOR_IO_CFG \ | |
74 | _IOW(MSM_CAM_IOCTL_MAGIC, 21, struct sensor_cfg_data *) | |
75 | ||
76 | #define MSM_CAMERA_LED_OFF 0 | |
77 | #define MSM_CAMERA_LED_LOW 1 | |
78 | #define MSM_CAMERA_LED_HIGH 2 | |
79 | ||
80 | #define MSM_CAM_IOCTL_FLASH_LED_CFG \ | |
81 | _IOW(MSM_CAM_IOCTL_MAGIC, 22, unsigned *) | |
82 | ||
83 | #define MSM_CAM_IOCTL_UNBLOCK_POLL_FRAME \ | |
84 | _IO(MSM_CAM_IOCTL_MAGIC, 23) | |
85 | ||
86 | #define MSM_CAM_IOCTL_CTRL_COMMAND_2 \ | |
87 | _IOW(MSM_CAM_IOCTL_MAGIC, 24, struct msm_ctrl_cmd *) | |
88 | ||
89 | #define MAX_SENSOR_NUM 3 | |
90 | #define MAX_SENSOR_NAME 32 | |
91 | ||
92 | #define MSM_CAM_CTRL_CMD_DONE 0 | |
93 | #define MSM_CAM_SENSOR_VFE_CMD 1 | |
94 | ||
95 | /***************************************************** | |
96 | * structure | |
97 | *****************************************************/ | |
98 | ||
99 | /* define five type of structures for userspace <==> kernel | |
100 | * space communication: | |
101 | * command 1 - 2 are from userspace ==> kernel | |
102 | * command 3 - 4 are from kernel ==> userspace | |
103 | * | |
104 | * 1. control command: control command(from control thread), | |
105 | * control status (from config thread); | |
106 | */ | |
107 | struct msm_ctrl_cmd { | |
108 | uint16_t type; | |
109 | uint16_t length; | |
110 | void *value; | |
111 | uint16_t status; | |
112 | uint32_t timeout_ms; | |
113 | int resp_fd; /* FIXME: to be used by the kernel, pass-through for now */ | |
114 | }; | |
115 | ||
116 | struct msm_vfe_evt_msg { | |
117 | unsigned short type; /* 1 == event (RPC), 0 == message (adsp) */ | |
118 | unsigned short msg_id; | |
119 | unsigned int len; /* size in, number of bytes out */ | |
120 | void *data; | |
121 | }; | |
122 | ||
123 | #define MSM_CAM_RESP_CTRL 0 | |
124 | #define MSM_CAM_RESP_STAT_EVT_MSG 1 | |
125 | #define MSM_CAM_RESP_V4L2 2 | |
126 | #define MSM_CAM_RESP_MAX 3 | |
127 | ||
128 | /* this one is used to send ctrl/status up to config thread */ | |
129 | struct msm_stats_event_ctrl { | |
130 | /* 0 - ctrl_cmd from control thread, | |
131 | * 1 - stats/event kernel, | |
132 | * 2 - V4L control or read request */ | |
133 | int resptype; | |
134 | int timeout_ms; | |
135 | struct msm_ctrl_cmd ctrl_cmd; | |
136 | /* struct vfe_event_t stats_event; */ | |
137 | struct msm_vfe_evt_msg stats_event; | |
138 | }; | |
139 | ||
140 | /* 2. config command: config command(from config thread); */ | |
141 | struct msm_camera_cfg_cmd { | |
142 | /* what to config: | |
143 | * 1 - sensor config, 2 - vfe config */ | |
144 | uint16_t cfg_type; | |
145 | ||
146 | /* sensor config type */ | |
147 | uint16_t cmd_type; | |
148 | uint16_t queue; | |
149 | uint16_t length; | |
150 | void *value; | |
151 | }; | |
152 | ||
153 | #define CMD_GENERAL 0 | |
154 | #define CMD_AXI_CFG_OUT1 1 | |
155 | #define CMD_AXI_CFG_SNAP_O1_AND_O2 2 | |
156 | #define CMD_AXI_CFG_OUT2 3 | |
157 | #define CMD_PICT_T_AXI_CFG 4 | |
158 | #define CMD_PICT_M_AXI_CFG 5 | |
159 | #define CMD_RAW_PICT_AXI_CFG 6 | |
160 | #define CMD_STATS_AXI_CFG 7 | |
161 | #define CMD_STATS_AF_AXI_CFG 8 | |
162 | #define CMD_FRAME_BUF_RELEASE 9 | |
163 | #define CMD_PREV_BUF_CFG 10 | |
164 | #define CMD_SNAP_BUF_RELEASE 11 | |
165 | #define CMD_SNAP_BUF_CFG 12 | |
166 | #define CMD_STATS_DISABLE 13 | |
167 | #define CMD_STATS_ENABLE 14 | |
168 | #define CMD_STATS_AF_ENABLE 15 | |
169 | #define CMD_STATS_BUF_RELEASE 16 | |
170 | #define CMD_STATS_AF_BUF_RELEASE 17 | |
171 | #define UPDATE_STATS_INVALID 18 | |
172 | ||
173 | /* vfe config command: config command(from config thread)*/ | |
174 | struct msm_vfe_cfg_cmd { | |
175 | int cmd_type; | |
176 | uint16_t length; | |
177 | void *value; | |
178 | }; | |
179 | ||
180 | #define MAX_CAMERA_ENABLE_NAME_LEN 32 | |
181 | struct camera_enable_cmd { | |
182 | char name[MAX_CAMERA_ENABLE_NAME_LEN]; | |
183 | }; | |
184 | ||
185 | #define MSM_PMEM_OUTPUT1 0 | |
186 | #define MSM_PMEM_OUTPUT2 1 | |
187 | #define MSM_PMEM_OUTPUT1_OUTPUT2 2 | |
188 | #define MSM_PMEM_THUMBAIL 3 | |
189 | #define MSM_PMEM_MAINIMG 4 | |
190 | #define MSM_PMEM_RAW_MAINIMG 5 | |
191 | #define MSM_PMEM_AEC_AWB 6 | |
192 | #define MSM_PMEM_AF 7 | |
193 | #define MSM_PMEM_MAX 8 | |
194 | ||
195 | #define FRAME_PREVIEW_OUTPUT1 0 | |
196 | #define FRAME_PREVIEW_OUTPUT2 1 | |
197 | #define FRAME_SNAPSHOT 2 | |
198 | #define FRAME_THUMBAIL 3 | |
199 | #define FRAME_RAW_SNAPSHOT 4 | |
200 | #define FRAME_MAX 5 | |
201 | ||
202 | struct msm_pmem_info { | |
203 | int type; | |
204 | int fd; | |
205 | void *vaddr; | |
206 | uint32_t y_off; | |
207 | uint32_t cbcr_off; | |
208 | uint8_t active; | |
209 | }; | |
210 | ||
211 | struct outputCfg { | |
212 | uint32_t height; | |
213 | uint32_t width; | |
214 | ||
215 | uint32_t window_height_firstline; | |
216 | uint32_t window_height_lastline; | |
217 | }; | |
218 | ||
219 | #define OUTPUT_1 0 | |
220 | #define OUTPUT_2 1 | |
221 | #define OUTPUT_1_AND_2 2 | |
222 | #define CAMIF_TO_AXI_VIA_OUTPUT_2 3 | |
223 | #define OUTPUT_1_AND_CAMIF_TO_AXI_VIA_OUTPUT_2 4 | |
224 | #define OUTPUT_2_AND_CAMIF_TO_AXI_VIA_OUTPUT_1 5 | |
225 | #define LAST_AXI_OUTPUT_MODE_ENUM = OUTPUT_2_AND_CAMIF_TO_AXI_VIA_OUTPUT_1 6 | |
226 | ||
227 | #define MSM_FRAME_PREV_1 0 | |
228 | #define MSM_FRAME_PREV_2 1 | |
229 | #define MSM_FRAME_ENC 2 | |
230 | ||
231 | struct msm_frame { | |
232 | int path; | |
233 | unsigned long buffer; | |
234 | uint32_t y_off; | |
235 | uint32_t cbcr_off; | |
236 | int fd; | |
237 | ||
238 | void *cropinfo; | |
239 | int croplen; | |
240 | }; | |
241 | ||
242 | #define STAT_AEAW 0 | |
243 | #define STAT_AF 1 | |
244 | #define STAT_MAX 2 | |
245 | ||
246 | struct msm_stats_buf { | |
247 | int type; | |
248 | unsigned long buffer; | |
249 | int fd; | |
250 | }; | |
251 | ||
252 | #define MSM_V4L2_VID_CAP_TYPE 0 | |
253 | #define MSM_V4L2_STREAM_ON 1 | |
254 | #define MSM_V4L2_STREAM_OFF 2 | |
255 | #define MSM_V4L2_SNAPSHOT 3 | |
256 | #define MSM_V4L2_QUERY_CTRL 4 | |
257 | #define MSM_V4L2_GET_CTRL 5 | |
258 | #define MSM_V4L2_SET_CTRL 6 | |
259 | #define MSM_V4L2_QUERY 7 | |
260 | #define MSM_V4L2_MAX 8 | |
261 | ||
262 | struct crop_info { | |
263 | void *info; | |
264 | int len; | |
265 | }; | |
266 | ||
267 | struct msm_postproc { | |
268 | int ftnum; | |
269 | struct msm_frame fthumnail; | |
270 | int fmnum; | |
271 | struct msm_frame fmain; | |
272 | }; | |
273 | ||
274 | struct msm_snapshot_pp_status { | |
275 | void *status; | |
276 | }; | |
277 | ||
278 | #define CFG_SET_MODE 0 | |
279 | #define CFG_SET_EFFECT 1 | |
280 | #define CFG_START 2 | |
281 | #define CFG_PWR_UP 3 | |
282 | #define CFG_PWR_DOWN 4 | |
283 | #define CFG_WRITE_EXPOSURE_GAIN 5 | |
284 | #define CFG_SET_DEFAULT_FOCUS 6 | |
285 | #define CFG_MOVE_FOCUS 7 | |
286 | #define CFG_REGISTER_TO_REAL_GAIN 8 | |
287 | #define CFG_REAL_TO_REGISTER_GAIN 9 | |
288 | #define CFG_SET_FPS 10 | |
289 | #define CFG_SET_PICT_FPS 11 | |
290 | #define CFG_SET_BRIGHTNESS 12 | |
291 | #define CFG_SET_CONTRAST 13 | |
292 | #define CFG_SET_ZOOM 14 | |
293 | #define CFG_SET_EXPOSURE_MODE 15 | |
294 | #define CFG_SET_WB 16 | |
295 | #define CFG_SET_ANTIBANDING 17 | |
296 | #define CFG_SET_EXP_GAIN 18 | |
297 | #define CFG_SET_PICT_EXP_GAIN 19 | |
298 | #define CFG_SET_LENS_SHADING 20 | |
299 | #define CFG_GET_PICT_FPS 21 | |
300 | #define CFG_GET_PREV_L_PF 22 | |
301 | #define CFG_GET_PREV_P_PL 23 | |
302 | #define CFG_GET_PICT_L_PF 24 | |
303 | #define CFG_GET_PICT_P_PL 25 | |
304 | #define CFG_GET_AF_MAX_STEPS 26 | |
305 | #define CFG_GET_PICT_MAX_EXP_LC 27 | |
306 | #define CFG_MAX 28 | |
307 | ||
308 | #define MOVE_NEAR 0 | |
309 | #define MOVE_FAR 1 | |
310 | ||
311 | #define SENSOR_PREVIEW_MODE 0 | |
312 | #define SENSOR_SNAPSHOT_MODE 1 | |
313 | #define SENSOR_RAW_SNAPSHOT_MODE 2 | |
314 | ||
315 | #define SENSOR_QTR_SIZE 0 | |
316 | #define SENSOR_FULL_SIZE 1 | |
317 | #define SENSOR_INVALID_SIZE 2 | |
318 | ||
319 | #define CAMERA_EFFECT_OFF 0 | |
320 | #define CAMERA_EFFECT_MONO 1 | |
321 | #define CAMERA_EFFECT_NEGATIVE 2 | |
322 | #define CAMERA_EFFECT_SOLARIZE 3 | |
323 | #define CAMERA_EFFECT_PASTEL 4 | |
324 | #define CAMERA_EFFECT_MOSAIC 5 | |
325 | #define CAMERA_EFFECT_RESIZE 6 | |
326 | #define CAMERA_EFFECT_SEPIA 7 | |
327 | #define CAMERA_EFFECT_POSTERIZE 8 | |
328 | #define CAMERA_EFFECT_WHITEBOARD 9 | |
329 | #define CAMERA_EFFECT_BLACKBOARD 10 | |
330 | #define CAMERA_EFFECT_AQUA 11 | |
331 | #define CAMERA_EFFECT_MAX 12 | |
332 | ||
333 | struct sensor_pict_fps { | |
334 | uint16_t prevfps; | |
335 | uint16_t pictfps; | |
336 | }; | |
337 | ||
338 | struct exp_gain_cfg { | |
339 | uint16_t gain; | |
340 | uint32_t line; | |
341 | }; | |
342 | ||
343 | struct focus_cfg { | |
344 | int32_t steps; | |
345 | int dir; | |
346 | }; | |
347 | ||
348 | struct fps_cfg { | |
349 | uint16_t f_mult; | |
350 | uint16_t fps_div; | |
351 | uint32_t pict_fps_div; | |
352 | }; | |
353 | ||
354 | struct sensor_cfg_data { | |
355 | int cfgtype; | |
356 | int mode; | |
357 | int rs; | |
358 | uint8_t max_steps; | |
359 | ||
360 | union { | |
361 | int8_t effect; | |
362 | uint8_t lens_shading; | |
363 | uint16_t prevl_pf; | |
364 | uint16_t prevp_pl; | |
365 | uint16_t pictl_pf; | |
366 | uint16_t pictp_pl; | |
367 | uint32_t pict_max_exp_lc; | |
368 | uint16_t p_fps; | |
369 | struct sensor_pict_fps gfps; | |
370 | struct exp_gain_cfg exp_gain; | |
371 | struct focus_cfg focus; | |
372 | struct fps_cfg fps; | |
373 | } cfg; | |
374 | }; | |
375 | ||
376 | #define GET_NAME 0 | |
377 | #define GET_PREVIEW_LINE_PER_FRAME 1 | |
378 | #define GET_PREVIEW_PIXELS_PER_LINE 2 | |
379 | #define GET_SNAPSHOT_LINE_PER_FRAME 3 | |
380 | #define GET_SNAPSHOT_PIXELS_PER_LINE 4 | |
381 | #define GET_SNAPSHOT_FPS 5 | |
382 | #define GET_SNAPSHOT_MAX_EP_LINE_CNT 6 | |
383 | ||
384 | struct msm_camsensor_info { | |
385 | char name[MAX_SENSOR_NAME]; | |
386 | uint8_t flash_enabled; | |
387 | }; | |
388 | #endif /* __LINUX_MSM_CAMERA_H */ |