cam_isp.h 39 KB

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