Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 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 |
Ravikishore Pampana | ff6132e | 2017-07-27 15:32:31 +0530 | [diff] [blame] | 76 | #define CAM_ISP_PACKET_META_DUAL_CONFIG 9 |
Pavan Kumar Chilamkurthi | 649cdf9 | 2017-08-15 01:40:57 -0700 | [diff] [blame] | 77 | #define CAM_ISP_PACKET_META_GENERIC_BLOB 10 |
| 78 | #define CAM_ISP_PACKET_META_MAX 11 |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 79 | |
Jing Zhou | 6562f69 | 2017-02-15 15:56:54 -0800 | [diff] [blame] | 80 | /* DSP mode */ |
| 81 | #define CAM_ISP_DSP_MODE_NONE 0 |
| 82 | #define CAM_ISP_DSP_MODE_ONE_WAY 1 |
| 83 | #define CAM_ISP_DSP_MODE_ROUND 2 |
| 84 | |
Pavan Kumar Chilamkurthi | 649cdf9 | 2017-08-15 01:40:57 -0700 | [diff] [blame] | 85 | /* ISP Generic Cmd Buffer Blob types */ |
| 86 | #define CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG 0 |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 87 | |
| 88 | /* Query devices */ |
| 89 | /** |
| 90 | * struct cam_isp_dev_cap_info - A cap info for particular hw type |
| 91 | * |
| 92 | * @hw_type: Hardware type for the cap info |
Jing Zhou | 6562f69 | 2017-02-15 15:56:54 -0800 | [diff] [blame] | 93 | * @reserved: reserved field for alignment |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 94 | * @hw_version: Hardware version |
| 95 | * |
| 96 | */ |
| 97 | struct cam_isp_dev_cap_info { |
| 98 | uint32_t hw_type; |
Jing Zhou | 6562f69 | 2017-02-15 15:56:54 -0800 | [diff] [blame] | 99 | uint32_t reserved; |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 100 | struct cam_hw_version hw_version; |
| 101 | }; |
| 102 | |
| 103 | /** |
| 104 | * struct cam_isp_query_cap_cmd - ISP query device capability payload |
| 105 | * |
| 106 | * @device_iommu: returned iommu handles for device |
| 107 | * @cdm_iommu: returned iommu handles for cdm |
| 108 | * @num_dev: returned number of device capabilities |
| 109 | * @reserved: reserved field for alignment |
| 110 | * @dev_caps: returned device capability array |
| 111 | * |
| 112 | */ |
| 113 | struct cam_isp_query_cap_cmd { |
| 114 | struct cam_iommu_handle device_iommu; |
| 115 | struct cam_iommu_handle cdm_iommu; |
| 116 | int32_t num_dev; |
| 117 | uint32_t reserved; |
| 118 | struct cam_isp_dev_cap_info dev_caps[CAM_ISP_HW_MAX]; |
| 119 | }; |
| 120 | |
| 121 | /* Acquire Device */ |
| 122 | /** |
| 123 | * struct cam_isp_out_port_info - An output port resource info |
| 124 | * |
| 125 | * @res_type: output resource type defined in file |
| 126 | * cam_isp_vfe.h or cam_isp_ife.h |
| 127 | * @format: output format of the resource |
| 128 | * @wdith: output width in pixels |
| 129 | * @height: output height in lines |
| 130 | * @comp_grp_id: composite group id for the resource. |
| 131 | * @split_point: split point in pixels for the dual VFE. |
| 132 | * @secure_mode: flag to tell if output should be run in secure |
| 133 | * mode or not. See cam_defs.h for definition |
| 134 | * @reserved: reserved field for alignment |
| 135 | * |
| 136 | */ |
| 137 | struct cam_isp_out_port_info { |
| 138 | uint32_t res_type; |
| 139 | uint32_t format; |
| 140 | uint32_t width; |
| 141 | uint32_t height; |
| 142 | uint32_t comp_grp_id; |
| 143 | uint32_t split_point; |
| 144 | uint32_t secure_mode; |
| 145 | uint32_t reserved; |
| 146 | }; |
| 147 | |
| 148 | /** |
| 149 | * struct cam_isp_in_port_info - An input port resource info |
| 150 | * |
| 151 | * @res_type: input resource type define in file |
| 152 | * cam_isp_vfe.h or cam_isp_ife.h |
| 153 | * @lane_type: lane type: c-phy or d-phy. |
| 154 | * @lane_num: active lane number |
| 155 | * @lane_cfg: lane configurations: 4 bits per lane |
| 156 | * @vc: input virtual channel number |
| 157 | * @dt: input data type number |
| 158 | * @format: input format |
| 159 | * @test_pattern: test pattern for the testgen |
| 160 | * @usage_type: whether dual vfe is required |
| 161 | * @left_start: left input start offset in pixels |
| 162 | * @left_stop: left input stop offset in pixels |
| 163 | * @left_width: left input width in pixels |
| 164 | * @right_start: right input start offset in pixels. |
| 165 | * Only for Dual VFE |
| 166 | * @right_stop: right input stop offset in pixels. |
| 167 | * Only for Dual VFE |
| 168 | * @right_width: right input width in pixels. |
| 169 | * Only for dual VFE |
| 170 | * @line_start: top of the line number |
| 171 | * @line_stop: bottome of the line number |
| 172 | * @height: input height in lines |
| 173 | * @pixel_clk; sensor output clock |
| 174 | * @batch_size: batch size for HFR mode |
Jing Zhou | 6562f69 | 2017-02-15 15:56:54 -0800 | [diff] [blame] | 175 | * @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*) |
| 176 | * @hbi_cnt: HBI count for the camif input |
| 177 | * @reserved: Reserved field for alignment |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 178 | * @num_out_res: number of the output resource associated |
| 179 | * @data: payload that contains the output resources |
| 180 | * |
| 181 | */ |
| 182 | struct cam_isp_in_port_info { |
| 183 | uint32_t res_type; |
| 184 | uint32_t lane_type; |
| 185 | uint32_t lane_num; |
| 186 | uint32_t lane_cfg; |
| 187 | uint32_t vc; |
| 188 | uint32_t dt; |
| 189 | uint32_t format; |
| 190 | uint32_t test_pattern; |
| 191 | uint32_t usage_type; |
| 192 | uint32_t left_start; |
| 193 | uint32_t left_stop; |
| 194 | uint32_t left_width; |
| 195 | uint32_t right_start; |
| 196 | uint32_t right_stop; |
| 197 | uint32_t right_width; |
| 198 | uint32_t line_start; |
| 199 | uint32_t line_stop; |
| 200 | uint32_t height; |
| 201 | uint32_t pixel_clk; |
| 202 | uint32_t batch_size; |
Jing Zhou | 6562f69 | 2017-02-15 15:56:54 -0800 | [diff] [blame] | 203 | uint32_t dsp_mode; |
| 204 | uint32_t hbi_cnt; |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 205 | uint32_t reserved; |
| 206 | uint32_t num_out_res; |
| 207 | struct cam_isp_out_port_info data[1]; |
| 208 | }; |
| 209 | |
| 210 | /** |
| 211 | * struct cam_isp_resource - A resource bundle |
| 212 | * |
| 213 | * @resoruce_id: resource id for the resource bundle |
| 214 | * @length: length of the while resource blob |
| 215 | * @handle_type: type of the resource handle |
| 216 | * @reserved: reserved field for alignment |
| 217 | * @res_hdl: resource handle that points to the |
| 218 | * resource array; |
| 219 | * |
| 220 | */ |
| 221 | struct cam_isp_resource { |
| 222 | uint32_t resource_id; |
| 223 | uint32_t length; |
| 224 | uint32_t handle_type; |
| 225 | uint32_t reserved; |
| 226 | uint64_t res_hdl; |
| 227 | }; |
| 228 | |
Pavan Kumar Chilamkurthi | 649cdf9 | 2017-08-15 01:40:57 -0700 | [diff] [blame] | 229 | /** |
| 230 | * struct cam_isp_port_hfr_config - HFR configuration for this port |
| 231 | * |
| 232 | * @resource_type: Resource type |
| 233 | * @subsample_pattern: Subsample pattern. Used in HFR mode. It |
| 234 | * should be consistent with batchSize and |
| 235 | * CAMIF programming. |
| 236 | * @subsample_period: Subsample period. Used in HFR mode. It |
| 237 | * should be consistent with batchSize and |
| 238 | * CAMIF programming. |
| 239 | * @framedrop_pattern: Framedrop pattern |
| 240 | * @framedrop_period: Framedrop period |
| 241 | * @reserved: Reserved for alignment |
| 242 | */ |
| 243 | struct cam_isp_port_hfr_config { |
| 244 | uint32_t resource_type; |
| 245 | uint32_t subsample_pattern; |
| 246 | uint32_t subsample_period; |
| 247 | uint32_t framedrop_pattern; |
| 248 | uint32_t framedrop_period; |
| 249 | uint32_t reserved; |
| 250 | }; |
| 251 | |
| 252 | /** |
| 253 | * struct cam_isp_resource_hfr_config - Resource HFR configuration |
| 254 | * |
| 255 | * @num_io_configs: Number of ports |
| 256 | * @reserved: Reserved for alignment |
| 257 | * @io_hfr_config: HFR configuration for each IO port |
| 258 | */ |
| 259 | struct cam_isp_resource_hfr_config { |
| 260 | uint32_t num_io_configs; |
| 261 | uint32_t reserved; |
| 262 | struct cam_isp_port_hfr_config io_hfr_config[1]; |
| 263 | }; |
| 264 | |
Ravikishore Pampana | ff6132e | 2017-07-27 15:32:31 +0530 | [diff] [blame] | 265 | /** |
| 266 | * struct cam_isp_dual_split_params - dual isp spilt parameters |
| 267 | * |
| 268 | * @split_point: Split point information x, where (0 < x < width) |
| 269 | * left ISP's input ends at x + righ padding and |
| 270 | * Right ISP's input starts at x - left padding |
| 271 | * @right_padding: Padding added past the split point for left |
| 272 | * ISP's input |
| 273 | * @left_padding: Padding added before split point for right |
| 274 | * ISP's input |
| 275 | * @reserved: Reserved filed for alignment |
| 276 | * |
| 277 | */ |
| 278 | struct cam_isp_dual_split_params { |
| 279 | uint32_t split_point; |
| 280 | uint32_t right_padding; |
| 281 | uint32_t left_padding; |
| 282 | uint32_t reserved; |
| 283 | }; |
| 284 | |
| 285 | /** |
| 286 | * struct cam_isp_dual_stripe_config - stripe config per bus client |
| 287 | * |
| 288 | * @offset: Start horizontal offset relative to |
| 289 | * output buffer |
| 290 | * In UBWC mode, this value indicates the H_INIT |
| 291 | * value in pixel |
| 292 | * @width: Width of the stripe in bytes |
| 293 | * @tileconfig Ubwc meta tile config. Contain the partial |
| 294 | * tile info |
| 295 | * @port_id: port id of ISP output |
| 296 | * |
| 297 | */ |
| 298 | struct cam_isp_dual_stripe_config { |
| 299 | uint32_t offset; |
| 300 | uint32_t width; |
| 301 | uint32_t tileconfig; |
| 302 | uint32_t port_id; |
| 303 | }; |
| 304 | |
| 305 | /** |
| 306 | * struct cam_isp_dual_config - dual isp configuration |
| 307 | * |
| 308 | * @num_ports Number of isp output ports |
| 309 | * @reserved Reserved field for alignment |
| 310 | * @split_params: Inpput split parameters |
| 311 | * @stripes: Stripe information |
| 312 | * |
| 313 | */ |
| 314 | struct cam_isp_dual_config { |
| 315 | uint32_t num_ports; |
| 316 | uint32_t reserved; |
| 317 | struct cam_isp_dual_split_params split_params; |
| 318 | struct cam_isp_dual_stripe_config stripes[1]; |
| 319 | }; |
| 320 | |
Jing Zhou | 8184f31 | 2017-01-31 14:06:30 -0800 | [diff] [blame] | 321 | #endif /* __UAPI_CAM_ISP_H__ */ |