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