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