blob: 5b4a6045d9ce2866c4e3301464af9823c64b8a32 [file] [log] [blame]
Lakshmi Narayana Kalavala6efb7cf2017-05-09 17:34:29 -07001#ifndef __UAPI_CAM_ICP_H__
2#define __UAPI_CAM_ICP_H__
3
4#include "cam_defs.h"
Raja Mallik477ca242019-06-21 14:23:32 +05305#include "cam_cpas.h"
Lakshmi Narayana Kalavala6efb7cf2017-05-09 17:34:29 -07006
7/* icp, ipe, bps, cdm(ipe/bps) are used in querycap */
8#define CAM_ICP_DEV_TYPE_A5 1
9#define CAM_ICP_DEV_TYPE_IPE 2
10#define CAM_ICP_DEV_TYPE_BPS 3
11#define CAM_ICP_DEV_TYPE_IPE_CDM 4
12#define CAM_ICP_DEV_TYPE_BPS_CDM 5
13#define CAM_ICP_DEV_TYPE_MAX 5
14
15/* definitions needed for icp aquire device */
16#define CAM_ICP_RES_TYPE_BPS 1
17#define CAM_ICP_RES_TYPE_IPE_RT 2
18#define CAM_ICP_RES_TYPE_IPE 3
19#define CAM_ICP_RES_TYPE_MAX 4
20
21/* packet opcode types */
22#define CAM_ICP_OPCODE_IPE_UPDATE 0
23#define CAM_ICP_OPCODE_BPS_UPDATE 1
Raja Mallik70d8a932018-12-13 16:22:43 +053024#define CAM_ICP_OPCODE_IPE_SETTINGS 2
25#define CAM_ICP_OPCODE_BPS_SETTINGS 3
Lakshmi Narayana Kalavala6efb7cf2017-05-09 17:34:29 -070026
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
Suresh Vankadara34494fc2017-08-12 18:18:09 +053062/* Command meta types */
63#define CAM_ICP_CMD_META_GENERIC_BLOB 0x1
64
Junzhe Zoud4eba5d2018-05-17 14:42:44 -070065/* Generic blob types */
Suresh Vankadara34494fc2017-08-12 18:18:09 +053066#define CAM_ICP_CMD_GENERIC_BLOB_CLK 0x1
Junzhe Zoud4eba5d2018-05-17 14:42:44 -070067#define CAM_ICP_CMD_GENERIC_BLOB_CFG_IO 0x2
Raja Mallik70d8a932018-12-13 16:22:43 +053068#define CAM_ICP_CMD_GENERIC_BLOB_FW_MEM_MAP 0x3
69#define CAM_ICP_CMD_GENERIC_BLOB_FW_MEM_UNMAP 0x4
Raja Mallik477ca242019-06-21 14:23:32 +053070#define CAM_ICP_CMD_GENERIC_BLOB_CLK_V2 0x5
71
72/**
73 * struct cam_icp_clk_bw_request_v2
74 *
75 * @budget_ns: Time required to process frame
76 * @frame_cycles: Frame cycles needed to process the frame
77 * @rt_flag: Flag to indicate real time stream
78 * @reserved: For memory alignment
79 * @num_paths: Number of axi paths in bw request
80 * @axi_path: Per path vote info for IPE/BPS
81 */
82struct cam_icp_clk_bw_request_v2 {
83 uint64_t budget_ns;
84 uint32_t frame_cycles;
85 uint32_t rt_flag;
86 uint32_t reserved;
87 uint32_t num_paths;
88 struct cam_axi_per_path_bw_vote axi_path[1];
89};
Suresh Vankadara34494fc2017-08-12 18:18:09 +053090
91/**
92 * struct cam_icp_clk_bw_request
93 *
94 * @budget_ns: Time required to process frame
95 * @frame_cycles: Frame cycles needed to process the frame
96 * @rt_flag: Flag to indicate real time stream
97 * @uncompressed_bw: Bandwidth required to process frame
98 * @compressed_bw: Compressed bandwidth to process frame
99 */
100struct cam_icp_clk_bw_request {
101 uint64_t budget_ns;
102 uint32_t frame_cycles;
103 uint32_t rt_flag;
104 uint64_t uncompressed_bw;
105 uint64_t compressed_bw;
106};
107
Lakshmi Narayana Kalavala6efb7cf2017-05-09 17:34:29 -0700108/**
109 * struct cam_icp_dev_ver - Device information for particular hw type
110 *
111 * This is used to get device version info of
112 * ICP, IPE, BPS and CDM related IPE and BPS from firmware
113 * and use this info in CAM_QUERY_CAP IOCTL
114 *
115 * @dev_type: hardware type for the cap info(icp, ipe, bps, cdm(ipe/bps))
116 * @reserved: reserved field
117 * @hw_ver: major, minor and incr values of a device version
118 */
119struct cam_icp_dev_ver {
120 uint32_t dev_type;
121 uint32_t reserved;
122 struct cam_hw_version hw_ver;
123};
124
125/**
126 * struct cam_icp_ver - ICP version info
127 *
128 * This strcuture is used for fw and api version
129 * this is used to get firmware version and api version from firmware
130 * and use this info in CAM_QUERY_CAP IOCTL
131 *
132 * @major: FW version major
133 * @minor: FW version minor
134 * @revision: FW version increment
135 */
136struct cam_icp_ver {
137 uint32_t major;
138 uint32_t minor;
139 uint32_t revision;
140 uint32_t reserved;
141};
142
143/**
144 * struct cam_icp_query_cap_cmd - ICP query device capability payload
145 *
146 * @dev_iommu_handle: icp iommu handles for secure/non secure modes
147 * @cdm_iommu_handle: iommu handles for secure/non secure modes
148 * @fw_version: firmware version info
149 * @api_version: api version info
150 * @num_ipe: number of ipes
151 * @num_bps: number of bps
152 * @dev_ver: returned device capability array
153 */
154struct cam_icp_query_cap_cmd {
155 struct cam_iommu_handle dev_iommu_handle;
156 struct cam_iommu_handle cdm_iommu_handle;
157 struct cam_icp_ver fw_version;
158 struct cam_icp_ver api_version;
159 uint32_t num_ipe;
160 uint32_t num_bps;
161 struct cam_icp_dev_ver dev_ver[CAM_ICP_DEV_TYPE_MAX];
162};
163
164/**
165 * struct cam_icp_res_info - ICP output resource info
166 *
167 * @format: format of the resource
168 * @width: width in pixels
169 * @height: height in lines
170 * @fps: fps
171 */
172struct cam_icp_res_info {
173 uint32_t format;
174 uint32_t width;
175 uint32_t height;
176 uint32_t fps;
177};
178
179/**
180 * struct cam_icp_acquire_dev_info - An ICP device info
181 *
182 * @scratch_mem_size: Output param - size of scratch memory
183 * @dev_type: device type (IPE_RT/IPE_NON_RT/BPS)
184 * @io_config_cmd_size: size of IO config command
185 * @io_config_cmd_handle: IO config command for each acquire
186 * @secure_mode: camera mode (secure/non secure)
187 * @chain_info: chaining info of FW device handles
188 * @in_res: resource info used for clock and bandwidth calculation
189 * @num_out_res: number of output resources
190 * @out_res: output resource
191 */
192struct cam_icp_acquire_dev_info {
193 uint32_t scratch_mem_size;
194 uint32_t dev_type;
195 uint32_t io_config_cmd_size;
196 int32_t io_config_cmd_handle;
197 uint32_t secure_mode;
198 int32_t chain_info;
199 struct cam_icp_res_info in_res;
200 uint32_t num_out_res;
201 struct cam_icp_res_info out_res[1];
202} __attribute__((__packed__));
203
204#endif /* __UAPI_CAM_ICP_H__ */