cam_isp.h 33 KB

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