cam_sensor.h 23 KB

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