cam_sensor.h 26 KB

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