cam_isp.h 39 KB

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