cam_isp.h 35 KB

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