1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Intel Camera Imaging ISP subsystem. 4 * Copyright (c) 2015, Intel Corporation. 5 */ 6 7 #ifndef __IA_CSS_SDIS_COMMON_TYPES_H 8 #define __IA_CSS_SDIS_COMMON_TYPES_H 9 10 /* @file 11 * CSS-API header file for DVS statistics parameters. 12 */ 13 14 #include <type_support.h> 15 16 /* DVS statistics grid dimensions in number of cells. 17 */ 18 19 struct ia_css_dvs_grid_dim { 20 u32 width; /** Width of DVS grid table in cells */ 21 u32 height; /** Height of DVS grid table in cells */ 22 }; 23 24 /* DVS statistics dimensions in number of cells for 25 * grid, coeffieicient and projection. 26 */ 27 28 struct ia_css_sdis_info { 29 struct { 30 struct ia_css_dvs_grid_dim dim; /* Dimensions */ 31 struct ia_css_dvs_grid_dim pad; /* Padded dimensions */ 32 } grid, coef, proj; 33 u32 deci_factor_log2; 34 }; 35 36 /* DVS statistics grid 37 * 38 * ISP block: SDVS1 (DIS/DVS Support for DIS/DVS ver.1 (2-axes)) 39 * SDVS2 (DVS Support for DVS ver.2 (6-axes)) 40 * ISP1: SDVS1 is used. 41 * ISP2: SDVS2 is used. 42 */ 43 struct ia_css_dvs_grid_res { 44 u32 width; /** Width of DVS grid table. 45 (= Horizontal number of grid cells 46 in table, which cells have effective 47 statistics.) 48 For DVS1, this is equal to 49 the number of vertical statistics. */ 50 u32 aligned_width; /** Stride of each grid line. 51 (= Horizontal number of grid cells 52 in table, which means 53 the allocated width.) */ 54 u32 height; /** Height of DVS grid table. 55 (= Vertical number of grid cells 56 in table, which cells have effective 57 statistics.) 58 For DVS1, This is equal to 59 the number of horizontal statistics. */ 60 u32 aligned_height;/** Stride of each grid column. 61 (= Vertical number of grid cells 62 in table, which means 63 the allocated height.) */ 64 }; 65 66 /* TODO: use ia_css_dvs_grid_res in here. 67 * However, that implies driver I/F changes 68 */ 69 struct ia_css_dvs_grid_info { 70 u32 enable; /** DVS statistics enabled. 71 0:disabled, 1:enabled */ 72 u32 width; /** Width of DVS grid table. 73 (= Horizontal number of grid cells 74 in table, which cells have effective 75 statistics.) 76 For DVS1, this is equal to 77 the number of vertical statistics. */ 78 u32 aligned_width; /** Stride of each grid line. 79 (= Horizontal number of grid cells 80 in table, which means 81 the allocated width.) */ 82 u32 height; /** Height of DVS grid table. 83 (= Vertical number of grid cells 84 in table, which cells have effective 85 statistics.) 86 For DVS1, This is equal to 87 the number of horizontal statistics. */ 88 u32 aligned_height;/** Stride of each grid column. 89 (= Vertical number of grid cells 90 in table, which means 91 the allocated height.) */ 92 u32 bqs_per_grid_cell; /** Grid cell size in BQ(Bayer Quad) unit. 93 (1BQ means {Gr,R,B,Gb}(2x2 pixels).) 94 For DVS1, valid value is 64. 95 For DVS2, valid value is only 64, 96 currently. */ 97 u32 num_hor_coefs; /** Number of horizontal coefficients. */ 98 u32 num_ver_coefs; /** Number of vertical coefficients. */ 99 }; 100 101 /* Number of DVS statistics levels 102 */ 103 #define IA_CSS_DVS_STAT_NUM_OF_LEVELS 3 104 105 /* DVS statistics generated by accelerator global configuration 106 */ 107 struct dvs_stat_public_dvs_global_cfg { 108 unsigned char kappa; 109 /** DVS statistics global configuration - kappa */ 110 unsigned char match_shift; 111 /** DVS statistics global configuration - match_shift */ 112 unsigned char ybin_mode; 113 /** DVS statistics global configuration - y binning mode */ 114 }; 115 116 /* DVS statistics generated by accelerator level grid 117 * configuration 118 */ 119 struct dvs_stat_public_dvs_level_grid_cfg { 120 unsigned char grid_width; 121 /** DVS statistics grid width */ 122 unsigned char grid_height; 123 /** DVS statistics grid height */ 124 unsigned char block_width; 125 /** DVS statistics block width */ 126 unsigned char block_height; 127 /** DVS statistics block height */ 128 }; 129 130 /* DVS statistics generated by accelerator level grid start 131 * configuration 132 */ 133 struct dvs_stat_public_dvs_level_grid_start { 134 unsigned short x_start; 135 /** DVS statistics level x start */ 136 unsigned short y_start; 137 /** DVS statistics level y start */ 138 unsigned char enable; 139 /** DVS statistics level enable */ 140 }; 141 142 /* DVS statistics generated by accelerator level grid end 143 * configuration 144 */ 145 struct dvs_stat_public_dvs_level_grid_end { 146 unsigned short x_end; 147 /** DVS statistics level x end */ 148 unsigned short y_end; 149 /** DVS statistics level y end */ 150 }; 151 152 /* DVS statistics generated by accelerator Feature Extraction 153 * Region Of Interest (FE-ROI) configuration 154 */ 155 struct dvs_stat_public_dvs_level_fe_roi_cfg { 156 unsigned char x_start; 157 /** DVS statistics fe-roi level x start */ 158 unsigned char y_start; 159 /** DVS statistics fe-roi level y start */ 160 unsigned char x_end; 161 /** DVS statistics fe-roi level x end */ 162 unsigned char y_end; 163 /** DVS statistics fe-roi level y end */ 164 }; 165 166 /* DVS statistics generated by accelerator public configuration 167 */ 168 struct dvs_stat_public_dvs_grd_cfg { 169 struct dvs_stat_public_dvs_level_grid_cfg grd_cfg; 170 /** DVS statistics level grid configuration */ 171 struct dvs_stat_public_dvs_level_grid_start grd_start; 172 /** DVS statistics level grid start configuration */ 173 struct dvs_stat_public_dvs_level_grid_end grd_end; 174 /** DVS statistics level grid end configuration */ 175 }; 176 177 /* DVS statistics grid generated by accelerator 178 */ 179 struct ia_css_dvs_stat_grid_info { 180 struct dvs_stat_public_dvs_global_cfg dvs_gbl_cfg; 181 /** DVS statistics global configuration (kappa, match, binning) */ 182 struct dvs_stat_public_dvs_grd_cfg grd_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS]; 183 /** DVS statistics grid configuration (blocks and grids) */ 184 struct dvs_stat_public_dvs_level_fe_roi_cfg 185 fe_roi_cfg[IA_CSS_DVS_STAT_NUM_OF_LEVELS]; 186 /** DVS statistics FE ROI (region of interest) configuration */ 187 }; 188 189 /* DVS statistics generated by accelerator default grid info 190 */ 191 #define DEFAULT_DVS_GRID_INFO { \ 192 .dvs_stat_grid_info = { \ 193 .fe_roi_cfg = { \ 194 [1] = { \ 195 .x_start = 4 \ 196 } \ 197 } \ 198 } \ 199 } 200 201 /* Union that holds all types of DVS statistics grid info in 202 * CSS format 203 * */ 204 union ia_css_dvs_grid_u { 205 struct ia_css_dvs_stat_grid_info dvs_stat_grid_info; 206 /** DVS statistics produced by accelerator grid info */ 207 struct ia_css_dvs_grid_info dvs_grid_info; 208 /** DVS (DVS1/DVS2) grid info */ 209 }; 210 211 #endif /* __IA_CSS_SDIS_COMMON_TYPES_H */ 212