blob: 7205c0d5d58acbeef262837b3bb7af63224f4239 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001#ifndef __LINUX_MSM_CAMERA_H
2#define __LINUX_MSM_CAMERA_H
3
4#ifdef MSM_CAMERA_BIONIC
5#include <sys/types.h>
6#endif
7#include <linux/types.h>
8#include <linux/ioctl.h>
9#include <linux/cdev.h>
10#ifdef MSM_CAMERA_GCC
11#include <time.h>
12#else
13#include <linux/time.h>
14#endif
15
16#define MSM_CAM_IOCTL_MAGIC 'm'
17
18#define MSM_CAM_IOCTL_GET_SENSOR_INFO \
19 _IOR(MSM_CAM_IOCTL_MAGIC, 1, struct msm_camsensor_info *)
20
21#define MSM_CAM_IOCTL_REGISTER_PMEM \
22 _IOW(MSM_CAM_IOCTL_MAGIC, 2, struct msm_pmem_info *)
23
24#define MSM_CAM_IOCTL_UNREGISTER_PMEM \
25 _IOW(MSM_CAM_IOCTL_MAGIC, 3, unsigned)
26
27#define MSM_CAM_IOCTL_CTRL_COMMAND \
28 _IOW(MSM_CAM_IOCTL_MAGIC, 4, struct msm_ctrl_cmd *)
29
30#define MSM_CAM_IOCTL_CONFIG_VFE \
31 _IOW(MSM_CAM_IOCTL_MAGIC, 5, struct msm_camera_vfe_cfg_cmd *)
32
33#define MSM_CAM_IOCTL_GET_STATS \
34 _IOR(MSM_CAM_IOCTL_MAGIC, 6, struct msm_camera_stats_event_ctrl *)
35
36#define MSM_CAM_IOCTL_GETFRAME \
37 _IOR(MSM_CAM_IOCTL_MAGIC, 7, struct msm_camera_get_frame *)
38
39#define MSM_CAM_IOCTL_ENABLE_VFE \
40 _IOW(MSM_CAM_IOCTL_MAGIC, 8, struct camera_enable_cmd *)
41
42#define MSM_CAM_IOCTL_CTRL_CMD_DONE \
43 _IOW(MSM_CAM_IOCTL_MAGIC, 9, struct camera_cmd *)
44
45#define MSM_CAM_IOCTL_CONFIG_CMD \
46 _IOW(MSM_CAM_IOCTL_MAGIC, 10, struct camera_cmd *)
47
48#define MSM_CAM_IOCTL_DISABLE_VFE \
49 _IOW(MSM_CAM_IOCTL_MAGIC, 11, struct camera_enable_cmd *)
50
51#define MSM_CAM_IOCTL_PAD_REG_RESET2 \
52 _IOW(MSM_CAM_IOCTL_MAGIC, 12, struct camera_enable_cmd *)
53
54#define MSM_CAM_IOCTL_VFE_APPS_RESET \
55 _IOW(MSM_CAM_IOCTL_MAGIC, 13, struct camera_enable_cmd *)
56
57#define MSM_CAM_IOCTL_RELEASE_FRAME_BUFFER \
58 _IOW(MSM_CAM_IOCTL_MAGIC, 14, struct camera_enable_cmd *)
59
60#define MSM_CAM_IOCTL_RELEASE_STATS_BUFFER \
61 _IOW(MSM_CAM_IOCTL_MAGIC, 15, struct msm_stats_buf *)
62
63#define MSM_CAM_IOCTL_AXI_CONFIG \
64 _IOW(MSM_CAM_IOCTL_MAGIC, 16, struct msm_camera_vfe_cfg_cmd *)
65
66#define MSM_CAM_IOCTL_GET_PICTURE \
67 _IOW(MSM_CAM_IOCTL_MAGIC, 17, struct msm_frame *)
68
69#define MSM_CAM_IOCTL_SET_CROP \
70 _IOW(MSM_CAM_IOCTL_MAGIC, 18, struct crop_info *)
71
72#define MSM_CAM_IOCTL_PICT_PP \
73 _IOW(MSM_CAM_IOCTL_MAGIC, 19, uint8_t *)
74
75#define MSM_CAM_IOCTL_PICT_PP_DONE \
76 _IOW(MSM_CAM_IOCTL_MAGIC, 20, struct msm_snapshot_pp_status *)
77
78#define MSM_CAM_IOCTL_SENSOR_IO_CFG \
79 _IOW(MSM_CAM_IOCTL_MAGIC, 21, struct sensor_cfg_data *)
80
81#define MSM_CAM_IOCTL_FLASH_LED_CFG \
82 _IOW(MSM_CAM_IOCTL_MAGIC, 22, unsigned *)
83
84#define MSM_CAM_IOCTL_UNBLOCK_POLL_FRAME \
85 _IO(MSM_CAM_IOCTL_MAGIC, 23)
86
87#define MSM_CAM_IOCTL_CTRL_COMMAND_2 \
88 _IOW(MSM_CAM_IOCTL_MAGIC, 24, struct msm_ctrl_cmd *)
89
90#define MSM_CAM_IOCTL_AF_CTRL \
91 _IOR(MSM_CAM_IOCTL_MAGIC, 25, struct msm_ctrl_cmt_t *)
92
93#define MSM_CAM_IOCTL_AF_CTRL_DONE \
94 _IOW(MSM_CAM_IOCTL_MAGIC, 26, struct msm_ctrl_cmt_t *)
95
96#define MSM_CAM_IOCTL_CONFIG_VPE \
97 _IOW(MSM_CAM_IOCTL_MAGIC, 27, struct msm_camera_vpe_cfg_cmd *)
98
99#define MSM_CAM_IOCTL_AXI_VPE_CONFIG \
100 _IOW(MSM_CAM_IOCTL_MAGIC, 28, struct msm_camera_vpe_cfg_cmd *)
101
102#define MSM_CAM_IOCTL_STROBE_FLASH_CFG \
103 _IOW(MSM_CAM_IOCTL_MAGIC, 29, uint32_t *)
104
105#define MSM_CAM_IOCTL_STROBE_FLASH_CHARGE \
106 _IOW(MSM_CAM_IOCTL_MAGIC, 30, uint32_t *)
107
108#define MSM_CAM_IOCTL_STROBE_FLASH_RELEASE \
109 _IO(MSM_CAM_IOCTL_MAGIC, 31)
110
111#define MSM_CAM_IOCTL_FLASH_CTRL \
112 _IOW(MSM_CAM_IOCTL_MAGIC, 32, struct flash_ctrl_data *)
113
114#define MSM_CAM_IOCTL_ERROR_CONFIG \
115 _IOW(MSM_CAM_IOCTL_MAGIC, 33, uint32_t *)
116
117#define MSM_CAM_IOCTL_ABORT_CAPTURE \
118 _IO(MSM_CAM_IOCTL_MAGIC, 34)
119
120#define MSM_CAM_IOCTL_SET_FD_ROI \
121 _IOW(MSM_CAM_IOCTL_MAGIC, 35, struct fd_roi_info *)
122
123#define MSM_CAM_IOCTL_GET_CAMERA_INFO \
124 _IOR(MSM_CAM_IOCTL_MAGIC, 36, struct msm_camera_info *)
125
126#define MSM_CAM_IOCTL_UNBLOCK_POLL_PIC_FRAME \
127 _IO(MSM_CAM_IOCTL_MAGIC, 37)
128
129#define MSM_CAM_IOCTL_RELEASE_PIC_BUFFER \
130 _IOW(MSM_CAM_IOCTL_MAGIC, 38, struct camera_enable_cmd *)
131
132#define MSM_CAM_IOCTL_PUT_ST_FRAME \
133 _IOW(MSM_CAM_IOCTL_MAGIC, 39, struct msm_camera_st_frame *)
134
135#define MSM_CAM_IOCTL_GET_CONFIG_INFO \
136 _IOR(MSM_CAM_IOCTL_MAGIC, 40, struct msm_cam_config_dev_info *)
137
Mansoor Aftab5d418372011-07-26 17:01:26 -0700138#define MSM_CAM_IOCTL_V4L2_EVT_NOTIFY \
Shuzhen Wang0d9277c2011-07-28 10:19:10 -0700139 _IOR(MSM_CAM_IOCTL_MAGIC, 41, struct v4l2_event *)
Mansoor Aftab5d418372011-07-26 17:01:26 -0700140
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700141#define MSM_CAMERA_LED_OFF 0
142#define MSM_CAMERA_LED_LOW 1
143#define MSM_CAMERA_LED_HIGH 2
144
145#define MSM_CAMERA_STROBE_FLASH_NONE 0
146#define MSM_CAMERA_STROBE_FLASH_XENON 1
147
148#define MSM_MAX_CAMERA_SENSORS 5
149#define MAX_SENSOR_NAME 32
150
151#define MSM_MAX_CAMERA_CONFIGS 2
152
153#define PP_SNAP 0x01
154#define PP_RAW_SNAP ((0x01)<<1)
155#define PP_PREV ((0x01)<<2)
156#define PP_MASK (PP_SNAP|PP_RAW_SNAP|PP_PREV)
157
158#define MSM_CAM_CTRL_CMD_DONE 0
159#define MSM_CAM_SENSOR_VFE_CMD 1
160
161/*****************************************************
162 * structure
163 *****************************************************/
164
165/* define five type of structures for userspace <==> kernel
166 * space communication:
167 * command 1 - 2 are from userspace ==> kernel
168 * command 3 - 4 are from kernel ==> userspace
169 *
170 * 1. control command: control command(from control thread),
171 * control status (from config thread);
172 */
173struct msm_ctrl_cmd {
174 uint16_t type;
175 uint16_t length;
176 void *value;
177 uint16_t status;
178 uint32_t timeout_ms;
179 int resp_fd; /* FIXME: to be used by the kernel, pass-through for now */
180 int vnode_id; /* video dev id. Can we overload resp_fd? */
181 uint32_t stream_type; /* used to pass value to qcamera server */
182};
183
184struct msm_cam_evt_msg {
185 unsigned short type; /* 1 == event (RPC), 0 == message (adsp) */
186 unsigned short msg_id;
187 unsigned int len; /* size in, number of bytes out */
188 uint32_t frame_id;
189 void *data;
190};
191
Mingcheng Zhu49505502011-07-19 20:44:36 -0700192struct msm_cam_evt_divert_frame {
Mingcheng Zhu5b04d352011-07-22 21:18:42 -0700193 unsigned short image_mode;
194 unsigned short op_mode;
Mingcheng Zhu49505502011-07-19 20:44:36 -0700195 unsigned short inst_idx;
196 unsigned short node_idx;
Mingcheng Zhu5b04d352011-07-22 21:18:42 -0700197 unsigned long phy_addr;
198 uint32_t phy_offset;
199 uint32_t y_off;
200 uint32_t cbcr_off;
201 int32_t fd;
202 uint32_t frame_id;
203 int path;
204 uint32_t length;
205 struct timeval timestamp;
Mingcheng Zhu49505502011-07-19 20:44:36 -0700206};
207
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700208struct msm_isp_stats_event_ctrl {
209 unsigned short resptype;
210 union {
211 struct msm_cam_evt_msg isp_msg;
212 struct msm_ctrl_cmd ctrl;
213 } isp_data;
214};
215
216#define MSM_CAM_RESP_CTRL 0
217#define MSM_CAM_RESP_STAT_EVT_MSG 1
218#define MSM_CAM_RESP_STEREO_OP_1 2
219#define MSM_CAM_RESP_STEREO_OP_2 3
220#define MSM_CAM_RESP_V4L2 4
Mingcheng Zhu49505502011-07-19 20:44:36 -0700221#define MSM_CAM_RESP_DIV_FRAME_EVT_MSG 5
Shuzhen Wang0d9277c2011-07-28 10:19:10 -0700222#define MSM_CAM_RESP_DONE_EVENT 6
223#define MSM_CAM_RESP_MAX 7
Mingcheng Zhu49505502011-07-19 20:44:36 -0700224
225#define MSM_CAMERA_EVT_TYPE_BASE V4L2_EVENT_PRIVATE_START
226enum msm_camera_event_type {
227 MSM_CAMERA_EVT_TYPE_STREAM,
228 MSM_CAMERA_EVT_TYPE_CTRL,
229 MSM_CAMERA_EVT_TYPE_STATS,
230 MSM_CAMERA_EVT_TYPE_MAX
231};
232
233enum msm_camera_stream_status {
234 MSM_CAMERA_STREAM_STATUS_ON,
235 MSM_CAMERA_STREAM_STATUS_OFF,
236 MSM_CAMERA_STREAM_STATUS_ERR,
237};
238struct msm_camera_event_stream {
239 uint32_t op_mode;
240 uint32_t image_mode;
241 uint32_t status;
242};
243struct msm_camera_event_ctrl {
244 uint32_t event_id;
245 uint32_t status;
246};
247struct msm_camera_event_stats {
248 uint32_t event_id;
Mansoor Aftab5d418372011-07-26 17:01:26 -0700249 uint8_t data[40]; /* to be determined later */
Mingcheng Zhu49505502011-07-19 20:44:36 -0700250};
251
252struct msm_camera_event {
253 uint32_t event_type;
254 /* the union size cannot go beyond 64 bytes. need RFC */
255 union {
256 struct msm_camera_event_stream stream;
257 struct msm_camera_event_ctrl ctrl;
258 struct msm_camera_event_stats stats;
Mansoor Aftab5d418372011-07-26 17:01:26 -0700259 } e;
Mingcheng Zhu49505502011-07-19 20:44:36 -0700260};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700261
262/* driver event types */
263#define MSM_CAM_EVT_HISTOGRAM_NOTIFY (V4L2_EVENT_PRIVATE_START+1)
264#define MSM_CAM_EVT_STREAMING_NOTIFY (V4L2_EVENT_PRIVATE_START+2)
265#define MSM_CAM_EVT_ASYNC_CMD_NOTIFY (V4L2_EVENT_PRIVATE_START+3)
Mansoor Aftab5d418372011-07-26 17:01:26 -0700266#define MSM_CAM_EVT_AUTO_FOCUS_DONE (V4L2_EVENT_PRIVATE_START+4)
267#define MSM_CAM_EVT_MAX (V4L2_EVENT_PRIVATE_START+5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700268
269struct msm_event_histogram {
270 int32_t fd;
271 uint32_t size;
272 uint32_t offset;
273};
274struct msm_event_async_cmd_status {
275 uint32_t cmd;
276 int32_t status;
277};
278struct msm_event_streaming_status {
279 uint32_t ext_mode;
280 int32_t streamon;
281 int32_t status;
282};
283struct msm_event_payload {
284 uint32_t type;
285 union {
286 struct msm_event_histogram hist;
287 struct msm_event_async_cmd_status cmd_status;
288 struct msm_event_streaming_status stream_status;
289 };
290};
291/* this one is used to send ctrl/status up to config thread */
292struct msm_stats_event_ctrl {
293 /* 0 - ctrl_cmd from control thread,
294 * 1 - stats/event kernel,
295 * 2 - V4L control or read request */
296 int resptype;
297 int timeout_ms;
298 struct msm_ctrl_cmd ctrl_cmd;
299 /* struct vfe_event_t stats_event; */
300 struct msm_cam_evt_msg stats_event;
301};
302
303/* 2. config command: config command(from config thread); */
304struct msm_camera_cfg_cmd {
305 /* what to config:
306 * 1 - sensor config, 2 - vfe config */
307 uint16_t cfg_type;
308
309 /* sensor config type */
310 uint16_t cmd_type;
311 uint16_t queue;
312 uint16_t length;
313 void *value;
314};
315
316#define CMD_GENERAL 0
317#define CMD_AXI_CFG_OUT1 1
318#define CMD_AXI_CFG_SNAP_O1_AND_O2 2
319#define CMD_AXI_CFG_OUT2 3
320#define CMD_PICT_T_AXI_CFG 4
321#define CMD_PICT_M_AXI_CFG 5
322#define CMD_RAW_PICT_AXI_CFG 6
323
324#define CMD_FRAME_BUF_RELEASE 7
325#define CMD_PREV_BUF_CFG 8
326#define CMD_SNAP_BUF_RELEASE 9
327#define CMD_SNAP_BUF_CFG 10
328#define CMD_STATS_DISABLE 11
329#define CMD_STATS_AEC_AWB_ENABLE 12
330#define CMD_STATS_AF_ENABLE 13
331#define CMD_STATS_AEC_ENABLE 14
332#define CMD_STATS_AWB_ENABLE 15
333#define CMD_STATS_ENABLE 16
334
335#define CMD_STATS_AXI_CFG 17
336#define CMD_STATS_AEC_AXI_CFG 18
337#define CMD_STATS_AF_AXI_CFG 19
338#define CMD_STATS_AWB_AXI_CFG 20
339#define CMD_STATS_RS_AXI_CFG 21
340#define CMD_STATS_CS_AXI_CFG 22
341#define CMD_STATS_IHIST_AXI_CFG 23
342#define CMD_STATS_SKIN_AXI_CFG 24
343
344#define CMD_STATS_BUF_RELEASE 25
345#define CMD_STATS_AEC_BUF_RELEASE 26
346#define CMD_STATS_AF_BUF_RELEASE 27
347#define CMD_STATS_AWB_BUF_RELEASE 28
348#define CMD_STATS_RS_BUF_RELEASE 29
349#define CMD_STATS_CS_BUF_RELEASE 30
350#define CMD_STATS_IHIST_BUF_RELEASE 31
351#define CMD_STATS_SKIN_BUF_RELEASE 32
352
353#define UPDATE_STATS_INVALID 33
354#define CMD_AXI_CFG_SNAP_GEMINI 34
355#define CMD_AXI_CFG_SNAP 35
356#define CMD_AXI_CFG_PREVIEW 36
357#define CMD_AXI_CFG_VIDEO 37
358
359#define CMD_STATS_IHIST_ENABLE 38
360#define CMD_STATS_RS_ENABLE 39
361#define CMD_STATS_CS_ENABLE 40
362#define CMD_VPE 41
363#define CMD_AXI_CFG_VPE 42
364#define CMD_AXI_CFG_ZSL 43
365#define CMD_AXI_CFG_SNAP_VPE 44
366#define CMD_AXI_CFG_SNAP_THUMB_VPE 45
Kiran Kumar H N0fb9dcf2011-07-17 12:31:53 -0700367#define CMD_CONFIG_PING_ADDR 46
368#define CMD_CONFIG_PONG_ADDR 47
369#define CMD_CONFIG_FREE_BUF_ADDR 48
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700370
371/* vfe config command: config command(from config thread)*/
372struct msm_vfe_cfg_cmd {
373 int cmd_type;
374 uint16_t length;
375 void *value;
376};
377
378struct msm_vpe_cfg_cmd {
379 int cmd_type;
380 uint16_t length;
381 void *value;
382};
383
384#define MAX_CAMERA_ENABLE_NAME_LEN 32
385struct camera_enable_cmd {
386 char name[MAX_CAMERA_ENABLE_NAME_LEN];
387};
388
389#define MSM_PMEM_OUTPUT1 0
390#define MSM_PMEM_OUTPUT2 1
391#define MSM_PMEM_OUTPUT1_OUTPUT2 2
392#define MSM_PMEM_THUMBNAIL 3
393#define MSM_PMEM_MAINIMG 4
394#define MSM_PMEM_RAW_MAINIMG 5
395#define MSM_PMEM_AEC_AWB 6
396#define MSM_PMEM_AF 7
397#define MSM_PMEM_AEC 8
398#define MSM_PMEM_AWB 9
399#define MSM_PMEM_RS 10
400#define MSM_PMEM_CS 11
401#define MSM_PMEM_IHIST 12
402#define MSM_PMEM_SKIN 13
403#define MSM_PMEM_VIDEO 14
404#define MSM_PMEM_PREVIEW 15
405#define MSM_PMEM_VIDEO_VPE 16
406#define MSM_PMEM_C2D 17
407#define MSM_PMEM_MAINIMG_VPE 18
408#define MSM_PMEM_THUMBNAIL_VPE 19
409#define MSM_PMEM_MAX 20
410
411#define STAT_AEAW 0
412#define STAT_AEC 1
413#define STAT_AF 2
414#define STAT_AWB 3
415#define STAT_RS 4
416#define STAT_CS 5
417#define STAT_IHIST 6
418#define STAT_SKIN 7
419#define STAT_MAX 8
420
421#define FRAME_PREVIEW_OUTPUT1 0
422#define FRAME_PREVIEW_OUTPUT2 1
423#define FRAME_SNAPSHOT 2
424#define FRAME_THUMBNAIL 3
425#define FRAME_RAW_SNAPSHOT 4
426#define FRAME_MAX 5
427
428struct msm_pmem_info {
429 int type;
430 int fd;
431 void *vaddr;
432 uint32_t offset;
433 uint32_t len;
Kiran Kumar H N5a19c682011-07-23 11:34:34 -0700434 uint32_t y_off;
435 uint32_t cbcr_off;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700436 uint8_t active;
437};
438
439struct outputCfg {
440 uint32_t height;
441 uint32_t width;
442
443 uint32_t window_height_firstline;
444 uint32_t window_height_lastline;
445};
446
447#define OUTPUT_1 0
448#define OUTPUT_2 1
449#define OUTPUT_1_AND_2 2 /* snapshot only */
450#define OUTPUT_1_AND_3 3 /* video */
451#define CAMIF_TO_AXI_VIA_OUTPUT_2 4
452#define OUTPUT_1_AND_CAMIF_TO_AXI_VIA_OUTPUT_2 5
453#define OUTPUT_2_AND_CAMIF_TO_AXI_VIA_OUTPUT_1 6
454#define OUTPUT_1_2_AND_3 7
455#define LAST_AXI_OUTPUT_MODE_ENUM = OUTPUT_1_2_AND_3 7
456
457#define MSM_FRAME_PREV_1 0
458#define MSM_FRAME_PREV_2 1
459#define MSM_FRAME_ENC 2
460
461#define OUTPUT_TYPE_P (1<<0)
462#define OUTPUT_TYPE_T (1<<1)
463#define OUTPUT_TYPE_S (1<<2)
464#define OUTPUT_TYPE_V (1<<3)
465#define OUTPUT_TYPE_L (1<<4)
466#define OUTPUT_TYPE_ST_L (1<<5)
467#define OUTPUT_TYPE_ST_R (1<<6)
468#define OUTPUT_TYPE_ST_D (1<<7)
469
470struct fd_roi_info {
471 void *info;
472 int info_len;
473};
474
Mingcheng Zhu5b04d352011-07-22 21:18:42 -0700475struct msm_mmap_entry {
476 uint32_t image_mode;/* extended mode */
477 uint32_t op_mode; /* operation mode, video, capture */
478 uint32_t vnode_idx; /* dev node idx */
479 uint32_t phy_addr; /* phy address: TBD: to be dropped */
480 uint32_t idx; /* v4l2 buffer index */
481};
482
Mingcheng Zhu49505502011-07-19 20:44:36 -0700483#define MSM_MEM_MMAP 0
484#define MSM_MEM_USERPTR 1
485#define MSM_PLANE_MAX 8
486#define MSM_PLANE_Y 0
487#define MSM_PLANE_UV 1
488
489struct msm_buffer_plane {
490 int type;
491 uint32_t offset;
492 uint32_t length;
493 uint32_t error;
494 unsigned long buffer;
495 unsigned long addr;
496 uint32_t addr_offset;
497 int fd;
498};
499struct msm_buffer {
500 struct timeval timestamp;
501 int memory_type;
502 uint32_t frame_id;
503 int path;
504 int num;
505 struct msm_buffer_plane planes[MSM_PLANE_MAX];
506};
507
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700508struct msm_frame {
509 struct timespec ts;
510 int path;
511 int type;
512 unsigned long buffer;
513 uint32_t phy_offset;
Kiran Kumar H N5a19c682011-07-23 11:34:34 -0700514 uint32_t y_off;
515 uint32_t cbcr_off;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700516 int fd;
517
518 void *cropinfo;
519 int croplen;
520 uint32_t error_code;
521 struct fd_roi_info roi_info;
522 uint32_t frame_id;
523 int stcam_quality_ind;
524 uint32_t stcam_conv_value;
525};
526
527enum msm_st_frame_packing {
528 SIDE_BY_SIDE_HALF,
529 SIDE_BY_SIDE_FULL,
530 TOP_DOWN_HALF,
531 TOP_DOWN_FULL,
532};
533
534struct msm_st_crop {
535 uint32_t in_w;
536 uint32_t in_h;
537 uint32_t out_w;
538 uint32_t out_h;
539};
540
541struct msm_st_half {
Kiran Kumar H N5a19c682011-07-23 11:34:34 -0700542 uint32_t buf_y_off;
543 uint32_t buf_cbcr_off;
544 uint32_t buf_y_stride;
545 uint32_t buf_cbcr_stride;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700546 uint32_t pix_x_off;
547 uint32_t pix_y_off;
548 struct msm_st_crop stCropInfo;
549};
550
551struct msm_st_frame {
552 struct msm_frame buf_info;
553 int type;
554 enum msm_st_frame_packing packing;
555 struct msm_st_half L;
556 struct msm_st_half R;
557 int frame_id;
558};
559
560#define MSM_CAMERA_ERR_MASK (0xFFFFFFFF & 1)
561
562struct stats_buff {
563 unsigned long buff;
564 int fd;
565};
566
567struct msm_stats_buf {
568 struct stats_buff aec;
569 struct stats_buff awb;
570 struct stats_buff af;
571 struct stats_buff ihist;
572 struct stats_buff rs;
573 struct stats_buff cs;
574 struct stats_buff skin;
575 int type;
576 uint32_t status_bits;
577 unsigned long buffer;
578 int fd;
579 uint32_t frame_id;
580};
581#define MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT 0
582/* video capture mode in VIDIOC_S_PARM */
583#define MSM_V4L2_EXT_CAPTURE_MODE_PREVIEW \
584 (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+1)
585/* extendedmode for video recording in VIDIOC_S_PARM */
586#define MSM_V4L2_EXT_CAPTURE_MODE_VIDEO \
587 (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+2)
588/* extendedmode for the full size main image in VIDIOC_S_PARM */
589#define MSM_V4L2_EXT_CAPTURE_MODE_MAIN (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+3)
590/* extendedmode for the thumb nail image in VIDIOC_S_PARM */
591#define MSM_V4L2_EXT_CAPTURE_MODE_THUMBNAIL \
592 (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+4)
593#define MSM_V4L2_EXT_CAPTURE_MODE_RAW \
594 (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+5)
595#define MSM_V4L2_EXT_CAPTURE_MODE_MAX (MSM_V4L2_EXT_CAPTURE_MODE_DEFAULT+6)
596
597
598#define MSM_V4L2_PID_MOTION_ISO V4L2_CID_PRIVATE_BASE
599#define MSM_V4L2_PID_EFFECT (V4L2_CID_PRIVATE_BASE+1)
600#define MSM_V4L2_PID_HJR (V4L2_CID_PRIVATE_BASE+2)
601#define MSM_V4L2_PID_LED_MODE (V4L2_CID_PRIVATE_BASE+3)
602#define MSM_V4L2_PID_PREP_SNAPSHOT (V4L2_CID_PRIVATE_BASE+4)
603#define MSM_V4L2_PID_EXP_METERING (V4L2_CID_PRIVATE_BASE+5)
604#define MSM_V4L2_PID_ISO (V4L2_CID_PRIVATE_BASE+6)
605#define MSM_V4L2_PID_CAM_MODE (V4L2_CID_PRIVATE_BASE+7)
606#define MSM_V4L2_PID_LUMA_ADAPTATION (V4L2_CID_PRIVATE_BASE+8)
607#define MSM_V4L2_PID_BEST_SHOT (V4L2_CID_PRIVATE_BASE+9)
608#define MSM_V4L2_PID_FOCUS_MODE (V4L2_CID_PRIVATE_BASE+10)
609#define MSM_V4L2_PID_BL_DETECTION (V4L2_CID_PRIVATE_BASE+11)
610#define MSM_V4L2_PID_SNOW_DETECTION (V4L2_CID_PRIVATE_BASE+12)
611#define MSM_V4L2_PID_CTRL_CMD (V4L2_CID_PRIVATE_BASE+13)
612#define MSM_V4L2_PID_EVT_SUB_INFO (V4L2_CID_PRIVATE_BASE+14)
Mingcheng Zhu5b04d352011-07-22 21:18:42 -0700613#define MSM_V4L2_PID_STROBE_FLASH (V4L2_CID_PRIVATE_BASE+15)
614#define MSM_V4L2_PID_MMAP_ENTRY (V4L2_CID_PRIVATE_BASE+16)
615#define MSM_V4L2_PID_MMAP_INST (V4L2_CID_PRIVATE_BASE+17)
616#define MSM_V4L2_PID_MAX MSM_V4L2_PID_MMAP_INST
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700617
618/* camera operation mode for video recording - two frame output queues */
619#define MSM_V4L2_CAM_OP_DEFAULT 0
620/* camera operation mode for video recording - two frame output queues */
621#define MSM_V4L2_CAM_OP_PREVIEW (MSM_V4L2_CAM_OP_DEFAULT+1)
622/* camera operation mode for video recording - two frame output queues */
623#define MSM_V4L2_CAM_OP_VIDEO (MSM_V4L2_CAM_OP_DEFAULT+2)
624/* camera operation mode for standard shapshot - two frame output queues */
625#define MSM_V4L2_CAM_OP_CAPTURE (MSM_V4L2_CAM_OP_DEFAULT+3)
626/* camera operation mode for zsl shapshot - three output queues */
627#define MSM_V4L2_CAM_OP_ZSL (MSM_V4L2_CAM_OP_DEFAULT+4)
628/* camera operation mode for raw snapshot - one frame output queue */
629#define MSM_V4L2_CAM_OP_RAW (MSM_V4L2_CAM_OP_DEFAULT+5)
630
631#define MSM_V4L2_VID_CAP_TYPE 0
632#define MSM_V4L2_STREAM_ON 1
633#define MSM_V4L2_STREAM_OFF 2
634#define MSM_V4L2_SNAPSHOT 3
635#define MSM_V4L2_QUERY_CTRL 4
636#define MSM_V4L2_GET_CTRL 5
637#define MSM_V4L2_SET_CTRL 6
638#define MSM_V4L2_QUERY 7
639#define MSM_V4L2_GET_CROP 8
640#define MSM_V4L2_SET_CROP 9
641#define MSM_V4L2_OPEN 10
642#define MSM_V4L2_CLOSE 11
643#define MSM_V4L2_SET_CTRL_CMD 12
644#define MSM_V4L2_EVT_SUB_MASK 13
645#define MSM_V4L2_MAX 14
646#define V4L2_CAMERA_EXIT 43
647
648struct crop_info {
649 void *info;
650 int len;
651};
652
653struct msm_postproc {
654 int ftnum;
655 struct msm_frame fthumnail;
656 int fmnum;
657 struct msm_frame fmain;
658};
659
660struct msm_snapshot_pp_status {
661 void *status;
662};
663
664#define CFG_SET_MODE 0
665#define CFG_SET_EFFECT 1
666#define CFG_START 2
667#define CFG_PWR_UP 3
668#define CFG_PWR_DOWN 4
669#define CFG_WRITE_EXPOSURE_GAIN 5
670#define CFG_SET_DEFAULT_FOCUS 6
671#define CFG_MOVE_FOCUS 7
672#define CFG_REGISTER_TO_REAL_GAIN 8
673#define CFG_REAL_TO_REGISTER_GAIN 9
674#define CFG_SET_FPS 10
675#define CFG_SET_PICT_FPS 11
676#define CFG_SET_BRIGHTNESS 12
677#define CFG_SET_CONTRAST 13
678#define CFG_SET_ZOOM 14
679#define CFG_SET_EXPOSURE_MODE 15
680#define CFG_SET_WB 16
681#define CFG_SET_ANTIBANDING 17
682#define CFG_SET_EXP_GAIN 18
683#define CFG_SET_PICT_EXP_GAIN 19
684#define CFG_SET_LENS_SHADING 20
685#define CFG_GET_PICT_FPS 21
686#define CFG_GET_PREV_L_PF 22
687#define CFG_GET_PREV_P_PL 23
688#define CFG_GET_PICT_L_PF 24
689#define CFG_GET_PICT_P_PL 25
690#define CFG_GET_AF_MAX_STEPS 26
691#define CFG_GET_PICT_MAX_EXP_LC 27
692#define CFG_SEND_WB_INFO 28
693#define CFG_SENSOR_INIT 29
694#define CFG_GET_3D_CALI_DATA 30
695#define CFG_GET_CALIB_DATA 31
696#define CFG_MAX 32
697
698
699#define MOVE_NEAR 0
700#define MOVE_FAR 1
701
702#define SENSOR_PREVIEW_MODE 0
703#define SENSOR_SNAPSHOT_MODE 1
704#define SENSOR_RAW_SNAPSHOT_MODE 2
705#define SENSOR_HFR_60FPS_MODE 3
706#define SENSOR_HFR_90FPS_MODE 4
707#define SENSOR_HFR_120FPS_MODE 5
708
709#define SENSOR_QTR_SIZE 0
710#define SENSOR_FULL_SIZE 1
711#define SENSOR_QVGA_SIZE 2
712#define SENSOR_INVALID_SIZE 3
713
714#define CAMERA_EFFECT_OFF 0
715#define CAMERA_EFFECT_MONO 1
716#define CAMERA_EFFECT_NEGATIVE 2
717#define CAMERA_EFFECT_SOLARIZE 3
718#define CAMERA_EFFECT_SEPIA 4
719#define CAMERA_EFFECT_POSTERIZE 5
720#define CAMERA_EFFECT_WHITEBOARD 6
721#define CAMERA_EFFECT_BLACKBOARD 7
722#define CAMERA_EFFECT_AQUA 8
723#define CAMERA_EFFECT_MAX 9
724
725struct sensor_pict_fps {
726 uint16_t prevfps;
727 uint16_t pictfps;
728};
729
730struct exp_gain_cfg {
731 uint16_t gain;
732 uint32_t line;
733};
734
735struct focus_cfg {
736 int32_t steps;
737 int dir;
738};
739
740struct fps_cfg {
741 uint16_t f_mult;
742 uint16_t fps_div;
743 uint32_t pict_fps_div;
744};
745struct wb_info_cfg {
746 uint16_t red_gain;
747 uint16_t green_gain;
748 uint16_t blue_gain;
749};
750struct sensor_3d_exp_cfg {
751 uint16_t gain;
752 uint32_t line;
753 uint16_t r_gain;
754 uint16_t b_gain;
755 uint16_t gr_gain;
756 uint16_t gb_gain;
757 uint16_t gain_adjust;
758};
759struct sensor_3d_cali_data_t{
760 unsigned char left_p_matrix[3][4][8];
761 unsigned char right_p_matrix[3][4][8];
762 unsigned char square_len[8];
763 unsigned char focal_len[8];
764 unsigned char pixel_pitch[8];
765 uint16_t left_r;
766 uint16_t left_b;
767 uint16_t left_gb;
768 uint16_t left_af_far;
769 uint16_t left_af_mid;
770 uint16_t left_af_short;
771 uint16_t left_af_5um;
772 uint16_t left_af_50up;
773 uint16_t left_af_50down;
774 uint16_t right_r;
775 uint16_t right_b;
776 uint16_t right_gb;
777 uint16_t right_af_far;
778 uint16_t right_af_mid;
779 uint16_t right_af_short;
780 uint16_t right_af_5um;
781 uint16_t right_af_50up;
782 uint16_t right_af_50down;
783};
784struct sensor_init_cfg {
785 uint8_t prev_res;
786 uint8_t pict_res;
787};
788
789struct sensor_calib_data {
790 /* Color Related Measurements */
791 uint16_t r_over_g;
792 uint16_t b_over_g;
793 uint16_t gr_over_gb;
794
795 /* Lens Related Measurements */
796 uint16_t macro_2_inf;
797 uint16_t inf_2_macro;
798 uint16_t stroke_amt;
799 uint16_t af_pos_1m;
800 uint16_t af_pos_inf;
801};
802
803struct sensor_cfg_data {
804 int cfgtype;
805 int mode;
806 int rs;
807 uint8_t max_steps;
808
809 union {
810 int8_t effect;
811 uint8_t lens_shading;
812 uint16_t prevl_pf;
813 uint16_t prevp_pl;
814 uint16_t pictl_pf;
815 uint16_t pictp_pl;
816 uint32_t pict_max_exp_lc;
817 uint16_t p_fps;
818 struct sensor_init_cfg init_info;
819 struct sensor_pict_fps gfps;
820 struct exp_gain_cfg exp_gain;
821 struct focus_cfg focus;
822 struct fps_cfg fps;
823 struct wb_info_cfg wb_info;
824 struct sensor_3d_exp_cfg sensor_3d_exp;
825 struct sensor_calib_data calib_info;
826 } cfg;
827};
828
829struct sensor_large_data {
830 int cfgtype;
831 union {
832 struct sensor_3d_cali_data_t sensor_3d_cali_data;
833 } data;
834};
835
836enum sensor_type_t {
837 BAYER,
838 YUV,
839 JPEG_SOC,
840};
841
842enum flash_type {
843 LED_FLASH,
844 STROBE_FLASH,
845};
846
847enum strobe_flash_ctrl_type {
848 STROBE_FLASH_CTRL_INIT,
849 STROBE_FLASH_CTRL_CHARGE,
850 STROBE_FLASH_CTRL_RELEASE
851};
852
853struct strobe_flash_ctrl_data {
854 enum strobe_flash_ctrl_type type;
855 int charge_en;
856};
857
858struct msm_camera_info {
859 int num_cameras;
860 uint8_t has_3d_support[MSM_MAX_CAMERA_SENSORS];
861 uint8_t is_internal_cam[MSM_MAX_CAMERA_SENSORS];
862 uint32_t s_mount_angle[MSM_MAX_CAMERA_SENSORS];
863 const char *video_dev_name[MSM_MAX_CAMERA_SENSORS];
864 enum sensor_type_t sensor_type[MSM_MAX_CAMERA_SENSORS];
865
866};
867
868struct msm_cam_config_dev_info {
869 int num_config_nodes;
870 const char *config_dev_name[MSM_MAX_CAMERA_CONFIGS];
871};
872
873struct flash_ctrl_data {
874 int flashtype;
875 union {
876 int led_state;
877 struct strobe_flash_ctrl_data strobe_ctrl;
878 } ctrl_data;
879};
880
881#define GET_NAME 0
882#define GET_PREVIEW_LINE_PER_FRAME 1
883#define GET_PREVIEW_PIXELS_PER_LINE 2
884#define GET_SNAPSHOT_LINE_PER_FRAME 3
885#define GET_SNAPSHOT_PIXELS_PER_LINE 4
886#define GET_SNAPSHOT_FPS 5
887#define GET_SNAPSHOT_MAX_EP_LINE_CNT 6
888
889struct msm_camsensor_info {
890 char name[MAX_SENSOR_NAME];
891 uint8_t flash_enabled;
892 int8_t total_steps;
893 uint8_t support_3d;
894};
895#endif /* __LINUX_MSM_CAMERA_H */