1 #ifndef __UAPI_CAM_ISP_H__ 2 #define __UAPI_CAM_ISP_H__ 3 4 #include "cam_defs.h" 5 #include "cam_isp_vfe.h" 6 #include "cam_isp_ife.h" 7 8 9 /* ISP driver name */ 10 #define CAM_ISP_DEV_NAME "cam-isp" 11 12 /* HW type */ 13 #define CAM_ISP_HW_BASE 0 14 #define CAM_ISP_HW_CSID 1 15 #define CAM_ISP_HW_VFE 2 16 #define CAM_ISP_HW_IFE 3 17 #define CAM_ISP_HW_ISPIF 4 18 #define CAM_ISP_HW_MAX 5 19 20 /* Color Pattern */ 21 #define CAM_ISP_PATTERN_BAYER_RGRGRG 0 22 #define CAM_ISP_PATTERN_BAYER_GRGRGR 1 23 #define CAM_ISP_PATTERN_BAYER_BGBGBG 2 24 #define CAM_ISP_PATTERN_BAYER_GBGBGB 3 25 #define CAM_ISP_PATTERN_YUV_YCBYCR 4 26 #define CAM_ISP_PATTERN_YUV_YCRYCB 5 27 #define CAM_ISP_PATTERN_YUV_CBYCRY 6 28 #define CAM_ISP_PATTERN_YUV_CRYCBY 7 29 #define CAM_ISP_PATTERN_MAX 8 30 31 /* Usage Type */ 32 #define CAM_ISP_RES_USAGE_SINGLE 0 33 #define CAM_ISP_RES_USAGE_DUAL 1 34 #define CAM_ISP_RES_USAGE_MAX 2 35 36 /* Resource ID */ 37 #define CAM_ISP_RES_ID_PORT 0 38 #define CAM_ISP_RES_ID_CLK 1 39 #define CAM_ISP_RES_ID_MAX 2 40 41 /* Resource Type - Type of resource for the resource id 42 * defined in cam_isp_vfe.h, cam_isp_ife.h 43 */ 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 50 /* ISP Resurce Composite Group ID */ 51 #define CAM_ISP_RES_COMP_GROUP_NONE 0 52 #define CAM_ISP_RES_COMP_GROUP_ID_0 1 53 #define CAM_ISP_RES_COMP_GROUP_ID_1 2 54 #define CAM_ISP_RES_COMP_GROUP_ID_2 3 55 #define CAM_ISP_RES_COMP_GROUP_ID_3 4 56 #define CAM_ISP_RES_COMP_GROUP_ID_4 5 57 #define CAM_ISP_RES_COMP_GROUP_ID_5 6 58 #define CAM_ISP_RES_COMP_GROUP_ID_MAX 6 59 60 /* ISP packet opcode for ISP */ 61 #define CAM_ISP_PACKET_OP_BASE 0 62 #define CAM_ISP_PACKET_INIT_DEV 1 63 #define CAM_ISP_PACKET_UPDATE_DEV 2 64 #define CAM_ISP_PACKET_OP_MAX 3 65 66 /* ISP packet meta_data type for command buffer */ 67 #define CAM_ISP_PACKET_META_BASE 0 68 #define CAM_ISP_PACKET_META_LEFT 1 69 #define CAM_ISP_PACKET_META_RIGHT 2 70 #define CAM_ISP_PACKET_META_COMMON 3 71 #define CAM_ISP_PACKET_META_DMI_LEFT 4 72 #define CAM_ISP_PACKET_META_DMI_RIGHT 5 73 #define CAM_ISP_PACKET_META_DMI_COMMON 6 74 #define CAM_ISP_PACKET_META_CLOCK 7 75 #define CAM_ISP_PACKET_META_CSID 8 76 #define CAM_ISP_PACKET_META_DUAL_CONFIG 9 77 #define CAM_ISP_PACKET_META_GENERIC_BLOB_LEFT 10 78 #define CAM_ISP_PACKET_META_GENERIC_BLOB_RIGHT 11 79 #define CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON 12 80 81 /* DSP mode */ 82 #define CAM_ISP_DSP_MODE_NONE 0 83 #define CAM_ISP_DSP_MODE_ONE_WAY 1 84 #define CAM_ISP_DSP_MODE_ROUND 2 85 86 /* ISP Generic Cmd Buffer Blob types */ 87 #define CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG 0 88 #define CAM_ISP_GENERIC_BLOB_TYPE_CLOCK_CONFIG 1 89 #define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG 2 90 91 /* Query devices */ 92 /** 93 * struct cam_isp_dev_cap_info - A cap info for particular hw type 94 * 95 * @hw_type: Hardware type for the cap info 96 * @reserved: reserved field for alignment 97 * @hw_version: Hardware version 98 * 99 */ 100 struct cam_isp_dev_cap_info { 101 uint32_t hw_type; 102 uint32_t reserved; 103 struct cam_hw_version hw_version; 104 }; 105 106 /** 107 * struct cam_isp_query_cap_cmd - ISP query device capability payload 108 * 109 * @device_iommu: returned iommu handles for device 110 * @cdm_iommu: returned iommu handles for cdm 111 * @num_dev: returned number of device capabilities 112 * @reserved: reserved field for alignment 113 * @dev_caps: returned device capability array 114 * 115 */ 116 struct cam_isp_query_cap_cmd { 117 struct cam_iommu_handle device_iommu; 118 struct cam_iommu_handle cdm_iommu; 119 int32_t num_dev; 120 uint32_t reserved; 121 struct cam_isp_dev_cap_info dev_caps[CAM_ISP_HW_MAX]; 122 }; 123 124 /* Acquire Device */ 125 /** 126 * struct cam_isp_out_port_info - An output port resource info 127 * 128 * @res_type: output resource type defined in file 129 * cam_isp_vfe.h or cam_isp_ife.h 130 * @format: output format of the resource 131 * @wdith: output width in pixels 132 * @height: output height in lines 133 * @comp_grp_id: composite group id for the resource. 134 * @split_point: split point in pixels for the dual VFE. 135 * @secure_mode: flag to tell if output should be run in secure 136 * mode or not. See cam_defs.h for definition 137 * @reserved: reserved field for alignment 138 * 139 */ 140 struct cam_isp_out_port_info { 141 uint32_t res_type; 142 uint32_t format; 143 uint32_t width; 144 uint32_t height; 145 uint32_t comp_grp_id; 146 uint32_t split_point; 147 uint32_t secure_mode; 148 uint32_t reserved; 149 }; 150 151 /** 152 * struct cam_isp_in_port_info - An input port resource info 153 * 154 * @res_type: input resource type define in file 155 * cam_isp_vfe.h or cam_isp_ife.h 156 * @lane_type: lane type: c-phy or d-phy. 157 * @lane_num: active lane number 158 * @lane_cfg: lane configurations: 4 bits per lane 159 * @vc: input virtual channel number 160 * @dt: input data type number 161 * @format: input format 162 * @test_pattern: test pattern for the testgen 163 * @usage_type: whether dual vfe is required 164 * @left_start: left input start offset in pixels 165 * @left_stop: left input stop offset in pixels 166 * @left_width: left input width in pixels 167 * @right_start: right input start offset in pixels. 168 * Only for Dual VFE 169 * @right_stop: right input stop offset in pixels. 170 * Only for Dual VFE 171 * @right_width: right input width in pixels. 172 * Only for dual VFE 173 * @line_start: top of the line number 174 * @line_stop: bottome of the line number 175 * @height: input height in lines 176 * @pixel_clk; sensor output clock 177 * @batch_size: batch size for HFR mode 178 * @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*) 179 * @hbi_cnt: HBI count for the camif input 180 * @reserved: Reserved field for alignment 181 * @num_out_res: number of the output resource associated 182 * @data: payload that contains the output resources 183 * 184 */ 185 struct cam_isp_in_port_info { 186 uint32_t res_type; 187 uint32_t lane_type; 188 uint32_t lane_num; 189 uint32_t lane_cfg; 190 uint32_t vc; 191 uint32_t dt; 192 uint32_t format; 193 uint32_t test_pattern; 194 uint32_t usage_type; 195 uint32_t left_start; 196 uint32_t left_stop; 197 uint32_t left_width; 198 uint32_t right_start; 199 uint32_t right_stop; 200 uint32_t right_width; 201 uint32_t line_start; 202 uint32_t line_stop; 203 uint32_t height; 204 uint32_t pixel_clk; 205 uint32_t batch_size; 206 uint32_t dsp_mode; 207 uint32_t hbi_cnt; 208 uint32_t reserved; 209 uint32_t num_out_res; 210 struct cam_isp_out_port_info data[1]; 211 }; 212 213 /** 214 * struct cam_isp_resource - A resource bundle 215 * 216 * @resoruce_id: resource id for the resource bundle 217 * @length: length of the while resource blob 218 * @handle_type: type of the resource handle 219 * @reserved: reserved field for alignment 220 * @res_hdl: resource handle that points to the 221 * resource array; 222 * 223 */ 224 struct cam_isp_resource { 225 uint32_t resource_id; 226 uint32_t length; 227 uint32_t handle_type; 228 uint32_t reserved; 229 uint64_t res_hdl; 230 }; 231 232 /** 233 * struct cam_isp_port_hfr_config - HFR configuration for this port 234 * 235 * @resource_type: Resource type 236 * @subsample_pattern: Subsample pattern. Used in HFR mode. It 237 * should be consistent with batchSize and 238 * CAMIF programming. 239 * @subsample_period: Subsample period. Used in HFR mode. It 240 * should be consistent with batchSize and 241 * CAMIF programming. 242 * @framedrop_pattern: Framedrop pattern 243 * @framedrop_period: Framedrop period 244 * @reserved: Reserved for alignment 245 */ 246 struct cam_isp_port_hfr_config { 247 uint32_t resource_type; 248 uint32_t subsample_pattern; 249 uint32_t subsample_period; 250 uint32_t framedrop_pattern; 251 uint32_t framedrop_period; 252 uint32_t reserved; 253 } __attribute__((packed)); 254 255 /** 256 * struct cam_isp_resource_hfr_config - Resource HFR configuration 257 * 258 * @num_ports: Number of ports 259 * @reserved: Reserved for alignment 260 * @port_hfr_config: HFR configuration for each IO port 261 */ 262 struct cam_isp_resource_hfr_config { 263 uint32_t num_ports; 264 uint32_t reserved; 265 struct cam_isp_port_hfr_config port_hfr_config[1]; 266 } __attribute__((packed)); 267 268 /** 269 * struct cam_isp_dual_split_params - dual isp spilt parameters 270 * 271 * @split_point: Split point information x, where (0 < x < width) 272 * left ISP's input ends at x + righ padding and 273 * Right ISP's input starts at x - left padding 274 * @right_padding: Padding added past the split point for left 275 * ISP's input 276 * @left_padding: Padding added before split point for right 277 * ISP's input 278 * @reserved: Reserved filed for alignment 279 * 280 */ 281 struct cam_isp_dual_split_params { 282 uint32_t split_point; 283 uint32_t right_padding; 284 uint32_t left_padding; 285 uint32_t reserved; 286 }; 287 288 /** 289 * struct cam_isp_dual_stripe_config - stripe config per bus client 290 * 291 * @offset: Start horizontal offset relative to 292 * output buffer 293 * In UBWC mode, this value indicates the H_INIT 294 * value in pixel 295 * @width: Width of the stripe in bytes 296 * @tileconfig Ubwc meta tile config. Contain the partial 297 * tile info 298 * @port_id: port id of ISP output 299 * 300 */ 301 struct cam_isp_dual_stripe_config { 302 uint32_t offset; 303 uint32_t width; 304 uint32_t tileconfig; 305 uint32_t port_id; 306 }; 307 308 /** 309 * struct cam_isp_dual_config - dual isp configuration 310 * 311 * @num_ports Number of isp output ports 312 * @reserved Reserved field for alignment 313 * @split_params: Inpput split parameters 314 * @stripes: Stripe information 315 * 316 */ 317 struct cam_isp_dual_config { 318 uint32_t num_ports; 319 uint32_t reserved; 320 struct cam_isp_dual_split_params split_params; 321 struct cam_isp_dual_stripe_config stripes[1]; 322 } __attribute__((packed)); 323 324 /** 325 * struct cam_isp_clock_config - Clock configuration 326 * 327 * @usage_type: Usage type (Single/Dual) 328 * @num_rdi: Number of RDI votes 329 * @left_pix_hz: Pixel Clock for Left ISP 330 * @right_pix_hz: Pixel Clock for Right ISP, valid only if Dual 331 * @rdi_hz: RDI Clock. ISP clock will be max of RDI and 332 * PIX clocks. For a particular context which ISP 333 * HW the RDI is allocated to is not known to UMD. 334 * Hence pass the clock and let KMD decide. 335 */ 336 struct cam_isp_clock_config { 337 uint32_t usage_type; 338 uint32_t num_rdi; 339 uint64_t left_pix_hz; 340 uint64_t right_pix_hz; 341 uint64_t rdi_hz[1]; 342 } __attribute__((packed)); 343 344 /** 345 * struct cam_isp_bw_vote - Bandwidth vote information 346 * 347 * @resource_id: Resource ID 348 * @reserved: Reserved field for alignment 349 * @cam_bw_bps: Bandwidth vote for CAMNOC 350 * @ext_bw_bps: Bandwidth vote for path-to-DDR after CAMNOC 351 */ 352 353 struct cam_isp_bw_vote { 354 uint32_t resource_id; 355 uint32_t reserved; 356 uint64_t cam_bw_bps; 357 uint64_t ext_bw_bps; 358 } __attribute__((packed)); 359 360 /** 361 * struct cam_isp_bw_config - Bandwidth configuration 362 * 363 * @usage_type: Usage type (Single/Dual) 364 * @num_rdi: Number of RDI votes 365 * @left_pix_vote: Bandwidth vote for left ISP 366 * @right_pix_vote: Bandwidth vote for right ISP 367 * @rdi_vote: RDI bandwidth requirements 368 */ 369 370 struct cam_isp_bw_config { 371 uint32_t usage_type; 372 uint32_t num_rdi; 373 struct cam_isp_bw_vote left_pix_vote; 374 struct cam_isp_bw_vote right_pix_vote; 375 struct cam_isp_bw_vote rdi_vote[1]; 376 } __attribute__((packed)); 377 378 #endif /* __UAPI_CAM_ISP_H__ */ 379