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