Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/linux/rkisp1-config.h
1 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR MIT) */ 2 /* 3 * Rockchip ISP1 userspace API 4 * Copyright (C) 2017 Rockchip Electronics Co., Ltd. 5 */ 6 7 #ifndef _RKISP1_CONFIG_H 8 #define _RKISP1_CONFIG_H 9 10 #include <linux/types.h> 11 12 #include <linux/media/v4l2-isp.h> 13 14 /* Defect Pixel Cluster Detection */ 15 #define RKISP1_CIF_ISP_MODULE_DPCC (1U << 0) 16 /* Black Level Subtraction */ 17 #define RKISP1_CIF_ISP_MODULE_BLS (1U << 1) 18 /* Sensor De-gamma */ 19 #define RKISP1_CIF_ISP_MODULE_SDG (1U << 2) 20 /* Histogram statistics configuration */ 21 #define RKISP1_CIF_ISP_MODULE_HST (1U << 3) 22 /* Lens Shade Control */ 23 #define RKISP1_CIF_ISP_MODULE_LSC (1U << 4) 24 /* Auto White Balance Gain */ 25 #define RKISP1_CIF_ISP_MODULE_AWB_GAIN (1U << 5) 26 /* Filter */ 27 #define RKISP1_CIF_ISP_MODULE_FLT (1U << 6) 28 /* Bayer Demosaic */ 29 #define RKISP1_CIF_ISP_MODULE_BDM (1U << 7) 30 /* Cross Talk */ 31 #define RKISP1_CIF_ISP_MODULE_CTK (1U << 8) 32 /* Gamma Out Curve */ 33 #define RKISP1_CIF_ISP_MODULE_GOC (1U << 9) 34 /* Color Processing */ 35 #define RKISP1_CIF_ISP_MODULE_CPROC (1U << 10) 36 /* Auto Focus Control statistics configuration */ 37 #define RKISP1_CIF_ISP_MODULE_AFC (1U << 11) 38 /* Auto White Balancing statistics configuration */ 39 #define RKISP1_CIF_ISP_MODULE_AWB (1U << 12) 40 /* Image Effect */ 41 #define RKISP1_CIF_ISP_MODULE_IE (1U << 13) 42 /* Auto Exposure Control statistics configuration */ 43 #define RKISP1_CIF_ISP_MODULE_AEC (1U << 14) 44 /* Wide Dynamic Range */ 45 #define RKISP1_CIF_ISP_MODULE_WDR (1U << 15) 46 /* Denoise Pre-Filter */ 47 #define RKISP1_CIF_ISP_MODULE_DPF (1U << 16) 48 /* Denoise Pre-Filter Strength */ 49 #define RKISP1_CIF_ISP_MODULE_DPF_STRENGTH (1U << 17) 50 51 #define RKISP1_CIF_ISP_CTK_COEFF_MAX 0x100 52 #define RKISP1_CIF_ISP_CTK_OFFSET_MAX 0x800 53 54 #define RKISP1_CIF_ISP_AE_MEAN_MAX_V10 25 55 #define RKISP1_CIF_ISP_AE_MEAN_MAX_V12 81 56 #define RKISP1_CIF_ISP_AE_MEAN_MAX RKISP1_CIF_ISP_AE_MEAN_MAX_V12 57 58 #define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10 16 59 #define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12 32 60 #define RKISP1_CIF_ISP_HIST_BIN_N_MAX RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12 61 62 #define RKISP1_CIF_ISP_AFM_MAX_WINDOWS 3 63 #define RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE 17 64 65 #define RKISP1_CIF_ISP_BDM_MAX_TH 0xff 66 67 /* 68 * Black level compensation 69 */ 70 /* maximum value for horizontal start address */ 71 #define RKISP1_CIF_ISP_BLS_START_H_MAX 0x00000fff 72 /* maximum value for horizontal stop address */ 73 #define RKISP1_CIF_ISP_BLS_STOP_H_MAX 0x00000fff 74 /* maximum value for vertical start address */ 75 #define RKISP1_CIF_ISP_BLS_START_V_MAX 0x00000fff 76 /* maximum value for vertical stop address */ 77 #define RKISP1_CIF_ISP_BLS_STOP_V_MAX 0x00000fff 78 /* maximum is 2^18 = 262144*/ 79 #define RKISP1_CIF_ISP_BLS_SAMPLES_MAX 0x00000012 80 /* maximum value for fixed black level */ 81 #define RKISP1_CIF_ISP_BLS_FIX_SUB_MAX 0x00000fff 82 /* minimum value for fixed black level */ 83 #define RKISP1_CIF_ISP_BLS_FIX_SUB_MIN 0xfffff000 84 /* 13 bit range (signed)*/ 85 #define RKISP1_CIF_ISP_BLS_FIX_MASK 0x00001fff 86 87 /* 88 * Automatic white balance measurements 89 */ 90 #define RKISP1_CIF_ISP_AWB_MAX_GRID 1 91 #define RKISP1_CIF_ISP_AWB_MAX_FRAMES 7 92 93 /* 94 * Gamma out 95 */ 96 /* Maximum number of color samples supported */ 97 #define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10 17 98 #define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12 34 99 #define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12 100 101 /* 102 * Lens shade correction 103 */ 104 #define RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE 8 105 106 /* 107 * The following matches the tuning process, 108 * not the max capabilities of the chip. 109 */ 110 #define RKISP1_CIF_ISP_LSC_SAMPLES_MAX 17 111 112 /* 113 * Histogram calculation 114 */ 115 #define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10 25 116 #define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12 81 117 #define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12 118 119 /* 120 * Defect Pixel Cluster Correction 121 */ 122 #define RKISP1_CIF_ISP_DPCC_METHODS_MAX 3 123 124 #define RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE (1U << 2) 125 126 #define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER (1U << 0) 127 #define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_RB_CENTER (1U << 1) 128 #define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_G_3X3 (1U << 2) 129 #define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_RB_3X3 (1U << 3) 130 131 /* 0-2 for sets 1-3 */ 132 #define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_SET(n) ((n) << 0) 133 #define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET (1U << 3) 134 135 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_GREEN_ENABLE (1U << 0) 136 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE (1U << 1) 137 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_GREEN_ENABLE (1U << 2) 138 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE (1U << 3) 139 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_GREEN_ENABLE (1U << 4) 140 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_RED_BLUE_ENABLE (1U << 8) 141 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE (1U << 9) 142 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_RED_BLUE_ENABLE (1U << 10) 143 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE (1U << 11) 144 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_RED_BLUE_ENABLE (1U << 12) 145 146 #define RKISP1_CIF_ISP_DPCC_LINE_THRESH_G(v) ((v) << 0) 147 #define RKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(v) ((v) << 8) 148 #define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_G(v) ((v) << 0) 149 #define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_RB(v) ((v) << 8) 150 #define RKISP1_CIF_ISP_DPCC_PG_FAC_G(v) ((v) << 0) 151 #define RKISP1_CIF_ISP_DPCC_PG_FAC_RB(v) ((v) << 8) 152 #define RKISP1_CIF_ISP_DPCC_RND_THRESH_G(v) ((v) << 0) 153 #define RKISP1_CIF_ISP_DPCC_RND_THRESH_RB(v) ((v) << 8) 154 #define RKISP1_CIF_ISP_DPCC_RG_FAC_G(v) ((v) << 0) 155 #define RKISP1_CIF_ISP_DPCC_RG_FAC_RB(v) ((v) << 8) 156 157 #define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_G(n, v) ((v) << ((n) * 4)) 158 #define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_RB(n, v) ((v) << ((n) * 4 + 2)) 159 160 #define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_G(n, v) ((v) << ((n) * 4)) 161 #define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(n, v) ((v) << ((n) * 4 + 2)) 162 163 /* 164 * Denoising pre filter 165 */ 166 #define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS 17 167 #define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6 168 169 /* 170 * Compand 171 */ 172 #define RKISP1_CIF_ISP_COMPAND_NUM_POINTS 64 173 174 /* 175 * Wide Dynamic Range 176 */ 177 #define RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV 32 178 #define RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF (RKISP1_CIF_ISP_WDR_CURVE_NUM_INTERV + 1) 179 #define RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS 4 180 181 /* 182 * Measurement types 183 */ 184 #define RKISP1_CIF_ISP_STAT_AWB (1U << 0) 185 #define RKISP1_CIF_ISP_STAT_AUTOEXP (1U << 1) 186 #define RKISP1_CIF_ISP_STAT_AFM (1U << 2) 187 #define RKISP1_CIF_ISP_STAT_HIST (1U << 3) 188 189 /** 190 * enum rkisp1_cif_isp_version - ISP variants 191 * 192 * @RKISP1_V10: Used at least in RK3288 and RK3399. 193 * @RKISP1_V11: Declared in the original vendor code, but not used. Same number 194 * of entries in grids and histogram as v10. 195 * @RKISP1_V12: Used at least in RK3326 and PX30. 196 * @RKISP1_V13: Used at least in RK1808. Same number of entries in grids and 197 * histogram as v12. 198 * @RKISP1_V_IMX8MP: Used in at least i.MX8MP. Same number of entries in grids 199 * and histogram as v10. 200 */ 201 enum rkisp1_cif_isp_version { 202 RKISP1_V10 = 10, 203 RKISP1_V11, 204 RKISP1_V12, 205 RKISP1_V13, 206 RKISP1_V_IMX8MP, 207 }; 208 209 enum rkisp1_cif_isp_histogram_mode { 210 RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE, 211 RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED, 212 RKISP1_CIF_ISP_HISTOGRAM_MODE_R_HISTOGRAM, 213 RKISP1_CIF_ISP_HISTOGRAM_MODE_G_HISTOGRAM, 214 RKISP1_CIF_ISP_HISTOGRAM_MODE_B_HISTOGRAM, 215 RKISP1_CIF_ISP_HISTOGRAM_MODE_Y_HISTOGRAM 216 }; 217 218 enum rkisp1_cif_isp_awb_mode_type { 219 RKISP1_CIF_ISP_AWB_MODE_MANUAL, 220 RKISP1_CIF_ISP_AWB_MODE_RGB, 221 RKISP1_CIF_ISP_AWB_MODE_YCBCR 222 }; 223 224 enum rkisp1_cif_isp_flt_mode { 225 RKISP1_CIF_ISP_FLT_STATIC_MODE, 226 RKISP1_CIF_ISP_FLT_DYNAMIC_MODE 227 }; 228 229 /** 230 * enum rkisp1_cif_isp_exp_ctrl_autostop - stop modes 231 * @RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0: continuous measurement 232 * @RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1: stop measuring after a complete frame 233 */ 234 enum rkisp1_cif_isp_exp_ctrl_autostop { 235 RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0 = 0, 236 RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1 = 1, 237 }; 238 239 /** 240 * enum rkisp1_cif_isp_exp_meas_mode - Exposure measure mode 241 * @RKISP1_CIF_ISP_EXP_MEASURING_MODE_0: Y = 16 + 0.25R + 0.5G + 0.1094B 242 * @RKISP1_CIF_ISP_EXP_MEASURING_MODE_1: Y = (R + G + B) x (85/256) 243 */ 244 enum rkisp1_cif_isp_exp_meas_mode { 245 RKISP1_CIF_ISP_EXP_MEASURING_MODE_0, 246 RKISP1_CIF_ISP_EXP_MEASURING_MODE_1, 247 }; 248 249 /*---------- PART1: Input Parameters ------------*/ 250 251 /** 252 * struct rkisp1_cif_isp_window - measurement window. 253 * 254 * Measurements are calculated per window inside the frame. 255 * This struct represents a window for a measurement. 256 * 257 * @h_offs: the horizontal offset of the window from the left of the frame in pixels. 258 * @v_offs: the vertical offset of the window from the top of the frame in pixels. 259 * @h_size: the horizontal size of the window in pixels 260 * @v_size: the vertical size of the window in pixels. 261 */ 262 struct rkisp1_cif_isp_window { 263 __u16 h_offs; 264 __u16 v_offs; 265 __u16 h_size; 266 __u16 v_size; 267 }; 268 269 /** 270 * struct rkisp1_cif_isp_bls_fixed_val - BLS fixed subtraction values 271 * 272 * The values will be subtracted from the sensor 273 * values. Therefore a negative value means addition instead of subtraction! 274 * 275 * @r: Fixed (signed!) subtraction value for Bayer pattern R 276 * @gr: Fixed (signed!) subtraction value for Bayer pattern Gr 277 * @gb: Fixed (signed!) subtraction value for Bayer pattern Gb 278 * @b: Fixed (signed!) subtraction value for Bayer pattern B 279 */ 280 struct rkisp1_cif_isp_bls_fixed_val { 281 __s16 r; 282 __s16 gr; 283 __s16 gb; 284 __s16 b; 285 }; 286 287 /** 288 * struct rkisp1_cif_isp_bls_config - Configuration used by black level subtraction 289 * 290 * @enable_auto: Automatic mode activated means that the measured values 291 * are subtracted. Otherwise the fixed subtraction 292 * values will be subtracted. 293 * @en_windows: enabled window 294 * @bls_window1: Measurement window 1 size 295 * @bls_window2: Measurement window 2 size 296 * @bls_samples: Set amount of measured pixels for each Bayer position 297 * (A, B,C and D) to 2^bls_samples. 298 * @fixed_val: Fixed subtraction values 299 */ 300 struct rkisp1_cif_isp_bls_config { 301 __u8 enable_auto; 302 __u8 en_windows; 303 struct rkisp1_cif_isp_window bls_window1; 304 struct rkisp1_cif_isp_window bls_window2; 305 __u8 bls_samples; 306 struct rkisp1_cif_isp_bls_fixed_val fixed_val; 307 }; 308 309 /** 310 * struct rkisp1_cif_isp_dpcc_methods_config - DPCC methods set configuration 311 * 312 * This structure stores the configuration of one set of methods for the DPCC 313 * algorithm. Multiple methods can be selected in each set (independently for 314 * the Green and Red/Blue components) through the @method field, the result is 315 * the logical AND of all enabled methods. The remaining fields set thresholds 316 * and factors for each method. 317 * 318 * @method: Method enable bits (RKISP1_CIF_ISP_DPCC_METHODS_SET_*) 319 * @line_thresh: Line threshold (RKISP1_CIF_ISP_DPCC_LINE_THRESH_*) 320 * @line_mad_fac: Line Mean Absolute Difference factor (RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_*) 321 * @pg_fac: Peak gradient factor (RKISP1_CIF_ISP_DPCC_PG_FAC_*) 322 * @rnd_thresh: Rank Neighbor Difference threshold (RKISP1_CIF_ISP_DPCC_RND_THRESH_*) 323 * @rg_fac: Rank gradient factor (RKISP1_CIF_ISP_DPCC_RG_FAC_*) 324 */ 325 struct rkisp1_cif_isp_dpcc_methods_config { 326 __u32 method; 327 __u32 line_thresh; 328 __u32 line_mad_fac; 329 __u32 pg_fac; 330 __u32 rnd_thresh; 331 __u32 rg_fac; 332 }; 333 334 /** 335 * struct rkisp1_cif_isp_dpcc_config - Configuration used by DPCC 336 * 337 * Configuration used by Defect Pixel Cluster Correction. Three sets of methods 338 * can be configured and selected through the @set_use field. The result is the 339 * logical OR of all enabled sets. 340 * 341 * @mode: DPCC mode (RKISP1_CIF_ISP_DPCC_MODE_*) 342 * @output_mode: Interpolation output mode (RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_*) 343 * @set_use: Methods sets selection (RKISP1_CIF_ISP_DPCC_SET_USE_*) 344 * @methods: Methods sets configuration 345 * @ro_limits: Rank order limits (RKISP1_CIF_ISP_DPCC_RO_LIMITS_*) 346 * @rnd_offs: Differential rank offsets for rank neighbor difference (RKISP1_CIF_ISP_DPCC_RND_OFFS_*) 347 */ 348 struct rkisp1_cif_isp_dpcc_config { 349 __u32 mode; 350 __u32 output_mode; 351 __u32 set_use; 352 struct rkisp1_cif_isp_dpcc_methods_config methods[RKISP1_CIF_ISP_DPCC_METHODS_MAX]; 353 __u32 ro_limits; 354 __u32 rnd_offs; 355 }; 356 357 /** 358 * struct rkisp1_cif_isp_gamma_corr_curve - gamma curve point definition y-axis (output). 359 * 360 * The reset values define a linear curve which has the same effect as bypass. Reset values are: 361 * gamma_y[0] = 0x0000, gamma_y[1] = 0x0100, ... gamma_y[15] = 0x0f00, gamma_y[16] = 0xfff 362 * 363 * @gamma_y: the values for the y-axis of gamma curve points. Each value is 12 bit. 364 */ 365 struct rkisp1_cif_isp_gamma_corr_curve { 366 __u16 gamma_y[RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE]; 367 }; 368 369 /** 370 * struct rkisp1_cif_isp_gamma_curve_x_axis_pnts - De-Gamma Curve definition x increments 371 * (sampling points). gamma_dx0 is for the lower samples (1-8), gamma_dx1 is for the 372 * higher samples (9-16). The reset values for both fields is 0x44444444. This means 373 * that each sample is 4 units away from the previous one on the x-axis. 374 * 375 * @gamma_dx0: gamma curve sample points definitions. Bits 0:2 for sample 1. Bit 3 unused. 376 * Bits 4:6 for sample 2. bit 7 unused ... Bits 28:30 for sample 8. Bit 31 unused 377 * @gamma_dx1: gamma curve sample points definitions. Bits 0:2 for sample 9. Bit 3 unused. 378 * Bits 4:6 for sample 10. bit 7 unused ... Bits 28:30 for sample 16. Bit 31 unused 379 */ 380 struct rkisp1_cif_isp_gamma_curve_x_axis_pnts { 381 __u32 gamma_dx0; 382 __u32 gamma_dx1; 383 }; 384 385 /** 386 * struct rkisp1_cif_isp_sdg_config - Configuration used by sensor degamma 387 * 388 * @curve_r: gamma curve point definition axis for red 389 * @curve_g: gamma curve point definition axis for green 390 * @curve_b: gamma curve point definition axis for blue 391 * @xa_pnts: x axis increments 392 */ 393 struct rkisp1_cif_isp_sdg_config { 394 struct rkisp1_cif_isp_gamma_corr_curve curve_r; 395 struct rkisp1_cif_isp_gamma_corr_curve curve_g; 396 struct rkisp1_cif_isp_gamma_corr_curve curve_b; 397 struct rkisp1_cif_isp_gamma_curve_x_axis_pnts xa_pnts; 398 }; 399 400 /** 401 * struct rkisp1_cif_isp_lsc_config - Configuration used by Lens shading correction 402 * 403 * @r_data_tbl: sample table red 404 * @gr_data_tbl: sample table green (red) 405 * @gb_data_tbl: sample table green (blue) 406 * @b_data_tbl: sample table blue 407 * @x_grad_tbl: gradient table x 408 * @y_grad_tbl: gradient table y 409 * @x_size_tbl: size table x 410 * @y_size_tbl: size table y 411 * @config_width: not used at the moment 412 * @config_height: not used at the moment 413 */ 414 struct rkisp1_cif_isp_lsc_config { 415 __u16 r_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX]; 416 __u16 gr_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX]; 417 __u16 gb_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX]; 418 __u16 b_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX]; 419 420 __u16 x_grad_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE]; 421 __u16 y_grad_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE]; 422 423 __u16 x_size_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE]; 424 __u16 y_size_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE]; 425 __u16 config_width; 426 __u16 config_height; 427 }; 428 429 /** 430 * struct rkisp1_cif_isp_ie_config - Configuration used by image effects 431 * 432 * @effect: values from 'enum v4l2_colorfx'. Possible values are: V4L2_COLORFX_SEPIA, 433 * V4L2_COLORFX_SET_CBCR, V4L2_COLORFX_AQUA, V4L2_COLORFX_EMBOSS, 434 * V4L2_COLORFX_SKETCH, V4L2_COLORFX_BW, V4L2_COLORFX_NEGATIVE 435 * @color_sel: bits 0:2 - colors bitmask (001 - blue, 010 - green, 100 - red). 436 * bits 8:15 - Threshold value of the RGB colors for the color selection effect. 437 * @eff_mat_1: 3x3 Matrix Coefficients for Emboss Effect 1 438 * @eff_mat_2: 3x3 Matrix Coefficients for Emboss Effect 2 439 * @eff_mat_3: 3x3 Matrix Coefficients for Emboss 3/Sketch 1 440 * @eff_mat_4: 3x3 Matrix Coefficients for Sketch Effect 2 441 * @eff_mat_5: 3x3 Matrix Coefficients for Sketch Effect 3 442 * @eff_tint: Chrominance increment values of tint (used for sepia effect) 443 */ 444 struct rkisp1_cif_isp_ie_config { 445 __u16 effect; 446 __u16 color_sel; 447 __u16 eff_mat_1; 448 __u16 eff_mat_2; 449 __u16 eff_mat_3; 450 __u16 eff_mat_4; 451 __u16 eff_mat_5; 452 __u16 eff_tint; 453 }; 454 455 /** 456 * struct rkisp1_cif_isp_cproc_config - Configuration used by Color Processing 457 * 458 * @c_out_range: Chrominance pixel clipping range at output. 459 * (0 for limit, 1 for full) 460 * @y_in_range: Luminance pixel clipping range at output. 461 * @y_out_range: Luminance pixel clipping range at output. 462 * @contrast: 00~ff, 0.0~1.992 463 * @brightness: 80~7F, -128~+127 464 * @sat: saturation, 00~FF, 0.0~1.992 465 * @hue: 80~7F, -90~+87.188 466 */ 467 struct rkisp1_cif_isp_cproc_config { 468 __u8 c_out_range; 469 __u8 y_in_range; 470 __u8 y_out_range; 471 __u8 contrast; 472 __u8 brightness; 473 __u8 sat; 474 __u8 hue; 475 }; 476 477 /** 478 * struct rkisp1_cif_isp_awb_meas_config - Configuration for the AWB statistics 479 * 480 * @awb_mode: the awb meas mode. From enum rkisp1_cif_isp_awb_mode_type. 481 * @awb_wnd: white balance measurement window (in pixels) 482 * @max_y: only pixels values < max_y contribute to awb measurement, set to 0 483 * to disable this feature 484 * @min_y: only pixels values > min_y contribute to awb measurement 485 * @max_csum: Chrominance sum maximum value, only consider pixels with Cb+Cr, 486 * smaller than threshold for awb measurements 487 * @min_c: Chrominance minimum value, only consider pixels with Cb/Cr 488 * each greater than threshold value for awb measurements 489 * @frames: number of frames - 1 used for mean value calculation 490 * (ucFrames=0 means 1 Frame) 491 * @awb_ref_cr: reference Cr value for AWB regulation, target for AWB 492 * @awb_ref_cb: reference Cb value for AWB regulation, target for AWB 493 * @enable_ymax_cmp: enable Y_MAX compare (Not valid in RGB measurement mode.) 494 */ 495 struct rkisp1_cif_isp_awb_meas_config { 496 /* 497 * Note: currently the h and v offsets are mapped to grid offsets 498 */ 499 struct rkisp1_cif_isp_window awb_wnd; 500 __u32 awb_mode; 501 __u8 max_y; 502 __u8 min_y; 503 __u8 max_csum; 504 __u8 min_c; 505 __u8 frames; 506 __u8 awb_ref_cr; 507 __u8 awb_ref_cb; 508 __u8 enable_ymax_cmp; 509 }; 510 511 /** 512 * struct rkisp1_cif_isp_awb_gain_config - Configuration used by auto white balance gain 513 * 514 * All fields in this struct are 10 bit, where: 515 * 0x100h = 1, unsigned integer value, range 0 to 4 with 8 bit fractional part. 516 * 517 * out_data_x = ( AWB_GAIN_X * in_data + 128) >> 8 518 * 519 * @gain_red: gain value for red component. 520 * @gain_green_r: gain value for green component in red line. 521 * @gain_blue: gain value for blue component. 522 * @gain_green_b: gain value for green component in blue line. 523 */ 524 struct rkisp1_cif_isp_awb_gain_config { 525 __u16 gain_red; 526 __u16 gain_green_r; 527 __u16 gain_blue; 528 __u16 gain_green_b; 529 }; 530 531 /** 532 * struct rkisp1_cif_isp_flt_config - Configuration used by ISP filtering 533 * 534 * All 4 threshold fields (thresh_*) are 10 bits. 535 * All 6 factor fields (fac_*) are 6 bits. 536 * 537 * @mode: ISP_FILT_MODE register fields (from enum rkisp1_cif_isp_flt_mode) 538 * @grn_stage1: Green filter stage 1 select (range 0x0...0x8) 539 * @chr_h_mode: Chroma filter horizontal mode 540 * @chr_v_mode: Chroma filter vertical mode 541 * @thresh_bl0: If thresh_bl1 < sum_grad < thresh_bl0 then fac_bl0 is selected (blurring th) 542 * @thresh_bl1: If sum_grad < thresh_bl1 then fac_bl1 is selected (blurring th) 543 * @thresh_sh0: If thresh_sh0 < sum_grad < thresh_sh1 then thresh_sh0 is selected (sharpening th) 544 * @thresh_sh1: If thresh_sh1 < sum_grad then thresh_sh1 is selected (sharpening th) 545 * @lum_weight: Parameters for luminance weight function. 546 * @fac_sh1: filter factor for sharp1 level 547 * @fac_sh0: filter factor for sharp0 level 548 * @fac_mid: filter factor for mid level and for static filter mode 549 * @fac_bl0: filter factor for blur 0 level 550 * @fac_bl1: filter factor for blur 1 level (max blur) 551 */ 552 struct rkisp1_cif_isp_flt_config { 553 __u32 mode; 554 __u8 grn_stage1; 555 __u8 chr_h_mode; 556 __u8 chr_v_mode; 557 __u32 thresh_bl0; 558 __u32 thresh_bl1; 559 __u32 thresh_sh0; 560 __u32 thresh_sh1; 561 __u32 lum_weight; 562 __u32 fac_sh1; 563 __u32 fac_sh0; 564 __u32 fac_mid; 565 __u32 fac_bl0; 566 __u32 fac_bl1; 567 }; 568 569 /** 570 * struct rkisp1_cif_isp_bdm_config - Configuration used by Bayer DeMosaic 571 * 572 * @demosaic_th: threshold for bayer demosaicing texture detection 573 */ 574 struct rkisp1_cif_isp_bdm_config { 575 __u8 demosaic_th; 576 }; 577 578 /** 579 * struct rkisp1_cif_isp_ctk_config - Configuration used by Cross Talk correction 580 * 581 * @coeff: color correction matrix. Values are 11-bit signed fixed-point numbers with 4 bit integer 582 * and 7 bit fractional part, ranging from -8 (0x400) to +7.992 (0x3FF). 0 is 583 * represented by 0x000 and a coefficient value of 1 as 0x080. 584 * @ct_offset: Red, Green, Blue offsets for the crosstalk correction matrix 585 */ 586 struct rkisp1_cif_isp_ctk_config { 587 __u16 coeff[3][3]; 588 __u16 ct_offset[3]; 589 }; 590 591 enum rkisp1_cif_isp_goc_mode { 592 RKISP1_CIF_ISP_GOC_MODE_LOGARITHMIC, 593 RKISP1_CIF_ISP_GOC_MODE_EQUIDISTANT 594 }; 595 596 /** 597 * struct rkisp1_cif_isp_goc_config - Configuration used by Gamma Out correction 598 * 599 * @mode: goc mode (from enum rkisp1_cif_isp_goc_mode) 600 * @gamma_y: gamma out curve y-axis for all color components 601 * 602 * The number of entries of @gamma_y depends on the hardware revision 603 * as is reported by the hw_revision field of the struct media_device_info 604 * that is returned by ioctl MEDIA_IOC_DEVICE_INFO. 605 * 606 * V10 has RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10 entries, V12 has 607 * RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12 entries. 608 * RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES is equal to the maximum of the two. 609 */ 610 struct rkisp1_cif_isp_goc_config { 611 __u32 mode; 612 __u16 gamma_y[RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES]; 613 }; 614 615 /** 616 * struct rkisp1_cif_isp_hst_config - Configuration for Histogram statistics 617 * 618 * @mode: histogram mode (from enum rkisp1_cif_isp_histogram_mode) 619 * @histogram_predivider: process every stepsize pixel, all other pixels are 620 * skipped 621 * @meas_window: coordinates of the measure window 622 * @hist_weight: weighting factor for sub-windows 623 * 624 * The number of entries of @hist_weight depends on the hardware revision 625 * as is reported by the hw_revision field of the struct media_device_info 626 * that is returned by ioctl MEDIA_IOC_DEVICE_INFO. 627 * 628 * V10 has RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10 entries, V12 has 629 * RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12 entries. 630 * RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE is equal to the maximum of the 631 * two. 632 */ 633 struct rkisp1_cif_isp_hst_config { 634 __u32 mode; 635 __u8 histogram_predivider; 636 struct rkisp1_cif_isp_window meas_window; 637 __u8 hist_weight[RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE]; 638 }; 639 640 /** 641 * struct rkisp1_cif_isp_aec_config - Configuration for Auto Exposure statistics 642 * 643 * @mode: Exposure measure mode (from enum rkisp1_cif_isp_exp_meas_mode) 644 * @autostop: stop mode (from enum rkisp1_cif_isp_exp_ctrl_autostop) 645 * @meas_window: coordinates of the measure window 646 */ 647 struct rkisp1_cif_isp_aec_config { 648 __u32 mode; 649 __u32 autostop; 650 struct rkisp1_cif_isp_window meas_window; 651 }; 652 653 /** 654 * struct rkisp1_cif_isp_afc_config - Configuration for the Auto Focus statistics 655 * 656 * @num_afm_win: max RKISP1_CIF_ISP_AFM_MAX_WINDOWS 657 * @afm_win: coordinates of the meas window 658 * @thres: threshold used for minimizing the influence of noise 659 * @var_shift: the number of bits for the shift operation at the end of the 660 * calculation chain. 661 */ 662 struct rkisp1_cif_isp_afc_config { 663 __u8 num_afm_win; 664 struct rkisp1_cif_isp_window afm_win[RKISP1_CIF_ISP_AFM_MAX_WINDOWS]; 665 __u32 thres; 666 __u32 var_shift; 667 }; 668 669 /** 670 * enum rkisp1_cif_isp_dpf_gain_usage - dpf gain usage 671 * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED: don't use any gains in preprocessing stage 672 * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS: use only the noise function gains from 673 * registers DPF_NF_GAIN_R, ... 674 * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS: use only the gains from LSC module 675 * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS: use the noise function gains and the 676 * gains from LSC module 677 * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS: use only the gains from AWB module 678 * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS: use the gains from AWB and LSC module 679 * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX: upper border (only for an internal evaluation) 680 */ 681 enum rkisp1_cif_isp_dpf_gain_usage { 682 RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED, 683 RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS, 684 RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS, 685 RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS, 686 RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS, 687 RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS, 688 RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX 689 }; 690 691 /** 692 * enum rkisp1_cif_isp_dpf_rb_filtersize - Red and blue filter sizes 693 * @RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9: red and blue filter kernel size 13x9 694 * (means 7x5 active pixel) 695 * @RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9: red and blue filter kernel size 9x9 696 * (means 5x5 active pixel) 697 */ 698 enum rkisp1_cif_isp_dpf_rb_filtersize { 699 RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9, 700 RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9, 701 }; 702 703 /** 704 * enum rkisp1_cif_isp_dpf_nll_scale_mode - dpf noise level scale mode 705 * @RKISP1_CIF_ISP_NLL_SCALE_LINEAR: use a linear scaling 706 * @RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC: use a logarithmic scaling 707 */ 708 enum rkisp1_cif_isp_dpf_nll_scale_mode { 709 RKISP1_CIF_ISP_NLL_SCALE_LINEAR, 710 RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC, 711 }; 712 713 /** 714 * struct rkisp1_cif_isp_dpf_nll - Noise level lookup 715 * 716 * @coeff: Noise level Lookup coefficient 717 * @scale_mode: dpf noise level scale mode (from enum rkisp1_cif_isp_dpf_nll_scale_mode) 718 */ 719 struct rkisp1_cif_isp_dpf_nll { 720 __u16 coeff[RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS]; 721 __u32 scale_mode; 722 }; 723 724 /** 725 * struct rkisp1_cif_isp_dpf_rb_flt - Red blue filter config 726 * 727 * @fltsize: The filter size for the red and blue pixels 728 * (from enum rkisp1_cif_isp_dpf_rb_filtersize) 729 * @spatial_coeff: Spatial weights 730 * @r_enable: enable filter processing for red pixels 731 * @b_enable: enable filter processing for blue pixels 732 */ 733 struct rkisp1_cif_isp_dpf_rb_flt { 734 __u32 fltsize; 735 __u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS]; 736 __u8 r_enable; 737 __u8 b_enable; 738 }; 739 740 /** 741 * struct rkisp1_cif_isp_dpf_g_flt - Green filter Configuration 742 * 743 * @spatial_coeff: Spatial weights 744 * @gr_enable: enable filter processing for green pixels in green/red lines 745 * @gb_enable: enable filter processing for green pixels in green/blue lines 746 */ 747 struct rkisp1_cif_isp_dpf_g_flt { 748 __u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS]; 749 __u8 gr_enable; 750 __u8 gb_enable; 751 }; 752 753 /** 754 * struct rkisp1_cif_isp_dpf_gain - Noise function Configuration 755 * 756 * @mode: dpf gain usage (from enum rkisp1_cif_isp_dpf_gain_usage) 757 * @nf_r_gain: Noise function Gain that replaces the AWB gain for red pixels 758 * @nf_b_gain: Noise function Gain that replaces the AWB gain for blue pixels 759 * @nf_gr_gain: Noise function Gain that replaces the AWB gain 760 * for green pixels in a red line 761 * @nf_gb_gain: Noise function Gain that replaces the AWB gain 762 * for green pixels in a blue line 763 */ 764 struct rkisp1_cif_isp_dpf_gain { 765 __u32 mode; 766 __u16 nf_r_gain; 767 __u16 nf_b_gain; 768 __u16 nf_gr_gain; 769 __u16 nf_gb_gain; 770 }; 771 772 /** 773 * struct rkisp1_cif_isp_dpf_config - Configuration used by De-noising pre-filter 774 * 775 * @gain: noise function gain 776 * @g_flt: green filter config 777 * @rb_flt: red blue filter config 778 * @nll: noise level lookup 779 */ 780 struct rkisp1_cif_isp_dpf_config { 781 struct rkisp1_cif_isp_dpf_gain gain; 782 struct rkisp1_cif_isp_dpf_g_flt g_flt; 783 struct rkisp1_cif_isp_dpf_rb_flt rb_flt; 784 struct rkisp1_cif_isp_dpf_nll nll; 785 }; 786 787 /** 788 * struct rkisp1_cif_isp_dpf_strength_config - strength of the filter 789 * 790 * @r: filter strength of the RED filter 791 * @g: filter strength of the GREEN filter 792 * @b: filter strength of the BLUE filter 793 */ 794 struct rkisp1_cif_isp_dpf_strength_config { 795 __u8 r; 796 __u8 g; 797 __u8 b; 798 }; 799 800 /** 801 * struct rkisp1_cif_isp_isp_other_cfg - Parameters for some blocks in rockchip isp1 802 * 803 * @dpcc_config: Defect Pixel Cluster Correction config 804 * @bls_config: Black Level Subtraction config 805 * @sdg_config: sensor degamma config 806 * @lsc_config: Lens Shade config 807 * @awb_gain_config: Auto White balance gain config 808 * @flt_config: filter config 809 * @bdm_config: demosaic config 810 * @ctk_config: cross talk config 811 * @goc_config: gamma out config 812 * @bls_config: black level subtraction config 813 * @dpf_config: De-noising pre-filter config 814 * @dpf_strength_config: dpf strength config 815 * @cproc_config: color process config 816 * @ie_config: image effects config 817 */ 818 struct rkisp1_cif_isp_isp_other_cfg { 819 struct rkisp1_cif_isp_dpcc_config dpcc_config; 820 struct rkisp1_cif_isp_bls_config bls_config; 821 struct rkisp1_cif_isp_sdg_config sdg_config; 822 struct rkisp1_cif_isp_lsc_config lsc_config; 823 struct rkisp1_cif_isp_awb_gain_config awb_gain_config; 824 struct rkisp1_cif_isp_flt_config flt_config; 825 struct rkisp1_cif_isp_bdm_config bdm_config; 826 struct rkisp1_cif_isp_ctk_config ctk_config; 827 struct rkisp1_cif_isp_goc_config goc_config; 828 struct rkisp1_cif_isp_dpf_config dpf_config; 829 struct rkisp1_cif_isp_dpf_strength_config dpf_strength_config; 830 struct rkisp1_cif_isp_cproc_config cproc_config; 831 struct rkisp1_cif_isp_ie_config ie_config; 832 }; 833 834 /** 835 * struct rkisp1_cif_isp_isp_meas_cfg - Rockchip ISP1 Measure Parameters 836 * 837 * @awb_meas_config: auto white balance config 838 * @hst_config: histogram config 839 * @aec_config: auto exposure config 840 * @afc_config: auto focus config 841 */ 842 struct rkisp1_cif_isp_isp_meas_cfg { 843 struct rkisp1_cif_isp_awb_meas_config awb_meas_config; 844 struct rkisp1_cif_isp_hst_config hst_config; 845 struct rkisp1_cif_isp_aec_config aec_config; 846 struct rkisp1_cif_isp_afc_config afc_config; 847 }; 848 849 /** 850 * struct rkisp1_params_cfg - Rockchip ISP1 Input Parameters Meta Data 851 * 852 * @module_en_update: mask the enable bits of which module should be updated 853 * @module_ens: mask the enable value of each module, only update the module 854 * which correspond bit was set in module_en_update 855 * @module_cfg_update: mask the config bits of which module should be updated 856 * @meas: measurement config 857 * @others: other config 858 */ 859 struct rkisp1_params_cfg { 860 __u32 module_en_update; 861 __u32 module_ens; 862 __u32 module_cfg_update; 863 864 struct rkisp1_cif_isp_isp_meas_cfg meas; 865 struct rkisp1_cif_isp_isp_other_cfg others; 866 }; 867 868 /** 869 * struct rkisp1_cif_isp_compand_bls_config - Rockchip ISP1 Companding parameters (BLS) 870 * @r: Fixed subtraction value for Bayer pattern R 871 * @gr: Fixed subtraction value for Bayer pattern Gr 872 * @gb: Fixed subtraction value for Bayer pattern Gb 873 * @b: Fixed subtraction value for Bayer pattern B 874 * 875 * The values will be subtracted from the sensor values. Note that unlike the 876 * dedicated BLS block, the BLS values in the compander are 20-bit unsigned. 877 */ 878 struct rkisp1_cif_isp_compand_bls_config { 879 __u32 r; 880 __u32 gr; 881 __u32 gb; 882 __u32 b; 883 }; 884 885 /** 886 * struct rkisp1_cif_isp_compand_curve_config - Rockchip ISP1 Companding 887 * parameters (expand and compression curves) 888 * @px: Compand curve x-values. Each value stores the distance from the 889 * previous x-value, expressed as log2 of the distance on 5 bits. 890 * @x: Compand curve x-values. The functionality of these parameters are 891 * unknown due to do a lack of hardware documentation, but these are left 892 * here for future compatibility purposes. 893 * @y: Compand curve y-values 894 */ 895 struct rkisp1_cif_isp_compand_curve_config { 896 __u8 px[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; 897 __u32 x[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; 898 __u32 y[RKISP1_CIF_ISP_COMPAND_NUM_POINTS]; 899 }; 900 901 /** 902 * struct rkisp1_cif_isp_wdr_tone_curve - Tone mapping curve definition for WDR. 903 * 904 * @dY: the dYn increments for horizontal (input) axis of the tone curve. 905 * each 3-bit dY value represents an increment of 2**(value+3). 906 * dY[0] bits 0:2 is increment dY1, bit 3 unused 907 * dY[0] bits 4:6 is increment dY2, bit 7 unused 908 * ... 909 * dY[0] bits 28:30 is increment dY8, bit 31 unused 910 * ... and so on till dY[3] bits 28:30 is increment dY32, bit 31 unused. 911 * @ym: the Ym values for the vertical (output) axis of the tone curve. 912 * each value is 13 bit. 913 */ 914 struct rkisp1_cif_isp_wdr_tone_curve { 915 __u32 dY[RKISP1_CIF_ISP_WDR_CURVE_NUM_DY_REGS]; 916 __u16 ym[RKISP1_CIF_ISP_WDR_CURVE_NUM_COEFF]; 917 }; 918 919 /** 920 * struct rkisp1_cif_isp_wdr_iref_config - Illumination reference config for WDR. 921 * 922 * Use illumination reference value as described below, instead of only the 923 * luminance (Y) value for tone mapping and gain calculations: 924 * IRef = (rgb_factor * RGBMax_tr + (8 - rgb_factor) * Y)/8 925 * 926 * @rgb_factor: defines how much influence the RGBmax approach has in 927 * comparison to Y (valid values are 0..8). 928 * @use_y9_8: use Y*9/8 for maximum value calculation along with the 929 * default of R, G, B for noise reduction. 930 * @use_rgb7_8: decrease RGBMax by 7/8 for noise reduction. 931 * @disable_transient: disable transient calculation between Y and RGBY_max. 932 */ 933 struct rkisp1_cif_isp_wdr_iref_config { 934 __u8 rgb_factor; 935 __u8 use_y9_8; 936 __u8 use_rgb7_8; 937 __u8 disable_transient; 938 }; 939 940 /** 941 * struct rkisp1_cif_isp_wdr_config - Configuration for wide dynamic range. 942 * 943 * @tone_curve: tone mapping curve. 944 * @iref_config: illumination reference configuration. (when use_iref is true) 945 * @rgb_offset: RGB offset value for RGB operation mode. (12 bits) 946 * @luma_offset: luminance offset value for RGB operation mode. (12 bits) 947 * @dmin_thresh: lower threshold for deltaMin value. (12 bits) 948 * @dmin_strength: strength factor for deltaMin. (valid range is 0x00..0x10) 949 * @use_rgb_colorspace: use RGB instead of luminance/chrominance colorspace. 950 * @bypass_chroma_mapping: disable chrominance mapping (only valid if 951 * use_rgb_colorspace = 0) 952 * @use_iref: use illumination reference instead of Y for tone mapping 953 * and gain calculations. 954 */ 955 struct rkisp1_cif_isp_wdr_config { 956 struct rkisp1_cif_isp_wdr_tone_curve tone_curve; 957 struct rkisp1_cif_isp_wdr_iref_config iref_config; 958 __u16 rgb_offset; 959 __u16 luma_offset; 960 __u16 dmin_thresh; 961 __u8 dmin_strength; 962 __u8 use_rgb_colorspace; 963 __u8 bypass_chroma_mapping; 964 __u8 use_iref; 965 }; 966 967 /*---------- PART2: Measurement Statistics ------------*/ 968 969 /** 970 * struct rkisp1_cif_isp_awb_meas - AWB measured values 971 * 972 * @cnt: White pixel count, number of "white pixels" found during last 973 * measurement 974 * @mean_y_or_g: Mean value of Y within window and frames, 975 * Green if RGB is selected. 976 * @mean_cb_or_b: Mean value of Cb within window and frames, 977 * Blue if RGB is selected. 978 * @mean_cr_or_r: Mean value of Cr within window and frames, 979 * Red if RGB is selected. 980 */ 981 struct rkisp1_cif_isp_awb_meas { 982 __u32 cnt; 983 __u8 mean_y_or_g; 984 __u8 mean_cb_or_b; 985 __u8 mean_cr_or_r; 986 }; 987 988 /** 989 * struct rkisp1_cif_isp_awb_stat - statistics automatic white balance data 990 * 991 * @awb_mean: Mean measured data 992 */ 993 struct rkisp1_cif_isp_awb_stat { 994 struct rkisp1_cif_isp_awb_meas awb_mean[RKISP1_CIF_ISP_AWB_MAX_GRID]; 995 }; 996 997 /** 998 * struct rkisp1_cif_isp_bls_meas_val - BLS measured values 999 * 1000 * @meas_r: Mean measured value for Bayer pattern R 1001 * @meas_gr: Mean measured value for Bayer pattern Gr 1002 * @meas_gb: Mean measured value for Bayer pattern Gb 1003 * @meas_b: Mean measured value for Bayer pattern B 1004 */ 1005 struct rkisp1_cif_isp_bls_meas_val { 1006 __u16 meas_r; 1007 __u16 meas_gr; 1008 __u16 meas_gb; 1009 __u16 meas_b; 1010 }; 1011 1012 /** 1013 * struct rkisp1_cif_isp_ae_stat - statistics auto exposure data 1014 * 1015 * @exp_mean: Mean luminance value of block xx 1016 * @bls_val: BLS measured values 1017 * 1018 * The number of entries of @exp_mean depends on the hardware revision 1019 * as is reported by the hw_revision field of the struct media_device_info 1020 * that is returned by ioctl MEDIA_IOC_DEVICE_INFO. 1021 * 1022 * V10 has RKISP1_CIF_ISP_AE_MEAN_MAX_V10 entries, V12 has 1023 * RKISP1_CIF_ISP_AE_MEAN_MAX_V12 entries. RKISP1_CIF_ISP_AE_MEAN_MAX is equal 1024 * to the maximum of the two. 1025 * 1026 * Image is divided into 5x5 blocks on V10 and 9x9 blocks on V12. 1027 */ 1028 struct rkisp1_cif_isp_ae_stat { 1029 __u8 exp_mean[RKISP1_CIF_ISP_AE_MEAN_MAX]; 1030 struct rkisp1_cif_isp_bls_meas_val bls_val; 1031 }; 1032 1033 /** 1034 * struct rkisp1_cif_isp_af_meas_val - AF measured values 1035 * 1036 * @sum: sharpness value 1037 * @lum: luminance value 1038 */ 1039 struct rkisp1_cif_isp_af_meas_val { 1040 __u32 sum; 1041 __u32 lum; 1042 }; 1043 1044 /** 1045 * struct rkisp1_cif_isp_af_stat - statistics auto focus data 1046 * 1047 * @window: AF measured value of window x 1048 * 1049 * The module measures the sharpness in 3 windows of selectable size via 1050 * register settings(ISP_AFM_*_A/B/C) 1051 */ 1052 struct rkisp1_cif_isp_af_stat { 1053 struct rkisp1_cif_isp_af_meas_val window[RKISP1_CIF_ISP_AFM_MAX_WINDOWS]; 1054 }; 1055 1056 /** 1057 * struct rkisp1_cif_isp_hist_stat - statistics histogram data 1058 * 1059 * @hist_bins: measured bin counters. Each bin is a 20 bits unsigned fixed point 1060 * type. Bits 0-4 are the fractional part and bits 5-19 are the 1061 * integer part. 1062 * 1063 * The window of the measurements area is divided to 5x5 sub-windows for 1064 * V10 and to 9x9 sub-windows for V12. The histogram is then computed for each 1065 * sub-window independently and the final result is a weighted average of the 1066 * histogram measurements on all sub-windows. The window of the measurements 1067 * area and the weight of each sub-window are configurable using 1068 * struct @rkisp1_cif_isp_hst_config. 1069 * 1070 * The histogram contains 16 bins in V10 and 32 bins in V12. 1071 * 1072 * The number of entries of @hist_bins depends on the hardware revision 1073 * as is reported by the hw_revision field of the struct media_device_info 1074 * that is returned by ioctl MEDIA_IOC_DEVICE_INFO. 1075 * 1076 * V10 has RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10 entries, V12 has 1077 * RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12 entries. RKISP1_CIF_ISP_HIST_BIN_N_MAX is 1078 * equal to the maximum of the two. 1079 */ 1080 struct rkisp1_cif_isp_hist_stat { 1081 __u32 hist_bins[RKISP1_CIF_ISP_HIST_BIN_N_MAX]; 1082 }; 1083 1084 /** 1085 * struct rkisp1_cif_isp_stat - Rockchip ISP1 Statistics Data 1086 * 1087 * @awb: statistics data for automatic white balance 1088 * @ae: statistics data for auto exposure 1089 * @af: statistics data for auto focus 1090 * @hist: statistics histogram data 1091 */ 1092 struct rkisp1_cif_isp_stat { 1093 struct rkisp1_cif_isp_awb_stat awb; 1094 struct rkisp1_cif_isp_ae_stat ae; 1095 struct rkisp1_cif_isp_af_stat af; 1096 struct rkisp1_cif_isp_hist_stat hist; 1097 }; 1098 1099 /** 1100 * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Meta Data 1101 * 1102 * @meas_type: measurement types (RKISP1_CIF_ISP_STAT_* definitions) 1103 * @frame_id: frame ID for sync 1104 * @params: statistics data 1105 */ 1106 struct rkisp1_stat_buffer { 1107 __u32 meas_type; 1108 __u32 frame_id; 1109 struct rkisp1_cif_isp_stat params; 1110 }; 1111 1112 /*---------- PART3: Extensible Configuration Parameters ------------*/ 1113 1114 /** 1115 * enum rkisp1_ext_params_block_type - RkISP1 extensible params block type 1116 * 1117 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS: Black level subtraction 1118 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC: Defect pixel cluster correction 1119 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG: Sensor de-gamma 1120 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN: Auto white balance gains 1121 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT: ISP filtering 1122 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM: Bayer de-mosaic 1123 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK: Cross-talk correction 1124 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC: Gamma out correction 1125 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF: De-noise pre-filter 1126 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH: De-noise pre-filter strength 1127 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC: Color processing 1128 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_IE: Image effects 1129 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC: Lens shading correction 1130 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS: Auto white balance statistics 1131 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS: Histogram statistics 1132 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS: Auto exposure statistics 1133 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS: Auto-focus statistics 1134 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS: BLS in the compand block 1135 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND: Companding expand curve 1136 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS: Companding compress curve 1137 * @RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR: Wide dynamic range 1138 */ 1139 enum rkisp1_ext_params_block_type { 1140 RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS, 1141 RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC, 1142 RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG, 1143 RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN, 1144 RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT, 1145 RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM, 1146 RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK, 1147 RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC, 1148 RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF, 1149 RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH, 1150 RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC, 1151 RKISP1_EXT_PARAMS_BLOCK_TYPE_IE, 1152 RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC, 1153 RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS, 1154 RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS, 1155 RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS, 1156 RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS, 1157 RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS, 1158 RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND, 1159 RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS, 1160 RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR, 1161 }; 1162 1163 /* For backward compatibility */ 1164 #define RKISP1_EXT_PARAMS_FL_BLOCK_DISABLE V4L2_ISP_PARAMS_FL_BLOCK_DISABLE 1165 #define RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE V4L2_ISP_PARAMS_FL_BLOCK_ENABLE 1166 1167 /* A bitmask of parameters blocks supported on the current hardware. */ 1168 #define RKISP1_CID_SUPPORTED_PARAMS_BLOCKS (V4L2_CID_USER_RKISP1_BASE + 0x01) 1169 1170 /** 1171 * rkisp1_ext_params_block_header - RkISP1 extensible parameters block header 1172 * 1173 * This structure represents the common part of all the ISP configuration 1174 * blocks and is identical to :c:type:`v4l2_isp_params_block_header`. 1175 * 1176 * The type field is one of the values enumerated by 1177 * :c:type:`rkisp1_ext_params_block_type` and specifies how the data should be 1178 * interpreted by the driver. 1179 * 1180 * The flags field is a bitmask of per-block flags RKISP1_EXT_PARAMS_FL_*. 1181 */ 1182 #define rkisp1_ext_params_block_header v4l2_isp_params_block_header 1183 1184 /** 1185 * struct rkisp1_ext_params_bls_config - RkISP1 extensible params BLS config 1186 * 1187 * RkISP1 extensible parameters Black Level Subtraction configuration block. 1188 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS`. 1189 * 1190 * @header: The RkISP1 extensible parameters header, see 1191 * :c:type:`rkisp1_ext_params_block_header` 1192 * @config: Black Level Subtraction configuration, see 1193 * :c:type:`rkisp1_cif_isp_bls_config` 1194 */ 1195 struct rkisp1_ext_params_bls_config { 1196 struct rkisp1_ext_params_block_header header; 1197 struct rkisp1_cif_isp_bls_config config; 1198 } __attribute__((aligned(8))); 1199 1200 /** 1201 * struct rkisp1_ext_params_dpcc_config - RkISP1 extensible params DPCC config 1202 * 1203 * RkISP1 extensible parameters Defective Pixel Cluster Correction configuration 1204 * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC`. 1205 * 1206 * @header: The RkISP1 extensible parameters header, see 1207 * :c:type:`rkisp1_ext_params_block_header` 1208 * @config: Defective Pixel Cluster Correction configuration, see 1209 * :c:type:`rkisp1_cif_isp_dpcc_config` 1210 */ 1211 struct rkisp1_ext_params_dpcc_config { 1212 struct rkisp1_ext_params_block_header header; 1213 struct rkisp1_cif_isp_dpcc_config config; 1214 } __attribute__((aligned(8))); 1215 1216 /** 1217 * struct rkisp1_ext_params_sdg_config - RkISP1 extensible params SDG config 1218 * 1219 * RkISP1 extensible parameters Sensor Degamma configuration block. Identified 1220 * by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_SDG`. 1221 * 1222 * @header: The RkISP1 extensible parameters header, see 1223 * :c:type:`rkisp1_ext_params_block_header` 1224 * @config: Sensor Degamma configuration, see 1225 * :c:type:`rkisp1_cif_isp_sdg_config` 1226 */ 1227 struct rkisp1_ext_params_sdg_config { 1228 struct rkisp1_ext_params_block_header header; 1229 struct rkisp1_cif_isp_sdg_config config; 1230 } __attribute__((aligned(8))); 1231 1232 /** 1233 * struct rkisp1_ext_params_lsc_config - RkISP1 extensible params LSC config 1234 * 1235 * RkISP1 extensible parameters Lens Shading Correction configuration block. 1236 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_LSC`. 1237 * 1238 * @header: The RkISP1 extensible parameters header, see 1239 * :c:type:`rkisp1_ext_params_block_header` 1240 * @config: Lens Shading Correction configuration, see 1241 * :c:type:`rkisp1_cif_isp_lsc_config` 1242 */ 1243 struct rkisp1_ext_params_lsc_config { 1244 struct rkisp1_ext_params_block_header header; 1245 struct rkisp1_cif_isp_lsc_config config; 1246 } __attribute__((aligned(8))); 1247 1248 /** 1249 * struct rkisp1_ext_params_awb_gain_config - RkISP1 extensible params AWB 1250 * gain config 1251 * 1252 * RkISP1 extensible parameters Auto-White Balance Gains configuration block. 1253 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_GAIN`. 1254 * 1255 * @header: The RkISP1 extensible parameters header, see 1256 * :c:type:`rkisp1_ext_params_block_header` 1257 * @config: Auto-White Balance Gains configuration, see 1258 * :c:type:`rkisp1_cif_isp_awb_gain_config` 1259 */ 1260 struct rkisp1_ext_params_awb_gain_config { 1261 struct rkisp1_ext_params_block_header header; 1262 struct rkisp1_cif_isp_awb_gain_config config; 1263 } __attribute__((aligned(8))); 1264 1265 /** 1266 * struct rkisp1_ext_params_flt_config - RkISP1 extensible params FLT config 1267 * 1268 * RkISP1 extensible parameters Filter configuration block. Identified by 1269 * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_FLT`. 1270 * 1271 * @header: The RkISP1 extensible parameters header, see 1272 * :c:type:`rkisp1_ext_params_block_header` 1273 * @config: Filter configuration, see :c:type:`rkisp1_cif_isp_flt_config` 1274 */ 1275 struct rkisp1_ext_params_flt_config { 1276 struct rkisp1_ext_params_block_header header; 1277 struct rkisp1_cif_isp_flt_config config; 1278 } __attribute__((aligned(8))); 1279 1280 /** 1281 * struct rkisp1_ext_params_bdm_config - RkISP1 extensible params BDM config 1282 * 1283 * RkISP1 extensible parameters Demosaicing configuration block. Identified by 1284 * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_BDM`. 1285 * 1286 * @header: The RkISP1 extensible parameters header, see 1287 * :c:type:`rkisp1_ext_params_block_header` 1288 * @config: Demosaicing configuration, see :c:type:`rkisp1_cif_isp_bdm_config` 1289 */ 1290 struct rkisp1_ext_params_bdm_config { 1291 struct rkisp1_ext_params_block_header header; 1292 struct rkisp1_cif_isp_bdm_config config; 1293 } __attribute__((aligned(8))); 1294 1295 /** 1296 * struct rkisp1_ext_params_ctk_config - RkISP1 extensible params CTK config 1297 * 1298 * RkISP1 extensible parameters Cross-Talk configuration block. Identified by 1299 * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CTK`. 1300 * 1301 * @header: The RkISP1 extensible parameters header, see 1302 * :c:type:`rkisp1_ext_params_block_header` 1303 * @config: Cross-Talk configuration, see :c:type:`rkisp1_cif_isp_ctk_config` 1304 */ 1305 struct rkisp1_ext_params_ctk_config { 1306 struct rkisp1_ext_params_block_header header; 1307 struct rkisp1_cif_isp_ctk_config config; 1308 } __attribute__((aligned(8))); 1309 1310 /** 1311 * struct rkisp1_ext_params_goc_config - RkISP1 extensible params GOC config 1312 * 1313 * RkISP1 extensible parameters Gamma-Out configuration block. Identified by 1314 * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_GOC`. 1315 * 1316 * @header: The RkISP1 extensible parameters header, see 1317 * :c:type:`rkisp1_ext_params_block_header` 1318 * @config: Gamma-Out configuration, see :c:type:`rkisp1_cif_isp_goc_config` 1319 */ 1320 struct rkisp1_ext_params_goc_config { 1321 struct rkisp1_ext_params_block_header header; 1322 struct rkisp1_cif_isp_goc_config config; 1323 } __attribute__((aligned(8))); 1324 1325 /** 1326 * struct rkisp1_ext_params_dpf_config - RkISP1 extensible params DPF config 1327 * 1328 * RkISP1 extensible parameters De-noise Pre-Filter configuration block. 1329 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF`. 1330 * 1331 * @header: The RkISP1 extensible parameters header, see 1332 * :c:type:`rkisp1_ext_params_block_header` 1333 * @config: De-noise Pre-Filter configuration, see 1334 * :c:type:`rkisp1_cif_isp_dpf_config` 1335 */ 1336 struct rkisp1_ext_params_dpf_config { 1337 struct rkisp1_ext_params_block_header header; 1338 struct rkisp1_cif_isp_dpf_config config; 1339 } __attribute__((aligned(8))); 1340 1341 /** 1342 * struct rkisp1_ext_params_dpf_strength_config - RkISP1 extensible params DPF 1343 * strength config 1344 * 1345 * RkISP1 extensible parameters De-noise Pre-Filter strength configuration 1346 * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_DPF_STRENGTH`. 1347 * 1348 * @header: The RkISP1 extensible parameters header, see 1349 * :c:type:`rkisp1_ext_params_block_header` 1350 * @config: De-noise Pre-Filter strength configuration, see 1351 * :c:type:`rkisp1_cif_isp_dpf_strength_config` 1352 */ 1353 struct rkisp1_ext_params_dpf_strength_config { 1354 struct rkisp1_ext_params_block_header header; 1355 struct rkisp1_cif_isp_dpf_strength_config config; 1356 } __attribute__((aligned(8))); 1357 1358 /** 1359 * struct rkisp1_ext_params_cproc_config - RkISP1 extensible params CPROC config 1360 * 1361 * RkISP1 extensible parameters Color Processing configuration block. 1362 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_CPROC`. 1363 * 1364 * @header: The RkISP1 extensible parameters header, see 1365 * :c:type:`rkisp1_ext_params_block_header` 1366 * @config: Color processing configuration, see 1367 * :c:type:`rkisp1_cif_isp_cproc_config` 1368 */ 1369 struct rkisp1_ext_params_cproc_config { 1370 struct rkisp1_ext_params_block_header header; 1371 struct rkisp1_cif_isp_cproc_config config; 1372 } __attribute__((aligned(8))); 1373 1374 /** 1375 * struct rkisp1_ext_params_ie_config - RkISP1 extensible params IE config 1376 * 1377 * RkISP1 extensible parameters Image Effect configuration block. Identified by 1378 * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_IE`. 1379 * 1380 * @header: The RkISP1 extensible parameters header, see 1381 * :c:type:`rkisp1_ext_params_block_header` 1382 * @config: Image Effect configuration, see :c:type:`rkisp1_cif_isp_ie_config` 1383 */ 1384 struct rkisp1_ext_params_ie_config { 1385 struct rkisp1_ext_params_block_header header; 1386 struct rkisp1_cif_isp_ie_config config; 1387 } __attribute__((aligned(8))); 1388 1389 /** 1390 * struct rkisp1_ext_params_awb_meas_config - RkISP1 extensible params AWB 1391 * Meas config 1392 * 1393 * RkISP1 extensible parameters Auto-White Balance Measurement configuration 1394 * block. Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AWB_MEAS`. 1395 * 1396 * @header: The RkISP1 extensible parameters header, see 1397 * :c:type:`rkisp1_ext_params_block_header` 1398 * @config: Auto-White Balance measure configuration, see 1399 * :c:type:`rkisp1_cif_isp_awb_meas_config` 1400 */ 1401 struct rkisp1_ext_params_awb_meas_config { 1402 struct rkisp1_ext_params_block_header header; 1403 struct rkisp1_cif_isp_awb_meas_config config; 1404 } __attribute__((aligned(8))); 1405 1406 /** 1407 * struct rkisp1_ext_params_hst_config - RkISP1 extensible params Histogram config 1408 * 1409 * RkISP1 extensible parameters Histogram statistics configuration block. 1410 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_HST_MEAS`. 1411 * 1412 * @header: The RkISP1 extensible parameters header, see 1413 * :c:type:`rkisp1_ext_params_block_header` 1414 * @config: Histogram statistics configuration, see 1415 * :c:type:`rkisp1_cif_isp_hst_config` 1416 */ 1417 struct rkisp1_ext_params_hst_config { 1418 struct rkisp1_ext_params_block_header header; 1419 struct rkisp1_cif_isp_hst_config config; 1420 } __attribute__((aligned(8))); 1421 1422 /** 1423 * struct rkisp1_ext_params_aec_config - RkISP1 extensible params AEC config 1424 * 1425 * RkISP1 extensible parameters Auto-Exposure statistics configuration block. 1426 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AEC_MEAS`. 1427 * 1428 * @header: The RkISP1 extensible parameters header, see 1429 * :c:type:`rkisp1_ext_params_block_header` 1430 * @config: Auto-Exposure statistics configuration, see 1431 * :c:type:`rkisp1_cif_isp_aec_config` 1432 */ 1433 struct rkisp1_ext_params_aec_config { 1434 struct rkisp1_ext_params_block_header header; 1435 struct rkisp1_cif_isp_aec_config config; 1436 } __attribute__((aligned(8))); 1437 1438 /** 1439 * struct rkisp1_ext_params_afc_config - RkISP1 extensible params AFC config 1440 * 1441 * RkISP1 extensible parameters Auto-Focus statistics configuration block. 1442 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_AFC_MEAS`. 1443 * 1444 * @header: The RkISP1 extensible parameters header, see 1445 * :c:type:`rkisp1_ext_params_block_header` 1446 * @config: Auto-Focus statistics configuration, see 1447 * :c:type:`rkisp1_cif_isp_afc_config` 1448 */ 1449 struct rkisp1_ext_params_afc_config { 1450 struct rkisp1_ext_params_block_header header; 1451 struct rkisp1_cif_isp_afc_config config; 1452 } __attribute__((aligned(8))); 1453 1454 /** 1455 * struct rkisp1_ext_params_compand_bls_config - RkISP1 extensible params 1456 * Compand BLS config 1457 * 1458 * RkISP1 extensible parameters Companding configuration block (black level 1459 * subtraction). Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_BLS`. 1460 * 1461 * @header: The RkISP1 extensible parameters header, see 1462 * :c:type:`rkisp1_ext_params_block_header` 1463 * @config: Companding BLS configuration, see 1464 * :c:type:`rkisp1_cif_isp_compand_bls_config` 1465 */ 1466 struct rkisp1_ext_params_compand_bls_config { 1467 struct rkisp1_ext_params_block_header header; 1468 struct rkisp1_cif_isp_compand_bls_config config; 1469 } __attribute__((aligned(8))); 1470 1471 /** 1472 * struct rkisp1_ext_params_compand_curve_config - RkISP1 extensible params 1473 * Compand curve config 1474 * 1475 * RkISP1 extensible parameters Companding configuration block (expand and 1476 * compression curves). Identified by 1477 * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_EXPAND` or 1478 * :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_COMPAND_COMPRESS`. 1479 * 1480 * @header: The RkISP1 extensible parameters header, see 1481 * :c:type:`rkisp1_ext_params_block_header` 1482 * @config: Companding curve configuration, see 1483 * :c:type:`rkisp1_cif_isp_compand_curve_config` 1484 */ 1485 struct rkisp1_ext_params_compand_curve_config { 1486 struct rkisp1_ext_params_block_header header; 1487 struct rkisp1_cif_isp_compand_curve_config config; 1488 } __attribute__((aligned(8))); 1489 1490 /** 1491 * struct rkisp1_ext_params_wdr_config - RkISP1 extensible params 1492 * Wide dynamic range config 1493 * 1494 * RkISP1 extensible parameters WDR block. 1495 * Identified by :c:type:`RKISP1_EXT_PARAMS_BLOCK_TYPE_WDR` 1496 * 1497 * @header: The RkISP1 extensible parameters header, see 1498 * :c:type:`rkisp1_ext_params_block_header` 1499 * @config: WDR configuration, see 1500 * :c:type:`rkisp1_cif_isp_wdr_config` 1501 */ 1502 struct rkisp1_ext_params_wdr_config { 1503 struct rkisp1_ext_params_block_header header; 1504 struct rkisp1_cif_isp_wdr_config config; 1505 } __attribute__((aligned(8))); 1506 1507 /* 1508 * The rkisp1_ext_params_compand_curve_config structure is counted twice as it 1509 * is used for both the COMPAND_EXPAND and COMPAND_COMPRESS block types. 1510 */ 1511 #define RKISP1_EXT_PARAMS_MAX_SIZE \ 1512 (sizeof(struct rkisp1_ext_params_bls_config) +\ 1513 sizeof(struct rkisp1_ext_params_dpcc_config) +\ 1514 sizeof(struct rkisp1_ext_params_sdg_config) +\ 1515 sizeof(struct rkisp1_ext_params_lsc_config) +\ 1516 sizeof(struct rkisp1_ext_params_awb_gain_config) +\ 1517 sizeof(struct rkisp1_ext_params_flt_config) +\ 1518 sizeof(struct rkisp1_ext_params_bdm_config) +\ 1519 sizeof(struct rkisp1_ext_params_ctk_config) +\ 1520 sizeof(struct rkisp1_ext_params_goc_config) +\ 1521 sizeof(struct rkisp1_ext_params_dpf_config) +\ 1522 sizeof(struct rkisp1_ext_params_dpf_strength_config) +\ 1523 sizeof(struct rkisp1_ext_params_cproc_config) +\ 1524 sizeof(struct rkisp1_ext_params_ie_config) +\ 1525 sizeof(struct rkisp1_ext_params_awb_meas_config) +\ 1526 sizeof(struct rkisp1_ext_params_hst_config) +\ 1527 sizeof(struct rkisp1_ext_params_aec_config) +\ 1528 sizeof(struct rkisp1_ext_params_afc_config) +\ 1529 sizeof(struct rkisp1_ext_params_compand_bls_config) +\ 1530 sizeof(struct rkisp1_ext_params_compand_curve_config) +\ 1531 sizeof(struct rkisp1_ext_params_compand_curve_config) +\ 1532 sizeof(struct rkisp1_ext_params_wdr_config)) 1533 1534 /** 1535 * enum rksip1_ext_param_buffer_version - RkISP1 extensible parameters version 1536 * 1537 * @RKISP1_EXT_PARAM_BUFFER_V1: First version of RkISP1 extensible parameters 1538 */ 1539 enum rksip1_ext_param_buffer_version { 1540 RKISP1_EXT_PARAM_BUFFER_V1 = V4L2_ISP_PARAMS_VERSION_V1, 1541 }; 1542 1543 /** 1544 * struct rkisp1_ext_params_cfg - RkISP1 extensible parameters configuration 1545 * 1546 * This is the driver-specific implementation of 1547 * :c:type:`v4l2_isp_params_buffer`. 1548 * 1549 * Currently the single RKISP1_EXT_PARAM_BUFFER_V1 version is supported. 1550 * When a new format version will be added, a mechanism for userspace to query 1551 * the supported format versions will be implemented in the form of a read-only 1552 * V4L2 control. If such control is not available, userspace should assume only 1553 * RKISP1_EXT_PARAM_BUFFER_V1 is supported by the driver. 1554 * 1555 * The read-only V4L2 control ``RKISP1_CID_SUPPORTED_PARAMS_BLOCKS`` can be used 1556 * to query the blocks supported by the device. It contains a bitmask where each 1557 * bit represents the availability of the corresponding entry from the 1558 * :c:type:`rkisp1_ext_params_block_type` enum. The current and default values 1559 * of the control represents the blocks supported by the device instance, while 1560 * the maximum value represents the blocks supported by the kernel driver, 1561 * independently of the device instance. 1562 * 1563 * The expected memory layout of the parameters buffer is:: 1564 * 1565 * +-------------------- struct rkisp1_ext_params_cfg -------------------+ 1566 * | version = RKISP1_EXT_PARAM_BUFFER_V1; | 1567 * | data_size = sizeof(struct rkisp1_ext_params_bls_config) | 1568 * | + sizeof(struct rkisp1_ext_params_dpcc_config); | 1569 * | +------------------------- data ---------------------------------+ | 1570 * | | +------------- struct rkisp1_ext_params_bls_config -----------+ | | 1571 * | | | +-------- struct rkisp1_ext_params_block_header ---------+ | | | 1572 * | | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_BLS; | | | | 1573 * | | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; | | | | 1574 * | | | | size = sizeof(struct rkisp1_ext_params_bls_config); | | | | 1575 * | | | +---------------------------------------------------------+ | | | 1576 * | | | +---------- struct rkisp1_cif_isp_bls_config -------------+ | | | 1577 * | | | | enable_auto = 0; | | | | 1578 * | | | | fixed_val.r = 256; | | | | 1579 * | | | | fixed_val.gr = 256; | | | | 1580 * | | | | fixed_val.gb = 256; | | | | 1581 * | | | | fixed_val.b = 256; | | | | 1582 * | | | +---------------------------------------------------------+ | | | 1583 * | | +------------ struct rkisp1_ext_params_dpcc_config -----------+ | | 1584 * | | | +-------- struct rkisp1_ext_params_block_header ---------+ | | | 1585 * | | | | type = RKISP1_EXT_PARAMS_BLOCK_TYPE_DPCC; | | | | 1586 * | | | | flags = RKISP1_EXT_PARAMS_FL_BLOCK_ENABLE; | | | | 1587 * | | | | size = sizeof(struct rkisp1_ext_params_dpcc_config); | | | | 1588 * | | | +---------------------------------------------------------+ | | | 1589 * | | | +---------- struct rkisp1_cif_isp_dpcc_config ------------+ | | | 1590 * | | | | mode = RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE; | | | | 1591 * | | | | output_mode = | | | | 1592 * | | | | RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER; | | | | 1593 * | | | | set_use = ... ; | | | | 1594 * | | | | ... = ... ; | | | | 1595 * | | | +---------------------------------------------------------+ | | | 1596 * | | +-------------------------------------------------------------+ | | 1597 * | +-----------------------------------------------------------------+ | 1598 * +---------------------------------------------------------------------+ 1599 * 1600 * @version: The RkISP1 extensible parameters buffer version, see 1601 * :c:type:`rksip1_ext_param_buffer_version` 1602 * @data_size: The RkISP1 configuration data effective size, excluding this 1603 * header 1604 * @data: The RkISP1 extensible configuration data blocks 1605 */ 1606 struct rkisp1_ext_params_cfg { 1607 __u32 version; 1608 __u32 data_size; 1609 __u8 data[RKISP1_EXT_PARAMS_MAX_SIZE]; 1610 }; 1611 1612 1613 #endif /* _RKISP1_CONFIG_H */