cam_isp.h 41 KB

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