cam_isp.h 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420
  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-2023 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_MC_TFE 8
  25. #define CAM_ISP_HW_MAX 9
  26. /* Color Pattern */
  27. #define CAM_ISP_PATTERN_BAYER_RGRGRG 0
  28. #define CAM_ISP_PATTERN_BAYER_GRGRGR 1
  29. #define CAM_ISP_PATTERN_BAYER_BGBGBG 2
  30. #define CAM_ISP_PATTERN_BAYER_GBGBGB 3
  31. #define CAM_ISP_PATTERN_YUV_YCBYCR 4
  32. #define CAM_ISP_PATTERN_YUV_YCRYCB 5
  33. #define CAM_ISP_PATTERN_YUV_CBYCRY 6
  34. #define CAM_ISP_PATTERN_YUV_CRYCBY 7
  35. #define CAM_ISP_PATTERN_MAX 8
  36. /* Usage Type */
  37. #define CAM_ISP_RES_USAGE_SINGLE 0
  38. #define CAM_ISP_RES_USAGE_DUAL 1
  39. #define CAM_ISP_RES_USAGE_MAX 2
  40. /* Resource ID */
  41. #define CAM_ISP_RES_ID_PORT 0
  42. #define CAM_ISP_RES_ID_CLK 1
  43. #define CAM_ISP_RES_ID_MAX 2
  44. /* Resource Type - Type of resource for the resource id
  45. * defined in cam_isp_vfe.h, cam_isp_ife.h
  46. */
  47. /* Lane Type in input resource for Port */
  48. #define CAM_ISP_LANE_TYPE_DPHY 0
  49. #define CAM_ISP_LANE_TYPE_CPHY 1
  50. #define CAM_ISP_LANE_TYPE_MAX 2
  51. /* ISP Resurce Composite Group ID */
  52. #define CAM_ISP_RES_COMP_GROUP_NONE 0
  53. #define CAM_ISP_RES_COMP_GROUP_ID_0 1
  54. #define CAM_ISP_RES_COMP_GROUP_ID_1 2
  55. #define CAM_ISP_RES_COMP_GROUP_ID_2 3
  56. #define CAM_ISP_RES_COMP_GROUP_ID_3 4
  57. #define CAM_ISP_RES_COMP_GROUP_ID_4 5
  58. #define CAM_ISP_RES_COMP_GROUP_ID_5 6
  59. #define CAM_ISP_RES_COMP_GROUP_ID_MAX 6
  60. /* ISP packet opcode for ISP */
  61. #define CAM_ISP_PACKET_OP_BASE 0
  62. #define CAM_ISP_PACKET_INIT_DEV 1
  63. #define CAM_ISP_PACKET_UPDATE_DEV 2
  64. #define CAM_ISP_PACKET_OP_MAX 3
  65. /* ISP packet meta_data type for command buffer */
  66. #define CAM_ISP_PACKET_META_BASE 0
  67. #define CAM_ISP_PACKET_META_LEFT 1
  68. #define CAM_ISP_PACKET_META_RIGHT 2
  69. #define CAM_ISP_PACKET_META_COMMON 3
  70. #define CAM_ISP_PACKET_META_DMI_LEFT 4
  71. #define CAM_ISP_PACKET_META_DMI_RIGHT 5
  72. #define CAM_ISP_PACKET_META_DMI_COMMON 6
  73. #define CAM_ISP_PACKET_META_CLOCK 7
  74. #define CAM_ISP_PACKET_META_CSID 8
  75. #define CAM_ISP_PACKET_META_DUAL_CONFIG 9
  76. #define CAM_ISP_PACKET_META_GENERIC_BLOB_LEFT 10
  77. #define CAM_ISP_PACKET_META_GENERIC_BLOB_RIGHT 11
  78. #define CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON 12
  79. #define CAM_ISP_PACKET_META_REG_DUMP_PER_REQUEST 13
  80. #define CAM_ISP_PACKET_META_REG_DUMP_ON_FLUSH 14
  81. #define CAM_ISP_PACKET_META_REG_DUMP_ON_ERROR 15
  82. #define CAM_ISP_PACKET_META_CSID_LEFT 16
  83. #define CAM_ISP_PACKET_META_CSID_RIGHT 17
  84. #define CAM_ISP_PACKET_META_CSID_COMMON 18
  85. /* SFE packet meta_data type for command buffer */
  86. #define CAM_ISP_SFE_PACKET_META_LEFT 0x15
  87. #define CAM_ISP_SFE_PACKET_META_RIGHT 0x16
  88. #define CAM_ISP_SFE_PACKET_META_COMMON 0x17
  89. #define CAM_ISP_SFE_PACKET_META_DUAL_CONFIG 0x18
  90. /* DSP mode */
  91. #define CAM_ISP_DSP_MODE_NONE 0
  92. #define CAM_ISP_DSP_MODE_ONE_WAY 1
  93. #define CAM_ISP_DSP_MODE_ROUND 2
  94. /* ISP Generic Cmd Buffer Blob types */
  95. #define CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG 0
  96. #define CAM_ISP_GENERIC_BLOB_TYPE_CLOCK_CONFIG 1
  97. #define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG 2
  98. #define CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG 3
  99. #define CAM_ISP_GENERIC_BLOB_TYPE_CSID_CLOCK_CONFIG 4
  100. #define CAM_ISP_GENERIC_BLOB_TYPE_FE_CONFIG 5
  101. #define CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG_V2 6
  102. #define CAM_ISP_GENERIC_BLOB_TYPE_IFE_CORE_CONFIG 7
  103. #define CAM_ISP_GENERIC_BLOB_TYPE_VFE_OUT_CONFIG 8
  104. #define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2 9
  105. #define CAM_ISP_GENERIC_BLOB_TYPE_DISCARD_INITIAL_FRAMES 10
  106. #define CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG 11
  107. #define CAM_ISP_GENERIC_BLOB_TYPE_CSID_QCFA_CONFIG 12
  108. #define CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_BLANKING_CONFIG 13
  109. #define CAM_ISP_GENERIC_BLOB_TYPE_TPG_CORE_CONFIG 14
  110. #define CAM_ISP_GENERIC_BLOB_TYPE_DYNAMIC_MODE_SWITCH 15
  111. #define CAM_ISP_GENERIC_BLOB_TYPE_BW_LIMITER_CFG 16
  112. #define CAM_ISP_GENERIC_BLOB_TYPE_FPS_CONFIG 17
  113. #define CAM_ISP_GENERIC_BLOB_TYPE_INIT_CONFIG 18
  114. #define CAM_ISP_GENERIC_BLOB_TYPE_RDI_LCR_CONFIG 19
  115. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_FCG_CFG 20
  116. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_CLOCK_CONFIG 21
  117. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_CORE_CONFIG 22
  118. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_OUT_CONFIG 23
  119. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_HFR_CONFIG 24
  120. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_FE_CONFIG 25
  121. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_SCRATCH_BUF_CFG 26
  122. #define CAM_ISP_GENERIC_BLOB_TYPE_SFE_EXP_ORDER_CFG 27
  123. #define CAM_ISP_GENERIC_BLOB_TYPE_DRV_CONFIG 28
  124. #define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V3 29
  125. #define CAM_ISP_GENERIC_BLOB_TYPE_NFI_MODE_SWITCH 30
  126. #define CAM_ISP_GENERIC_BLOB_TYPE_IRQ_COMP_CFG 31
  127. #define CAM_ISP_GENERIC_BLOB_TYPE_VFE_OUT_CONFIG_V2 32
  128. #define CAM_ISP_GENERIC_BLOB_TYPE_IFE_FCG_CFG 33
  129. #define CAM_ISP_VC_DT_CFG 4
  130. #define CAM_ISP_IFE0_HW 0x1
  131. #define CAM_ISP_IFE1_HW 0x2
  132. #define CAM_ISP_IFE0_LITE_HW 0x4
  133. #define CAM_ISP_IFE1_LITE_HW 0x8
  134. #define CAM_ISP_IFE2_LITE_HW 0x10
  135. #define CAM_ISP_IFE3_LITE_HW 0x20
  136. #define CAM_ISP_IFE4_LITE_HW 0x40
  137. #define CAM_ISP_IFE2_HW 0x100
  138. #define CAM_ISP_SFE0_HW 0x1000
  139. #define CAM_ISP_SFE1_HW 0x2000
  140. #define CAM_ISP_SFE2_HW 0x4000
  141. #define CAM_ISP_PXL_PATH 0x1
  142. #define CAM_ISP_PPP_PATH 0x2
  143. #define CAM_ISP_LCR_PATH 0x4
  144. #define CAM_ISP_RDI0_PATH 0x8
  145. #define CAM_ISP_RDI1_PATH 0x10
  146. #define CAM_ISP_RDI2_PATH 0x20
  147. #define CAM_ISP_RDI3_PATH 0x40
  148. #define CAM_ISP_RDI4_PATH 0x80
  149. #define CAM_ISP_PXL1_PATH 0x100
  150. #define CAM_ISP_PXL2_PATH 0x200
  151. /*
  152. * Multi Context Mask
  153. */
  154. #define CAM_ISP_MULTI_CTXT0_MASK 0x1
  155. #define CAM_ISP_MULTI_CTXT1_MASK 0x2
  156. #define CAM_ISP_MULTI_CTXT2_MASK 0x4
  157. /* Per Path Usage Data */
  158. #define CAM_ISP_USAGE_INVALID 0
  159. #define CAM_ISP_USAGE_LEFT_PX 1
  160. #define CAM_ISP_USAGE_RIGHT_PX 2
  161. #define CAM_ISP_USAGE_RDI 3
  162. #define CAM_ISP_USAGE_SFE_LEFT 4
  163. #define CAM_ISP_USAGE_SFE_RIGHT 5
  164. #define CAM_ISP_USAGE_SFE_RDI 6
  165. /* Acquire with custom hw */
  166. #define CAM_ISP_ACQ_CUSTOM_NONE 0
  167. #define CAM_ISP_ACQ_CUSTOM_PRIMARY 1
  168. #define CAM_ISP_ACQ_CUSTOM_SECONDARY 2
  169. #define CAM_IFE_CSID_RDI_MAX 5
  170. /* Feature Flag indicators */
  171. #define CAM_ISP_PARAM_FETCH_SECURITY_MODE BIT(0)
  172. #define CAM_ISP_CAN_USE_LITE_MODE BIT(1)
  173. #define CAM_ISP_DYNAMIC_SENOR_SWITCH_EN BIT(2)
  174. #define CAM_ISP_SFE_BINNED_EPOCH_CFG_ENABLE BIT(3)
  175. #define CAM_ISP_EPD_SUPPORT BIT(4)
  176. #define CAM_ISP_SFE_FS_MODE_EN BIT(5)
  177. #define CAM_ISP_SFE_SHDR_MODE_EN BIT(6)
  178. #define CAM_ISP_AEB_MODE_EN BIT(7)
  179. #define CAM_ISP_HDR_MODE_DYNAMIC_SWITCH_EN BIT(8)
  180. #define CAM_ISP_NFI_BASED_MODE_SWITCH_EN BIT(9)
  181. /* ISP core cfg flag params */
  182. #define CAM_ISP_PARAM_CORE_CFG_HDR_MUX_SEL BIT(0)
  183. #define CAM_ISP_PARAM_CORE_CFG_PP_FORMAT BIT(16)
  184. /* Indicate which module is configured for FCG */
  185. #define CAM_ISP_FCG_ENABLE_PHASE BIT(0)
  186. #define CAM_ISP_FCG_ENABLE_STATS BIT(1)
  187. /*
  188. * Indicate which channel is configured for FCG
  189. * For SFE, channel 1/2 are used on demand
  190. * For IFE, treat it as channel 0
  191. * For TFE, use Multi Context Mask to indicate the path
  192. */
  193. #define CAM_ISP_FCG_MASK_CH0 0x1
  194. #define CAM_ISP_FCG_MASK_CH1 0x2
  195. #define CAM_ISP_FCG_MASK_CH2 0x4
  196. /**
  197. * Decode format1 Support for multi VCDT use case.
  198. * Format type is packed in 8 bits. BIT(0-7) is
  199. * format and BIT(8-15) is format1 type in the format
  200. * variable
  201. */
  202. #define CAM_IFE_DECODE_FORMAT_MASK 0xFF
  203. #define CAM_IFE_DECODE_FORMAT_SHIFT_VAL 8
  204. /*
  205. * to indicate if packing is to be done at Bus side.
  206. * CSID gives the plain data and packed at bus.
  207. * This mask reserves the param_mask for cam_isp_out_port_info_v3.
  208. *
  209. */
  210. #define CAM_IFE_USE_WM_PACK BIT(0)
  211. /*
  212. * to indicate if RCS to be enabled.
  213. */
  214. #define CAM_IFE_WM_RCS_EN BIT(1)
  215. /**
  216. * struct cam_isp_irq_comp_cfg - CSID composite config for MC-based TFE
  217. * Contains information regarding active contexts in CSID CAMIF
  218. * and active contexts in write engine TFE
  219. *
  220. * @ipp_src_ctxt_mask : Active paths in CSID CAMIF
  221. * @ipp_dst_comp_mask : Active paths in TFE
  222. * @num_valid_params : Number of valid params
  223. * @valid_param_mask : Valid param mask
  224. * @params : params
  225. */
  226. struct cam_isp_irq_comp_cfg {
  227. __u32 ipp_src_ctxt_mask;
  228. __u32 ipp_dst_comp_mask;
  229. __u32 num_valid_params;
  230. __u32 valid_param_mask;
  231. __u32 params[4];
  232. } __attribute__((packed));
  233. /**
  234. * struct cam_isp_drv_config - CSID config for DRV
  235. * Enables DRV and provides worst case timeout value in INIT packet,
  236. * provides path_idle_en and timeout updates (if any) in UPDATE packet
  237. *
  238. * @drv_en : Enables DRV block
  239. * @timeout_val : Timeout value from SOF to trigger vote up,
  240. * given in number of Global Counter cycles.
  241. * @path_idle_en : Mask for paths to be considered for consolidated IDLE signal.
  242. * When paths matching the mask go idle, BW is voted down.
  243. * @num_valid_params : Number of valid params
  244. * @valid_param_mask : Valid param mask
  245. * @params : params
  246. */
  247. struct cam_isp_drv_config {
  248. __u32 drv_en;
  249. __u32 timeout_val;
  250. __u32 path_idle_en;
  251. __u32 num_valid_params;
  252. __u32 valid_param_mask;
  253. __u32 params[5];
  254. } __attribute__((packed));
  255. /* Query devices */
  256. /**
  257. * struct cam_isp_dev_cap_info - A cap info for particular hw type
  258. *
  259. * @hw_type: Hardware type for the cap info
  260. * @num_hw: Number of HW of type @hw_type
  261. * @hw_version: Hardware version
  262. *
  263. */
  264. struct cam_isp_dev_cap_info {
  265. __u32 hw_type;
  266. __u32 num_hw;
  267. struct cam_hw_version hw_version;
  268. };
  269. /**
  270. * struct cam_isp_query_cap_cmd - ISP query device capability payload
  271. *
  272. * @device_iommu: returned iommu handles for device
  273. * @cdm_iommu: returned iommu handles for cdm
  274. * @num_dev: returned number of device capabilities
  275. * @reserved: reserved field for alignment
  276. * @dev_caps: returned device capability array
  277. *
  278. */
  279. struct cam_isp_query_cap_cmd {
  280. struct cam_iommu_handle device_iommu;
  281. struct cam_iommu_handle cdm_iommu;
  282. __s32 num_dev;
  283. __u32 reserved;
  284. struct cam_isp_dev_cap_info dev_caps[CAM_ISP_HW_MAX];
  285. };
  286. /* Acquire Device */
  287. /**
  288. * struct cam_isp_out_port_info - An output port resource info
  289. *
  290. * @res_type: output resource type defined in file
  291. * cam_isp_vfe.h or cam_isp_ife.h
  292. * @format: output format of the resource
  293. * @wdith: output width in pixels
  294. * @height: output height in lines
  295. * @comp_grp_id: composite group id for the resource.
  296. * @split_point: split point in pixels for the dual VFE.
  297. * @secure_mode: flag to tell if output should be run in secure
  298. * mode or not. See cam_defs.h for definition
  299. * @reserved: reserved field for alignment
  300. *
  301. */
  302. struct cam_isp_out_port_info {
  303. __u32 res_type;
  304. __u32 format;
  305. __u32 width;
  306. __u32 height;
  307. __u32 comp_grp_id;
  308. __u32 split_point;
  309. __u32 secure_mode;
  310. __u32 reserved;
  311. };
  312. /**
  313. * struct cam_isp_out_port_info_v2 - An output port resource info
  314. *
  315. * @res_type: output resource type defined in file
  316. * cam_isp_vfe.h or cam_isp_ife.h
  317. * @format: output format of the resource
  318. * @wdith: output width in pixels
  319. * @height: output height in lines
  320. * @comp_grp_id: composite group id for the resource.
  321. * @split_point: split point in pixels for the dual VFE.
  322. * @secure_mode: flag to tell if output should be run in secure
  323. * mode or not. See cam_defs.h for definition
  324. * @wm_mode: WM mode
  325. * @out_port_res1: Output reserved field
  326. * @out_port_res2: Output reserved field
  327. *
  328. */
  329. struct cam_isp_out_port_info_v2 {
  330. __u32 res_type;
  331. __u32 format;
  332. __u32 width;
  333. __u32 height;
  334. __u32 comp_grp_id;
  335. __u32 split_point;
  336. __u32 secure_mode;
  337. __u32 wm_mode;
  338. __u32 out_port_res1;
  339. __u32 out_port_res2;
  340. };
  341. /**
  342. * struct cam_isp_in_port_info - An input port resource info
  343. *
  344. * @res_type: input resource type define in file
  345. * cam_isp_vfe.h or cam_isp_ife.h
  346. * @lane_type: lane type: c-phy or d-phy.
  347. * @lane_num: active lane number
  348. * @lane_cfg: lane configurations: 4 bits per lane
  349. * @vc: input virtual channel number
  350. * @dt: input data type number
  351. * @format: input format
  352. * @test_pattern: test pattern for the testgen
  353. * @usage_type: whether dual vfe is required
  354. * @left_start: left input start offset in pixels
  355. * @left_stop: left input stop offset in pixels
  356. * @left_width: left input width in pixels
  357. * @right_start: right input start offset in pixels.
  358. * Only for Dual VFE
  359. * @right_stop: right input stop offset in pixels.
  360. * Only for Dual VFE
  361. * @right_width: right input width in pixels.
  362. * Only for dual VFE
  363. * @line_start: top of the line number
  364. * @line_stop: bottome of the line number
  365. * @height: input height in lines
  366. * @pixel_clk; sensor output clock
  367. * @batch_size: batch size for HFR mode
  368. * @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*)
  369. * @hbi_cnt: HBI count for the camif input
  370. * @reserved: Reserved field for alignment
  371. * @num_out_res: number of the output resource associated
  372. * @data: payload that contains the output resources
  373. *
  374. */
  375. struct cam_isp_in_port_info {
  376. __u32 res_type;
  377. __u32 lane_type;
  378. __u32 lane_num;
  379. __u32 lane_cfg;
  380. __u32 vc;
  381. __u32 dt;
  382. __u32 format;
  383. __u32 test_pattern;
  384. __u32 usage_type;
  385. __u32 left_start;
  386. __u32 left_stop;
  387. __u32 left_width;
  388. __u32 right_start;
  389. __u32 right_stop;
  390. __u32 right_width;
  391. __u32 line_start;
  392. __u32 line_stop;
  393. __u32 height;
  394. __u32 pixel_clk;
  395. __u32 batch_size;
  396. __u32 dsp_mode;
  397. __u32 hbi_cnt;
  398. __u32 reserved;
  399. __u32 num_out_res;
  400. struct cam_isp_out_port_info data[1];
  401. };
  402. /**
  403. * struct cam_isp_in_port_info_v2 - An input port resource info
  404. *
  405. * @res_type: input resource type define in file
  406. * cam_isp_vfe.h or cam_isp_ife.h
  407. * @lane_type: lane type: c-phy or d-phy.
  408. * @lane_num: active lane number
  409. * @lane_cfg: lane configurations: 4 bits per lane
  410. * @vc: input virtual channel number
  411. * @dt: input data type number
  412. * @num_valid_vc_dt: valid vc and dt in array
  413. * @format: input format
  414. * @test_pattern: test pattern for the testgen
  415. * @usage_type: whether dual vfe is required
  416. * @left_start: left input start offset in pixels
  417. * @left_stop: left input stop offset in pixels
  418. * @left_width: left input width in pixels
  419. * @right_start: right input start offset in pixels.
  420. * Only for Dual VFE
  421. * @right_stop: right input stop offset in pixels.
  422. * only for Dual VFE
  423. * @right_width: right input width in pixels.
  424. * only for dual VFE
  425. * @line_start: top of the line number
  426. * @line_stop: bottome of the line number
  427. * @height: input height in lines
  428. * @pixel_clk; sensor output clock
  429. * @batch_size: batch size for HFR mode
  430. * @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*)
  431. * @hbi_cnt: HBI count for the camif input
  432. * @cust_node: if any custom HW block is present before IFE
  433. * @num_out_res: number of the output resource associated
  434. * @bidirectional_bin: [0 : 15] - Set 1 for Horizontal binning
  435. * [16 : 31] - Set 1 for Vertical binning
  436. * @qcfa_bin: Quadra Binning info
  437. * @sfe_in_path_type: SFE input path type
  438. * 0:15 - refer to cam_isp_sfe.h for SFE paths
  439. * 16:31 - Corresponding IFE i/p path type
  440. * Example:((CAM_ISP_PXL_PATH << 16) |
  441. * CAM_ISP_SFE_INLINE_PIX)
  442. * This will acquire SFE inline IPP and IFE IPP
  443. * PPP is an exception CSID PPP -> IFE PPP
  444. * @feature_flag: See the macros defined under feature flag above
  445. * @ife_res_1: payload for future use.
  446. * @ife_res_2: payload for future use.
  447. * @data: payload that contains the output resources
  448. *
  449. */
  450. struct cam_isp_in_port_info_v2 {
  451. __u32 res_type;
  452. __u32 lane_type;
  453. __u32 lane_num;
  454. __u32 lane_cfg;
  455. __u32 vc[CAM_ISP_VC_DT_CFG];
  456. __u32 dt[CAM_ISP_VC_DT_CFG];
  457. __u32 num_valid_vc_dt;
  458. __u32 format;
  459. __u32 test_pattern;
  460. __u32 usage_type;
  461. __u32 left_start;
  462. __u32 left_stop;
  463. __u32 left_width;
  464. __u32 right_start;
  465. __u32 right_stop;
  466. __u32 right_width;
  467. __u32 line_start;
  468. __u32 line_stop;
  469. __u32 height;
  470. __u32 pixel_clk;
  471. __u32 batch_size;
  472. __u32 dsp_mode;
  473. __u32 hbi_cnt;
  474. __u32 cust_node;
  475. __u32 num_out_res;
  476. __u32 offline_mode;
  477. __u32 bidirectional_bin;
  478. __u32 qcfa_bin;
  479. __u32 sfe_in_path_type;
  480. __u32 feature_flag;
  481. __u32 ife_res_1;
  482. __u32 ife_res_2;
  483. struct cam_isp_out_port_info_v2 data[1];
  484. };
  485. /**
  486. * struct cam_isp_in_port_phy_info - CSID in port PHY info
  487. *
  488. * @res_type: input resource for the stream
  489. * @lane_type: Lane type--> C-Phy/ D-Phy
  490. * @lane_num: Number of lanes
  491. * @lane_cfg: Lane Configuraion
  492. */
  493. struct cam_isp_in_port_phy_info {
  494. __u32 res_type;
  495. __u32 lane_type;
  496. __u32 lane_num;
  497. __u32 lane_cfg;
  498. };
  499. /**
  500. * struct cam_isp_in_port_csid_info - CSID in port info
  501. *
  502. * @vc: Virtual Channel for the incoming stream
  503. * @dt: Data type for the incoming stream
  504. * @num_valid_vc_dt Number of valid vc dt in case of multi vc dt on a single path
  505. * @format: Incoming format for this input
  506. * @width: Width of incoming stream
  507. * @height: Height of incoming stream
  508. * @path_id: CSID IPP Path to be acquired
  509. * @param_mask: Reserved field to add new features
  510. * @params: Reserved fields
  511. */
  512. struct cam_isp_in_port_csid_info {
  513. __u32 vc[CAM_ISP_VC_DT_CFG];
  514. __u32 dt[CAM_ISP_VC_DT_CFG];
  515. __u32 num_valid_vc_dt;
  516. __u32 format;
  517. __u32 width;
  518. __u32 height;
  519. __u32 path_id;
  520. __u32 param_mask;
  521. __u32 params[7];
  522. };
  523. /**
  524. * struct cam_isp_out_port_info_v3 - An output port resource info
  525. *
  526. * @res_type: output resource type defined in file
  527. * cam_isp_vfe.h or cam_isp_ife.h
  528. * @format: output format of the resource
  529. * @width: output width in pixels
  530. * @height: output height in lines
  531. * @comp_grp_id: composite group id for the resource.
  532. * @split_point: split point in pixels for the dual VFE.
  533. * @secure_mode: flag to tell if output should be run in secure
  534. * mode or not. See cam_defs.h for definition
  535. * @wm_mode: WM mode
  536. * @context_id: Context ID in case of multi context
  537. * @param_mask: Reserved field to add new features
  538. * @params: Reserved fields
  539. */
  540. struct cam_isp_out_port_info_v3 {
  541. __u32 res_type;
  542. __u32 format;
  543. __u32 width;
  544. __u32 height;
  545. __u32 comp_grp_id;
  546. __u32 split_point;
  547. __u32 secure_mode;
  548. __u32 wm_mode;
  549. __u32 context_id;
  550. __u32 param_mask;
  551. __u32 params[6];
  552. };
  553. /**
  554. * struct cam_isp_in_port_info_v3 - A resource bundle
  555. *
  556. * @csid_info: resource id for the resource bundle
  557. * @phy_info: length of the while resource blob
  558. * @num_contexts Num of contexts in case of multi context
  559. * @feature_mask: Feature mask to store bit fields for any specific use case
  560. * @data: Pointer to out resource data
  561. */
  562. struct cam_isp_in_port_info_v3 {
  563. struct cam_isp_in_port_csid_info csid_info;
  564. struct cam_isp_in_port_phy_info phy_info;
  565. __u32 num_contexts;
  566. __u32 feature_mask;
  567. __u32 num_out_res;
  568. struct cam_isp_out_port_info_v3 data[1];
  569. };
  570. /**
  571. * struct cam_isp_resource - A resource bundle
  572. *
  573. * @resoruce_id: resource id for the resource bundle
  574. * @length: length of the while resource blob
  575. * @handle_type: type of the resource handle
  576. * @reserved: reserved field for alignment
  577. * @res_hdl: resource handle that points to the
  578. * resource array;
  579. *
  580. */
  581. struct cam_isp_resource {
  582. __u32 resource_id;
  583. __u32 length;
  584. __u32 handle_type;
  585. __u32 reserved;
  586. __u64 res_hdl;
  587. };
  588. /**
  589. * struct cam_isp_port_hfr_config - HFR configuration for this port
  590. *
  591. * @resource_type: Resource type
  592. * @subsample_pattern: Subsample pattern. Used in HFR mode. It
  593. * should be consistent with batchSize and
  594. * CAMIF programming.
  595. * @subsample_period: Subsample period. Used in HFR mode. It
  596. * should be consistent with batchSize and
  597. * CAMIF programming.
  598. * @framedrop_pattern: Framedrop pattern
  599. * @framedrop_period: Framedrop period
  600. * @reserved: Reserved for alignment
  601. */
  602. struct cam_isp_port_hfr_config {
  603. __u32 resource_type;
  604. __u32 subsample_pattern;
  605. __u32 subsample_period;
  606. __u32 framedrop_pattern;
  607. __u32 framedrop_period;
  608. __u32 reserved;
  609. } __attribute__((packed));
  610. /**
  611. * struct cam_isp_resource_hfr_config - Resource HFR configuration
  612. *
  613. * @num_ports: Number of ports
  614. * @reserved: Reserved for alignment
  615. * @port_hfr_config: HFR configuration for each IO port
  616. */
  617. struct cam_isp_resource_hfr_config {
  618. __u32 num_ports;
  619. __u32 reserved;
  620. struct cam_isp_port_hfr_config port_hfr_config[1];
  621. } __attribute__((packed));
  622. /**
  623. * struct cam_isp_dual_split_params - dual isp spilt parameters
  624. *
  625. * @split_point: Split point information x, where (0 < x < width)
  626. * left ISP's input ends at x + righ padding and
  627. * Right ISP's input starts at x - left padding
  628. * @right_padding: Padding added past the split point for left
  629. * ISP's input
  630. * @left_padding: Padding added before split point for right
  631. * ISP's input
  632. * @reserved: Reserved filed for alignment
  633. *
  634. */
  635. struct cam_isp_dual_split_params {
  636. __u32 split_point;
  637. __u32 right_padding;
  638. __u32 left_padding;
  639. __u32 reserved;
  640. };
  641. /**
  642. * struct cam_isp_dual_stripe_config - stripe config per bus client
  643. *
  644. * @offset: Start horizontal offset relative to
  645. * output buffer
  646. * In UBWC mode, this value indicates the H_INIT
  647. * value in pixel
  648. * @width: Width of the stripe in bytes
  649. * @tileconfig Ubwc meta tile config. Contain the partial
  650. * tile info
  651. * @port_id: port id of ISP output
  652. *
  653. */
  654. struct cam_isp_dual_stripe_config {
  655. __u32 offset;
  656. __u32 width;
  657. __u32 tileconfig;
  658. __u32 port_id;
  659. };
  660. /**
  661. * struct cam_isp_dual_config - dual isp configuration
  662. *
  663. * @num_ports Number of isp output ports
  664. * @reserved Reserved field for alignment
  665. * @split_params: Inpput split parameters
  666. * @stripes: Stripe information
  667. *
  668. */
  669. struct cam_isp_dual_config {
  670. __u32 num_ports;
  671. __u32 reserved;
  672. struct cam_isp_dual_split_params split_params;
  673. struct cam_isp_dual_stripe_config stripes[1];
  674. } __attribute__((packed));
  675. /**
  676. * struct cam_isp_clock_config - Clock configuration
  677. *
  678. * @usage_type: Usage type (Single/Dual)
  679. * @num_rdi: Number of RDI votes
  680. * @left_pix_hz: Pixel Clock for Left ISP
  681. * @right_pix_hz: Pixel Clock for Right ISP, valid only if Dual
  682. * @rdi_hz: RDI Clock. ISP clock will be max of RDI and
  683. * PIX clocks. For a particular context which ISP
  684. * HW the RDI is allocated to is not known to UMD.
  685. * Hence pass the clock and let KMD decide.
  686. */
  687. struct cam_isp_clock_config {
  688. __u32 usage_type;
  689. __u32 num_rdi;
  690. __u64 left_pix_hz;
  691. __u64 right_pix_hz;
  692. __u64 rdi_hz[1];
  693. } __attribute__((packed));
  694. /**
  695. * struct cam_isp_csid_clock_config - CSID clock configuration
  696. *
  697. * @csid_clock CSID clock
  698. */
  699. struct cam_isp_csid_clock_config {
  700. __u64 csid_clock;
  701. } __attribute__((packed));
  702. /**
  703. * struct cam_isp_csid_qcfa_config - CSID qcfa binning support configuration
  704. *
  705. * @csid_binning CSID binning
  706. */
  707. struct cam_isp_csid_qcfa_config {
  708. __u32 csid_binning;
  709. } __attribute__((packed));
  710. /**
  711. * struct cam_isp_bw_vote - Bandwidth vote information
  712. *
  713. * @resource_id: Resource ID
  714. * @reserved: Reserved field for alignment
  715. * @cam_bw_bps: Bandwidth vote for CAMNOC
  716. * @ext_bw_bps: Bandwidth vote for path-to-DDR after CAMNOC
  717. */
  718. struct cam_isp_bw_vote {
  719. __u32 resource_id;
  720. __u32 reserved;
  721. __u64 cam_bw_bps;
  722. __u64 ext_bw_bps;
  723. } __attribute__((packed));
  724. /**
  725. * struct cam_isp_bw_config - Bandwidth configuration
  726. *
  727. * @usage_type: Usage type (Single/Dual)
  728. * @num_rdi: Number of RDI votes
  729. * @left_pix_vote: Bandwidth vote for left ISP
  730. * @right_pix_vote: Bandwidth vote for right ISP
  731. * @rdi_vote: RDI bandwidth requirements
  732. */
  733. struct cam_isp_bw_config {
  734. __u32 usage_type;
  735. __u32 num_rdi;
  736. struct cam_isp_bw_vote left_pix_vote;
  737. struct cam_isp_bw_vote right_pix_vote;
  738. struct cam_isp_bw_vote rdi_vote[1];
  739. } __attribute__((packed));
  740. /**
  741. * struct cam_isp_bw_config_v2 - Bandwidth configuration
  742. *
  743. * @usage_type: Usage type (Single/Dual)
  744. * @num_paths: Number of axi data paths
  745. * @axi_path Per path vote info
  746. */
  747. struct cam_isp_bw_config_v2 {
  748. __u32 usage_type;
  749. __u32 num_paths;
  750. struct cam_axi_per_path_bw_vote axi_path[1];
  751. } __attribute__((packed));
  752. /**
  753. * struct cam_isp_bw_config_v3 - Bandwidth configuration
  754. *
  755. * @usage_type: Usage type (Single/Dual)
  756. * @num_paths: Number of axi data paths
  757. * @num_valid_params: Number of valid params
  758. * @valid_param_mask: Valid param mask
  759. * @params: params
  760. * @axi_path: Per path vote info v2
  761. */
  762. struct cam_isp_bw_config_v3 {
  763. __u32 usage_type;
  764. __u32 num_paths;
  765. __u32 num_valid_params;
  766. __u32 valid_param_mask;
  767. __u32 params[4];
  768. struct cam_axi_per_path_bw_vote_v2 axi_path[1];
  769. } __attribute__((packed));
  770. /**
  771. * struct cam_fe_config - Fetch Engine configuration
  772. *
  773. * @version: fetch engine veriosn
  774. * @min_vbi: require min vbi
  775. * @fs_mode: indicates if fs mode enabled
  776. * @fs_line_sync_en: frame level sync or line level
  777. * sync for fetch engine
  778. * @hbi_count: hbi count
  779. * @fs_sync_enable: indicates if fetch engine working
  780. * wokring in sync with write engine
  781. * @go_cmd_sel: softwrae go_cmd or hw go_cmd
  782. * @client_enable: enable read engine
  783. * @source_addr: adrress of buffer to read from
  784. * @width: buffer width
  785. * @height: buffer height
  786. * @stride: buffer stride (here equal to width)
  787. * @format: format of image in buffer
  788. * @unpacker_cfg: unpacker config type
  789. * @latency_buf_size: latency buffer for read engine
  790. */
  791. struct cam_fe_config {
  792. __u64 version;
  793. __u32 min_vbi;
  794. __u32 fs_mode;
  795. __u32 fs_line_sync_en;
  796. __u32 hbi_count;
  797. __u32 fs_sync_enable;
  798. __u32 go_cmd_sel;
  799. __u32 client_enable;
  800. __u32 source_addr;
  801. __u32 width;
  802. __u32 height;
  803. __u32 stride;
  804. __u32 format;
  805. __u32 unpacker_cfg;
  806. __u32 latency_buf_size;
  807. } __attribute__((packed));
  808. /**
  809. * struct cam_isp_sensor_path_dimension
  810. *
  811. * @width expected width
  812. * @height expected height
  813. * @measure_enabled flag to indicate if pixel measurement is to be enabled
  814. */
  815. struct cam_isp_sensor_dimension {
  816. __u32 width;
  817. __u32 height;
  818. __u32 measure_enabled;
  819. } __attribute__((packed));
  820. /**
  821. * struct cam_isp_sensor_blanking_config
  822. *
  823. * @hbi HBI value
  824. * @vbi VBI value
  825. */
  826. struct cam_isp_sensor_blanking_config {
  827. __u32 hbi;
  828. __u32 vbi;
  829. } __attribute__((packed));
  830. /**
  831. * struct cam_isp_sensor_config - Sensor Dimension configuration
  832. *
  833. * @ppp_path: expected ppp path configuration
  834. * @ipp_path: expected ipp path configuration
  835. * @rdi_path: expected rdi path configuration
  836. * @hbi: HBI value
  837. * @vbi: VBI value
  838. */
  839. struct cam_isp_sensor_config {
  840. struct cam_isp_sensor_dimension ppp_path;
  841. struct cam_isp_sensor_dimension ipp_path;
  842. struct cam_isp_sensor_dimension rdi_path[CAM_IFE_CSID_RDI_MAX];
  843. __u32 hbi;
  844. __u32 vbi;
  845. } __attribute__((packed));
  846. /**
  847. * struct cam_isp_core_config - ISP core registers configuration
  848. *
  849. * @version: Version info
  850. * @vid_ds16_r2pd: Enables Y and C merging PD output for video DS16
  851. * @vid_ds4_r2pd: Enables Y and C merging PD output for video DS4
  852. * @disp_ds16_r2pd: Enables Y and C merging PD output for disp DS16
  853. * @disp_ds4_r2pd: Enables Y and C merging PD output for disp DS4
  854. * @dsp_streaming_tap_point: This selects source for DSP streaming interface
  855. * @ihist_src_sel: Selects input for IHIST module
  856. * @hdr_be_src_sel: Selects input for HDR BE module
  857. * @hdr_bhist_src_sel: Selects input for HDR BHIST module
  858. * @input_mux_sel_pdaf: Selects input for PDAF
  859. * @input_mux_sel_pp: Selects input for Pixel Pipe
  860. * @core_cfg_flag: Core config flag to set HDR mux/PP
  861. * input format type
  862. */
  863. struct cam_isp_core_config {
  864. __u32 version;
  865. __u32 vid_ds16_r2pd;
  866. __u32 vid_ds4_r2pd;
  867. __u32 disp_ds16_r2pd;
  868. __u32 disp_ds4_r2pd;
  869. __u32 dsp_streaming_tap_point;
  870. __u32 ihist_src_sel;
  871. __u32 hdr_be_src_sel;
  872. __u32 hdr_bhist_src_sel;
  873. __u32 input_mux_sel_pdaf;
  874. __u32 input_mux_sel_pp;
  875. __u32 core_cfg_flag;
  876. } __attribute__((packed));
  877. /**
  878. * struct cam_isp_sfe_core_config - SFE core registers configuration
  879. *
  880. * @version : Version info
  881. * @mode_sel : Selects core for sHDR/non-sHDR mode
  882. * @ops_mode_cfg : Selects core if is inline/offline mode
  883. * @fs_mode_cfg : Selects output in fast shutter mode
  884. * @sfe_params : SFE params for future use
  885. */
  886. struct cam_isp_sfe_core_config {
  887. __u32 version;
  888. __u32 mode_sel;
  889. __u32 ops_mode_cfg;
  890. __u32 fs_mode_cfg;
  891. __u32 sfe_params[6];
  892. } __attribute__((packed));
  893. /**
  894. * struct cam_isp_sfe_scratch_buf_info - Scratch buf info
  895. *
  896. * @mem_handle : Scratch buffer handle
  897. * @offset : Offset to the buffer
  898. * @width : Width in pixels
  899. * @height : Height in pixels
  900. * @stride : Stride in pixels
  901. * @slice_height : Slice height in lines
  902. * @resource_type : rsrc type
  903. * @scratch_buf_params : for future use
  904. */
  905. struct cam_isp_sfe_scratch_buf_info {
  906. __s32 mem_handle;
  907. __u32 offset;
  908. __u32 width;
  909. __u32 height;
  910. __u32 stride;
  911. __u32 slice_height;
  912. __u32 resource_type;
  913. __u32 scratch_buf_params[5];
  914. };
  915. /**
  916. * struct cam_isp_sfe_init_scratch_buf_config - SFE init buffer cfg
  917. * Provides scratch buffer info for SFE ports
  918. * as part of INIT packet
  919. *
  920. * @num_ports : Number of ports
  921. * @reserved : reserved
  922. * @port_scratch_cfg : scratch buffer info
  923. */
  924. struct cam_isp_sfe_init_scratch_buf_config {
  925. __u32 num_ports;
  926. __u32 reserved;
  927. struct cam_isp_sfe_scratch_buf_info port_scratch_cfg[1];
  928. };
  929. /**
  930. * struct cam_isp_predict_fcg_config - FCG config in a single prediction
  931. *
  932. * @version: Version Info
  933. * @phase_index_g: Starting index of LUT for G channel in phase
  934. * @phase_index_r: Starting index of LUT for R channel in phase
  935. * @phase_index_b: Starting index of LUT for B channel in phase
  936. * @stats_index_g: Starting index of LUT for G channel in stats
  937. * @stats_index_r: Starting index of LUT for R channel in stats
  938. * @stats_index_b: Starting index of LUT for B channel in stats
  939. * @num_valid_params: Number of valid params being used
  940. * @valid_param_mask: Indicate the exact params being used
  941. * @params: Params for future change
  942. */
  943. struct cam_isp_predict_fcg_config {
  944. __u32 version;
  945. __u32 phase_index_g;
  946. __u32 phase_index_r;
  947. __u32 phase_index_b;
  948. __u32 stats_index_g;
  949. __u32 stats_index_r;
  950. __u32 stats_index_b;
  951. __u32 num_valid_params;
  952. __u32 valid_param_mask;
  953. __u32 params[5];
  954. };
  955. /**
  956. * struct cam_isp_ch_ctx_fcg_config - FCG config in a single channel for SFE/IFE
  957. * or in a single context in TFE
  958. *
  959. * @version: Version Info
  960. * @fcg_ch_ctx_id: Index of the channel to be configured that FCG
  961. * blocks reside on. If one wants to config FCG
  962. * block for IFE/SFE, CAM_ISP_FCG_MASK_CH0/1/2 is
  963. * used. If one wants to config FCG block for TFE,
  964. * multi context mask is used.
  965. * @fcg_enable_mask: Indicate which module will be enabled for
  966. * FCG. For example, if one wants to config
  967. * SFE FCG STATS module, CAM_ISP_FCG_ENABLE_STATS
  968. * will be set in mask
  969. * @num_valid_params: Number of valid params being used
  970. * @valid_param_mask: Indicate the exact params being used
  971. * @params: Params for future change
  972. * @predicted_fcg_configs: Pointer to fcg config for each prediction of
  973. * the channel in serial order
  974. */
  975. struct cam_isp_ch_ctx_fcg_config {
  976. __u32 version;
  977. __u32 fcg_ch_ctx_id;
  978. __u32 fcg_enable_mask;
  979. __u32 num_valid_params;
  980. __u32 valid_param_mask;
  981. __u32 params[5];
  982. struct cam_isp_predict_fcg_config predicted_fcg_configs[1];
  983. };
  984. /**
  985. * struct cam_isp_generic_fcg_config - FCG config for a frame
  986. *
  987. * @version: Version info
  988. * @size: Size for the whole FCG configurations
  989. * @num_ch_ctx: Number of channels for fcg config in SFE/IFE
  990. * or number of contexts in TFE
  991. * @num_predictions: Number of predictions for each channel
  992. * in SFE/IFE or for each context in TFE
  993. * @num_valid_params: Number of valid params being used
  994. * @valid_param_mask: Indicate the exact params being used
  995. * @params: Params for future change
  996. * @ch_ctx_fcg_configs: Pointer to fcg config for each channel in
  997. * SFE/IFE or for each context in TFE
  998. */
  999. struct cam_isp_generic_fcg_config {
  1000. __u32 version;
  1001. __u32 size;
  1002. __u32 num_ch_ctx;
  1003. __u32 num_predictions;
  1004. __u32 num_valid_params;
  1005. __u32 valid_params_mask;
  1006. __u32 params[4];
  1007. struct cam_isp_ch_ctx_fcg_config ch_ctx_fcg_configs[1];
  1008. };
  1009. /**
  1010. * struct cam_isp_tpg_core_config - TPG core registers configuration
  1011. *
  1012. * @version : Version info
  1013. * @vc_dt_pattern_id : TPG pattern - SparsePD, sHDR etc.
  1014. * @qcfa_en : Selects qcfa in color bar
  1015. * @pix_pattern : Pix pattern color bar cfg
  1016. * @hbi_clk_cnt : Number of HBI # of cycles
  1017. * @vbi_clk_cnt : Number of VBI # of cycles
  1018. * @throttle_pattern : Defines bubble pattern in throttler
  1019. * @tpg_params : TPG params for future use
  1020. */
  1021. struct cam_isp_tpg_core_config {
  1022. __u32 version;
  1023. __u32 vc_dt_pattern_id;
  1024. __u32 qcfa_en;
  1025. __u32 pix_pattern;
  1026. __u32 hbi_clk_cnt;
  1027. __u32 vbi_clk_cnt;
  1028. __u32 throttle_pattern;
  1029. __u32 tpg_params[3];
  1030. } __attribute__((packed));
  1031. /**
  1032. * struct cam_isp_acquire_hw_info - ISP acquire HW params
  1033. *
  1034. * @common_info_version : Version of common info struct used
  1035. * @common_info_size : Size of common info struct used
  1036. * @common_info_offset : Offset of common info from start of data
  1037. * @num_inputs : Number of inputs
  1038. * @input_info_version : Version of input info struct used
  1039. * @input_info_size : Size of input info struct used
  1040. * @input_info_offset : Offset of input info from start of data
  1041. * @data : Start of data region
  1042. */
  1043. struct cam_isp_acquire_hw_info {
  1044. __u16 common_info_version;
  1045. __u16 common_info_size;
  1046. __u32 common_info_offset;
  1047. __u32 num_inputs;
  1048. __u32 input_info_version;
  1049. __u32 input_info_size;
  1050. __u32 input_info_offset;
  1051. __u64 data;
  1052. };
  1053. /**
  1054. * struct cam_isp_vfe_wm_config - VFE write master config per port
  1055. *
  1056. * @port_type : Unique ID of output port
  1057. * @wm_mode : Write master mode
  1058. * 0x0 - Line based mode
  1059. * 0x1 - Frame based mode
  1060. * 0x2 - Index based mode, valid for BAF only
  1061. * @h_init : Horizontal starting coordinate in pixels. Must be a
  1062. * multiple of 3 for TP10 format
  1063. * @height : Height in pixels
  1064. * @width : Width in pixels
  1065. * @virtual_frame_en : Enabling virtual frame will prevent actual request from
  1066. * being sent to NOC
  1067. * @stride : Write master stride
  1068. * @offset : Write master offset
  1069. * @addr_reuse_en : Enabling addr-reuse will write output to the same addr
  1070. * after the last addr that was read from FIFO.
  1071. * @packer_format : Update packer format for Write master config
  1072. * @reserved_3 : Reserved field for Write master config
  1073. * For acquired version 3-->corresponds to context_id_mask
  1074. * @reserved_4 : Reserved field for Write master config
  1075. */
  1076. struct cam_isp_vfe_wm_config {
  1077. __u32 port_type;
  1078. __u32 wm_mode;
  1079. __u32 h_init;
  1080. __u32 height;
  1081. __u32 width;
  1082. __u32 virtual_frame_en;
  1083. __u32 stride;
  1084. __u32 offset;
  1085. __u32 addr_reuse_en;
  1086. __u32 packer_format;
  1087. __u32 reserved_3;
  1088. __u32 reserved_4;
  1089. };
  1090. /**
  1091. * struct cam_isp_vfe_wm_config_v2 - VFE write master config per port
  1092. *
  1093. * @version : Version for this structure
  1094. * @port_type : Unique ID of output port
  1095. * @wm_mode : Write master mode
  1096. * 0x0 - Line based mode
  1097. * 0x1 - Frame based mode
  1098. * 0x2 - Index based mode, valid for BAF only
  1099. * @h_init : Horizontal starting coordinate in pixels. Must be a
  1100. * multiple of 3 for TP10 format
  1101. * @height : Height in pixels
  1102. * @width : Width in pixels
  1103. * @virtual_frame_en : Enabling virtual frame will prevent actual request from
  1104. * being sent to NOC
  1105. * @stride : Write master stride
  1106. * @offset : Write master offset
  1107. * @addr_reuse_en : Enabling addr-reuse will write output to the same addr
  1108. * after the last addr that was read from FIFO.
  1109. * @packer_format : Update packer format for Write master config
  1110. * @offset_in_bytes : Offest in bytes
  1111. * @context_id_mask : context id mask in case of multi context
  1112. * @use_pack : Hint to use WM pack in case of per frame changes
  1113. * @enable : Enable/Disable WM at run time
  1114. * @params : Indicate params supported, to accommodate future changes
  1115. * @param_mask : Indicate params supported, to accommodate future changes
  1116. */
  1117. struct cam_isp_vfe_wm_config_v2 {
  1118. __u32 version;
  1119. __u32 port_type;
  1120. __u32 wm_mode;
  1121. __u32 h_init;
  1122. __u32 height;
  1123. __u32 width;
  1124. __u32 virtual_frame_en;
  1125. __u32 stride;
  1126. __u32 offset;
  1127. __u32 addr_reuse_en;
  1128. __u32 packer_format;
  1129. __u32 offset_in_bytes;
  1130. __u32 context_id_mask;
  1131. __u32 use_pack;
  1132. __u32 enable;
  1133. __u32 param_mask;
  1134. __u32 params[5];
  1135. };
  1136. /**
  1137. * struct cam_isp_vfe_out_config_v2 - VFE write master config
  1138. *
  1139. * @version : Version for this structure
  1140. * @num_ports : Number of ports
  1141. * @reserved : Reserved field
  1142. * @wm_config : VFE out config
  1143. * @params : Indicate params supported, to accommodate future changes
  1144. * @param_mask : Indicate params supported, to accommodate future changes
  1145. */
  1146. struct cam_isp_vfe_out_config_v2 {
  1147. __u32 version;
  1148. __u32 num_ports;
  1149. __u32 reserved;
  1150. struct cam_isp_vfe_wm_config_v2 wm_config[1];
  1151. __u32 param_mask;
  1152. __u32 params[5];
  1153. };
  1154. /**
  1155. * struct cam_isp_vfe_out_config - VFE write master config
  1156. *
  1157. * @num_ports : Number of ports
  1158. * @reserved : Reserved field
  1159. * @wm_config : VFE out config
  1160. */
  1161. struct cam_isp_vfe_out_config {
  1162. __u32 num_ports;
  1163. __u32 reserved;
  1164. struct cam_isp_vfe_wm_config wm_config[1];
  1165. };
  1166. /**
  1167. * struct cam_isp_mode_switch_info - Dynamic mode switch info
  1168. *
  1169. * @mup : MUP for incoming VC of next frame
  1170. * @num_expoures : Number of exposures
  1171. * @reserved : Reserved
  1172. */
  1173. struct cam_isp_mode_switch_info{
  1174. __u32 mup;
  1175. __u32 num_expoures;
  1176. __u32 reserved;
  1177. } __attribute__((packed));
  1178. /**
  1179. * struct cam_isp_nfi_mode_switch_info - New Frame ID (NFI) Based Switching Scheme info
  1180. *
  1181. * @version : Version info
  1182. * @mode_id : Mode ID value for the next frame
  1183. * @modeid_vc : The VC with which the embedded packet with MODE ID comes with.
  1184. * @x_offset : X offset of MODE ID location in horizontal
  1185. * direction within single EBD line packet, unit is byte.
  1186. * @y_offset : Y offset of MODE ID location in vertical direction
  1187. * within EBD Lines, unit is line packet.
  1188. * @reg_length : Number of bytes for each MODE ID
  1189. * @num_valid_params : Number of valid params
  1190. * @param_mask : Mask to indicate fields in params
  1191. * @params : Additional Params
  1192. */
  1193. struct cam_isp_nfi_mode_switch_info {
  1194. __u32 version;
  1195. __u32 mode_id;
  1196. __u32 modeid_vc;
  1197. __u32 x_offset;
  1198. __u32 y_offset;
  1199. __u32 reg_length;
  1200. __u32 num_valid_params;
  1201. __u32 param_mask;
  1202. __u32 params[4];
  1203. } __attribute__((packed));
  1204. /**
  1205. * struct cam_isp_sfe_wm_exp_order_config - SFE write master
  1206. * exposure order config
  1207. *
  1208. * This config will reflect for corresponding RM as well
  1209. *
  1210. * @res_type : output resource type defined in file
  1211. * cam_isp_sfe.h or cam_isp_ife.h
  1212. * @additional_params : Params for future use
  1213. */
  1214. struct cam_isp_sfe_wm_exp_order_config {
  1215. __u32 res_type;
  1216. __u32 additional_params[5];
  1217. };
  1218. /**
  1219. * struct cam_isp_sfe_exp_config - SFE out exposure config
  1220. *
  1221. * Exp order is determined by it's index in wm_config[]
  1222. * The last resource in the array will be considered as
  1223. * last [shortest] exposure.
  1224. *
  1225. * @num_ports : Number of ports
  1226. * @reserved : Reserved field
  1227. * @wm_config : WM exp config
  1228. */
  1229. struct cam_isp_sfe_exp_config {
  1230. __u32 num_ports;
  1231. __u32 reserved;
  1232. struct cam_isp_sfe_wm_exp_order_config wm_config[1];
  1233. };
  1234. /**
  1235. * struct cam_isp_discard_initial_frames - Discard init frames
  1236. *
  1237. * Some sensors require discarding the initial frames
  1238. * after the sensor is streamed on. The discard would be
  1239. * applied on all paths [IPP/PPP/RDIx] for the given
  1240. * pipeline.
  1241. *
  1242. * @num_frames : Number of frames to be discarded
  1243. * @discard_params : Params for future use
  1244. */
  1245. struct cam_isp_discard_initial_frames {
  1246. __u32 num_frames;
  1247. __u32 discard_params[5];
  1248. } __attribute__((packed));
  1249. /**
  1250. * struct cam_isp_wm_bw_limiter_config - ISP write master
  1251. * BW limter config
  1252. *
  1253. *
  1254. * @res_type : output resource type defined in file
  1255. * cam_isp_sfe.h or cam_isp_ife.h
  1256. * @enable_limiter : 0 for disable else enabled
  1257. * @counter_limit : Max counter value
  1258. * @additional_params : Params for future use
  1259. */
  1260. struct cam_isp_wm_bw_limiter_config {
  1261. __u32 res_type;
  1262. __u32 enable_limiter;
  1263. __u32 counter_limit[CAM_PACKET_MAX_PLANES];
  1264. __u32 additional_params[5];
  1265. };
  1266. /**
  1267. * struct cam_isp_out_rsrc_bw_limiter_config - ISP out rsrc BW limiter config
  1268. *
  1269. * Configure BW limiter for ISP WMs
  1270. *
  1271. * @num_ports : Number of ports
  1272. * @reserved : Reserved field
  1273. * @bw_limit_config : WM BW limiter config
  1274. */
  1275. struct cam_isp_out_rsrc_bw_limiter_config {
  1276. __u32 num_ports;
  1277. __u32 reserved;
  1278. struct cam_isp_wm_bw_limiter_config bw_limiter_config[1];
  1279. };
  1280. /**
  1281. * struct cam_isp_init_config - Init config for IFE/CSID/SFE
  1282. *
  1283. * Any configurations to be consumed by KMD
  1284. * prior to stream on - one time configuration per stream.
  1285. * This blob is expected only in INIT packet. Per frame
  1286. * dynamic settings will not be part of this blob.
  1287. *
  1288. * @epoch_factor : % factor for epoch config with respect to frame height
  1289. * If factor is 60, epoch will be configured to 3/5th of
  1290. * the frame height. If this field is 0,
  1291. * KMD will configure default 50% of the height
  1292. * @additional_params : Reserved fields for future use
  1293. */
  1294. struct cam_isp_init_config {
  1295. struct cam_isp_epoch_height_config {
  1296. __u32 epoch_factor;
  1297. } epoch_cfg;
  1298. __u32 additional_params[19];
  1299. };
  1300. /**
  1301. * struct cam_isp_lcr_rdi_config - RDI res id to be muxed to LCR
  1302. *
  1303. * Configure RDI Res id for LCR
  1304. *
  1305. * @res_id : Out port Res id, it is same as the out port
  1306. * configured during acquire. It would vary
  1307. * as per SFE or IFE. Based on this res id,
  1308. * Mux register in IFE will be programmed.
  1309. * Examples:
  1310. * IFE:
  1311. * CAM_ISP_IFE_OUT_RES_RDI_0
  1312. * SFE:
  1313. * CAM_ISP_SFE_OUT_RES_RDI_0
  1314. * This blob is expected as a part of init packet for
  1315. * all LCR cases. For SHDR-LCR cases, this can be used
  1316. * per request. For non-shdr cases, this blob is not
  1317. * expected as the input to LCR will remain same throughout
  1318. * the session
  1319. * @reserved : Reserved field
  1320. */
  1321. struct cam_isp_lcr_rdi_config {
  1322. __u32 res_id;
  1323. __u32 reserved[5];
  1324. };
  1325. #define CAM_ISP_ACQUIRE_COMMON_VER0 0x1000
  1326. #define CAM_ISP_ACQUIRE_COMMON_SIZE_VER0 0x0
  1327. #define CAM_ISP_ACQUIRE_INPUT_VER0 0x2000
  1328. #define CAM_ISP_ACQUIRE_INPUT_SIZE_VER0 sizeof(struct cam_isp_in_port_info)
  1329. #define CAM_ISP_ACQUIRE_OUT_VER0 0x3000
  1330. #define CAM_ISP_ACQUIRE_OUT_SIZE_VER0 sizeof(struct cam_isp_out_port_info)
  1331. #endif /* __UAPI_CAM_ISP_H__ */