blob: ac370bae1848df728426d0774bb67698cd5cc877 [file] [log] [blame]
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -08001#ifndef __UAPI_CAM_SENSOR_H__
2#define __UAPI_CAM_SENSOR_H__
3
4#include <linux/types.h>
5#include <linux/ioctl.h>
6#include <media/cam_defs.h>
7
8#define CAM_SENSOR_PROBE_CMD (CAM_COMMON_OPCODE_MAX + 1)
Jigarkumar Zala35226272017-04-19 16:05:24 -07009#define CAM_FLASH_MAX_LED_TRIGGERS 3
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -080010/**
11 * struct cam_sensor_query_cap - capabilities info for sensor
12 *
13 * @slot_info : Indicates about the slotId or cell Index
14 * @secure_camera : Camera is in secure/Non-secure mode
15 * @pos_pitch : Sensor position pitch
16 * @pos_roll : Sensor position roll
17 * @pos_yaw : Sensor position yaw
18 * @actuator_slot_id : Actuator slot id which connected to sensor
19 * @eeprom_slot_id : EEPROM slot id which connected to sensor
20 * @ois_slot_id : OIS slot id which connected to sensor
21 * @flash_slot_id : Flash slot id which connected to sensor
22 * @csiphy_slot_id : CSIphy slot id which connected to sensor
23 *
24 */
25struct cam_sensor_query_cap {
26 uint32_t slot_info;
27 uint32_t secure_camera;
28 uint32_t pos_pitch;
29 uint32_t pos_roll;
30 uint32_t pos_yaw;
31 uint32_t actuator_slot_id;
32 uint32_t eeprom_slot_id;
33 uint32_t ois_slot_id;
34 uint32_t flash_slot_id;
35 uint32_t csiphy_slot_id;
36} __attribute__((packed));
37
38/**
39 * struct cam_csiphy_query_cap - capabilities info for csiphy
40 *
41 * @slot_info : Indicates about the slotId or cell Index
42 * @version : CSIphy version
43 * @clk lane : Of the 5 lanes, informs lane configured
44 * as clock lane
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -070045 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -080046 */
47struct cam_csiphy_query_cap {
48 uint32_t slot_info;
49 uint32_t version;
50 uint32_t clk_lane;
51 uint32_t reserved;
52} __attribute__((packed));
53
54/**
55 * struct cam_actuator_query_cap - capabilities info for actuator
56 *
57 * @slot_info : Indicates about the slotId or cell Index
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -070058 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -080059 */
60struct cam_actuator_query_cap {
61 uint32_t slot_info;
62 uint32_t reserved;
63} __attribute__((packed));
64
65/**
Vivek Veenam2ad8de12017-04-04 18:56:22 +053066 * struct cam_eeprom_query_cap_t - capabilities info for eeprom
67 *
68 * @slot_info : Indicates about the slotId or cell Index
69 * @eeprom_kernel_probe : Indicates about the kernel or userspace probe
70 */
71struct cam_eeprom_query_cap_t {
72 uint32_t slot_info;
73 uint16_t eeprom_kernel_probe;
74 uint16_t reserved;
75} __attribute__((packed));
76
77/**
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -080078 * struct cam_cmd_i2c_info - Contains slave I2C related info
79 *
80 * @slave_addr : Slave address
81 * @i2c_freq_mode : 4 bits are used for I2c freq mode
82 * @cmd_type : Explains type of command
83 */
84struct cam_cmd_i2c_info {
85 uint16_t slave_addr;
86 uint8_t i2c_freq_mode;
87 uint8_t cmd_type;
88} __attribute__((packed));
89
90/**
91 * struct cam_cmd_probe - Contains sensor slave info
92 *
93 * @data_type : Slave register data type
94 * @addr_type : Slave register address type
95 * @op_code : Don't Care
96 * @cmd_type : Explains type of command
97 * @reg_addr : Slave register address
98 * @expected_data : Data expected at slave register address
99 * @data_mask : Data mask if only few bits are valid
100 * @camera_id : Indicates the slot to which camera
101 * needs to be probed
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700102 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800103 */
104struct cam_cmd_probe {
105 uint8_t data_type;
106 uint8_t addr_type;
107 uint8_t op_code;
108 uint8_t cmd_type;
109 uint32_t reg_addr;
110 uint32_t expected_data;
111 uint32_t data_mask;
112 uint16_t camera_id;
113 uint16_t reserved;
114} __attribute__((packed));
115
116/**
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700117 * struct cam_power_settings - Contains sensor power setting info
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800118 *
119 * @power_seq_type : Type of power sequence
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700120 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800121 * @config_val_low : Lower 32 bit value configuration value
122 * @config_val_high : Higher 32 bit value configuration value
123 *
124 */
125struct cam_power_settings {
126 uint16_t power_seq_type;
127 uint16_t reserved;
128 uint32_t config_val_low;
129 uint32_t config_val_high;
130} __attribute__((packed));
131
132/**
133 * struct cam_cmd_power - Explains about the power settings
134 *
135 * @count : Number of power settings follows
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700136 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800137 * @cmd_type : Explains type of command
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700138 * @power_settings : Contains power setting info
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800139 */
140struct cam_cmd_power {
141 uint16_t count;
142 uint8_t reserved;
143 uint8_t cmd_type;
144 struct cam_power_settings power_settings[1];
145} __attribute__((packed));
146
147/**
148 * struct i2c_rdwr_header - header of READ/WRITE I2C command
149 *
150 * @ count : Number of registers / data / reg-data pairs
151 * @ op_code : Operation code
152 * @ cmd_type : Command buffer type
153 * @ data_type : I2C data type
154 * @ addr_type : I2C address type
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700155 * @ reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800156 */
157struct i2c_rdwr_header {
158 uint16_t count;
159 uint8_t op_code;
160 uint8_t cmd_type;
161 uint8_t data_type;
162 uint8_t addr_type;
163 uint16_t reserved;
164} __attribute__((packed));
165
166/**
167 * struct i2c_random_wr_payload - payload for I2C random write
168 *
169 * @ reg_addr : Register address
170 * @ reg_data : Register data
171 *
172 */
173struct i2c_random_wr_payload {
174 uint32_t reg_addr;
175 uint32_t reg_data;
176} __attribute__((packed));
177
178/**
179 * struct cam_cmd_i2c_random_wr - I2C random write command
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700180 * @ header : header of READ/WRITE I2C command
181 * @ random_wr_payload : payload for I2C random write
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800182 */
183struct cam_cmd_i2c_random_wr {
184 struct i2c_rdwr_header header;
185 struct i2c_random_wr_payload random_wr_payload[1];
186} __attribute__((packed));
187
188/**
189 * struct cam_cmd_read - I2C read command
190 * @ reg_data : Register data
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700191 * @ reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800192 */
193struct cam_cmd_read {
194 uint32_t reg_data;
195 uint32_t reserved;
196} __attribute__((packed));
197
198/**
199 * struct cam_cmd_i2c_continuous_wr - I2C continuous write command
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700200 * @ header : header of READ/WRITE I2C command
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800201 * @ reg_addr : Register address
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700202 * @ data_read : I2C read command
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800203 */
204struct cam_cmd_i2c_continuous_wr {
205 struct i2c_rdwr_header header;
206 uint32_t reg_addr;
207 struct cam_cmd_read data_read[1];
208} __attribute__((packed));
209
210/**
211 * struct cam_cmd_i2c_random_rd - I2C random read command
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700212 * @ header : header of READ/WRITE I2C command
213 * @ data_read : I2C read command
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800214 */
215struct cam_cmd_i2c_random_rd {
216 struct i2c_rdwr_header header;
217 struct cam_cmd_read data_read[1];
218} __attribute__((packed));
219
220/**
221 * struct cam_cmd_i2c_continuous_rd - I2C continuous continuous read command
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700222 * @ header : header of READ/WRITE I2C command
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800223 * @ reg_addr : Register address
224 *
225 */
226struct cam_cmd_i2c_continuous_rd {
227 struct i2c_rdwr_header header;
228 uint32_t reg_addr;
229} __attribute__((packed));
230
231/**
232 * struct cam_cmd_conditional_wait - Conditional wait command
233 * @data_type : Data type
234 * @addr_type : Address type
235 * @op_code : Opcode
236 * @cmd_type : Explains type of command
237 * @timeout : Timeout for retries
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700238 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800239 * @reg_addr : Register Address
240 * @reg_data : Register data
241 * @data_mask : Data mask if only few bits are valid
242 * @camera_id : Indicates the slot to which camera
243 * needs to be probed
244 *
245 */
246struct cam_cmd_conditional_wait {
247 uint8_t data_type;
248 uint8_t addr_type;
249 uint8_t op_code;
250 uint8_t cmd_type;
251 uint16_t timeout;
252 uint16_t reserved;
253 uint32_t reg_addr;
254 uint32_t reg_data;
255 uint32_t data_mask;
256} __attribute__((packed));
257
258/**
259 * struct cam_cmd_unconditional_wait - Un-conditional wait command
260 * @delay : Delay
261 * @op_code : Opcode
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700262 * @cmd_type : Explains type of command
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800263 */
264struct cam_cmd_unconditional_wait {
265 int16_t delay;
266 uint8_t op_code;
267 uint8_t cmd_type;
268} __attribute__((packed));
269
270/**
271 * cam_csiphy_info: Provides cmdbuffer structre
272 * @lane_mask : Lane mask details
273 * @lane_assign : Lane sensor will be using
274 * @csiphy_3phase : Total number of lanes
275 * @combo_mode : Info regarding combo_mode is enable / disable
276 * @lane_cnt : Total number of lanes
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700277 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800278 * @3phase : Details whether 3Phase / 2Phase operation
279 * @settle_time : Settling time in ms
280 * @data_rate : Data rate
281 *
282 */
283struct cam_csiphy_info {
284 uint16_t lane_mask;
285 uint16_t lane_assign;
286 uint8_t csiphy_3phase;
287 uint8_t combo_mode;
288 uint8_t lane_cnt;
289 uint8_t reserved;
290 uint64_t settle_time;
291 uint64_t data_rate;
292} __attribute__((packed));
293
294/**
295 * cam_csiphy_acquire_dev_info : Information needed for
296 * csiphy at the time of acquire
297 * @combo_mode : Indicates the device mode of operation
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700298 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800299 *
300 */
301struct cam_csiphy_acquire_dev_info {
302 uint32_t combo_mode;
303 uint32_t reserved;
304} __attribute__((packed));
305
306/**
307 * cam_sensor_acquire_dev : Updates sensor acuire cmd
308 * @device_handle : Updates device handle
309 * @session_handle : Session handle for acquiring device
310 * @handle_type : Resource handle type
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700311 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800312 * @info_handle : Handle to additional info
313 * needed for sensor sub modules
314 *
315 */
316struct cam_sensor_acquire_dev {
317 uint32_t session_handle;
318 uint32_t device_handle;
319 uint32_t handle_type;
320 uint32_t reserved;
321 uint64_t info_handle;
322} __attribute__((packed));
323
324/**
325 * cam_sensor_streamon_dev : StreamOn command for the sensor
326 * @session_handle : Session handle for acquiring device
327 * @device_handle : Updates device handle
328 * @handle_type : Resource handle type
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700329 * @reserved
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800330 * @info_handle : Information Needed at the time of streamOn
331 *
332 */
333struct cam_sensor_streamon_dev {
334 uint32_t session_handle;
335 uint32_t device_handle;
336 uint32_t handle_type;
337 uint32_t reserved;
338 uint64_t info_handle;
339} __attribute__((packed));
340
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700341/**
342 * struct cam_flash_init : Init command for the flash
343 * @flash_type : flash hw type
344 * @reserved
345 * @cmd_type : command buffer type
346 */
347struct cam_flash_init {
348 uint8_t flash_type;
349 uint16_t reserved;
350 uint8_t cmd_type;
351} __attribute__((packed));
352
353/**
354 * struct cam_flash_set_rer : RedEyeReduction command buffer
355 *
356 * @count : Number of flash leds
357 * @opcode : Command buffer opcode
358 * CAM_FLASH_FIRE_RER
359 * @cmd_type : command buffer operation type
360 * @num_iteration : Number of led turn on/off sequence
361 * @reserved
362 * @led_on_delay_ms : flash led turn on time in ms
363 * @led_off_delay_ms : flash led turn off time in ms
364 * @led_current_ma : flash led current in ma
365 *
366 */
367struct cam_flash_set_rer {
368 uint16_t count;
369 uint8_t opcode;
370 uint8_t cmd_type;
371 uint16_t num_iteration;
372 uint16_t reserved;
373 uint32_t led_on_delay_ms;
374 uint32_t led_off_delay_ms;
Jigarkumar Zala35226272017-04-19 16:05:24 -0700375 uint32_t led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS];
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700376} __attribute__((packed));
377
378/**
379 * struct cam_flash_set_on_off : led turn on/off command buffer
380 *
381 * @count : Number of Flash leds
382 * @opcode : command buffer opcodes
383 * CAM_FLASH_FIRE_LOW
384 * CAM_FLASH_FIRE_HIGH
385 * CAM_FLASH_OFF
386 * @cmd_type : command buffer operation type
387 * @led_current_ma : flash led current in ma
388 *
389 */
390struct cam_flash_set_on_off {
391 uint16_t count;
392 uint8_t opcode;
393 uint8_t cmd_type;
Jigarkumar Zala35226272017-04-19 16:05:24 -0700394 uint32_t led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS];
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700395} __attribute__((packed));
396
397/**
398 * struct cam_flash_query_curr : query current command buffer
399 *
400 * @reserved
401 * @opcode : command buffer opcode
402 * @cmd_type : command buffer operation type
403 * @query_current_ma : battery current in ma
404 *
405 */
406struct cam_flash_query_curr {
407 uint16_t reserved;
408 uint8_t opcode;
409 uint8_t cmd_type;
410 uint32_t query_current_ma;
411} __attribute__ ((packed));
412
413/**
414 * struct cam_flash_query_cap : capabilities info for flash
415 *
416 * @slot_info : Indicates about the slotId or cell Index
417 * @max_current_flash : max supported current for flash
418 * @max_duration_flash : max flash turn on duration
419 * @max_current_torch : max supported current for torch
420 *
421 */
422struct cam_flash_query_cap_info {
423 uint32_t slot_info;
Jigarkumar Zala35226272017-04-19 16:05:24 -0700424 uint32_t max_current_flash[CAM_FLASH_MAX_LED_TRIGGERS];
425 uint32_t max_duration_flash[CAM_FLASH_MAX_LED_TRIGGERS];
426 uint32_t max_current_torch[CAM_FLASH_MAX_LED_TRIGGERS];
Jigarkumar Zalaa98014d2017-04-20 15:03:39 -0700427} __attribute__ ((packed));
428
Viswanadha Raju Thotakura29a2c772017-02-28 13:11:19 -0800429#endif