Home | History | Annotate | Download | only in media
      1 #ifndef __UAPI_LINUX_MSM_CAMSENSOR_SDK_H
      2 #define __UAPI_LINUX_MSM_CAMSENSOR_SDK_H
      3 
      4 #include <linux/videodev2.h>
      5 
      6 #define KVERSION 0x1
      7 
      8 #define MAX_POWER_CONFIG      12
      9 #define GPIO_OUT_LOW          (0 << 1)
     10 #define GPIO_OUT_HIGH         (1 << 1)
     11 #define CSI_EMBED_DATA        0x12
     12 #define CSI_RESERVED_DATA_0   0x13
     13 #define CSI_YUV422_8          0x1E
     14 #define CSI_RAW8              0x2A
     15 #define CSI_RAW10             0x2B
     16 #define CSI_RAW12             0x2C
     17 #define CSI_DECODE_6BIT         0
     18 #define CSI_DECODE_8BIT         1
     19 #define CSI_DECODE_10BIT        2
     20 #define CSI_DECODE_12BIT        3
     21 #define CSI_DECODE_DPCM_10_6_10 4
     22 #define CSI_DECODE_DPCM_10_8_10 5
     23 #define MAX_CID                 16
     24 #define I2C_SEQ_REG_DATA_MAX    1024
     25 #define I2C_REG_DATA_MAX       (8*1024)
     26 
     27 #define MSM_V4L2_PIX_FMT_META v4l2_fourcc('M', 'E', 'T', 'A') /* META */
     28 #define MSM_V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4')
     29 	/* 14  BGBG.. GRGR.. */
     30 #define MSM_V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4')
     31 	/* 14  GBGB.. RGRG.. */
     32 #define MSM_V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4')
     33 	/* 14  GRGR.. BGBG.. */
     34 #define MSM_V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4')
     35 	/* 14  RGRG.. GBGB.. */
     36 
     37 #define MAX_ACTUATOR_REG_TBL_SIZE 8
     38 #define MAX_ACTUATOR_REGION       5
     39 #define NUM_ACTUATOR_DIR          2
     40 #define MAX_ACTUATOR_SCENARIO     8
     41 #define MAX_ACT_MOD_NAME_SIZE     32
     42 #define MAX_ACT_NAME_SIZE         32
     43 #define MAX_ACTUATOR_INIT_SET     120
     44 #define MAX_I2C_REG_SET           12
     45 
     46 #define MAX_LED_TRIGGERS          3
     47 
     48 #define MSM_EEPROM_MEMORY_MAP_MAX_SIZE  80
     49 #define MSM_EEPROM_MAX_MEM_MAP_CNT      8
     50 
     51 enum msm_sensor_camera_id_t {
     52 	CAMERA_0,
     53 	CAMERA_1,
     54 	CAMERA_2,
     55 	CAMERA_3,
     56 	MAX_CAMERAS,
     57 };
     58 
     59 enum i2c_freq_mode_t {
     60 	I2C_STANDARD_MODE,
     61 	I2C_FAST_MODE,
     62 	I2C_CUSTOM_MODE,
     63 	I2C_CUSTOM1_MODE,
     64 	I2C_CUSTOM2_MODE,
     65 	I2C_FAST_PLUS_MODE,
     66 	I2C_MAX_MODES,
     67 };
     68 
     69 enum camb_position_t {
     70 	BACK_CAMERA_B,
     71 	FRONT_CAMERA_B,
     72 	AUX_CAMERA_B = 0x100,
     73 	INVALID_CAMERA_B,
     74 };
     75 
     76 enum msm_sensor_power_seq_type_t {
     77 	SENSOR_CLK,
     78 	SENSOR_GPIO,
     79 	SENSOR_VREG,
     80 	SENSOR_I2C_MUX,
     81 	SENSOR_I2C,
     82 };
     83 
     84 enum msm_camera_i2c_reg_addr_type {
     85 	MSM_CAMERA_I2C_BYTE_ADDR = 1,
     86 	MSM_CAMERA_I2C_WORD_ADDR,
     87 	MSM_CAMERA_I2C_3B_ADDR,
     88 	MSM_CAMERA_I2C_ADDR_TYPE_MAX,
     89 };
     90 
     91 enum msm_camera_i2c_data_type {
     92 	MSM_CAMERA_I2C_BYTE_DATA = 1,
     93 	MSM_CAMERA_I2C_WORD_DATA,
     94 	MSM_CAMERA_I2C_DWORD_DATA,
     95 	MSM_CAMERA_I2C_SET_BYTE_MASK,
     96 	MSM_CAMERA_I2C_UNSET_BYTE_MASK,
     97 	MSM_CAMERA_I2C_SET_WORD_MASK,
     98 	MSM_CAMERA_I2C_UNSET_WORD_MASK,
     99 	MSM_CAMERA_I2C_SET_BYTE_WRITE_MASK_DATA,
    100 	MSM_CAMERA_I2C_DATA_TYPE_MAX,
    101 };
    102 
    103 enum msm_sensor_power_seq_gpio_t {
    104 	SENSOR_GPIO_RESET,
    105 	SENSOR_GPIO_STANDBY,
    106 	SENSOR_GPIO_AF_PWDM,
    107 	SENSOR_GPIO_VIO,
    108 	SENSOR_GPIO_VANA,
    109 	SENSOR_GPIO_VDIG,
    110 	SENSOR_GPIO_VAF,
    111 	SENSOR_GPIO_FL_EN,
    112 	SENSOR_GPIO_FL_NOW,
    113 	SENSOR_GPIO_FL_RESET,
    114 	SENSOR_GPIO_CUSTOM1,
    115 	SENSOR_GPIO_CUSTOM2,
    116 	SENSOR_GPIO_MAX,
    117 };
    118 
    119 enum msm_camera_vreg_name_t {
    120 	CAM_VDIG,
    121 	CAM_VIO,
    122 	CAM_VANA,
    123 	CAM_VAF,
    124 	CAM_V_CUSTOM1,
    125 	CAM_V_CUSTOM2,
    126 	CAM_VREG_MAX,
    127 };
    128 
    129 enum msm_sensor_clk_type_t {
    130 	SENSOR_CAM_MCLK,
    131 	SENSOR_CAM_CLK,
    132 	SENSOR_CAM_CLK_MAX,
    133 };
    134 
    135 enum camerab_mode_t {
    136 	CAMERA_MODE_2D_B = (1<<0),
    137 	CAMERA_MODE_3D_B = (1<<1),
    138 	CAMERA_MODE_INVALID = (1<<2),
    139 };
    140 
    141 enum msm_actuator_data_type {
    142 	MSM_ACTUATOR_BYTE_DATA = 1,
    143 	MSM_ACTUATOR_WORD_DATA,
    144 };
    145 
    146 enum msm_actuator_addr_type {
    147 	MSM_ACTUATOR_BYTE_ADDR = 1,
    148 	MSM_ACTUATOR_WORD_ADDR,
    149 };
    150 
    151 enum msm_actuator_write_type {
    152 	MSM_ACTUATOR_WRITE_HW_DAMP,
    153 	MSM_ACTUATOR_WRITE_DAC,
    154 	MSM_ACTUATOR_WRITE,
    155 	MSM_ACTUATOR_WRITE_DIR_REG,
    156 	MSM_ACTUATOR_POLL,
    157 	MSM_ACTUATOR_READ_WRITE,
    158 };
    159 
    160 enum msm_actuator_i2c_operation {
    161 	MSM_ACT_WRITE = 0,
    162 	MSM_ACT_POLL,
    163 };
    164 
    165 enum actuator_type {
    166 	ACTUATOR_VCM,
    167 	ACTUATOR_PIEZO,
    168 	ACTUATOR_HVCM,
    169 	ACTUATOR_BIVCM,
    170 };
    171 
    172 enum msm_flash_driver_type {
    173 	FLASH_DRIVER_PMIC,
    174 	FLASH_DRIVER_I2C,
    175 	FLASH_DRIVER_GPIO,
    176 	FLASH_DRIVER_DEFAULT
    177 };
    178 
    179 enum msm_flash_cfg_type_t {
    180 	CFG_FLASH_INIT,
    181 	CFG_FLASH_RELEASE,
    182 	CFG_FLASH_OFF,
    183 	CFG_FLASH_LOW,
    184 	CFG_FLASH_HIGH,
    185 };
    186 
    187 enum msm_sensor_output_format_t {
    188 	MSM_SENSOR_BAYER,
    189 	MSM_SENSOR_YCBCR,
    190 	MSM_SENSOR_META,
    191 };
    192 
    193 struct msm_sensor_power_setting {
    194 	enum msm_sensor_power_seq_type_t seq_type;
    195 	unsigned short seq_val;
    196 	long config_val;
    197 	unsigned short delay;
    198 	void *data[10];
    199 };
    200 
    201 struct msm_sensor_power_setting_array {
    202 	struct msm_sensor_power_setting  power_setting_a[MAX_POWER_CONFIG];
    203 	struct msm_sensor_power_setting *power_setting;
    204 	unsigned short size;
    205 	struct msm_sensor_power_setting  power_down_setting_a[MAX_POWER_CONFIG];
    206 	struct msm_sensor_power_setting *power_down_setting;
    207 	unsigned short size_down;
    208 };
    209 
    210 enum msm_camera_i2c_operation {
    211 	MSM_CAM_WRITE = 0,
    212 	MSM_CAM_POLL,
    213 	MSM_CAM_READ,
    214 };
    215 
    216 struct msm_sensor_i2c_sync_params {
    217 	unsigned int cid;
    218 	int csid;
    219 	unsigned short line;
    220 	unsigned short delay;
    221 };
    222 
    223 struct msm_camera_reg_settings_t {
    224 	uint16_t reg_addr;
    225 	enum msm_camera_i2c_reg_addr_type addr_type;
    226 	uint16_t reg_data;
    227 	enum msm_camera_i2c_data_type data_type;
    228 	enum msm_camera_i2c_operation i2c_operation;
    229 	uint16_t delay;
    230 };
    231 
    232 struct msm_eeprom_mem_map_t {
    233 	int slave_addr;
    234 	struct msm_camera_reg_settings_t
    235 		mem_settings[MSM_EEPROM_MEMORY_MAP_MAX_SIZE];
    236 	int memory_map_size;
    237 };
    238 
    239 struct msm_eeprom_memory_map_array {
    240 	struct msm_eeprom_mem_map_t memory_map[MSM_EEPROM_MAX_MEM_MAP_CNT];
    241 	uint32_t msm_size_of_max_mappings;
    242 };
    243 
    244 struct msm_sensor_init_params {
    245 	/* mask of modes supported: 2D, 3D */
    246 	int                 modes_supported;
    247 	/* sensor position: front, back */
    248 	enum camb_position_t position;
    249 	/* sensor mount angle */
    250 	unsigned int            sensor_mount_angle;
    251 };
    252 
    253 struct msm_sensor_id_info_t {
    254 	unsigned short sensor_id_reg_addr;
    255 	unsigned short sensor_id;
    256 	unsigned short sensor_id_mask;
    257 };
    258 
    259 struct msm_camera_sensor_slave_info {
    260 	char sensor_name[32];
    261 	char eeprom_name[32];
    262 	char actuator_name[32];
    263 	char ois_name[32];
    264 	char flash_name[32];
    265 	enum msm_sensor_camera_id_t camera_id;
    266 	unsigned short slave_addr;
    267 	enum i2c_freq_mode_t i2c_freq_mode;
    268 	enum msm_camera_i2c_reg_addr_type addr_type;
    269 	struct msm_sensor_id_info_t sensor_id_info;
    270 	struct msm_sensor_power_setting_array power_setting_array;
    271 	unsigned char  is_init_params_valid;
    272 	struct msm_sensor_init_params sensor_init_params;
    273 	enum msm_sensor_output_format_t output_format;
    274 };
    275 
    276 struct msm_camera_i2c_reg_array {
    277 	unsigned short reg_addr;
    278 	unsigned short reg_data;
    279 	unsigned int delay;
    280 };
    281 
    282 struct msm_camera_i2c_reg_setting {
    283 	struct msm_camera_i2c_reg_array *reg_setting;
    284 	unsigned short size;
    285 	enum msm_camera_i2c_reg_addr_type addr_type;
    286 	enum msm_camera_i2c_data_type data_type;
    287 	unsigned short delay;
    288 };
    289 
    290 struct msm_camera_csid_vc_cfg {
    291 	unsigned char cid;
    292 	unsigned char dt;
    293 	unsigned char decode_format;
    294 };
    295 
    296 struct msm_camera_csid_lut_params {
    297 	unsigned char num_cid;
    298 	struct msm_camera_csid_vc_cfg vc_cfg_a[MAX_CID];
    299 	struct msm_camera_csid_vc_cfg *vc_cfg[MAX_CID];
    300 };
    301 
    302 struct msm_camera_csid_params {
    303 	unsigned char lane_cnt;
    304 	unsigned short lane_assign;
    305 	unsigned char phy_sel;
    306 	unsigned int csi_clk;
    307 	struct msm_camera_csid_lut_params lut_params;
    308 	unsigned char csi_3p_sel;
    309 };
    310 
    311 struct msm_camera_csid_testmode_parms {
    312 	unsigned int num_bytes_per_line;
    313 	unsigned int num_lines;
    314 	unsigned int h_blanking_count;
    315 	unsigned int v_blanking_count;
    316 	unsigned int payload_mode;
    317 };
    318 
    319 struct msm_camera_csiphy_params {
    320 	unsigned char lane_cnt;
    321 	unsigned char settle_cnt;
    322 	unsigned short lane_mask;
    323 	unsigned char combo_mode;
    324 	unsigned char csid_core;
    325 	unsigned int csiphy_clk;
    326 	unsigned char csi_3phase;
    327 };
    328 
    329 struct msm_camera_i2c_seq_reg_array {
    330 	unsigned short reg_addr;
    331 	unsigned char reg_data[I2C_SEQ_REG_DATA_MAX];
    332 	unsigned short reg_data_size;
    333 };
    334 
    335 struct msm_camera_i2c_seq_reg_setting {
    336 	struct msm_camera_i2c_seq_reg_array *reg_setting;
    337 	unsigned short size;
    338 	enum msm_camera_i2c_reg_addr_type addr_type;
    339 	unsigned short delay;
    340 };
    341 
    342 struct msm_actuator_reg_params_t {
    343 	enum msm_actuator_write_type reg_write_type;
    344 	unsigned int hw_mask;
    345 	unsigned short reg_addr;
    346 	unsigned short hw_shift;
    347 	unsigned short data_shift;
    348 	unsigned short data_type;
    349 	unsigned short addr_type;
    350 	unsigned short reg_data;
    351 	unsigned short delay;
    352 };
    353 
    354 
    355 struct damping_params_t {
    356 	unsigned int damping_step;
    357 	unsigned int damping_delay;
    358 	unsigned int hw_params;
    359 };
    360 
    361 struct region_params_t {
    362 	/* [0] = ForwardDirection Macro boundary
    363 	   [1] = ReverseDirection Inf boundary
    364 	*/
    365 	unsigned short step_bound[2];
    366 	unsigned short code_per_step;
    367 	/* qvalue for converting float type numbers to integer format */
    368 	unsigned int qvalue;
    369 };
    370 
    371 struct reg_settings_t {
    372 	unsigned short reg_addr;
    373 	enum msm_camera_i2c_reg_addr_type addr_type;
    374 	unsigned short reg_data;
    375 	enum msm_camera_i2c_data_type data_type;
    376 	enum msm_actuator_i2c_operation i2c_operation;
    377 	unsigned int delay;
    378 };
    379 
    380 struct msm_camera_i2c_reg_setting_array {
    381 	struct msm_camera_i2c_reg_array reg_setting_a[MAX_I2C_REG_SET];
    382 	unsigned short size;
    383 	enum msm_camera_i2c_reg_addr_type addr_type;
    384 	enum msm_camera_i2c_data_type data_type;
    385 	unsigned short delay;
    386 };
    387 
    388 #endif
    389