• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef __UAPI_CAM_ICP_H__
2 #define __UAPI_CAM_ICP_H__
3 
4 #include "cam_defs.h"
5 
6 /* icp, ipe, bps, cdm(ipe/bps) are used in querycap */
7 #define CAM_ICP_DEV_TYPE_A5      1
8 #define CAM_ICP_DEV_TYPE_IPE     2
9 #define CAM_ICP_DEV_TYPE_BPS     3
10 #define CAM_ICP_DEV_TYPE_IPE_CDM 4
11 #define CAM_ICP_DEV_TYPE_BPS_CDM 5
12 #define CAM_ICP_DEV_TYPE_MAX     5
13 
14 /* definitions needed for icp aquire device */
15 #define CAM_ICP_RES_TYPE_BPS        1
16 #define CAM_ICP_RES_TYPE_IPE_RT     2
17 #define CAM_ICP_RES_TYPE_IPE        3
18 #define CAM_ICP_RES_TYPE_MAX        4
19 
20 /* packet opcode types */
21 #define CAM_ICP_OPCODE_IPE_UPDATE   0
22 #define CAM_ICP_OPCODE_BPS_UPDATE   1
23 #define CAM_ICP_OPCODE_IPE_SETTINGS 2
24 #define CAM_ICP_OPCODE_BPS_SETTINGS 3
25 
26 
27 /* IPE input port resource type */
28 #define CAM_ICP_IPE_INPUT_IMAGE_FULL            0x0
29 #define CAM_ICP_IPE_INPUT_IMAGE_DS4             0x1
30 #define CAM_ICP_IPE_INPUT_IMAGE_DS16            0x2
31 #define CAM_ICP_IPE_INPUT_IMAGE_DS64            0x3
32 #define CAM_ICP_IPE_INPUT_IMAGE_FULL_REF        0x4
33 #define CAM_ICP_IPE_INPUT_IMAGE_DS4_REF         0x5
34 #define CAM_ICP_IPE_INPUT_IMAGE_DS16_REF        0x6
35 #define CAM_ICP_IPE_INPUT_IMAGE_DS64_REF        0x7
36 
37 /* IPE output port resource type */
38 #define CAM_ICP_IPE_OUTPUT_IMAGE_DISPLAY        0x8
39 #define CAM_ICP_IPE_OUTPUT_IMAGE_VIDEO          0x9
40 #define CAM_ICP_IPE_OUTPUT_IMAGE_FULL_REF       0xA
41 #define CAM_ICP_IPE_OUTPUT_IMAGE_DS4_REF        0xB
42 #define CAM_ICP_IPE_OUTPUT_IMAGE_DS16_REF       0xC
43 #define CAM_ICP_IPE_OUTPUT_IMAGE_DS64_REF       0xD
44 
45 #define CAM_ICP_IPE_IMAGE_MAX                   0xE
46 
47 /* BPS input port resource type */
48 #define CAM_ICP_BPS_INPUT_IMAGE                 0x0
49 
50 /* BPS output port resource type */
51 #define CAM_ICP_BPS_OUTPUT_IMAGE_FULL           0x1
52 #define CAM_ICP_BPS_OUTPUT_IMAGE_DS4            0x2
53 #define CAM_ICP_BPS_OUTPUT_IMAGE_DS16           0x3
54 #define CAM_ICP_BPS_OUTPUT_IMAGE_DS64           0x4
55 #define CAM_ICP_BPS_OUTPUT_IMAGE_STATS_BG       0x5
56 #define CAM_ICP_BPS_OUTPUT_IMAGE_STATS_BHIST    0x6
57 #define CAM_ICP_BPS_OUTPUT_IMAGE_REG1           0x7
58 #define CAM_ICP_BPS_OUTPUT_IMAGE_REG2           0x8
59 
60 #define CAM_ICP_BPS_IO_IMAGES_MAX               0x9
61 
62 /* Command meta types */
63 #define CAM_ICP_CMD_META_GENERIC_BLOB           0x1
64 
65 /* Generic blob types */
66 #define CAM_ICP_CMD_GENERIC_BLOB_CLK            0x1
67 #define CAM_ICP_CMD_GENERIC_BLOB_CFG_IO         0x2
68 #define CAM_ICP_CMD_GENERIC_BLOB_FW_MEM_MAP     0x3
69 #define CAM_ICP_CMD_GENERIC_BLOB_FW_MEM_UNMAP   0x4
70 
71 #ifdef CONFIG_BOARD_SUNFISH
72 
73 #include "cam_cpas.h"
74 
75 #define CAM_ICP_CMD_GENERIC_BLOB_CLK_V2         0x5
76 
77 /**
78  * struct cam_icp_clk_bw_request_v2
79  *
80  * @budget_ns: Time required to process frame
81  * @frame_cycles: Frame cycles needed to process the frame
82  * @rt_flag: Flag to indicate real time stream
83  * @reserved: For memory alignment
84  * @num_paths: Number of axi paths in bw request
85  * @axi_path: Per path vote info for IPE/BPS
86  */
87 struct cam_icp_clk_bw_request_v2 {
88        uint64_t                          budget_ns;
89        uint32_t                          frame_cycles;
90        uint32_t                          rt_flag;
91        uint32_t                          reserved;
92        uint32_t                          num_paths;
93        struct cam_axi_per_path_bw_vote   axi_path[1];
94 };
95 
96 #endif /*CONFIG_BOARD_SUNFISH*/
97 
98 /**
99  * struct cam_icp_clk_bw_request
100  *
101  * @budget_ns: Time required to process frame
102  * @frame_cycles: Frame cycles needed to process the frame
103  * @rt_flag: Flag to indicate real time stream
104  * @uncompressed_bw: Bandwidth required to process frame
105  * @compressed_bw: Compressed bandwidth to process frame
106  */
107 struct cam_icp_clk_bw_request {
108 	uint64_t budget_ns;
109 	uint32_t frame_cycles;
110 	uint32_t rt_flag;
111 	uint64_t uncompressed_bw;
112 	uint64_t compressed_bw;
113 };
114 
115 /**
116  * struct cam_icp_dev_ver - Device information for particular hw type
117  *
118  * This is used to get device version info of
119  * ICP, IPE, BPS and CDM related IPE and BPS from firmware
120  * and use this info in CAM_QUERY_CAP IOCTL
121  *
122  * @dev_type: hardware type for the cap info(icp, ipe, bps, cdm(ipe/bps))
123  * @reserved: reserved field
124  * @hw_ver: major, minor and incr values of a device version
125  */
126 struct cam_icp_dev_ver {
127 	uint32_t dev_type;
128 	uint32_t reserved;
129 	struct cam_hw_version hw_ver;
130 };
131 
132 /**
133  * struct cam_icp_ver - ICP version info
134  *
135  * This strcuture is used for fw and api version
136  * this is used to get firmware version and api version from firmware
137  * and use this info in CAM_QUERY_CAP IOCTL
138  *
139  * @major: FW version major
140  * @minor: FW version minor
141  * @revision: FW version increment
142  */
143 struct cam_icp_ver {
144 	uint32_t major;
145 	uint32_t minor;
146 	uint32_t revision;
147 	uint32_t reserved;
148 };
149 
150 /**
151  * struct cam_icp_query_cap_cmd - ICP query device capability payload
152  *
153  * @dev_iommu_handle: icp iommu handles for secure/non secure modes
154  * @cdm_iommu_handle: iommu handles for secure/non secure modes
155  * @fw_version: firmware version info
156  * @api_version: api version info
157  * @num_ipe: number of ipes
158  * @num_bps: number of bps
159  * @dev_ver: returned device capability array
160  */
161 struct cam_icp_query_cap_cmd {
162 	struct cam_iommu_handle dev_iommu_handle;
163 	struct cam_iommu_handle cdm_iommu_handle;
164 	struct cam_icp_ver fw_version;
165 	struct cam_icp_ver api_version;
166 	uint32_t num_ipe;
167 	uint32_t num_bps;
168 	struct cam_icp_dev_ver dev_ver[CAM_ICP_DEV_TYPE_MAX];
169 };
170 
171 /**
172  * struct cam_icp_res_info - ICP output resource info
173  *
174  * @format: format of the resource
175  * @width:  width in pixels
176  * @height: height in lines
177  * @fps:  fps
178  */
179 struct cam_icp_res_info {
180 	uint32_t format;
181 	uint32_t width;
182 	uint32_t height;
183 	uint32_t fps;
184 };
185 
186 /**
187  * struct cam_icp_acquire_dev_info - An ICP device info
188  *
189  * @scratch_mem_size: Output param - size of scratch memory
190  * @dev_type: device type (IPE_RT/IPE_NON_RT/BPS)
191  * @io_config_cmd_size: size of IO config command
192  * @io_config_cmd_handle: IO config command for each acquire
193  * @secure_mode: camera mode (secure/non secure)
194  * @chain_info: chaining info of FW device handles
195  * @in_res: resource info used for clock and bandwidth calculation
196  * @num_out_res: number of output resources
197  * @out_res: output resource
198  */
199 struct cam_icp_acquire_dev_info {
200 	uint32_t scratch_mem_size;
201 	uint32_t dev_type;
202 	uint32_t io_config_cmd_size;
203 	int32_t  io_config_cmd_handle;
204 	uint32_t secure_mode;
205 	int32_t chain_info;
206 	struct cam_icp_res_info in_res;
207 	uint32_t num_out_res;
208 	struct cam_icp_res_info out_res[1];
209 } __attribute__((__packed__));
210 
211 #endif /* __UAPI_CAM_ICP_H__ */
212