cam_sensor.h 24 KB

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