cam_isp.h 50 KB

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