1 #ifndef __LINUX_MSM_CAM_SENSOR_H 2 #define __LINUX_MSM_CAM_SENSOR_H 3 4 #ifdef MSM_CAMERA_BIONIC 5 #include <sys/types.h> 6 #endif 7 #include <linux/types.h> 8 #include <linux/v4l2-mediabus.h> 9 #include <linux/i2c.h> 10 11 #define I2C_SEQ_REG_SETTING_MAX 5 12 #define I2C_SEQ_REG_DATA_MAX 256 13 #define MAX_CID 16 14 15 #define MSM_SENSOR_MCLK_8HZ 8000000 16 #define MSM_SENSOR_MCLK_16HZ 16000000 17 #define MSM_SENSOR_MCLK_24HZ 24000000 18 19 #define GPIO_OUT_LOW (0 << 1) 20 #define GPIO_OUT_HIGH (1 << 1) 21 22 #define CSI_EMBED_DATA 0x12 23 #define CSI_RESERVED_DATA_0 0x13 24 #define CSI_YUV422_8 0x1E 25 #define CSI_RAW8 0x2A 26 #define CSI_RAW10 0x2B 27 #define CSI_RAW12 0x2C 28 29 #define CSI_DECODE_6BIT 0 30 #define CSI_DECODE_8BIT 1 31 #define CSI_DECODE_10BIT 2 32 #define CSI_DECODE_DPCM_10_8_10 5 33 34 #define MAX_SENSOR_NAME 32 35 36 #define MAX_ACT_MOD_NAME_SIZE 32 37 #define MAX_ACT_NAME_SIZE 32 38 #define NUM_ACTUATOR_DIR 2 39 #define MAX_ACTUATOR_SCENARIO 8 40 #define MAX_ACTUATOR_REGION 5 41 #define MAX_ACTUATOR_INIT_SET 12 42 #define MAX_ACTUATOR_REG_TBL_SIZE 8 43 #define MAX_ACTUATOR_AF_TOTAL_STEPS 1024 44 45 #define MAX_OIS_MOD_NAME_SIZE 32 46 #define MAX_OIS_NAME_SIZE 32 47 #define MAX_OIS_REG_SETTINGS 800 48 49 #define MOVE_NEAR 0 50 #define MOVE_FAR 1 51 52 #define MSM_ACTUATOR_MOVE_SIGNED_FAR -1 53 #define MSM_ACTUATOR_MOVE_SIGNED_NEAR 1 54 55 #define MAX_EEPROM_NAME 32 56 57 #define MAX_AF_ITERATIONS 3 58 #define MAX_NUMBER_OF_STEPS 47 59 60 #define MAX_LED_TRIGGERS 3 61 #define MAX_POWER_CONFIG 12 62 63 enum sensor_stats_type { 64 YRGB, 65 YYYY, 66 }; 67 68 enum flash_type { 69 LED_FLASH = 1, 70 STROBE_FLASH, 71 GPIO_FLASH 72 }; 73 74 enum msm_camera_i2c_reg_addr_type { 75 MSM_CAMERA_I2C_BYTE_ADDR = 1, 76 MSM_CAMERA_I2C_WORD_ADDR, 77 MSM_CAMERA_I2C_3B_ADDR, 78 MSM_CAMERA_I2C_ADDR_TYPE_MAX, 79 }; 80 81 enum msm_camera_i2c_data_type { 82 MSM_CAMERA_I2C_BYTE_DATA = 1, 83 MSM_CAMERA_I2C_WORD_DATA, 84 MSM_CAMERA_I2C_DWORD_DATA, 85 MSM_CAMERA_I2C_SET_BYTE_MASK, 86 MSM_CAMERA_I2C_UNSET_BYTE_MASK, 87 MSM_CAMERA_I2C_SET_WORD_MASK, 88 MSM_CAMERA_I2C_UNSET_WORD_MASK, 89 MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA, 90 MSM_CAMERA_I2C_DATA_TYPE_MAX, 91 }; 92 93 enum msm_sensor_power_seq_type_t { 94 SENSOR_CLK, 95 SENSOR_GPIO, 96 SENSOR_VREG, 97 SENSOR_I2C_MUX, 98 }; 99 100 enum msm_sensor_clk_type_t { 101 SENSOR_CAM_MCLK, 102 SENSOR_CAM_CLK, 103 SENSOR_CAM_CLK_MAX, 104 }; 105 106 enum msm_sensor_power_seq_gpio_t { 107 SENSOR_GPIO_RESET, 108 SENSOR_GPIO_STANDBY, 109 SENSOR_GPIO_AF_PWDM, 110 SENSOR_GPIO_VIO, 111 SENSOR_GPIO_VANA, 112 SENSOR_GPIO_VDIG, 113 SENSOR_GPIO_VAF, 114 SENSOR_GPIO_FL_EN, 115 SENSOR_GPIO_FL_NOW, 116 SENSOR_GPIO_TOR_EN, 117 SENSOR_GPIO_MAX, 118 }; 119 120 enum msm_camera_vreg_name_t { 121 CAM_VDIG, 122 CAM_VIO, 123 CAM_VANA, 124 CAM_VAF, 125 CAM_VREG_MAX, 126 }; 127 128 enum msm_sensor_resolution_t { 129 MSM_SENSOR_RES_FULL, 130 MSM_SENSOR_RES_QTR, 131 MSM_SENSOR_RES_2, 132 MSM_SENSOR_RES_3, 133 MSM_SENSOR_RES_4, 134 MSM_SENSOR_RES_5, 135 MSM_SENSOR_RES_6, 136 MSM_SENSOR_RES_7, 137 MSM_SENSOR_INVALID_RES, 138 }; 139 140 enum msm_camera_stream_type_t { 141 MSM_CAMERA_STREAM_PREVIEW, 142 MSM_CAMERA_STREAM_SNAPSHOT, 143 MSM_CAMERA_STREAM_VIDEO, 144 MSM_CAMERA_STREAM_INVALID, 145 }; 146 147 enum sensor_sub_module_t { 148 SUB_MODULE_SENSOR, 149 SUB_MODULE_CHROMATIX, 150 SUB_MODULE_ACTUATOR, 151 SUB_MODULE_EEPROM, 152 SUB_MODULE_LED_FLASH, 153 SUB_MODULE_STROBE_FLASH, 154 SUB_MODULE_CSID, 155 SUB_MODULE_CSID_3D, 156 SUB_MODULE_CSIPHY, 157 SUB_MODULE_CSIPHY_3D, 158 SUB_MODULE_OIS, 159 SUB_MODULE_MAX, 160 }; 161 162 163 struct otp_info_t { 164 uint8_t enable; 165 166 uint16_t page_size; 167 uint16_t num_of_pages; 168 uint16_t page_reg_addr; 169 uint16_t page_reg_base_addr; 170 171 uint16_t ctrl_reg_addr; 172 uint16_t ctrl_reg_read_mode; 173 174 uint16_t status_reg_addr; 175 uint16_t status_reg_read_complete_bit; 176 177 uint16_t reset_reg_addr; 178 uint16_t reset_reg_stream_on; 179 uint16_t reset_reg_stream_off; 180 181 uint16_t data_seg_addr; 182 183 enum msm_camera_i2c_data_type data_size; 184 185 uint8_t big_endian; 186 187 uint8_t poll_times; 188 uint16_t poll_usleep; 189 190 /* Initialized by the sensor driver */ 191 uint8_t *otp_info; 192 uint8_t otp_read; 193 }; 194 195 enum { 196 MSM_CAMERA_EFFECT_MODE_OFF, 197 MSM_CAMERA_EFFECT_MODE_MONO, 198 MSM_CAMERA_EFFECT_MODE_NEGATIVE, 199 MSM_CAMERA_EFFECT_MODE_SOLARIZE, 200 MSM_CAMERA_EFFECT_MODE_SEPIA, 201 MSM_CAMERA_EFFECT_MODE_POSTERIZE, 202 MSM_CAMERA_EFFECT_MODE_WHITEBOARD, 203 MSM_CAMERA_EFFECT_MODE_BLACKBOARD, 204 MSM_CAMERA_EFFECT_MODE_AQUA, 205 MSM_CAMERA_EFFECT_MODE_EMBOSS, 206 MSM_CAMERA_EFFECT_MODE_SKETCH, 207 MSM_CAMERA_EFFECT_MODE_NEON, 208 MSM_CAMERA_EFFECT_MODE_MAX 209 }; 210 211 enum { 212 MSM_CAMERA_WB_MODE_AUTO, 213 MSM_CAMERA_WB_MODE_CUSTOM, 214 MSM_CAMERA_WB_MODE_INCANDESCENT, 215 MSM_CAMERA_WB_MODE_FLUORESCENT, 216 MSM_CAMERA_WB_MODE_WARM_FLUORESCENT, 217 MSM_CAMERA_WB_MODE_DAYLIGHT, 218 MSM_CAMERA_WB_MODE_CLOUDY_DAYLIGHT, 219 MSM_CAMERA_WB_MODE_TWILIGHT, 220 MSM_CAMERA_WB_MODE_SHADE, 221 MSM_CAMERA_WB_MODE_OFF, 222 MSM_CAMERA_WB_MODE_MAX 223 }; 224 225 enum { 226 MSM_CAMERA_SCENE_MODE_OFF, 227 MSM_CAMERA_SCENE_MODE_AUTO, 228 MSM_CAMERA_SCENE_MODE_LANDSCAPE, 229 MSM_CAMERA_SCENE_MODE_SNOW, 230 MSM_CAMERA_SCENE_MODE_BEACH, 231 MSM_CAMERA_SCENE_MODE_SUNSET, 232 MSM_CAMERA_SCENE_MODE_NIGHT, 233 MSM_CAMERA_SCENE_MODE_PORTRAIT, 234 MSM_CAMERA_SCENE_MODE_BACKLIGHT, 235 MSM_CAMERA_SCENE_MODE_SPORTS, 236 MSM_CAMERA_SCENE_MODE_ANTISHAKE, 237 MSM_CAMERA_SCENE_MODE_FLOWERS, 238 MSM_CAMERA_SCENE_MODE_CANDLELIGHT, 239 MSM_CAMERA_SCENE_MODE_FIREWORKS, 240 MSM_CAMERA_SCENE_MODE_PARTY, 241 MSM_CAMERA_SCENE_MODE_NIGHT_PORTRAIT, 242 MSM_CAMERA_SCENE_MODE_THEATRE, 243 MSM_CAMERA_SCENE_MODE_ACTION, 244 MSM_CAMERA_SCENE_MODE_AR, 245 MSM_CAMERA_SCENE_MODE_FACE_PRIORITY, 246 MSM_CAMERA_SCENE_MODE_BARCODE, 247 MSM_CAMERA_SCENE_MODE_HDR, 248 MSM_CAMERA_SCENE_MODE_MAX 249 }; 250 251 enum csid_cfg_type_t { 252 CSID_INIT, 253 CSID_CFG, 254 CSID_RELEASE, 255 }; 256 257 enum csiphy_cfg_type_t { 258 CSIPHY_INIT, 259 CSIPHY_CFG, 260 CSIPHY_RELEASE, 261 }; 262 263 enum camera_vreg_type { 264 REG_LDO, 265 REG_VS, 266 REG_GPIO, 267 }; 268 269 enum sensor_af_t { 270 SENSOR_AF_FOCUSSED, 271 SENSOR_AF_NOT_FOCUSSED, 272 }; 273 274 struct msm_sensor_power_setting { 275 enum msm_sensor_power_seq_type_t seq_type; 276 uint16_t seq_val; 277 long config_val; 278 uint16_t delay; 279 void *data[10]; 280 }; 281 282 struct msm_sensor_power_setting_array { 283 struct msm_sensor_power_setting *power_setting; 284 uint16_t size; 285 struct msm_sensor_power_setting *power_down_setting; 286 uint16_t size_down; 287 }; 288 289 struct msm_sensor_id_info_t { 290 uint16_t sensor_id_reg_addr; 291 uint16_t sensor_id; 292 }; 293 294 enum msm_sensor_camera_id_t { 295 CAMERA_0, 296 CAMERA_1, 297 CAMERA_2, 298 CAMERA_3, 299 MAX_CAMERAS, 300 }; 301 302 enum cci_i2c_master_t { 303 MASTER_0, 304 MASTER_1, 305 MASTER_MAX, 306 }; 307 308 enum i2c_freq_mode_t { 309 I2C_STANDARD_MODE, 310 I2C_FAST_MODE, 311 I2C_CUSTOM_MODE, 312 I2C_MAX_MODES, 313 }; 314 315 struct msm_camera_i2c_reg_array { 316 uint16_t reg_addr; 317 uint16_t reg_data; 318 uint32_t delay; 319 }; 320 321 struct msm_camera_i2c_reg_setting { 322 struct msm_camera_i2c_reg_array *reg_setting; 323 uint16_t size; 324 enum msm_camera_i2c_reg_addr_type addr_type; 325 enum msm_camera_i2c_data_type data_type; 326 uint16_t delay; 327 }; 328 329 struct msm_camera_i2c_seq_reg_array { 330 uint16_t reg_addr; 331 uint8_t reg_data[I2C_SEQ_REG_DATA_MAX]; 332 uint16_t reg_data_size; 333 }; 334 335 struct msm_camera_i2c_seq_reg_setting { 336 struct msm_camera_i2c_seq_reg_array *reg_setting; 337 uint16_t size; 338 enum msm_camera_i2c_reg_addr_type addr_type; 339 uint16_t delay; 340 }; 341 342 struct msm_camera_i2c_array_write_config { 343 struct msm_camera_i2c_reg_setting conf_array; 344 uint16_t slave_addr; 345 }; 346 347 struct msm_camera_i2c_read_config { 348 uint16_t slave_addr; 349 uint16_t reg_addr; 350 enum msm_camera_i2c_data_type data_type; 351 uint16_t *data; 352 }; 353 354 struct msm_camera_csid_vc_cfg { 355 uint8_t cid; 356 uint8_t dt; 357 uint8_t decode_format; 358 }; 359 360 struct msm_camera_csid_lut_params { 361 uint8_t num_cid; 362 struct msm_camera_csid_vc_cfg *vc_cfg[MAX_CID]; 363 }; 364 365 struct msm_camera_csid_params { 366 uint8_t lane_cnt; 367 uint16_t lane_assign; 368 uint8_t phy_sel; 369 struct msm_camera_csid_lut_params lut_params; 370 }; 371 372 struct msm_camera_csiphy_params { 373 uint8_t lane_cnt; 374 uint8_t settle_cnt; 375 uint16_t lane_mask; 376 uint8_t combo_mode; 377 uint8_t csid_core; 378 }; 379 380 struct msm_camera_csi2_params { 381 struct msm_camera_csid_params csid_params; 382 struct msm_camera_csiphy_params csiphy_params; 383 }; 384 385 struct msm_camera_csi_lane_params { 386 uint16_t csi_lane_assign; 387 uint16_t csi_lane_mask; 388 }; 389 390 struct csi_lane_params_t { 391 uint16_t csi_lane_assign; 392 uint8_t csi_lane_mask; 393 uint8_t csi_if; 394 uint8_t csid_core[2]; 395 uint8_t csi_phy_sel; 396 }; 397 398 enum camb_position_t { 399 BACK_CAMERA_B, 400 FRONT_CAMERA_B, 401 INVALID_CAMERA_B, 402 }; 403 404 struct msm_sensor_info_t { 405 char sensor_name[MAX_SENSOR_NAME]; 406 uint32_t session_id; 407 int32_t subdev_id[SUB_MODULE_MAX]; 408 uint8_t is_mount_angle_valid; 409 uint32_t sensor_mount_angle; 410 int modes_supported; 411 enum camb_position_t position; 412 }; 413 414 struct camera_vreg_t { 415 const char *reg_name; 416 int min_voltage; 417 int max_voltage; 418 int op_mode; 419 uint32_t delay; 420 }; 421 422 enum camerab_mode_t { 423 CAMERA_MODE_2D_B = (1<<0), 424 CAMERA_MODE_3D_B = (1<<1), 425 CAMERA_MODE_INVALID = (1<<2), 426 }; 427 428 struct msm_sensor_init_params { 429 /* mask of modes supported: 2D, 3D */ 430 int modes_supported; 431 /* sensor position: front, back */ 432 enum camb_position_t position; 433 /* sensor mount angle */ 434 uint32_t sensor_mount_angle; 435 /* sensor OTP params */ 436 struct otp_info_t sensor_otp; 437 }; 438 439 struct msm_camera_sensor_slave_info { 440 char sensor_name[32]; 441 char eeprom_name[32]; 442 char actuator_name[32]; 443 char ois_name[32]; 444 enum msm_sensor_camera_id_t camera_id; 445 uint16_t slave_addr; 446 enum i2c_freq_mode_t i2c_freq_mode; 447 enum msm_camera_i2c_reg_addr_type addr_type; 448 struct msm_sensor_id_info_t sensor_id_info; 449 struct msm_sensor_power_setting_array power_setting_array; 450 uint8_t is_init_params_valid; 451 struct msm_sensor_init_params sensor_init_params; 452 uint8_t is_flash_supported; 453 }; 454 455 struct sensorb_cfg_data { 456 int cfgtype; 457 union { 458 struct msm_sensor_info_t sensor_info; 459 struct msm_sensor_init_params sensor_init_params; 460 void *setting; 461 } cfg; 462 }; 463 464 struct csid_cfg_data { 465 enum csid_cfg_type_t cfgtype; 466 union { 467 uint32_t csid_version; 468 struct msm_camera_csid_params *csid_params; 469 } cfg; 470 }; 471 472 struct csiphy_cfg_data { 473 enum csiphy_cfg_type_t cfgtype; 474 union { 475 struct msm_camera_csiphy_params *csiphy_params; 476 struct msm_camera_csi_lane_params *csi_lane_params; 477 } cfg; 478 }; 479 480 enum eeprom_cfg_type_t { 481 CFG_EEPROM_GET_INFO, 482 CFG_EEPROM_GET_CAL_DATA, 483 CFG_EEPROM_READ_CAL_DATA, 484 CFG_EEPROM_WRITE_DATA, 485 CFG_EEPROM_GET_MM_INFO, 486 }; 487 488 struct eeprom_get_t { 489 uint32_t num_bytes; 490 }; 491 492 struct eeprom_read_t { 493 uint8_t *dbuffer; 494 uint32_t num_bytes; 495 }; 496 497 struct eeprom_write_t { 498 uint8_t *dbuffer; 499 uint32_t num_bytes; 500 }; 501 502 struct eeprom_get_cmm_t { 503 uint32_t cmm_support; 504 uint32_t cmm_compression; 505 uint32_t cmm_size; 506 }; 507 508 struct msm_eeprom_cfg_data { 509 enum eeprom_cfg_type_t cfgtype; 510 uint8_t is_supported; 511 union { 512 char eeprom_name[MAX_SENSOR_NAME]; 513 struct eeprom_get_t get_data; 514 struct eeprom_read_t read_data; 515 struct eeprom_write_t write_data; 516 struct eeprom_get_cmm_t get_cmm_data; 517 } cfg; 518 }; 519 520 enum msm_sensor_cfg_type_t { 521 CFG_SET_SLAVE_INFO, 522 CFG_SLAVE_READ_I2C, 523 CFG_WRITE_I2C_ARRAY, 524 CFG_SLAVE_WRITE_I2C_ARRAY, 525 CFG_WRITE_I2C_SEQ_ARRAY, 526 CFG_POWER_UP, 527 CFG_POWER_DOWN, 528 CFG_SET_STOP_STREAM_SETTING, 529 CFG_GET_SENSOR_INFO, 530 CFG_GET_MODULE_INFO, 531 CFG_GET_SENSOR_INIT_PARAMS, 532 CFG_SET_INIT_SETTING, 533 CFG_SET_RESOLUTION, 534 CFG_SET_STOP_STREAM, 535 CFG_SET_START_STREAM, 536 CFG_SET_SATURATION, 537 CFG_SET_CONTRAST, 538 CFG_SET_SHARPNESS, 539 CFG_SET_ISO, 540 CFG_SET_EXPOSURE_COMPENSATION, 541 CFG_SET_ANTIBANDING, 542 CFG_SET_BESTSHOT_MODE, 543 CFG_SET_EFFECT, 544 CFG_SET_WHITE_BALANCE, 545 CFG_SET_AUTOFOCUS, 546 CFG_CANCEL_AUTOFOCUS, 547 CFG_SET_STREAM_TYPE, 548 }; 549 550 enum msm_actuator_cfg_type_t { 551 CFG_GET_ACTUATOR_INFO, 552 CFG_SET_ACTUATOR_INFO, 553 CFG_SET_DEFAULT_FOCUS, 554 CFG_SET_POSITION, 555 CFG_MOVE_FOCUS, 556 CFG_ACTUATOR_POWERDOWN, 557 CFG_ACTUATOR_POWERUP, 558 CFG_ACTUATOR_INIT, 559 CFG_DIRECT_I2C_WRITE, /*to support non-trivial actuators*/ 560 }; 561 562 enum msm_ois_cfg_type_t { 563 CFG_OIS_INIT, 564 CFG_GET_OIS_INFO, 565 CFG_OIS_POWERDOWN, 566 CFG_OIS_INI_SET, 567 CFG_OIS_ENABLE, 568 CFG_OIS_DISABLE, 569 CFG_OIS_SET_MOVIE_MODE, 570 CFG_OIS_SET_STILL_MODE, 571 CFG_OIS_SET_CENTERING_ON, 572 CFG_OIS_SET_PANTILT_ON, 573 CFG_OIS_POWERUP, 574 CFG_OIS_I2C_WRITE_SEQ_TABLE, 575 }; 576 577 enum msm_ois_i2c_operation { 578 MSM_OIS_WRITE = 0, 579 MSM_OIS_POLL, 580 }; 581 582 struct reg_settings_ois_t { 583 uint16_t reg_addr; 584 enum msm_camera_i2c_reg_addr_type addr_type; 585 uint32_t reg_data; 586 enum msm_camera_i2c_data_type data_type; 587 enum msm_ois_i2c_operation i2c_operation; 588 uint32_t delay; 589 }; 590 591 struct msm_ois_params_t { 592 uint16_t data_size; 593 uint16_t init_setting_size; 594 uint16_t enable_ois_setting_size; 595 uint16_t disable_ois_setting_size; 596 uint16_t movie_mode_ois_setting_size; 597 uint16_t still_mode_ois_setting_size; 598 uint16_t centering_on_ois_setting_size; 599 uint16_t centering_off_ois_setting_size; 600 uint16_t pantilt_on_ois_setting_size; 601 uint32_t i2c_addr; 602 enum msm_camera_i2c_reg_addr_type i2c_addr_type; 603 enum msm_camera_i2c_data_type i2c_data_type; 604 struct reg_settings_ois_t *init_settings; 605 struct reg_settings_ois_t *enable_ois_settings; 606 struct reg_settings_ois_t *disable_ois_settings; 607 struct reg_settings_ois_t *movie_mode_ois_settings; 608 struct reg_settings_ois_t *still_mode_ois_settings; 609 struct reg_settings_ois_t *centering_on_ois_settings; 610 struct reg_settings_ois_t *centering_off_ois_settings; 611 struct reg_settings_ois_t *pantilt_on_ois_settings; 612 }; 613 614 struct msm_ois_set_info_t { 615 struct msm_ois_params_t ois_params; 616 }; 617 618 enum actuator_type { 619 ACTUATOR_VCM, 620 ACTUATOR_PIEZO, 621 ACTUATOR_HVCM, 622 }; 623 624 enum msm_actuator_data_type { 625 MSM_ACTUATOR_BYTE_DATA = 1, 626 MSM_ACTUATOR_WORD_DATA, 627 }; 628 629 enum msm_actuator_addr_type { 630 MSM_ACTUATOR_BYTE_ADDR = 1, 631 MSM_ACTUATOR_WORD_ADDR, 632 }; 633 634 enum msm_actuator_i2c_operation { 635 MSM_ACT_WRITE = 0, 636 MSM_ACT_POLL, 637 }; 638 639 struct reg_settings_t { 640 uint16_t reg_addr; 641 enum msm_actuator_addr_type addr_type; 642 uint16_t reg_data; 643 enum msm_actuator_data_type data_type; 644 enum msm_actuator_i2c_operation i2c_operation; 645 uint32_t delay; 646 }; 647 648 struct region_params_t { 649 /* [0] = ForwardDirection Macro boundary 650 [1] = ReverseDirection Inf boundary 651 */ 652 uint16_t step_bound[2]; 653 uint16_t code_per_step; 654 }; 655 656 struct damping_params_t { 657 uint32_t damping_step; 658 uint32_t damping_delay; 659 uint32_t hw_params; 660 }; 661 662 struct msm_actuator_move_params_t { 663 int8_t dir; 664 int8_t sign_dir; 665 int16_t dest_step_pos; 666 int32_t num_steps; 667 uint16_t curr_lens_pos; 668 struct damping_params_t *ringing_params; 669 }; 670 671 struct msm_actuator_tuning_params_t { 672 int16_t initial_code; 673 uint16_t pwd_step; 674 uint16_t region_size; 675 uint32_t total_steps; 676 struct region_params_t *region_params; 677 }; 678 679 struct park_lens_data_t { 680 uint32_t damping_step; 681 uint32_t damping_delay; 682 uint32_t hw_params; 683 uint32_t max_step; 684 }; 685 686 struct msm_actuator_params_t { 687 enum actuator_type act_type; 688 uint8_t reg_tbl_size; 689 uint16_t data_size; 690 uint16_t init_setting_size; 691 uint32_t i2c_addr; 692 enum msm_actuator_addr_type i2c_addr_type; 693 enum msm_actuator_data_type i2c_data_type; 694 struct msm_actuator_reg_params_t *reg_tbl_params; 695 struct reg_settings_t *init_settings; 696 struct park_lens_data_t park_lens; 697 }; 698 699 struct msm_actuator_set_info_t { 700 struct msm_actuator_params_t actuator_params; 701 struct msm_actuator_tuning_params_t af_tuning_params; 702 }; 703 704 struct msm_actuator_get_info_t { 705 uint32_t focal_length_num; 706 uint32_t focal_length_den; 707 uint32_t f_number_num; 708 uint32_t f_number_den; 709 uint32_t f_pix_num; 710 uint32_t f_pix_den; 711 uint32_t total_f_dist_num; 712 uint32_t total_f_dist_den; 713 uint32_t hor_view_angle_num; 714 uint32_t hor_view_angle_den; 715 uint32_t ver_view_angle_num; 716 uint32_t ver_view_angle_den; 717 }; 718 719 enum af_camera_name { 720 ACTUATOR_MAIN_CAM_0, 721 ACTUATOR_MAIN_CAM_1, 722 ACTUATOR_MAIN_CAM_2, 723 ACTUATOR_MAIN_CAM_3, 724 ACTUATOR_MAIN_CAM_4, 725 ACTUATOR_MAIN_CAM_5, 726 ACTUATOR_WEB_CAM_0, 727 ACTUATOR_WEB_CAM_1, 728 ACTUATOR_WEB_CAM_2, 729 }; 730 731 struct msm_ois_cfg_data { 732 int cfgtype; 733 uint8_t is_ois_supported; 734 union { 735 uint8_t enable_centering_ois; 736 struct msm_ois_set_info_t set_info; 737 struct msm_camera_i2c_seq_reg_setting *settings; 738 } cfg; 739 }; 740 741 struct msm_actuator_set_position_t { 742 uint16_t number_of_steps; 743 uint16_t pos[MAX_NUMBER_OF_STEPS]; 744 uint16_t delay[MAX_NUMBER_OF_STEPS]; 745 }; 746 747 struct msm_actuator_i2c { 748 uint16_t addr; 749 uint16_t value; 750 uint32_t wait_time; 751 }; 752 753 #define MSM_ACTUATOR_I2C_MAX_TABLE_SIZE (8) 754 struct msm_actuator_i2c_table { 755 struct msm_actuator_i2c data[MSM_ACTUATOR_I2C_MAX_TABLE_SIZE]; 756 uint32_t size; 757 }; 758 759 struct msm_actuator_cfg_data { 760 int cfgtype; 761 uint8_t is_af_supported; 762 union { 763 struct msm_actuator_move_params_t move; 764 struct msm_actuator_set_info_t set_info; 765 struct msm_actuator_get_info_t get_info; 766 struct msm_actuator_set_position_t setpos; 767 enum af_camera_name cam_name; 768 struct msm_actuator_i2c_table i2c_table; 769 } cfg; 770 }; 771 772 enum msm_actuator_write_type { 773 MSM_ACTUATOR_WRITE_HW_DAMP, 774 MSM_ACTUATOR_WRITE_DAC, 775 }; 776 777 struct msm_actuator_reg_params_t { 778 enum msm_actuator_write_type reg_write_type; 779 uint32_t hw_mask; 780 uint16_t reg_addr; 781 uint16_t hw_shift; 782 uint16_t data_shift; 783 }; 784 785 enum msm_camera_led_config_t { 786 MSM_CAMERA_LED_OFF, 787 MSM_CAMERA_LED_LOW, 788 MSM_CAMERA_LED_HIGH, 789 MSM_CAMERA_LED_INIT, 790 MSM_CAMERA_LED_RELEASE, 791 }; 792 793 struct msm_camera_led_cfg_t { 794 enum msm_camera_led_config_t cfgtype; 795 uint32_t torch_current; 796 uint32_t flash_current[MAX_LED_TRIGGERS]; 797 uint32_t flash_duration[MAX_LED_TRIGGERS]; 798 }; 799 800 /* sensor init structures and enums */ 801 enum msm_sensor_init_cfg_type_t { 802 CFG_SINIT_PROBE, 803 CFG_SINIT_PROBE_DONE, 804 CFG_SINIT_PROBE_WAIT_DONE, 805 }; 806 807 struct sensor_init_cfg_data { 808 enum msm_sensor_init_cfg_type_t cfgtype; 809 union { 810 void *setting; 811 } cfg; 812 }; 813 814 #define VIDIOC_MSM_SENSOR_CFG \ 815 _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct sensorb_cfg_data) 816 817 #define VIDIOC_MSM_SENSOR_RELEASE \ 818 _IO('V', BASE_VIDIOC_PRIVATE + 2) 819 820 #define VIDIOC_MSM_SENSOR_GET_SUBDEV_ID \ 821 _IOWR('V', BASE_VIDIOC_PRIVATE + 3, uint32_t) 822 823 #define VIDIOC_MSM_CSIPHY_IO_CFG \ 824 _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct csiphy_cfg_data) 825 826 #define VIDIOC_MSM_CSID_IO_CFG \ 827 _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct csid_cfg_data) 828 829 #define VIDIOC_MSM_ACTUATOR_CFG \ 830 _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct msm_actuator_cfg_data) 831 832 #define VIDIOC_MSM_FLASH_LED_DATA_CFG \ 833 _IOWR('V', BASE_VIDIOC_PRIVATE + 7, struct msm_camera_led_cfg_t) 834 835 #define VIDIOC_MSM_EEPROM_CFG \ 836 _IOWR('V', BASE_VIDIOC_PRIVATE + 8, struct msm_eeprom_cfg_data) 837 838 #define VIDIOC_MSM_SENSOR_GET_AF_STATUS \ 839 _IOWR('V', BASE_VIDIOC_PRIVATE + 9, uint32_t) 840 841 #define VIDIOC_MSM_SENSOR_INIT_CFG \ 842 _IOWR('V', BASE_VIDIOC_PRIVATE + 10, struct sensor_init_cfg_data) 843 844 #define VIDIOC_MSM_OIS_CFG \ 845 _IOWR('V', BASE_VIDIOC_PRIVATE + 11, struct msm_ois_cfg_data) 846 847 #define MSM_V4L2_PIX_FMT_META v4l2_fourcc('M', 'E', 'T', 'A') /* META */ 848 849 #endif /* __LINUX_MSM_CAM_SENSOR_H */ 850