cam_isp.h 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  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) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef __UAPI_CAM_ISP_H__
  7. #define __UAPI_CAM_ISP_H__
  8. #include <media/cam_defs.h>
  9. #include <media/cam_isp_vfe.h>
  10. #include <media/cam_isp_ife.h>
  11. #include <media/cam_isp_sfe.h>
  12. #include <media/cam_cpas.h>
  13. /* ISP driver name */
  14. #define CAM_ISP_DEV_NAME "cam-isp"
  15. /* HW type */
  16. #define CAM_ISP_HW_BASE 0
  17. #define CAM_ISP_HW_CSID 1
  18. #define CAM_ISP_HW_VFE 2
  19. #define CAM_ISP_HW_IFE 3
  20. #define CAM_ISP_HW_ISPIF 4
  21. #define CAM_ISP_HW_IFE_LITE 5
  22. #define CAM_ISP_HW_CSID_LITE 6
  23. #define CAM_ISP_HW_SFE 7
  24. #define CAM_ISP_HW_MAX 8
  25. /* Color Pattern */
  26. #define CAM_ISP_PATTERN_BAYER_RGRGRG 0
  27. #define CAM_ISP_PATTERN_BAYER_GRGRGR 1
  28. #define CAM_ISP_PATTERN_BAYER_BGBGBG 2
  29. #define CAM_ISP_PATTERN_BAYER_GBGBGB 3
  30. #define CAM_ISP_PATTERN_YUV_YCBYCR 4
  31. #define CAM_ISP_PATTERN_YUV_YCRYCB 5
  32. #define CAM_ISP_PATTERN_YUV_CBYCRY 6
  33. #define CAM_ISP_PATTERN_YUV_CRYCBY 7
  34. #define CAM_ISP_PATTERN_MAX 8
  35. /* Usage Type */
  36. #define CAM_ISP_RES_USAGE_SINGLE 0
  37. #define CAM_ISP_RES_USAGE_DUAL 1
  38. #define CAM_ISP_RES_USAGE_MAX 2
  39. /* Resource ID */
  40. #define CAM_ISP_RES_ID_PORT 0
  41. #define CAM_ISP_RES_ID_CLK 1
  42. #define CAM_ISP_RES_ID_MAX 2
  43. /* Resource Type - Type of resource for the resource id
  44. * defined in cam_isp_vfe.h, cam_isp_ife.h
  45. */
  46. /* Lane Type in input resource for Port */
  47. #define CAM_ISP_LANE_TYPE_DPHY 0
  48. #define CAM_ISP_LANE_TYPE_CPHY 1
  49. #define CAM_ISP_LANE_TYPE_MAX 2
  50. /* ISP Resurce Composite Group ID */
  51. #define CAM_ISP_RES_COMP_GROUP_NONE 0
  52. #define CAM_ISP_RES_COMP_GROUP_ID_0 1
  53. #define CAM_ISP_RES_COMP_GROUP_ID_1 2
  54. #define CAM_ISP_RES_COMP_GROUP_ID_2 3
  55. #define CAM_ISP_RES_COMP_GROUP_ID_3 4
  56. #define CAM_ISP_RES_COMP_GROUP_ID_4 5
  57. #define CAM_ISP_RES_COMP_GROUP_ID_5 6
  58. #define CAM_ISP_RES_COMP_GROUP_ID_MAX 6
  59. /* ISP packet opcode for ISP */
  60. #define CAM_ISP_PACKET_OP_BASE 0
  61. #define CAM_ISP_PACKET_INIT_DEV 1
  62. #define CAM_ISP_PACKET_UPDATE_DEV 2
  63. #define CAM_ISP_PACKET_OP_MAX 3
  64. /* ISP packet meta_data type for command buffer */
  65. #define CAM_ISP_PACKET_META_BASE 0
  66. #define CAM_ISP_PACKET_META_LEFT 1
  67. #define CAM_ISP_PACKET_META_RIGHT 2
  68. #define CAM_ISP_PACKET_META_COMMON 3
  69. #define CAM_ISP_PACKET_META_DMI_LEFT 4
  70. #define CAM_ISP_PACKET_META_DMI_RIGHT 5
  71. #define CAM_ISP_PACKET_META_DMI_COMMON 6
  72. #define CAM_ISP_PACKET_META_CLOCK 7
  73. #define CAM_ISP_PACKET_META_CSID 8
  74. #define CAM_ISP_PACKET_META_DUAL_CONFIG 9
  75. #define CAM_ISP_PACKET_META_GENERIC_BLOB_LEFT 10
  76. #define CAM_ISP_PACKET_META_GENERIC_BLOB_RIGHT 11
  77. #define CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON 12
  78. #define CAM_ISP_PACKET_META_REG_DUMP_PER_REQUEST 13
  79. #define CAM_ISP_PACKET_META_REG_DUMP_ON_FLUSH 14
  80. #define CAM_ISP_PACKET_META_REG_DUMP_ON_ERROR 15
  81. #define CAM_ISP_PACKET_META_CSID_LEFT 16
  82. #define CAM_ISP_PACKET_META_CSID_RIGHT 17
  83. #define CAM_ISP_PACKET_META_CSID_COMMON 18
  84. /* SFE packet meta_data type for command buffer */
  85. #define CAM_ISP_SFE_PACKET_META_LEFT 0x15
  86. #define CAM_ISP_SFE_PACKET_META_RIGHT 0x16
  87. #define CAM_ISP_SFE_PACKET_META_COMMON 0x17
  88. #define CAM_ISP_SFE_PACKET_META_DUAL_CONFIG 0x18
  89. /* DSP mode */
  90. #define CAM_ISP_DSP_MODE_NONE 0
  91. #define CAM_ISP_DSP_MODE_ONE_WAY 1
  92. #define CAM_ISP_DSP_MODE_ROUND 2
  93. /* ISP Generic Cmd Buffer Blob types */
  94. #define CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG 0
  95. #define CAM_ISP_GENERIC_BLOB_TYPE_CLOCK_CONFIG 1
  96. #define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG 2
  97. #define CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG 3
  98. #define CAM_ISP_GENERIC_BLOB_TYPE_CSID_CLOCK_CONFIG 4
  99. #define CAM_ISP_GENERIC_BLOB_TYPE_FE_CONFIG 5
  100. #define CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG_V2 6
  101. #define CAM_ISP_GENERIC_BLOB_TYPE_IFE_CORE_CONFIG 7
  102. #define CAM_ISP_GENERIC_BLOB_TYPE_VFE_OUT_CONFIG 8
  103. #define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2 9
  104. #define CAM_ISP_GENERIC_BLOB_TYPE_DISCARD_INITIAL_FRAMES 10
  105. #define CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG 11
  106. #define CAM_ISP_GENERIC_BLOB_TYPE_CSID_QCFA_CONFIG 12
  107. #define CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_BLANKING_CONFIG 13
  108. #define CAM_ISP_GENERIC_BLOB_TYPE_TPG_CORE_CONFIG 14
  109. #define CAM_ISP_GENERIC_BLOB_TYPE_DYNAMIC_MODE_SWITCH 15
  110. #define CAM_ISP_GENERIC_BLOB_TYPE_BW_LIMITER_CFG 16
  111. #define CAM_ISP_GENERIC_BLOB_TYPE_FPS_CONFIG 17
  112. #define CAM_ISP_GENERIC_BLOB_TYPE_INIT_CONFIG 18
  113. #define CAM_ISP_GENERIC_BLOB_TYPE_RDI_LCR_CONFIG 19
  114. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_CLOCK_CONFIG 21
  115. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_CORE_CONFIG 22
  116. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_OUT_CONFIG 23
  117. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_HFR_CONFIG 24
  118. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_FE_CONFIG 25
  119. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_SCRATCH_BUF_CFG 26
  120. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_EXP_ORDER_CFG 27
  121. #define CAM_ISP_VC_DT_CFG 4
  122. #define CAM_ISP_IFE0_HW 0x1
  123. #define CAM_ISP_IFE1_HW 0x2
  124. #define CAM_ISP_IFE0_LITE_HW 0x4
  125. #define CAM_ISP_IFE1_LITE_HW 0x8
  126. #define CAM_ISP_IFE2_LITE_HW 0x10
  127. #define CAM_ISP_IFE3_LITE_HW 0x20
  128. #define CAM_ISP_IFE4_LITE_HW 0x40
  129. #define CAM_ISP_IFE2_HW 0x100
  130. #define CAM_ISP_SFE0_HW 0x1000
  131. #define CAM_ISP_SFE1_HW 0x2000
  132. #define CAM_ISP_PXL_PATH 0x1
  133. #define CAM_ISP_PPP_PATH 0x2
  134. #define CAM_ISP_LCR_PATH 0x4
  135. #define CAM_ISP_RDI0_PATH 0x8
  136. #define CAM_ISP_RDI1_PATH 0x10
  137. #define CAM_ISP_RDI2_PATH 0x20
  138. #define CAM_ISP_RDI3_PATH 0x40
  139. /* Per Path Usage Data */
  140. #define CAM_ISP_USAGE_INVALID 0
  141. #define CAM_ISP_USAGE_LEFT_PX 1
  142. #define CAM_ISP_USAGE_RIGHT_PX 2
  143. #define CAM_ISP_USAGE_RDI 3
  144. #define CAM_ISP_USAGE_SFE_LEFT 4
  145. #define CAM_ISP_USAGE_SFE_RIGHT 5
  146. #define CAM_ISP_USAGE_SFE_RDI 6
  147. /* Acquire with custom hw */
  148. #define CAM_ISP_ACQ_CUSTOM_NONE 0
  149. #define CAM_ISP_ACQ_CUSTOM_PRIMARY 1
  150. #define CAM_ISP_ACQ_CUSTOM_SECONDARY 2
  151. #define CAM_IFE_CSID_RDI_MAX 5
  152. /* Feature Flag indicators */
  153. #define CAM_ISP_PARAM_FETCH_SECURITY_MODE BIT(0)
  154. #define CAM_ISP_CAN_USE_LITE_MODE BIT(1)
  155. #define CAM_ISP_DYNAMIC_SENOR_SWITCH_EN BIT(2)
  156. #define CAM_ISP_SFE_BINNED_EPOCH_CFG_ENABLE BIT(3)
  157. #define CAM_ISP_EPD_SUPPORT BIT(4)
  158. #define CAM_ISP_SFE_FS_MODE_EN BIT(5)
  159. #define CAM_ISP_SFE_SHDR_MODE_EN BIT(6)
  160. #define CAM_ISP_AEB_MODE_EN BIT(7)
  161. #define CAM_ISP_HDR_MODE_DYNAMIC_SWITCH_EN BIT(8)
  162. /* ISP core cfg flag params */
  163. #define CAM_ISP_PARAM_CORE_CFG_HDR_MUX_SEL BIT(0)
  164. #define CAM_ISP_PARAM_CORE_CFG_PP_FORMAT BIT(16)
  165. /**
  166. * Decode format1 Support for multi VCDT use case.
  167. * Format type is packed in 8 bits. BIT(0-7) is
  168. * format and BIT(8-15) is format1 type in the format
  169. * variable
  170. */
  171. #define CAM_IFE_DECODE_FORMAT_MASK 0xFF
  172. #define CAM_IFE_DECODE_FORMAT_SHIFT_VAL 8
  173. /* Query devices */
  174. /**
  175. * struct cam_isp_dev_cap_info - A cap info for particular hw type
  176. *
  177. * @hw_type: Hardware type for the cap info
  178. * @num_hw: Number of HW of type @hw_type
  179. * @hw_version: Hardware version
  180. *
  181. */
  182. struct cam_isp_dev_cap_info {
  183. __u32 hw_type;
  184. __u32 num_hw;
  185. struct cam_hw_version hw_version;
  186. };
  187. /**
  188. * struct cam_isp_query_cap_cmd - ISP query device capability payload
  189. *
  190. * @device_iommu: returned iommu handles for device
  191. * @cdm_iommu: returned iommu handles for cdm
  192. * @num_dev: returned number of device capabilities
  193. * @reserved: reserved field for alignment
  194. * @dev_caps: returned device capability array
  195. *
  196. */
  197. struct cam_isp_query_cap_cmd {
  198. struct cam_iommu_handle device_iommu;
  199. struct cam_iommu_handle cdm_iommu;
  200. __s32 num_dev;
  201. __u32 reserved;
  202. struct cam_isp_dev_cap_info dev_caps[CAM_ISP_HW_MAX];
  203. };
  204. /* Acquire Device */
  205. /**
  206. * struct cam_isp_out_port_info - An output port resource info
  207. *
  208. * @res_type: output resource type defined in file
  209. * cam_isp_vfe.h or cam_isp_ife.h
  210. * @format: output format of the resource
  211. * @wdith: output width in pixels
  212. * @height: output height in lines
  213. * @comp_grp_id: composite group id for the resource.
  214. * @split_point: split point in pixels for the dual VFE.
  215. * @secure_mode: flag to tell if output should be run in secure
  216. * mode or not. See cam_defs.h for definition
  217. * @reserved: reserved field for alignment
  218. *
  219. */
  220. struct cam_isp_out_port_info {
  221. __u32 res_type;
  222. __u32 format;
  223. __u32 width;
  224. __u32 height;
  225. __u32 comp_grp_id;
  226. __u32 split_point;
  227. __u32 secure_mode;
  228. __u32 reserved;
  229. };
  230. /**
  231. * struct cam_isp_out_port_info_v2 - An output port resource info
  232. *
  233. * @res_type: output resource type defined in file
  234. * cam_isp_vfe.h or cam_isp_ife.h
  235. * @format: output format of the resource
  236. * @wdith: output width in pixels
  237. * @height: output height in lines
  238. * @comp_grp_id: composite group id for the resource.
  239. * @split_point: split point in pixels for the dual VFE.
  240. * @secure_mode: flag to tell if output should be run in secure
  241. * mode or not. See cam_defs.h for definition
  242. * @wm_mode: WM mode
  243. * @out_port_res1: Output reserved field
  244. * @out_port_res2: Output reserved field
  245. *
  246. */
  247. struct cam_isp_out_port_info_v2 {
  248. __u32 res_type;
  249. __u32 format;
  250. __u32 width;
  251. __u32 height;
  252. __u32 comp_grp_id;
  253. __u32 split_point;
  254. __u32 secure_mode;
  255. __u32 wm_mode;
  256. __u32 out_port_res1;
  257. __u32 out_port_res2;
  258. };
  259. /**
  260. * struct cam_isp_in_port_info - An input port resource info
  261. *
  262. * @res_type: input resource type define in file
  263. * cam_isp_vfe.h or cam_isp_ife.h
  264. * @lane_type: lane type: c-phy or d-phy.
  265. * @lane_num: active lane number
  266. * @lane_cfg: lane configurations: 4 bits per lane
  267. * @vc: input virtual channel number
  268. * @dt: input data type number
  269. * @format: input format
  270. * @test_pattern: test pattern for the testgen
  271. * @usage_type: whether dual vfe is required
  272. * @left_start: left input start offset in pixels
  273. * @left_stop: left input stop offset in pixels
  274. * @left_width: left input width in pixels
  275. * @right_start: right input start offset in pixels.
  276. * Only for Dual VFE
  277. * @right_stop: right input stop offset in pixels.
  278. * Only for Dual VFE
  279. * @right_width: right input width in pixels.
  280. * Only for dual VFE
  281. * @line_start: top of the line number
  282. * @line_stop: bottome of the line number
  283. * @height: input height in lines
  284. * @pixel_clk; sensor output clock
  285. * @batch_size: batch size for HFR mode
  286. * @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*)
  287. * @hbi_cnt: HBI count for the camif input
  288. * @reserved: Reserved field for alignment
  289. * @num_out_res: number of the output resource associated
  290. * @data: payload that contains the output resources
  291. *
  292. */
  293. struct cam_isp_in_port_info {
  294. __u32 res_type;
  295. __u32 lane_type;
  296. __u32 lane_num;
  297. __u32 lane_cfg;
  298. __u32 vc;
  299. __u32 dt;
  300. __u32 format;
  301. __u32 test_pattern;
  302. __u32 usage_type;
  303. __u32 left_start;
  304. __u32 left_stop;
  305. __u32 left_width;
  306. __u32 right_start;
  307. __u32 right_stop;
  308. __u32 right_width;
  309. __u32 line_start;
  310. __u32 line_stop;
  311. __u32 height;
  312. __u32 pixel_clk;
  313. __u32 batch_size;
  314. __u32 dsp_mode;
  315. __u32 hbi_cnt;
  316. __u32 reserved;
  317. __u32 num_out_res;
  318. struct cam_isp_out_port_info data[1];
  319. };
  320. /**
  321. * struct cam_isp_in_port_info_v2 - An input port resource info
  322. *
  323. * @res_type: input resource type define in file
  324. * cam_isp_vfe.h or cam_isp_ife.h
  325. * @lane_type: lane type: c-phy or d-phy.
  326. * @lane_num: active lane number
  327. * @lane_cfg: lane configurations: 4 bits per lane
  328. * @vc: input virtual channel number
  329. * @dt: input data type number
  330. * @num_valid_vc_dt: valid vc and dt in array
  331. * @format: input format
  332. * @test_pattern: test pattern for the testgen
  333. * @usage_type: whether dual vfe is required
  334. * @left_start: left input start offset in pixels
  335. * @left_stop: left input stop offset in pixels
  336. * @left_width: left input width in pixels
  337. * @right_start: right input start offset in pixels.
  338. * Only for Dual VFE
  339. * @right_stop: right input stop offset in pixels.
  340. * only for Dual VFE
  341. * @right_width: right input width in pixels.
  342. * only for dual VFE
  343. * @line_start: top of the line number
  344. * @line_stop: bottome of the line number
  345. * @height: input height in lines
  346. * @pixel_clk; sensor output clock
  347. * @batch_size: batch size for HFR mode
  348. * @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*)
  349. * @hbi_cnt: HBI count for the camif input
  350. * @cust_node: if any custom HW block is present before IFE
  351. * @num_out_res: number of the output resource associated
  352. * @bidirectional_bin: [0 : 15] - Set 1 for Horizontal binning
  353. * [16 : 31] - Set 1 for Vertical binning
  354. * @qcfa_bin: Quadra Binning info
  355. * @sfe_in_path_type: SFE input path type
  356. * 0:15 - refer to cam_isp_sfe.h for SFE paths
  357. * 16:31 - Corresponding IFE i/p path type
  358. * Example:((CAM_ISP_PXL_PATH << 16) |
  359. * CAM_ISP_SFE_INLINE_PIX)
  360. * This will acquire SFE inline IPP and IFE IPP
  361. * PPP is an exception CSID PPP -> IFE PPP
  362. * @feature_flag: See the macros defined under feature flag above
  363. * @ife_res_1: payload for future use.
  364. * @ife_res_2: payload for future use.
  365. * @data: payload that contains the output resources
  366. *
  367. */
  368. struct cam_isp_in_port_info_v2 {
  369. __u32 res_type;
  370. __u32 lane_type;
  371. __u32 lane_num;
  372. __u32 lane_cfg;
  373. __u32 vc[CAM_ISP_VC_DT_CFG];
  374. __u32 dt[CAM_ISP_VC_DT_CFG];
  375. __u32 num_valid_vc_dt;
  376. __u32 format;
  377. __u32 test_pattern;
  378. __u32 usage_type;
  379. __u32 left_start;
  380. __u32 left_stop;
  381. __u32 left_width;
  382. __u32 right_start;
  383. __u32 right_stop;
  384. __u32 right_width;
  385. __u32 line_start;
  386. __u32 line_stop;
  387. __u32 height;
  388. __u32 pixel_clk;
  389. __u32 batch_size;
  390. __u32 dsp_mode;
  391. __u32 hbi_cnt;
  392. __u32 cust_node;
  393. __u32 num_out_res;
  394. __u32 offline_mode;
  395. __u32 bidirectional_bin;
  396. __u32 qcfa_bin;
  397. __u32 sfe_in_path_type;
  398. __u32 feature_flag;
  399. __u32 ife_res_1;
  400. __u32 ife_res_2;
  401. struct cam_isp_out_port_info_v2 data[1];
  402. };
  403. /**
  404. * struct cam_isp_resource - A resource bundle
  405. *
  406. * @resoruce_id: resource id for the resource bundle
  407. * @length: length of the while resource blob
  408. * @handle_type: type of the resource handle
  409. * @reserved: reserved field for alignment
  410. * @res_hdl: resource handle that points to the
  411. * resource array;
  412. *
  413. */
  414. struct cam_isp_resource {
  415. __u32 resource_id;
  416. __u32 length;
  417. __u32 handle_type;
  418. __u32 reserved;
  419. __u64 res_hdl;
  420. };
  421. /**
  422. * struct cam_isp_port_hfr_config - HFR configuration for this port
  423. *
  424. * @resource_type: Resource type
  425. * @subsample_pattern: Subsample pattern. Used in HFR mode. It
  426. * should be consistent with batchSize and
  427. * CAMIF programming.
  428. * @subsample_period: Subsample period. Used in HFR mode. It
  429. * should be consistent with batchSize and
  430. * CAMIF programming.
  431. * @framedrop_pattern: Framedrop pattern
  432. * @framedrop_period: Framedrop period
  433. * @reserved: Reserved for alignment
  434. */
  435. struct cam_isp_port_hfr_config {
  436. __u32 resource_type;
  437. __u32 subsample_pattern;
  438. __u32 subsample_period;
  439. __u32 framedrop_pattern;
  440. __u32 framedrop_period;
  441. __u32 reserved;
  442. } __attribute__((packed));
  443. /**
  444. * struct cam_isp_resource_hfr_config - Resource HFR configuration
  445. *
  446. * @num_ports: Number of ports
  447. * @reserved: Reserved for alignment
  448. * @port_hfr_config: HFR configuration for each IO port
  449. */
  450. struct cam_isp_resource_hfr_config {
  451. __u32 num_ports;
  452. __u32 reserved;
  453. struct cam_isp_port_hfr_config port_hfr_config[1];
  454. } __attribute__((packed));
  455. /**
  456. * struct cam_isp_dual_split_params - dual isp spilt parameters
  457. *
  458. * @split_point: Split point information x, where (0 < x < width)
  459. * left ISP's input ends at x + righ padding and
  460. * Right ISP's input starts at x - left padding
  461. * @right_padding: Padding added past the split point for left
  462. * ISP's input
  463. * @left_padding: Padding added before split point for right
  464. * ISP's input
  465. * @reserved: Reserved filed for alignment
  466. *
  467. */
  468. struct cam_isp_dual_split_params {
  469. __u32 split_point;
  470. __u32 right_padding;
  471. __u32 left_padding;
  472. __u32 reserved;
  473. };
  474. /**
  475. * struct cam_isp_dual_stripe_config - stripe config per bus client
  476. *
  477. * @offset: Start horizontal offset relative to
  478. * output buffer
  479. * In UBWC mode, this value indicates the H_INIT
  480. * value in pixel
  481. * @width: Width of the stripe in bytes
  482. * @tileconfig Ubwc meta tile config. Contain the partial
  483. * tile info
  484. * @port_id: port id of ISP output
  485. *
  486. */
  487. struct cam_isp_dual_stripe_config {
  488. __u32 offset;
  489. __u32 width;
  490. __u32 tileconfig;
  491. __u32 port_id;
  492. };
  493. /**
  494. * struct cam_isp_dual_config - dual isp configuration
  495. *
  496. * @num_ports Number of isp output ports
  497. * @reserved Reserved field for alignment
  498. * @split_params: Inpput split parameters
  499. * @stripes: Stripe information
  500. *
  501. */
  502. struct cam_isp_dual_config {
  503. __u32 num_ports;
  504. __u32 reserved;
  505. struct cam_isp_dual_split_params split_params;
  506. struct cam_isp_dual_stripe_config stripes[1];
  507. } __attribute__((packed));
  508. /**
  509. * struct cam_isp_clock_config - Clock configuration
  510. *
  511. * @usage_type: Usage type (Single/Dual)
  512. * @num_rdi: Number of RDI votes
  513. * @left_pix_hz: Pixel Clock for Left ISP
  514. * @right_pix_hz: Pixel Clock for Right ISP, valid only if Dual
  515. * @rdi_hz: RDI Clock. ISP clock will be max of RDI and
  516. * PIX clocks. For a particular context which ISP
  517. * HW the RDI is allocated to is not known to UMD.
  518. * Hence pass the clock and let KMD decide.
  519. */
  520. struct cam_isp_clock_config {
  521. __u32 usage_type;
  522. __u32 num_rdi;
  523. __u64 left_pix_hz;
  524. __u64 right_pix_hz;
  525. __u64 rdi_hz[1];
  526. } __attribute__((packed));
  527. /**
  528. * struct cam_isp_csid_clock_config - CSID clock configuration
  529. *
  530. * @csid_clock CSID clock
  531. */
  532. struct cam_isp_csid_clock_config {
  533. __u64 csid_clock;
  534. } __attribute__((packed));
  535. /**
  536. * struct cam_isp_csid_qcfa_config - CSID qcfa binning support configuration
  537. *
  538. * @csid_binning CSID binning
  539. */
  540. struct cam_isp_csid_qcfa_config {
  541. __u32 csid_binning;
  542. } __attribute__((packed));
  543. /**
  544. * struct cam_isp_bw_vote - Bandwidth vote information
  545. *
  546. * @resource_id: Resource ID
  547. * @reserved: Reserved field for alignment
  548. * @cam_bw_bps: Bandwidth vote for CAMNOC
  549. * @ext_bw_bps: Bandwidth vote for path-to-DDR after CAMNOC
  550. */
  551. struct cam_isp_bw_vote {
  552. __u32 resource_id;
  553. __u32 reserved;
  554. __u64 cam_bw_bps;
  555. __u64 ext_bw_bps;
  556. } __attribute__((packed));
  557. /**
  558. * struct cam_isp_bw_config - Bandwidth configuration
  559. *
  560. * @usage_type: Usage type (Single/Dual)
  561. * @num_rdi: Number of RDI votes
  562. * @left_pix_vote: Bandwidth vote for left ISP
  563. * @right_pix_vote: Bandwidth vote for right ISP
  564. * @rdi_vote: RDI bandwidth requirements
  565. */
  566. struct cam_isp_bw_config {
  567. __u32 usage_type;
  568. __u32 num_rdi;
  569. struct cam_isp_bw_vote left_pix_vote;
  570. struct cam_isp_bw_vote right_pix_vote;
  571. struct cam_isp_bw_vote rdi_vote[1];
  572. } __attribute__((packed));
  573. /**
  574. * struct cam_isp_bw_config_v2 - Bandwidth configuration
  575. *
  576. * @usage_type: Usage type (Single/Dual)
  577. * @num_paths: Number of axi data paths
  578. * @axi_path Per path vote info
  579. */
  580. struct cam_isp_bw_config_v2 {
  581. __u32 usage_type;
  582. __u32 num_paths;
  583. struct cam_axi_per_path_bw_vote axi_path[1];
  584. } __attribute__((packed));
  585. /**
  586. * struct cam_fe_config - Fetch Engine configuration
  587. *
  588. * @version: fetch engine veriosn
  589. * @min_vbi: require min vbi
  590. * @fs_mode: indicates if fs mode enabled
  591. * @fs_line_sync_en: frame level sync or line level
  592. * sync for fetch engine
  593. * @hbi_count: hbi count
  594. * @fs_sync_enable: indicates if fetch engine working
  595. * wokring in sync with write engine
  596. * @go_cmd_sel: softwrae go_cmd or hw go_cmd
  597. * @client_enable: enable read engine
  598. * @source_addr: adrress of buffer to read from
  599. * @width: buffer width
  600. * @height: buffer height
  601. * @stride: buffer stride (here equal to width)
  602. * @format: format of image in buffer
  603. * @unpacker_cfg: unpacker config type
  604. * @latency_buf_size: latency buffer for read engine
  605. */
  606. struct cam_fe_config {
  607. __u64 version;
  608. __u32 min_vbi;
  609. __u32 fs_mode;
  610. __u32 fs_line_sync_en;
  611. __u32 hbi_count;
  612. __u32 fs_sync_enable;
  613. __u32 go_cmd_sel;
  614. __u32 client_enable;
  615. __u32 source_addr;
  616. __u32 width;
  617. __u32 height;
  618. __u32 stride;
  619. __u32 format;
  620. __u32 unpacker_cfg;
  621. __u32 latency_buf_size;
  622. } __attribute__((packed));
  623. /**
  624. * struct cam_isp_sensor_path_dimension
  625. *
  626. * @width expected width
  627. * @height expected height
  628. * @measure_enabled flag to indicate if pixel measurement is to be enabled
  629. */
  630. struct cam_isp_sensor_dimension {
  631. __u32 width;
  632. __u32 height;
  633. __u32 measure_enabled;
  634. } __attribute__((packed));
  635. /**
  636. * struct cam_isp_sensor_blanking_config
  637. *
  638. * @hbi HBI value
  639. * @vbi VBI value
  640. */
  641. struct cam_isp_sensor_blanking_config {
  642. __u32 hbi;
  643. __u32 vbi;
  644. } __attribute__((packed));
  645. /**
  646. * struct cam_isp_sensor_config - Sensor Dimension configuration
  647. *
  648. * @ppp_path: expected ppp path configuration
  649. * @ipp_path: expected ipp path configuration
  650. * @rdi_path: expected rdi path configuration
  651. * @hbi: HBI value
  652. * @vbi: VBI value
  653. */
  654. struct cam_isp_sensor_config {
  655. struct cam_isp_sensor_dimension ppp_path;
  656. struct cam_isp_sensor_dimension ipp_path;
  657. struct cam_isp_sensor_dimension rdi_path[CAM_IFE_CSID_RDI_MAX];
  658. __u32 hbi;
  659. __u32 vbi;
  660. } __attribute__((packed));
  661. /**
  662. * struct cam_isp_core_config - ISP core registers configuration
  663. *
  664. * @version: Version info
  665. * @vid_ds16_r2pd: Enables Y and C merging PD output for video DS16
  666. * @vid_ds4_r2pd: Enables Y and C merging PD output for video DS4
  667. * @disp_ds16_r2pd: Enables Y and C merging PD output for disp DS16
  668. * @disp_ds4_r2pd: Enables Y and C merging PD output for disp DS4
  669. * @dsp_streaming_tap_point: This selects source for DSP streaming interface
  670. * @ihist_src_sel: Selects input for IHIST module
  671. * @hdr_be_src_sel: Selects input for HDR BE module
  672. * @hdr_bhist_src_sel: Selects input for HDR BHIST module
  673. * @input_mux_sel_pdaf: Selects input for PDAF
  674. * @input_mux_sel_pp: Selects input for Pixel Pipe
  675. * @core_cfg_flag: Core config flag to set HDR mux/PP
  676. * input format type
  677. */
  678. struct cam_isp_core_config {
  679. __u32 version;
  680. __u32 vid_ds16_r2pd;
  681. __u32 vid_ds4_r2pd;
  682. __u32 disp_ds16_r2pd;
  683. __u32 disp_ds4_r2pd;
  684. __u32 dsp_streaming_tap_point;
  685. __u32 ihist_src_sel;
  686. __u32 hdr_be_src_sel;
  687. __u32 hdr_bhist_src_sel;
  688. __u32 input_mux_sel_pdaf;
  689. __u32 input_mux_sel_pp;
  690. __u32 core_cfg_flag;
  691. } __attribute__((packed));
  692. /**
  693. * struct cam_isp_sfe_core_config - SFE core registers configuration
  694. *
  695. * @version : Version info
  696. * @mode_sel : Selects core for sHDR/non-sHDR mode
  697. * @ops_mode_cfg : Selects core if is inline/offline mode
  698. * @fs_mode_cfg : Selects output in fast shutter mode
  699. * @sfe_params : SFE params for future use
  700. */
  701. struct cam_isp_sfe_core_config {
  702. __u32 version;
  703. __u32 mode_sel;
  704. __u32 ops_mode_cfg;
  705. __u32 fs_mode_cfg;
  706. __u32 sfe_params[6];
  707. } __attribute__((packed));
  708. /**
  709. * struct cam_isp_sfe_scratch_buf_info - Scratch buf info
  710. *
  711. * @mem_handle : Scratch buffer handle
  712. * @offset : Offset to the buffer
  713. * @width : Width in pixels
  714. * @height : Height in pixels
  715. * @stride : Stride in pixels
  716. * @slice_height : Slice height in lines
  717. * @resource_type : rsrc type
  718. * @scratch_buf_params : for future use
  719. */
  720. struct cam_isp_sfe_scratch_buf_info {
  721. __s32 mem_handle;
  722. __u32 offset;
  723. __u32 width;
  724. __u32 height;
  725. __u32 stride;
  726. __u32 slice_height;
  727. __u32 resource_type;
  728. __u32 scratch_buf_params[5];
  729. };
  730. /**
  731. * struct cam_isp_sfe_init_scratch_buf_config - SFE init buffer cfg
  732. * Provides scratch buffer info for SFE ports
  733. * as part of INIT packet
  734. *
  735. * @num_ports : Number of ports
  736. * @reserved : reserved
  737. * @port_scratch_cfg : scratch buffer info
  738. */
  739. struct cam_isp_sfe_init_scratch_buf_config {
  740. __u32 num_ports;
  741. __u32 reserved;
  742. struct cam_isp_sfe_scratch_buf_info port_scratch_cfg[1];
  743. };
  744. /**
  745. * struct cam_isp_tpg_core_config - TPG core registers configuration
  746. *
  747. * @version : Version info
  748. * @vc_dt_pattern_id : TPG pattern - SparsePD, sHDR etc.
  749. * @qcfa_en : Selects qcfa in color bar
  750. * @pix_pattern : Pix pattern color bar cfg
  751. * @hbi_clk_cnt : Number of HBI # of cycles
  752. * @vbi_clk_cnt : Number of VBI # of cycles
  753. * @throttle_pattern : Defines bubble pattern in throttler
  754. * @tpg_params : TPG params for future use
  755. */
  756. struct cam_isp_tpg_core_config {
  757. __u32 version;
  758. __u32 vc_dt_pattern_id;
  759. __u32 qcfa_en;
  760. __u32 pix_pattern;
  761. __u32 hbi_clk_cnt;
  762. __u32 vbi_clk_cnt;
  763. __u32 throttle_pattern;
  764. __u32 tpg_params[3];
  765. } __attribute__((packed));
  766. /**
  767. * struct cam_isp_acquire_hw_info - ISP acquire HW params
  768. *
  769. * @common_info_version : Version of common info struct used
  770. * @common_info_size : Size of common info struct used
  771. * @common_info_offset : Offset of common info from start of data
  772. * @num_inputs : Number of inputs
  773. * @input_info_version : Version of input info struct used
  774. * @input_info_size : Size of input info struct used
  775. * @input_info_offset : Offset of input info from start of data
  776. * @data : Start of data region
  777. */
  778. struct cam_isp_acquire_hw_info {
  779. __u16 common_info_version;
  780. __u16 common_info_size;
  781. __u32 common_info_offset;
  782. __u32 num_inputs;
  783. __u32 input_info_version;
  784. __u32 input_info_size;
  785. __u32 input_info_offset;
  786. __u64 data;
  787. };
  788. /**
  789. * struct cam_isp_vfe_wm_config - VFE write master config per port
  790. *
  791. * @port_type : Unique ID of output port
  792. * @wm_mode : Write master mode
  793. * 0x0 - Line based mode
  794. * 0x1 - Frame based mode
  795. * 0x2 - Index based mode, valid for BAF only
  796. * @h_init : Horizontal starting coordinate in pixels. Must be a
  797. * multiple of 3 for TP10 format
  798. * @height : Height in pixels
  799. * @width : Width in pixels
  800. * @virtual_frame_en : Enabling virtual frame will prevent actual request from
  801. * being sent to NOC
  802. * @stride : Write master stride
  803. * @offset : Write master offset
  804. * @addr_reuse_en : Enabling addr-reuse will write output to the same addr
  805. * after the last addr that was read from FIFO.
  806. * @packer_format : Update packer format for Write master config
  807. * @reserved_3 : Reserved field for Write master config
  808. * @reserved_4 : Reserved field for Write master config
  809. */
  810. struct cam_isp_vfe_wm_config {
  811. __u32 port_type;
  812. __u32 wm_mode;
  813. __u32 h_init;
  814. __u32 height;
  815. __u32 width;
  816. __u32 virtual_frame_en;
  817. __u32 stride;
  818. __u32 offset;
  819. __u32 addr_reuse_en;
  820. __u32 packer_format;
  821. __u32 reserved_3;
  822. __u32 reserved_4;
  823. };
  824. /**
  825. * struct cam_isp_vfe_out_config - VFE write master config
  826. *
  827. * @num_ports : Number of ports
  828. * @reserved : Reserved field
  829. * @wm_config : VFE out config
  830. */
  831. struct cam_isp_vfe_out_config {
  832. __u32 num_ports;
  833. __u32 reserved;
  834. struct cam_isp_vfe_wm_config wm_config[1];
  835. };
  836. /**
  837. * struct cam_isp_mode_switch_info - Dynamic mode switch info
  838. *
  839. * @mup : MUP for incoming VC of next frame
  840. * @num_expoures : Number of exposures
  841. * @reserved : Reserved
  842. */
  843. struct cam_isp_mode_switch_info{
  844. __u32 mup;
  845. __u32 num_expoures;
  846. __u32 reserved;
  847. } __attribute__((packed));
  848. /**
  849. * struct cam_isp_sfe_wm_exp_order_config - SFE write master
  850. * exposure order config
  851. *
  852. * This config will reflect for corresponding RM as well
  853. *
  854. * @res_type : output resource type defined in file
  855. * cam_isp_sfe.h or cam_isp_ife.h
  856. * @additional_params : Params for future use
  857. */
  858. struct cam_isp_sfe_wm_exp_order_config {
  859. __u32 res_type;
  860. __u32 additional_params[5];
  861. };
  862. /**
  863. * struct cam_isp_sfe_exp_config - SFE out exposure config
  864. *
  865. * Exp order is determined by it's index in wm_config[]
  866. * The last resource in the array will be considered as
  867. * last [shortest] exposure.
  868. *
  869. * @num_ports : Number of ports
  870. * @reserved : Reserved field
  871. * @wm_config : WM exp config
  872. */
  873. struct cam_isp_sfe_exp_config {
  874. __u32 num_ports;
  875. __u32 reserved;
  876. struct cam_isp_sfe_wm_exp_order_config wm_config[1];
  877. };
  878. /**
  879. * struct cam_isp_discard_initial_frames - Discard init frames
  880. *
  881. * Some sensors require discarding the initial frames
  882. * after the sensor is streamed on. The discard would be
  883. * applied on all paths [IPP/PPP/RDIx] for the given
  884. * pipeline.
  885. *
  886. * @num_frames : Number of frames to be discarded
  887. * @discard_params : Params for future use
  888. */
  889. struct cam_isp_discard_initial_frames {
  890. __u32 num_frames;
  891. __u32 discard_params[5];
  892. } __attribute__((packed));
  893. /**
  894. * struct cam_isp_wm_bw_limiter_config - ISP write master
  895. * BW limter config
  896. *
  897. *
  898. * @res_type : output resource type defined in file
  899. * cam_isp_sfe.h or cam_isp_ife.h
  900. * @enable_limiter : 0 for disable else enabled
  901. * @counter_limit : Max counter value
  902. * @additional_params : Params for future use
  903. */
  904. struct cam_isp_wm_bw_limiter_config {
  905. __u32 res_type;
  906. __u32 enable_limiter;
  907. __u32 counter_limit[CAM_PACKET_MAX_PLANES];
  908. __u32 additional_params[5];
  909. };
  910. /**
  911. * struct cam_isp_out_rsrc_bw_limiter_config - ISP out rsrc BW limiter config
  912. *
  913. * Configure BW limiter for ISP WMs
  914. *
  915. * @num_ports : Number of ports
  916. * @reserved : Reserved field
  917. * @bw_limit_config : WM BW limiter config
  918. */
  919. struct cam_isp_out_rsrc_bw_limiter_config {
  920. __u32 num_ports;
  921. __u32 reserved;
  922. struct cam_isp_wm_bw_limiter_config bw_limiter_config[1];
  923. };
  924. /**
  925. * struct cam_isp_init_config - Init config for IFE/CSID/SFE
  926. *
  927. * Any configurations to be consumed by KMD
  928. * prior to stream on - one time configuration per stream.
  929. * This blob is expected only in INIT packet. Per frame
  930. * dynamic settings will not be part of this blob.
  931. *
  932. * @epoch_factor : % factor for epoch config with respect to frame height
  933. * If factor is 60, epoch will be configured to 3/5th of
  934. * the frame height. If this field is 0,
  935. * KMD will configure default 50% of the height
  936. * @additional_params : Reserved fields for future use
  937. */
  938. struct cam_isp_init_config {
  939. struct cam_isp_epoch_height_config {
  940. __u32 epoch_factor;
  941. } epoch_cfg;
  942. __u32 additional_params[19];
  943. };
  944. /**
  945. * struct cam_isp_lcr_rdi_config - RDI res id to be muxed to LCR
  946. *
  947. * Configure RDI Res id for LCR
  948. *
  949. * @res_id : Out port Res id, it is same as the out port
  950. * configured during acquire. It would vary
  951. * as per SFE or IFE. Based on this res id,
  952. * Mux register in IFE will be programmed.
  953. * Examples:
  954. * IFE:
  955. * CAM_ISP_IFE_OUT_RES_RDI_0
  956. * SFE:
  957. * CAM_ISP_SFE_OUT_RES_RDI_0
  958. * This blob is expected as a part of init packet for
  959. * all LCR cases. For SHDR-LCR cases, this can be used
  960. * per request. For non-shdr cases, this blob is not
  961. * expected as the input to LCR will remain same throughout
  962. * the session
  963. * @reserved : Reserved field
  964. */
  965. struct cam_isp_lcr_rdi_config {
  966. __u32 res_id;
  967. __u32 reserved[5];
  968. };
  969. #define CAM_ISP_ACQUIRE_COMMON_VER0 0x1000
  970. #define CAM_ISP_ACQUIRE_COMMON_SIZE_VER0 0x0
  971. #define CAM_ISP_ACQUIRE_INPUT_VER0 0x2000
  972. #define CAM_ISP_ACQUIRE_INPUT_SIZE_VER0 sizeof(struct cam_isp_in_port_info)
  973. #define CAM_ISP_ACQUIRE_OUT_VER0 0x3000
  974. #define CAM_ISP_ACQUIRE_OUT_SIZE_VER0 sizeof(struct cam_isp_out_port_info)
  975. #endif /* __UAPI_CAM_ISP_H__ */