cam_sensor.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __UAPI_CAM_SENSOR_H__
  7. #define __UAPI_CAM_SENSOR_H__
  8. #include <linux/types.h>
  9. #include <linux/ioctl.h>
  10. #include <media/cam_defs.h>
  11. #define CAM_SENSOR_PROBE_CMD (CAM_COMMON_OPCODE_MAX + 1)
  12. #define CAM_FLASH_MAX_LED_TRIGGERS 2
  13. #define MAX_OIS_NAME_SIZE 32
  14. #define CAM_CSIPHY_SECURE_MODE_ENABLED 1
  15. #define CAM_SENSOR_NAME_MAX_SIZE 32
  16. #define SKEW_CAL_MASK BIT(1)
  17. #define PREAMBLE_PATTEN_CAL_MASK BIT(2)
  18. enum camera_sensor_cmd_type {
  19. CAMERA_SENSOR_CMD_TYPE_INVALID,
  20. CAMERA_SENSOR_CMD_TYPE_PROBE,
  21. CAMERA_SENSOR_CMD_TYPE_PWR_UP,
  22. CAMERA_SENSOR_CMD_TYPE_PWR_DOWN,
  23. CAMERA_SENSOR_CMD_TYPE_I2C_INFO,
  24. CAMERA_SENSOR_CMD_TYPE_I2C_RNDM_WR,
  25. CAMERA_SENSOR_CMD_TYPE_I2C_RNDM_RD,
  26. CAMERA_SENSOR_CMD_TYPE_I2C_CONT_WR,
  27. CAMERA_SENSOR_CMD_TYPE_I2C_CONT_RD,
  28. CAMERA_SENSOR_CMD_TYPE_WAIT,
  29. CAMERA_SENSOR_FLASH_CMD_TYPE_INIT_INFO,
  30. CAMERA_SENSOR_FLASH_CMD_TYPE_FIRE,
  31. CAMERA_SENSOR_FLASH_CMD_TYPE_RER,
  32. CAMERA_SENSOR_FLASH_CMD_TYPE_QUERYCURR,
  33. CAMERA_SENSOR_FLASH_CMD_TYPE_WIDGET,
  34. CAMERA_SENSOR_CMD_TYPE_RD_DATA,
  35. CAMERA_SENSOR_FLASH_CMD_TYPE_INIT_FIRE,
  36. CAMERA_SENSOR_CMD_TYPE_MAX,
  37. };
  38. enum cam_actuator_packet_opcodes {
  39. CAM_ACTUATOR_PACKET_OPCODE_INIT,
  40. CAM_ACTUATOR_PACKET_AUTO_MOVE_LENS,
  41. CAM_ACTUATOR_PACKET_MANUAL_MOVE_LENS,
  42. CAM_ACTUATOR_PACKET_OPCODE_READ
  43. };
  44. enum cam_eeprom_packet_opcodes {
  45. CAM_EEPROM_PACKET_OPCODE_INIT,
  46. CAM_EEPROM_WRITE
  47. };
  48. enum cam_ois_packet_opcodes {
  49. CAM_OIS_PACKET_OPCODE_INIT,
  50. CAM_OIS_PACKET_OPCODE_OIS_CONTROL,
  51. CAM_OIS_PACKET_OPCODE_READ,
  52. CAM_OIS_PACKET_OPCODE_WRITE_TIME
  53. };
  54. enum camera_sensor_i2c_op_code {
  55. CAMERA_SENSOR_I2C_OP_INVALID,
  56. CAMERA_SENSOR_I2C_OP_RNDM_WR,
  57. CAMERA_SENSOR_I2C_OP_RNDM_WR_VERF,
  58. CAMERA_SENSOR_I2C_OP_CONT_WR_BRST,
  59. CAMERA_SENSOR_I2C_OP_CONT_WR_BRST_VERF,
  60. CAMERA_SENSOR_I2C_OP_CONT_WR_SEQN,
  61. CAMERA_SENSOR_I2C_OP_CONT_WR_SEQN_VERF,
  62. CAMERA_SENSOR_I2C_OP_MAX,
  63. };
  64. enum camera_sensor_wait_op_code {
  65. CAMERA_SENSOR_WAIT_OP_INVALID,
  66. CAMERA_SENSOR_WAIT_OP_COND,
  67. CAMERA_SENSOR_WAIT_OP_HW_UCND,
  68. CAMERA_SENSOR_WAIT_OP_SW_UCND,
  69. CAMERA_SENSOR_WAIT_OP_MAX,
  70. };
  71. enum cam_tpg_packet_opcodes {
  72. CAM_TPG_PACKET_OPCODE_INVALID = 0,
  73. CAM_TPG_PACKET_OPCODE_INITIAL_CONFIG,
  74. CAM_TPG_PACKET_OPCODE_NOP,
  75. CAM_TPG_PACKET_OPCODE_MAX,
  76. };
  77. enum cam_sensor_packet_opcodes {
  78. CAM_SENSOR_PACKET_OPCODE_SENSOR_STREAMON,
  79. CAM_SENSOR_PACKET_OPCODE_SENSOR_UPDATE,
  80. CAM_SENSOR_PACKET_OPCODE_SENSOR_INITIAL_CONFIG,
  81. CAM_SENSOR_PACKET_OPCODE_SENSOR_PROBE,
  82. CAM_SENSOR_PACKET_OPCODE_SENSOR_CONFIG,
  83. CAM_SENSOR_PACKET_OPCODE_SENSOR_STREAMOFF,
  84. CAM_SENSOR_PACKET_OPCODE_SENSOR_READ,
  85. CAM_SENSOR_PACKET_OPCODE_SENSOR_FRAME_SKIP_UPDATE,
  86. CAM_SENSOR_PACKET_OPCODE_SENSOR_PROBE_V2,
  87. CAM_SENSOR_PACKET_OPCODE_SENSOR_NOP = 127
  88. };
  89. enum tpg_command_type_t {
  90. TPG_CMD_TYPE_INVALID = 0,
  91. TPG_CMD_TYPE_GLOBAL_CONFIG,
  92. TPG_CMD_TYPE_STREAM_CONFIG,
  93. TPG_CMD_TYPE_ILLUMINATION_CONFIG,
  94. TPG_CMD_TYPE_MAX,
  95. };
  96. enum tpg_pattern_t {
  97. TPG_PATTERN_INVALID = 0,
  98. TPG_PATTERN_REAL_IMAGE,
  99. TPG_PATTERN_RANDOM_PIXL,
  100. TPG_PATTERN_RANDOM_INCREMENTING_PIXEL,
  101. TPG_PATTERN_COLOR_BAR,
  102. TPG_PATTERN_ALTERNATING_55_AA,
  103. TPG_PATTERN_ALTERNATING_USER_DEFINED,
  104. TPG_PATTERN_MAX,
  105. };
  106. enum tpg_color_bar_mode_t {
  107. TPG_COLOR_BAR_MODE_INVALID = 0,
  108. TPG_COLOR_BAR_MODE_NORMAL,
  109. TPG_COLOR_BAR_MODE_SPLIT,
  110. TPG_COLOR_BAR_MODE_ROTATING,
  111. TPG_COLOR_BAR_MODE_MAX,
  112. };
  113. enum tpg_image_format_t {
  114. TPG_IMAGE_FORMAT_INVALID = 0,
  115. TPG_IMAGE_FORMAT_BAYER,
  116. TPG_IMAGE_FORMAT_QCFA,
  117. TPG_IMAGE_FORMAT_YUV,
  118. TPG_IMAGE_FORMAT_JPEG,
  119. TPG_IMAGE_FORMAT_MAX,
  120. };
  121. enum tpg_phy_type_t {
  122. TPG_PHY_TYPE_INVALID = 0,
  123. TPG_PHY_TYPE_DPHY,
  124. TPG_PHY_TYPE_CPHY,
  125. TPG_PHY_TYPE_MAX,
  126. };
  127. enum tpg_interleaving_format_t {
  128. TPG_INTERLEAVING_FORMAT_INVALID = 0,
  129. TPG_INTERLEAVING_FORMAT_FRAME,
  130. TPG_INTERLEAVING_FORMAT_LINE,
  131. TPG_INTERLEAVING_FORMAT_SHDR,
  132. TPG_INTERLEAVING_FORMAT_SPARSE_PD,
  133. TPG_INTERLEAVING_FORMAT_MAX,
  134. };
  135. enum tpg_shutter_t {
  136. TPG_SHUTTER_TYPE_INVALID = 0,
  137. TPG_SHUTTER_TYPE_ROLLING,
  138. TPG_SHUTTER_TYPE_GLOBAL,
  139. TPG_SHUTTER_TYPE_MAX,
  140. };
  141. enum tpg_stream_t {
  142. TPG_STREAM_TYPE_INVALID = 0,
  143. TPG_STREAM_TYPE_IMAGE,
  144. TPG_STREAM_TYPE_PDAF,
  145. TPG_STREAM_TYPE_META,
  146. TPG_STREAM_TYPE_MAX,
  147. };
  148. enum tpg_cfa_arrangement_t {
  149. TPG_CFA_ARRANGEMENT_TYPE_INVALID = 0,
  150. TPG_CFA_ARRANGEMENT_TYPE_MAX,
  151. };
  152. /**
  153. * struct cam_sensor_query_cap - capabilities info for sensor
  154. *
  155. * @slot_info : Indicates about the slotId or cell Index
  156. * @secure_camera : Camera is in secure/Non-secure mode
  157. * @pos_pitch : Sensor position pitch
  158. * @pos_roll : Sensor position roll
  159. * @pos_yaw : Sensor position yaw
  160. * @actuator_slot_id : Actuator slot id which connected to sensor
  161. * @eeprom_slot_id : EEPROM slot id which connected to sensor
  162. * @ois_slot_id : OIS slot id which connected to sensor
  163. * @flash_slot_id : Flash slot id which connected to sensor
  164. * @csiphy_slot_id : CSIphy slot id which connected to sensor
  165. *
  166. */
  167. struct cam_sensor_query_cap {
  168. __u32 slot_info;
  169. __u32 secure_camera;
  170. __u32 pos_pitch;
  171. __u32 pos_roll;
  172. __u32 pos_yaw;
  173. __u32 actuator_slot_id;
  174. __u32 eeprom_slot_id;
  175. __u32 ois_slot_id;
  176. __u32 flash_slot_id;
  177. __u32 csiphy_slot_id;
  178. } __attribute__((packed));
  179. /**
  180. * struct cam_csiphy_query_cap - capabilities info for csiphy
  181. *
  182. * @slot_info : Indicates about the slotId or cell Index
  183. * @version : CSIphy version
  184. * @clk lane : Of the 5 lanes, informs lane configured
  185. * as clock lane
  186. * @reserved
  187. */
  188. struct cam_csiphy_query_cap {
  189. __u32 slot_info;
  190. __u32 version;
  191. __u32 clk_lane;
  192. __u32 reserved;
  193. } __attribute__((packed));
  194. /**
  195. * struct cam_actuator_query_cap - capabilities info for actuator
  196. *
  197. * @slot_info : Indicates about the slotId or cell Index
  198. * @reserved
  199. */
  200. struct cam_actuator_query_cap {
  201. __u32 slot_info;
  202. __u32 reserved;
  203. } __attribute__((packed));
  204. /**
  205. * struct cam_eeprom_query_cap_t - capabilities info for eeprom
  206. *
  207. * @slot_info : Indicates about the slotId or cell Index
  208. * @eeprom_kernel_probe : Indicates about the kernel or userspace probe
  209. */
  210. struct cam_eeprom_query_cap_t {
  211. __u32 slot_info;
  212. __u16 eeprom_kernel_probe;
  213. __u16 is_multimodule_mode;
  214. } __attribute__((packed));
  215. /**
  216. * struct cam_ois_query_cap_t - capabilities info for ois
  217. *
  218. * @slot_info : Indicates about the slotId or cell Index
  219. */
  220. struct cam_ois_query_cap_t {
  221. __u32 slot_info;
  222. __u16 reserved;
  223. } __attribute__((packed));
  224. /**
  225. * struct cam_tpg_query_cap - capabilities info for tpg
  226. *
  227. * @slot_info : Indicates about the slotId or cell Index
  228. * @version : TPG version , in msb
  229. * @reserved : Reserved for future Use
  230. * @secure_camera : Camera is in secure/Non-secure mode
  231. * @csiphy_slot_id : CSIphy slot id which connected to sensor
  232. */
  233. struct cam_tpg_query_cap {
  234. __u32 slot_info;
  235. __u32 version;
  236. __u32 secure_camera;
  237. __u32 csiphy_slot_id;
  238. __u32 reserved[2];
  239. } __attribute__((packed));
  240. /**
  241. * struct cam_cmd_i2c_info - Contains slave I2C related info
  242. *
  243. * @slave_addr : Slave address
  244. * @i2c_freq_mode : 4 bits are used for I2c freq mode
  245. * @cmd_type : Explains type of command
  246. */
  247. struct cam_cmd_i2c_info {
  248. __u32 slave_addr;
  249. __u8 i2c_freq_mode;
  250. __u8 cmd_type;
  251. __u16 reserved;
  252. } __attribute__((packed));
  253. /**
  254. * struct cam_ois_opcode - Contains OIS opcode
  255. *
  256. * @prog : OIS FW prog register address
  257. * @coeff : OIS FW coeff register address
  258. * @pheripheral : OIS pheripheral
  259. * @memory : OIS memory
  260. */
  261. struct cam_ois_opcode {
  262. __u32 prog;
  263. __u32 coeff;
  264. __u32 pheripheral;
  265. __u32 memory;
  266. } __attribute__((packed));
  267. /**
  268. * struct cam_cmd_ois_info - Contains OIS slave info
  269. *
  270. * @slave_addr : OIS i2c slave address
  271. * @i2c_freq_mode : i2c frequency mode
  272. * @cmd_type : Explains type of command
  273. * @ois_fw_flag : indicates if fw is present or not
  274. * @is_ois_calib : indicates the calibration data is available
  275. * @ois_name : OIS name
  276. * @opcode : opcode
  277. */
  278. struct cam_cmd_ois_info {
  279. __u32 slave_addr;
  280. __u8 i2c_freq_mode;
  281. __u8 cmd_type;
  282. __u8 ois_fw_flag;
  283. __u8 is_ois_calib;
  284. char ois_name[MAX_OIS_NAME_SIZE];
  285. struct cam_ois_opcode opcode;
  286. } __attribute__((packed));
  287. /**
  288. * struct cam_cmd_probe - Contains sensor slave info
  289. *
  290. * @data_type : Slave register data type
  291. * @addr_type : Slave register address type
  292. * @op_code : Don't Care
  293. * @cmd_type : Explains type of command
  294. * @reg_addr : Slave register address
  295. * @expected_data : Data expected at slave register address
  296. * @data_mask : Data mask if only few bits are valid
  297. * @camera_id : Indicates the slot to which camera
  298. * needs to be probed
  299. * @reserved
  300. */
  301. struct cam_cmd_probe {
  302. __u8 data_type;
  303. __u8 addr_type;
  304. __u8 op_code;
  305. __u8 cmd_type;
  306. __u32 reg_addr;
  307. __u32 expected_data;
  308. __u32 data_mask;
  309. __u16 camera_id;
  310. __u16 reserved;
  311. } __attribute__((packed));
  312. /**
  313. * struct cam_cmd_probe_v2 - Contains sensor slave info version 2
  314. *
  315. * @data_type : Slave register data type
  316. * @addr_type : Slave register address type
  317. * @op_code : Don't Care
  318. * @cmd_type : Explains type of command
  319. * @reg_addr : Slave register address
  320. * @expected_data : Data expected at slave register address
  321. * @data_mask : Data mask if only few bits are valid
  322. * @camera_id : Indicates the slot to which camera
  323. * needs to be probed
  324. * @pipeline_delay : Pipeline delay
  325. * @logical_camera_id : Logical Camera ID
  326. * @sensor_name : Sensor's name
  327. * @reserved
  328. */
  329. struct cam_cmd_probe_v2 {
  330. __u8 data_type;
  331. __u8 addr_type;
  332. __u8 op_code;
  333. __u8 cmd_type;
  334. __u32 reg_addr;
  335. __u32 expected_data;
  336. __u32 data_mask;
  337. __u16 camera_id;
  338. __u16 pipeline_delay;
  339. __u32 logical_camera_id;
  340. char sensor_name[CAM_SENSOR_NAME_MAX_SIZE];
  341. __u32 reserved[4];
  342. } __attribute__((packed));
  343. /**
  344. * struct cam_power_settings - Contains sensor power setting info
  345. *
  346. * @power_seq_type : Type of power sequence
  347. * @reserved
  348. * @config_val_low : Lower 32 bit value configuration value
  349. * @config_val_high : Higher 32 bit value configuration value
  350. *
  351. */
  352. struct cam_power_settings {
  353. __u16 power_seq_type;
  354. __u16 reserved;
  355. __u32 config_val_low;
  356. __u32 config_val_high;
  357. } __attribute__((packed));
  358. /**
  359. * struct cam_cmd_power - Explains about the power settings
  360. *
  361. * @count : Number of power settings follows
  362. * @reserved
  363. * @cmd_type : Explains type of command
  364. * @power_settings : Contains power setting info
  365. */
  366. struct cam_cmd_power {
  367. __u32 count;
  368. __u8 reserved;
  369. __u8 cmd_type;
  370. __u16 more_reserved;
  371. struct cam_power_settings power_settings[1];
  372. } __attribute__((packed));
  373. /**
  374. * struct i2c_rdwr_header - header of READ/WRITE I2C command
  375. *
  376. * @ count : Number of registers / data / reg-data pairs
  377. * @ op_code : Operation code
  378. * @ cmd_type : Command buffer type
  379. * @ data_type : I2C data type
  380. * @ addr_type : I2C address type
  381. * @ reserved
  382. */
  383. struct i2c_rdwr_header {
  384. __u32 count;
  385. __u8 op_code;
  386. __u8 cmd_type;
  387. __u8 data_type;
  388. __u8 addr_type;
  389. } __attribute__((packed));
  390. /**
  391. * struct i2c_random_wr_payload - payload for I2C random write
  392. *
  393. * @ reg_addr : Register address
  394. * @ reg_data : Register data
  395. *
  396. */
  397. struct i2c_random_wr_payload {
  398. __u32 reg_addr;
  399. __u32 reg_data;
  400. } __attribute__((packed));
  401. /**
  402. * struct cam_cmd_i2c_random_wr - I2C random write command
  403. * @ header : header of READ/WRITE I2C command
  404. * @ random_wr_payload : payload for I2C random write
  405. */
  406. struct cam_cmd_i2c_random_wr {
  407. struct i2c_rdwr_header header;
  408. struct i2c_random_wr_payload random_wr_payload[1];
  409. } __attribute__((packed));
  410. /**
  411. * struct cam_cmd_read - I2C read command
  412. * @ reg_data : Register data
  413. * @ reserved
  414. */
  415. struct cam_cmd_read {
  416. __u32 reg_data;
  417. __u32 reserved;
  418. } __attribute__((packed));
  419. /**
  420. * struct cam_cmd_i2c_continuous_wr - I2C continuous write command
  421. * @ header : header of READ/WRITE I2C command
  422. * @ reg_addr : Register address
  423. * @ data_read : I2C read command
  424. */
  425. struct cam_cmd_i2c_continuous_wr {
  426. struct i2c_rdwr_header header;
  427. __u32 reg_addr;
  428. struct cam_cmd_read data_read[1];
  429. } __attribute__((packed));
  430. /**
  431. * struct cam_cmd_i2c_random_rd - I2C random read command
  432. * @ header : header of READ/WRITE I2C command
  433. * @ data_read : I2C read command
  434. */
  435. struct cam_cmd_i2c_random_rd {
  436. struct i2c_rdwr_header header;
  437. struct cam_cmd_read data_read[1];
  438. } __attribute__((packed));
  439. /**
  440. * struct cam_cmd_i2c_continuous_rd - I2C continuous continuous read command
  441. * @ header : header of READ/WRITE I2C command
  442. * @ reg_addr : Register address
  443. *
  444. */
  445. struct cam_cmd_i2c_continuous_rd {
  446. struct i2c_rdwr_header header;
  447. __u32 reg_addr;
  448. } __attribute__((packed));
  449. /**
  450. * struct cam_cmd_conditional_wait - Conditional wait command
  451. * @data_type : Data type
  452. * @addr_type : Address type
  453. * @op_code : Opcode
  454. * @cmd_type : Explains type of command
  455. * @timeout : Timeout for retries
  456. * @reserved
  457. * @reg_addr : Register Address
  458. * @reg_data : Register data
  459. * @data_mask : Data mask if only few bits are valid
  460. * @camera_id : Indicates the slot to which camera
  461. * needs to be probed
  462. *
  463. */
  464. struct cam_cmd_conditional_wait {
  465. __u8 data_type;
  466. __u8 addr_type;
  467. __u16 reserved;
  468. __u8 op_code;
  469. __u8 cmd_type;
  470. __u16 timeout;
  471. __u32 reg_addr;
  472. __u32 reg_data;
  473. __u32 data_mask;
  474. } __attribute__((packed));
  475. /**
  476. * struct cam_cmd_unconditional_wait - Un-conditional wait command
  477. * @delay : Delay
  478. * @op_code : Opcode
  479. * @cmd_type : Explains type of command
  480. */
  481. struct cam_cmd_unconditional_wait {
  482. __s16 delay;
  483. __s16 reserved;
  484. __u8 op_code;
  485. __u8 cmd_type;
  486. __u16 reserved1;
  487. } __attribute__((packed));
  488. /**
  489. * cam_csiphy_info : Provides cmdbuffer structre
  490. * @lane_assign : Lane sensor will be using
  491. * @mipi_flags : Phy flags for differnt calibration operations
  492. * @lane_cnt : Total number of lanes
  493. * @secure_mode : Secure mode flag to enable / disable
  494. * @settle_time : Settling time in ms
  495. * @data_rate : Data rate
  496. *
  497. */
  498. struct cam_csiphy_info {
  499. __u16 reserved;
  500. __u16 lane_assign;
  501. __u16 mipi_flags;
  502. __u8 lane_cnt;
  503. __u8 secure_mode;
  504. __u64 settle_time;
  505. __u64 data_rate;
  506. } __attribute__((packed));
  507. /**
  508. * cam_csiphy_acquire_dev_info : Information needed for
  509. * csiphy at the time of acquire
  510. * @combo_mode : Indicates the device mode of operation
  511. * @cphy_dphy_combo_mode : Info regarding cphy_dphy_combo mode
  512. * @csiphy_3phase : Details whether 3Phase / 2Phase operation
  513. * @reserve
  514. *
  515. */
  516. struct cam_csiphy_acquire_dev_info {
  517. __u32 combo_mode;
  518. __u16 cphy_dphy_combo_mode;
  519. __u8 csiphy_3phase;
  520. __u8 reserve;
  521. } __attribute__((packed));
  522. /**
  523. * cam_sensor_acquire_dev : Updates sensor acuire cmd
  524. * @device_handle : Updates device handle
  525. * @session_handle : Session handle for acquiring device
  526. * @handle_type : Resource handle type
  527. * @reserved
  528. * @info_handle : Handle to additional info
  529. * needed for sensor sub modules
  530. *
  531. */
  532. struct cam_sensor_acquire_dev {
  533. __u32 session_handle;
  534. __u32 device_handle;
  535. __u32 handle_type;
  536. __u32 reserved;
  537. __u64 info_handle;
  538. } __attribute__((packed));
  539. /**
  540. * cam_tpg_acquire_dev : Updates tpg acuire cmd
  541. * @device_handle : Updates device handle
  542. * @session_handle : Session handle for acquiring device
  543. * @handle_type : Resource handle type
  544. * @reserved
  545. * @info_handle : Handle to additional info
  546. * needed for sensor sub modules
  547. */
  548. struct cam_tpg_acquire_dev {
  549. __u32 session_handle;
  550. __u32 device_handle;
  551. __u32 handle_type;
  552. __u32 reserved;
  553. __u64 info_handle;
  554. } __attribute__((packed));
  555. /**
  556. * cam_sensor_streamon_dev : StreamOn command for the sensor
  557. * @session_handle : Session handle for acquiring device
  558. * @device_handle : Updates device handle
  559. * @handle_type : Resource handle type
  560. * @reserved
  561. * @info_handle : Information Needed at the time of streamOn
  562. *
  563. */
  564. struct cam_sensor_streamon_dev {
  565. __u32 session_handle;
  566. __u32 device_handle;
  567. __u32 handle_type;
  568. __u32 reserved;
  569. __u64 info_handle;
  570. } __attribute__((packed));
  571. /**
  572. * stream_dimension : Stream dimension
  573. *
  574. * @left : left pixel locaiton of stream
  575. * @top : top pixel location of stream
  576. * @width : width of the image stream
  577. * @height : Height of the image stream
  578. */
  579. struct stream_dimension {
  580. uint32_t left;
  581. uint32_t top;
  582. uint32_t width;
  583. uint32_t height;
  584. };
  585. /**
  586. * tpg_command_header_t : tpg command common header
  587. *
  588. * @cmd_type : command type
  589. * @size : size of the command including header
  590. * @cmd_version : version of the command associated
  591. */
  592. struct tpg_command_header_t {
  593. __u32 cmd_type;
  594. ssize_t size;
  595. uint32_t cmd_version;
  596. } __attribute__((packed));
  597. /**
  598. * tpg_global_config_t : global configuration command structure
  599. *
  600. * @header : common header
  601. * @phy_type : phy type , cpy , dphy
  602. * @lane_count : number of lanes used
  603. * @interleaving_format : interleaving format used
  604. * @phy_mode : phy mode of operation
  605. * @shutter_type : shutter type
  606. * @mode : if any specific mode needs to configured
  607. * @hbi : horizontal blanking intervel
  608. * @vbi : vertical blanking intervel
  609. * @skip_pattern : frame skip pattern
  610. * @tpg_clock : tpg clock
  611. * @reserved : reserved for future use
  612. */
  613. struct tpg_global_config_t {
  614. struct tpg_command_header_t header;
  615. enum tpg_phy_type_t phy_type;
  616. uint8_t lane_count;
  617. enum tpg_interleaving_format_t interleaving_format;
  618. uint8_t phy_mode;
  619. enum tpg_shutter_t shutter_type;
  620. uint32_t mode;
  621. uint32_t hbi;
  622. uint32_t vbi;
  623. uint32_t skip_pattern;
  624. uint64_t tpg_clock;
  625. uint32_t reserved[4];
  626. } __attribute__((packed));
  627. /**
  628. * tpg_stream_config_t : stream configuration command
  629. *
  630. * @header: common tpg command header
  631. * @pattern_type : tpg pattern type used in this stream
  632. * @cb_mode : tpg color bar mode used in this stream
  633. * @frame_count : frame count in case of trigger burst mode
  634. * @stream_type : type of stream like image pdaf etc
  635. * @stream_dimension : Dimension of the stream
  636. * @pixel_depth : bits per each pixel
  637. * @cfa_arrangement : color filter arragement
  638. * @output_format : output image format
  639. * @hbi : horizontal blanking intervel
  640. * @vbi : vertical blanking intervel
  641. * @vc : virtual channel of this stream
  642. * @dt : data type of this stream
  643. * @skip_pattern : skip pattern for this stream
  644. * @xcfa_debug : for xcfa debug;
  645. * @shdr_line_offset0 : for shdr line offset0
  646. * @shdr_line_offset1 : for shdr line offset1
  647. * @reserved : reserved for future use
  648. */
  649. struct tpg_stream_config_t {
  650. struct tpg_command_header_t header;
  651. enum tpg_pattern_t pattern_type;
  652. enum tpg_color_bar_mode_t cb_mode;
  653. uint32_t frame_count;
  654. enum tpg_stream_t stream_type;
  655. struct stream_dimension stream_dimension;
  656. uint8_t pixel_depth;
  657. enum tpg_cfa_arrangement_t cfa_arrangement;
  658. enum tpg_image_format_t output_format;
  659. uint32_t hbi;
  660. uint32_t vbi;
  661. uint16_t vc;
  662. uint16_t dt;
  663. uint32_t skip_pattern;
  664. uint32_t rotate_period;
  665. uint32_t xcfa_debug;
  666. uint32_t shdr_line_offset0;
  667. uint32_t shdr_line_offset1;
  668. uint32_t reserved[4];
  669. } __attribute__((packed));
  670. /**
  671. * tpg_illumination_control : illumianation control command
  672. *
  673. * @header : common header for tpg command
  674. * @vc : virtual channel to identify the stream
  675. * @dt : dt to identify the stream
  676. * @exposure_short : short exposure time
  677. * @exposure_mid : mid exposure time
  678. * @exposure_long : long exposure time
  679. * @r_gain : r channel gain
  680. * @g_gain : g channel gain
  681. * @b_gain : b channel gain
  682. * @reserved : reserved for future use
  683. */
  684. struct tpg_illumination_control {
  685. struct tpg_command_header_t header;
  686. uint16_t vc;
  687. uint16_t dt;
  688. uint32_t exposure_short;
  689. uint32_t exposure_mid;
  690. uint32_t exposure_long;
  691. uint16_t r_gain;
  692. uint16_t g_gain;
  693. uint16_t b_gain;
  694. uint32_t reserved[4];
  695. } __attribute__((packed));
  696. /**
  697. * struct cam_flash_init : Init command for the flash
  698. * @flash_type : flash hw type
  699. * @reserved
  700. * @cmd_type : command buffer type
  701. */
  702. struct cam_flash_init {
  703. __u32 flash_type;
  704. __u8 reserved;
  705. __u8 cmd_type;
  706. __u16 reserved1;
  707. } __attribute__((packed));
  708. /**
  709. * struct cam_flash_set_rer : RedEyeReduction command buffer
  710. *
  711. * @count : Number of flash leds
  712. * @opcode : Command buffer opcode
  713. * CAM_FLASH_FIRE_RER
  714. * @cmd_type : command buffer operation type
  715. * @num_iteration : Number of led turn on/off sequence
  716. * @reserved
  717. * @led_on_delay_ms : flash led turn on time in ms
  718. * @led_off_delay_ms : flash led turn off time in ms
  719. * @led_current_ma : flash led current in ma
  720. *
  721. */
  722. struct cam_flash_set_rer {
  723. __u32 count;
  724. __u8 opcode;
  725. __u8 cmd_type;
  726. __u16 num_iteration;
  727. __u32 led_on_delay_ms;
  728. __u32 led_off_delay_ms;
  729. __u32 led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS];
  730. } __attribute__((packed));
  731. /**
  732. * struct cam_flash_set_on_off : led turn on/off command buffer
  733. *
  734. * @count : Number of Flash leds
  735. * @opcode : Command buffer opcodes
  736. * CAM_FLASH_FIRE_LOW
  737. * CAM_FLASH_FIRE_HIGH
  738. * CAM_FLASH_OFF
  739. * @cmd_type : Command buffer operation type
  740. * @led_current_ma : Flash led current in ma
  741. * @time_on_duration_ns : Flash time on duration in ns
  742. * @led_on_wait_time_ns : Flash led turn on wait time in ns
  743. *
  744. */
  745. struct cam_flash_set_on_off {
  746. __u32 count;
  747. __u8 opcode;
  748. __u8 cmd_type;
  749. __u16 reserved;
  750. __u32 led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS];
  751. __u64 time_on_duration_ns;
  752. __u64 led_on_wait_time_ns;
  753. } __attribute__((packed));
  754. /**
  755. * struct cam_flash_query_curr : query current command buffer
  756. *
  757. * @reserved
  758. * @opcode : command buffer opcode
  759. * @cmd_type : command buffer operation type
  760. * @query_current_ma : battery current in ma
  761. *
  762. */
  763. struct cam_flash_query_curr {
  764. __u16 reserved;
  765. __u8 opcode;
  766. __u8 cmd_type;
  767. __u32 query_current_ma;
  768. } __attribute__ ((packed));
  769. /**
  770. * struct cam_flash_query_cap : capabilities info for flash
  771. *
  772. * @slot_info : Indicates about the slotId or cell Index
  773. * @max_current_flash : max supported current for flash
  774. * @max_duration_flash : max flash turn on duration
  775. * @max_current_torch : max supported current for torch
  776. *
  777. */
  778. struct cam_flash_query_cap_info {
  779. __u32 slot_info;
  780. __u32 max_current_flash[CAM_FLASH_MAX_LED_TRIGGERS];
  781. __u32 max_duration_flash[CAM_FLASH_MAX_LED_TRIGGERS];
  782. __u32 max_current_torch[CAM_FLASH_MAX_LED_TRIGGERS];
  783. } __attribute__ ((packed));
  784. #endif