1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* Copyright (C) 2017 - 2018 Intel Corporation */ 3 4 #ifndef __IPU3_UAPI_H 5 #define __IPU3_UAPI_H 6 7 #include <linux/types.h> 8 9 /* from /drivers/staging/media/ipu3/include/videodev2.h */ 10 11 /* Vendor specific - used for IPU3 camera sub-system */ 12 /* IPU3 processing parameters */ 13 #define V4L2_META_FMT_IPU3_PARAMS v4l2_fourcc('i', 'p', '3', 'p') 14 /* IPU3 3A statistics */ 15 #define V4L2_META_FMT_IPU3_STAT_3A v4l2_fourcc('i', 'p', '3', 's') 16 17 /* from include/uapi/linux/v4l2-controls.h */ 18 #define V4L2_CID_INTEL_IPU3_BASE (V4L2_CID_USER_BASE + 0x10c0) 19 #define V4L2_CID_INTEL_IPU3_MODE (V4L2_CID_INTEL_IPU3_BASE + 1) 20 21 /******************* ipu3_uapi_stats_3a *******************/ 22 23 #define IPU3_UAPI_MAX_STRIPES 2 24 #define IPU3_UAPI_MAX_BUBBLE_SIZE 10 25 26 #define IPU3_UAPI_GRID_START_MASK ((1 << 12) - 1) 27 #define IPU3_UAPI_GRID_Y_START_EN (1 << 15) 28 29 /* controls generation of meta_data (like FF enable/disable) */ 30 #define IPU3_UAPI_AWB_RGBS_THR_B_EN (1 << 14) 31 #define IPU3_UAPI_AWB_RGBS_THR_B_INCL_SAT (1 << 15) 32 33 /** 34 * struct ipu3_uapi_grid_config - Grid plane config 35 * 36 * @width: Grid horizontal dimensions, in number of grid blocks(cells). 37 * For AWB, the range is (16, 80). 38 * For AF/AE, the range is (16, 32). 39 * @height: Grid vertical dimensions, in number of grid cells. 40 * For AWB, the range is (16, 60). 41 * For AF/AE, the range is (16, 24). 42 * @block_width_log2: Log2 of the width of each cell in pixels. 43 * For AWB, the range is [3, 6]. 44 * For AF/AE, the range is [3, 7]. 45 * @block_height_log2: Log2 of the height of each cell in pixels. 46 * For AWB, the range is [3, 6]. 47 * For AF/AE, the range is [3, 7]. 48 * @height_per_slice: The number of blocks in vertical axis per slice. 49 * Default 2. 50 * @x_start: X value of top left corner of Region of Interest(ROI). 51 * @y_start: Y value of top left corner of ROI 52 * @x_end: X value of bottom right corner of ROI 53 * @y_end: Y value of bottom right corner of ROI 54 * 55 * Due to the size of total amount of collected data, most statistics 56 * create a grid-based output, and the data is then divided into "slices". 57 */ 58 struct ipu3_uapi_grid_config { 59 __u8 width; 60 __u8 height; 61 __u16 block_width_log2:3; 62 __u16 block_height_log2:3; 63 __u16 height_per_slice:8; 64 __u16 x_start; 65 __u16 y_start; 66 __u16 x_end; 67 __u16 y_end; 68 } __packed; 69 70 /** 71 * struct ipu3_uapi_awb_set_item - Memory layout for each cell in AWB 72 * 73 * @Gr_avg: Green average for red lines in the cell. 74 * @R_avg: Red average in the cell. 75 * @B_avg: Blue average in the cell. 76 * @Gb_avg: Green average for blue lines in the cell. 77 * @sat_ratio: Percentage of pixels over the thresholds specified in 78 * ipu3_uapi_awb_config_s, coded from 0 to 255. 79 * @padding0: Unused byte for padding. 80 * @padding1: Unused byte for padding. 81 * @padding2: Unused byte for padding. 82 */ 83 struct ipu3_uapi_awb_set_item { 84 __u8 Gr_avg; 85 __u8 R_avg; 86 __u8 B_avg; 87 __u8 Gb_avg; 88 __u8 sat_ratio; 89 __u8 padding0; 90 __u8 padding1; 91 __u8 padding2; 92 } __attribute__((packed)); 93 94 /* 95 * The grid based data is divided into "slices" called set, each slice of setX 96 * refers to ipu3_uapi_grid_config width * height_per_slice. 97 */ 98 #define IPU3_UAPI_AWB_MAX_SETS 60 99 /* Based on grid size 80 * 60 and cell size 16 x 16 */ 100 #define IPU3_UAPI_AWB_SET_SIZE 160 101 #define IPU3_UAPI_AWB_SPARE_FOR_BUBBLES \ 102 (IPU3_UAPI_MAX_BUBBLE_SIZE * IPU3_UAPI_MAX_STRIPES) 103 #define IPU3_UAPI_AWB_MAX_BUFFER_SIZE \ 104 (IPU3_UAPI_AWB_MAX_SETS * \ 105 (IPU3_UAPI_AWB_SET_SIZE + IPU3_UAPI_AWB_SPARE_FOR_BUBBLES)) 106 107 /** 108 * struct ipu3_uapi_awb_raw_buffer - AWB raw buffer 109 * 110 * @meta_data: buffer to hold auto white balance meta data which is 111 * the average values for each color channel. 112 */ 113 struct ipu3_uapi_awb_raw_buffer { 114 struct ipu3_uapi_awb_set_item meta_data[IPU3_UAPI_AWB_MAX_BUFFER_SIZE] 115 __attribute__((aligned(32))); 116 } __packed; 117 118 /** 119 * struct ipu3_uapi_awb_config_s - AWB config 120 * 121 * @rgbs_thr_gr: gr threshold value. 122 * @rgbs_thr_r: Red threshold value. 123 * @rgbs_thr_gb: gb threshold value. 124 * @rgbs_thr_b: Blue threshold value. 125 * @grid: &ipu3_uapi_grid_config, the default grid resolution is 16x16 cells. 126 * 127 * The threshold is a saturation measure range [0, 8191], 8191 is default. 128 * Values over threshold may be optionally rejected for averaging. 129 */ 130 struct ipu3_uapi_awb_config_s { 131 __u16 rgbs_thr_gr; 132 __u16 rgbs_thr_r; 133 __u16 rgbs_thr_gb; 134 __u16 rgbs_thr_b; 135 struct ipu3_uapi_grid_config grid; 136 } __attribute__((aligned(32))) __packed; 137 138 /** 139 * struct ipu3_uapi_awb_config - AWB config wrapper 140 * 141 * @config: config for auto white balance as defined by &ipu3_uapi_awb_config_s 142 */ 143 struct ipu3_uapi_awb_config { 144 struct ipu3_uapi_awb_config_s config __attribute__((aligned(32))); 145 } __packed; 146 147 #define IPU3_UAPI_AE_COLORS 4 /* R, G, B, Y */ 148 #define IPU3_UAPI_AE_BINS 256 149 #define IPU3_UAPI_AE_WEIGHTS 96 150 151 /** 152 * struct ipu3_uapi_ae_raw_buffer - AE global weighted histogram 153 * 154 * @vals: Sum of IPU3_UAPI_AE_COLORS in cell 155 * 156 * Each histogram contains IPU3_UAPI_AE_BINS bins. Each bin has 24 bit unsigned 157 * for counting the number of the pixel. 158 */ 159 struct ipu3_uapi_ae_raw_buffer { 160 __u32 vals[IPU3_UAPI_AE_BINS * IPU3_UAPI_AE_COLORS]; 161 } __packed; 162 163 /** 164 * struct ipu3_uapi_ae_raw_buffer_aligned - AE raw buffer 165 * 166 * @buff: &ipu3_uapi_ae_raw_buffer to hold full frame meta data. 167 */ 168 struct ipu3_uapi_ae_raw_buffer_aligned { 169 struct ipu3_uapi_ae_raw_buffer buff __attribute__((aligned(32))); 170 } __packed; 171 172 /** 173 * struct ipu3_uapi_ae_grid_config - AE weight grid 174 * 175 * @width: Grid horizontal dimensions. Value: [16, 32], default 16. 176 * @height: Grid vertical dimensions. Value: [16, 24], default 16. 177 * @block_width_log2: Log2 of the width of the grid cell, value: [3, 7]. 178 * @block_height_log2: Log2 of the height of the grid cell, value: [3, 7]. 179 * default is 3 (cell size 8x8), 4 cell per grid. 180 * @reserved0: reserved 181 * @ae_en: 0: does not write to &ipu3_uapi_ae_raw_buffer_aligned array, 182 * 1: write normally. 183 * @rst_hist_array: write 1 to trigger histogram array reset. 184 * @done_rst_hist_array: flag for histogram array reset done. 185 * @x_start: X value of top left corner of ROI, default 0. 186 * @y_start: Y value of top left corner of ROI, default 0. 187 * @x_end: X value of bottom right corner of ROI 188 * @y_end: Y value of bottom right corner of ROI 189 * 190 * The AE block accumulates 4 global weighted histograms(R, G, B, Y) over 191 * a defined ROI within the frame. The contribution of each pixel into the 192 * histogram, defined by &ipu3_uapi_ae_weight_elem LUT, is indexed by a grid. 193 */ 194 struct ipu3_uapi_ae_grid_config { 195 __u8 width; 196 __u8 height; 197 __u8 block_width_log2:4; 198 __u8 block_height_log2:4; 199 __u8 reserved0:5; 200 __u8 ae_en:1; 201 __u8 rst_hist_array:1; 202 __u8 done_rst_hist_array:1; 203 __u16 x_start; 204 __u16 y_start; 205 __u16 x_end; 206 __u16 y_end; 207 } __packed; 208 209 /** 210 * struct ipu3_uapi_ae_weight_elem - AE weights LUT 211 * 212 * @cell0: weighted histogram grid value. 213 * @cell1: weighted histogram grid value. 214 * @cell2: weighted histogram grid value. 215 * @cell3: weighted histogram grid value. 216 * @cell4: weighted histogram grid value. 217 * @cell5: weighted histogram grid value. 218 * @cell6: weighted histogram grid value. 219 * @cell7: weighted histogram grid value. 220 * 221 * Use weighted grid value to give a different contribution factor to each cell. 222 * Precision u4, range [0, 15]. 223 */ 224 struct ipu3_uapi_ae_weight_elem { 225 __u32 cell0:4; 226 __u32 cell1:4; 227 __u32 cell2:4; 228 __u32 cell3:4; 229 __u32 cell4:4; 230 __u32 cell5:4; 231 __u32 cell6:4; 232 __u32 cell7:4; 233 } __packed; 234 235 /** 236 * struct ipu3_uapi_ae_ccm - AE coefficients for WB and CCM 237 * 238 * @gain_gr: WB gain factor for the gr channels. Default 256. 239 * @gain_r: WB gain factor for the r channel. Default 256. 240 * @gain_b: WB gain factor for the b channel. Default 256. 241 * @gain_gb: WB gain factor for the gb channels. Default 256. 242 * @mat: 4x4 matrix that transforms Bayer quad output from WB to RGB+Y. 243 * 244 * Default: 245 * 128, 0, 0, 0, 246 * 0, 128, 0, 0, 247 * 0, 0, 128, 0, 248 * 0, 0, 0, 128, 249 * 250 * As part of the raw frame pre-process stage, the WB and color conversion need 251 * to be applied to expose the impact of these gain operations. 252 */ 253 struct ipu3_uapi_ae_ccm { 254 __u16 gain_gr; 255 __u16 gain_r; 256 __u16 gain_b; 257 __u16 gain_gb; 258 __s16 mat[16]; 259 } __packed; 260 261 /** 262 * struct ipu3_uapi_ae_config - AE config 263 * 264 * @grid_cfg: config for auto exposure statistics grid. See struct 265 * &ipu3_uapi_ae_grid_config, as Imgu did not support output 266 * auto exposure statistics, so user can ignore this configuration 267 * and use the RGB table in auto-whitebalance statistics instead. 268 * @weights: &IPU3_UAPI_AE_WEIGHTS is based on 32x24 blocks in the grid. 269 * Each grid cell has a corresponding value in weights LUT called 270 * grid value, global histogram is updated based on grid value and 271 * pixel value. 272 * @ae_ccm: Color convert matrix pre-processing block. 273 * 274 * Calculate AE grid from image resolution, resample ae weights. 275 */ 276 struct ipu3_uapi_ae_config { 277 struct ipu3_uapi_ae_grid_config grid_cfg __attribute__((aligned(32))); 278 struct ipu3_uapi_ae_weight_elem weights[IPU3_UAPI_AE_WEIGHTS] 279 __attribute__((aligned(32))); 280 struct ipu3_uapi_ae_ccm ae_ccm __attribute__((aligned(32))); 281 } __packed; 282 283 /** 284 * struct ipu3_uapi_af_filter_config - AF 2D filter for contrast measurements 285 * 286 * @y1_coeff_0: filter Y1, structure: 3x11, support both symmetry and 287 * anti-symmetry type. A12 is center, A1-A11 are neighbours. 288 * for analyzing low frequency content, used to calculate sum 289 * of gradients in x direction. 290 * @y1_coeff_0.a1: filter1 coefficients A1, u8, default 0. 291 * @y1_coeff_0.a2: filter1 coefficients A2, u8, default 0. 292 * @y1_coeff_0.a3: filter1 coefficients A3, u8, default 0. 293 * @y1_coeff_0.a4: filter1 coefficients A4, u8, default 0. 294 * @y1_coeff_1: Struct 295 * @y1_coeff_1.a5: filter1 coefficients A5, u8, default 0. 296 * @y1_coeff_1.a6: filter1 coefficients A6, u8, default 0. 297 * @y1_coeff_1.a7: filter1 coefficients A7, u8, default 0. 298 * @y1_coeff_1.a8: filter1 coefficients A8, u8, default 0. 299 * @y1_coeff_2: Struct 300 * @y1_coeff_2.a9: filter1 coefficients A9, u8, default 0. 301 * @y1_coeff_2.a10: filter1 coefficients A10, u8, default 0. 302 * @y1_coeff_2.a11: filter1 coefficients A11, u8, default 0. 303 * @y1_coeff_2.a12: filter1 coefficients A12, u8, default 128. 304 * @y1_sign_vec: Each bit corresponds to one coefficient sign bit, 305 * 0: positive, 1: negative, default 0. 306 * @y2_coeff_0: Y2, same structure as Y1. For analyzing high frequency content. 307 * @y2_coeff_0.a1: filter2 coefficients A1, u8, default 0. 308 * @y2_coeff_0.a2: filter2 coefficients A2, u8, default 0. 309 * @y2_coeff_0.a3: filter2 coefficients A3, u8, default 0. 310 * @y2_coeff_0.a4: filter2 coefficients A4, u8, default 0. 311 * @y2_coeff_1: Struct 312 * @y2_coeff_1.a5: filter2 coefficients A5, u8, default 0. 313 * @y2_coeff_1.a6: filter2 coefficients A6, u8, default 0. 314 * @y2_coeff_1.a7: filter2 coefficients A7, u8, default 0. 315 * @y2_coeff_1.a8: filter2 coefficients A8, u8, default 0. 316 * @y2_coeff_2: Struct 317 * @y2_coeff_2.a9: filter1 coefficients A9, u8, default 0. 318 * @y2_coeff_2.a10: filter1 coefficients A10, u8, default 0. 319 * @y2_coeff_2.a11: filter1 coefficients A11, u8, default 0. 320 * @y2_coeff_2.a12: filter1 coefficients A12, u8, default 128. 321 * @y2_sign_vec: Each bit corresponds to one coefficient sign bit, 322 * 0: positive, 1: negative, default 0. 323 * @y_calc: Pre-processing that converts Bayer quad to RGB+Y values to be 324 * used for building histogram. Range [0, 32], default 8. 325 * 326 * Rule: 327 * y_gen_rate_gr + y_gen_rate_r + y_gen_rate_b + y_gen_rate_gb = 32 328 * A single Y is calculated based on sum of Gr/R/B/Gb based on 329 * their contribution ratio. 330 * @y_calc.y_gen_rate_gr: Contribution ratio Gr for Y 331 * @y_calc.y_gen_rate_r: Contribution ratio R for Y 332 * @y_calc.y_gen_rate_b: Contribution ratio B for Y 333 * @y_calc.y_gen_rate_gb: Contribution ratio Gb for Y 334 * @nf: The shift right value that should be applied during the Y1/Y2 filter to 335 * make sure the total memory needed is 2 bytes per grid cell. 336 * @nf.reserved0: reserved 337 * @nf.y1_nf: Normalization factor for the convolution coeffs of y1, 338 * should be log2 of the sum of the abs values of the filter 339 * coeffs, default 7 (2^7 = 128). 340 * @nf.reserved1: reserved 341 * @nf.y2_nf: Normalization factor for y2, should be log2 of the sum of the 342 * abs values of the filter coeffs. 343 * @nf.reserved2: reserved 344 */ 345 struct ipu3_uapi_af_filter_config { 346 struct { 347 __u8 a1; 348 __u8 a2; 349 __u8 a3; 350 __u8 a4; 351 } y1_coeff_0; 352 struct { 353 __u8 a5; 354 __u8 a6; 355 __u8 a7; 356 __u8 a8; 357 } y1_coeff_1; 358 struct { 359 __u8 a9; 360 __u8 a10; 361 __u8 a11; 362 __u8 a12; 363 } y1_coeff_2; 364 365 __u32 y1_sign_vec; 366 367 struct { 368 __u8 a1; 369 __u8 a2; 370 __u8 a3; 371 __u8 a4; 372 } y2_coeff_0; 373 struct { 374 __u8 a5; 375 __u8 a6; 376 __u8 a7; 377 __u8 a8; 378 } y2_coeff_1; 379 struct { 380 __u8 a9; 381 __u8 a10; 382 __u8 a11; 383 __u8 a12; 384 } y2_coeff_2; 385 386 __u32 y2_sign_vec; 387 388 struct { 389 __u8 y_gen_rate_gr; 390 __u8 y_gen_rate_r; 391 __u8 y_gen_rate_b; 392 __u8 y_gen_rate_gb; 393 } y_calc; 394 395 struct { 396 __u32 reserved0:8; 397 __u32 y1_nf:4; 398 __u32 reserved1:4; 399 __u32 y2_nf:4; 400 __u32 reserved2:12; 401 } nf; 402 } __packed; 403 404 #define IPU3_UAPI_AF_MAX_SETS 24 405 #define IPU3_UAPI_AF_MD_ITEM_SIZE 4 406 #define IPU3_UAPI_AF_SPARE_FOR_BUBBLES \ 407 (IPU3_UAPI_MAX_BUBBLE_SIZE * IPU3_UAPI_MAX_STRIPES * \ 408 IPU3_UAPI_AF_MD_ITEM_SIZE) 409 #define IPU3_UAPI_AF_Y_TABLE_SET_SIZE 128 410 #define IPU3_UAPI_AF_Y_TABLE_MAX_SIZE \ 411 (IPU3_UAPI_AF_MAX_SETS * \ 412 (IPU3_UAPI_AF_Y_TABLE_SET_SIZE + IPU3_UAPI_AF_SPARE_FOR_BUBBLES) * \ 413 IPU3_UAPI_MAX_STRIPES) 414 415 /** 416 * struct ipu3_uapi_af_raw_buffer - AF meta data 417 * 418 * @y_table: Each color component will be convolved separately with filter1 419 * and filter2 and the result will be summed out and averaged for 420 * each cell. 421 */ 422 struct ipu3_uapi_af_raw_buffer { 423 __u8 y_table[IPU3_UAPI_AF_Y_TABLE_MAX_SIZE] __attribute__((aligned(32))); 424 } __packed; 425 426 /** 427 * struct ipu3_uapi_af_config_s - AF config 428 * 429 * @filter_config: AF uses Y1 and Y2 filters as configured in 430 * &ipu3_uapi_af_filter_config 431 * @padding: paddings 432 * @grid_cfg: See &ipu3_uapi_grid_config, default resolution 16x16. Use large 433 * grid size for large image and vice versa. 434 */ 435 struct ipu3_uapi_af_config_s { 436 struct ipu3_uapi_af_filter_config filter_config __attribute__((aligned(32))); 437 __u8 padding[4]; 438 struct ipu3_uapi_grid_config grid_cfg __attribute__((aligned(32))); 439 } __packed; 440 441 #define IPU3_UAPI_AWB_FR_MAX_SETS 24 442 #define IPU3_UAPI_AWB_FR_MD_ITEM_SIZE 8 443 #define IPU3_UAPI_AWB_FR_BAYER_TBL_SIZE 256 444 #define IPU3_UAPI_AWB_FR_SPARE_FOR_BUBBLES \ 445 (IPU3_UAPI_MAX_BUBBLE_SIZE * IPU3_UAPI_MAX_STRIPES * \ 446 IPU3_UAPI_AWB_FR_MD_ITEM_SIZE) 447 #define IPU3_UAPI_AWB_FR_BAYER_TABLE_MAX_SIZE \ 448 (IPU3_UAPI_AWB_FR_MAX_SETS * \ 449 (IPU3_UAPI_AWB_FR_BAYER_TBL_SIZE + \ 450 IPU3_UAPI_AWB_FR_SPARE_FOR_BUBBLES) * IPU3_UAPI_MAX_STRIPES) 451 452 /** 453 * struct ipu3_uapi_awb_fr_raw_buffer - AWB filter response meta data 454 * 455 * @meta_data: Statistics output on the grid after convolving with 1D filter. 456 */ 457 struct ipu3_uapi_awb_fr_raw_buffer { 458 __u8 meta_data[IPU3_UAPI_AWB_FR_BAYER_TABLE_MAX_SIZE] 459 __attribute__((aligned(32))); 460 } __packed; 461 462 /** 463 * struct ipu3_uapi_awb_fr_config_s - AWB filter response config 464 * 465 * @grid_cfg: grid config, default 16x16. 466 * @bayer_coeff: 1D Filter 1x11 center symmetry/anti-symmetry. 467 * coefficients defaults { 0, 0, 0, 0, 0, 128 }. 468 * Applied on whole image for each Bayer channel separately 469 * by a weighted sum of its 11x1 neighbors. 470 * @reserved1: reserved 471 * @bayer_sign: sign of filter coefficients, default 0. 472 * @bayer_nf: normalization factor for the convolution coeffs, to make sure 473 * total memory needed is within pre-determined range. 474 * NF should be the log2 of the sum of the abs values of the 475 * filter coeffs, range [7, 14], default 7. 476 * @reserved2: reserved 477 */ 478 struct ipu3_uapi_awb_fr_config_s { 479 struct ipu3_uapi_grid_config grid_cfg; 480 __u8 bayer_coeff[6]; 481 __u16 reserved1; 482 __u32 bayer_sign; 483 __u8 bayer_nf; 484 __u8 reserved2[7]; 485 } __packed; 486 487 /** 488 * struct ipu3_uapi_4a_config - 4A config 489 * 490 * @awb_config: &ipu3_uapi_awb_config_s, default resolution 16x16 491 * @ae_grd_config: auto exposure statistics &ipu3_uapi_ae_grid_config 492 * @padding: paddings 493 * @af_config: auto focus config &ipu3_uapi_af_config_s 494 * @awb_fr_config: &ipu3_uapi_awb_fr_config_s, default resolution 16x16 495 */ 496 struct ipu3_uapi_4a_config { 497 struct ipu3_uapi_awb_config_s awb_config __attribute__((aligned(32))); 498 struct ipu3_uapi_ae_grid_config ae_grd_config; 499 __u8 padding[20]; 500 struct ipu3_uapi_af_config_s af_config; 501 struct ipu3_uapi_awb_fr_config_s awb_fr_config 502 __attribute__((aligned(32))); 503 } __packed; 504 505 /** 506 * struct ipu3_uapi_bubble_info - Bubble info for host side debugging 507 * 508 * @num_of_stripes: A single frame is divided into several parts called stripes 509 * due to limitation on line buffer memory. 510 * The separation between the stripes is vertical. Each such 511 * stripe is processed as a single frame by the ISP pipe. 512 * @padding: padding bytes. 513 * @num_sets: number of sets. 514 * @padding1: padding bytes. 515 * @size_of_set: set size. 516 * @padding2: padding bytes. 517 * @bubble_size: is the amount of padding in the bubble expressed in "sets". 518 * @padding3: padding bytes. 519 */ 520 struct ipu3_uapi_bubble_info { 521 __u32 num_of_stripes __attribute__((aligned(32))); 522 __u8 padding[28]; 523 __u32 num_sets; 524 __u8 padding1[28]; 525 __u32 size_of_set; 526 __u8 padding2[28]; 527 __u32 bubble_size; 528 __u8 padding3[28]; 529 } __packed; 530 531 /* 532 * struct ipu3_uapi_stats_3a_bubble_info_per_stripe 533 */ 534 struct ipu3_uapi_stats_3a_bubble_info_per_stripe { 535 struct ipu3_uapi_bubble_info awb[IPU3_UAPI_MAX_STRIPES]; 536 struct ipu3_uapi_bubble_info af[IPU3_UAPI_MAX_STRIPES]; 537 struct ipu3_uapi_bubble_info awb_fr[IPU3_UAPI_MAX_STRIPES]; 538 } __packed; 539 540 /** 541 * struct ipu3_uapi_ff_status - Enable bits for each 3A fixed function 542 * 543 * @awb_en: auto white balance enable 544 * @padding: padding config 545 * @ae_en: auto exposure enable 546 * @padding1: padding config 547 * @af_en: auto focus enable 548 * @padding2: padding config 549 * @awb_fr_en: awb filter response enable bit 550 * @padding3: padding config 551 */ 552 struct ipu3_uapi_ff_status { 553 __u32 awb_en __attribute__((aligned(32))); 554 __u8 padding[28]; 555 __u32 ae_en; 556 __u8 padding1[28]; 557 __u32 af_en; 558 __u8 padding2[28]; 559 __u32 awb_fr_en; 560 __u8 padding3[28]; 561 } __packed; 562 563 /** 564 * struct ipu3_uapi_stats_3a - 3A statistics 565 * 566 * @awb_raw_buffer: auto white balance meta data &ipu3_uapi_awb_raw_buffer 567 * @ae_raw_buffer: auto exposure raw data &ipu3_uapi_ae_raw_buffer_aligned 568 * current Imgu does not output the auto exposure statistics 569 * to ae_raw_buffer, the user such as 3A algorithm can use the 570 * RGB table in &ipu3_uapi_awb_raw_buffer to do auto-exposure. 571 * @af_raw_buffer: &ipu3_uapi_af_raw_buffer for auto focus meta data 572 * @awb_fr_raw_buffer: value as specified by &ipu3_uapi_awb_fr_raw_buffer 573 * @stats_4a_config: 4a statistics config as defined by &ipu3_uapi_4a_config. 574 * @ae_join_buffers: 1 to use ae_raw_buffer. 575 * @padding: padding config 576 * @stats_3a_bubble_per_stripe: a &ipu3_uapi_stats_3a_bubble_info_per_stripe 577 * @stats_3a_status: 3a statistics status set in &ipu3_uapi_ff_status 578 */ 579 struct ipu3_uapi_stats_3a { 580 struct ipu3_uapi_awb_raw_buffer awb_raw_buffer; 581 struct ipu3_uapi_ae_raw_buffer_aligned 582 ae_raw_buffer[IPU3_UAPI_MAX_STRIPES]; 583 struct ipu3_uapi_af_raw_buffer af_raw_buffer; 584 struct ipu3_uapi_awb_fr_raw_buffer awb_fr_raw_buffer; 585 struct ipu3_uapi_4a_config stats_4a_config; 586 __u32 ae_join_buffers; 587 __u8 padding[28]; 588 struct ipu3_uapi_stats_3a_bubble_info_per_stripe 589 stats_3a_bubble_per_stripe; 590 struct ipu3_uapi_ff_status stats_3a_status; 591 } __packed; 592 593 /******************* ipu3_uapi_acc_param *******************/ 594 595 #define IPU3_UAPI_ISP_VEC_ELEMS 64 596 #define IPU3_UAPI_ISP_TNR3_VMEM_LEN 9 597 598 #define IPU3_UAPI_BNR_LUT_SIZE 32 599 600 /* number of elements in gamma correction LUT */ 601 #define IPU3_UAPI_GAMMA_CORR_LUT_ENTRIES 256 602 603 /* largest grid is 73x56, for grid_height_per_slice of 2, 73x2 = 146 */ 604 #define IPU3_UAPI_SHD_MAX_CELLS_PER_SET 146 605 #define IPU3_UAPI_SHD_MAX_CFG_SETS 28 606 /* Normalization shift aka nf */ 607 #define IPU3_UAPI_SHD_BLGR_NF_SHIFT 13 608 #define IPU3_UAPI_SHD_BLGR_NF_MASK 7 609 610 #define IPU3_UAPI_YUVP2_TCC_MACC_TABLE_ELEMENTS 16 611 #define IPU3_UAPI_YUVP2_TCC_INV_Y_LUT_ELEMENTS 14 612 #define IPU3_UAPI_YUVP2_TCC_GAIN_PCWL_LUT_ELEMENTS 258 613 #define IPU3_UAPI_YUVP2_TCC_R_SQR_LUT_ELEMENTS 24 614 615 #define IPU3_UAPI_ANR_LUT_SIZE 26 616 #define IPU3_UAPI_ANR_PYRAMID_SIZE 22 617 618 #define IPU3_UAPI_LIN_LUT_SIZE 64 619 620 /* Bayer Noise Reduction related structs */ 621 622 /** 623 * struct ipu3_uapi_bnr_static_config_wb_gains_config - White balance gains 624 * 625 * @gr: white balance gain for Gr channel. 626 * @r: white balance gain for R channel. 627 * @b: white balance gain for B channel. 628 * @gb: white balance gain for Gb channel. 629 * 630 * For BNR parameters WB gain factor for the three channels [Ggr, Ggb, Gb, Gr]. 631 * Their precision is U3.13 and the range is (0, 8) and the actual gain is 632 * Gx + 1, it is typically Gx = 1. 633 * 634 * Pout = {Pin * (1 + Gx)}. 635 */ 636 struct ipu3_uapi_bnr_static_config_wb_gains_config { 637 __u16 gr; 638 __u16 r; 639 __u16 b; 640 __u16 gb; 641 } __packed; 642 643 /** 644 * struct ipu3_uapi_bnr_static_config_wb_gains_thr_config - Threshold config 645 * 646 * @gr: white balance threshold gain for Gr channel. 647 * @r: white balance threshold gain for R channel. 648 * @b: white balance threshold gain for B channel. 649 * @gb: white balance threshold gain for Gb channel. 650 * 651 * Defines the threshold that specifies how different a defect pixel can be from 652 * its neighbors.(used by dynamic defect pixel correction sub block) 653 * Precision u4.4 range [0, 8]. 654 */ 655 struct ipu3_uapi_bnr_static_config_wb_gains_thr_config { 656 __u8 gr; 657 __u8 r; 658 __u8 b; 659 __u8 gb; 660 } __packed; 661 662 /** 663 * struct ipu3_uapi_bnr_static_config_thr_coeffs_config - Noise model 664 * coefficients that controls noise threshold 665 * 666 * @cf: Free coefficient for threshold calculation, range [0, 8191], default 0. 667 * @reserved0: reserved 668 * @cg: Gain coefficient for threshold calculation, [0, 31], default 8. 669 * @ci: Intensity coefficient for threshold calculation. range [0, 0x1f] 670 * default 6. 671 * format: u3.2 (3 most significant bits represent whole number, 672 * 2 least significant bits represent the fractional part 673 * with each count representing 0.25) 674 * e.g. 6 in binary format is 00110, that translates to 1.5 675 * @reserved1: reserved 676 * @r_nf: Normalization shift value for r^2 calculation, range [12, 20] 677 * where r is a radius of pixel [row, col] from centor of sensor. 678 * default 14. 679 * 680 * Threshold used to distinguish between noise and details. 681 */ 682 struct ipu3_uapi_bnr_static_config_thr_coeffs_config { 683 __u32 cf:13; 684 __u32 reserved0:3; 685 __u32 cg:5; 686 __u32 ci:5; 687 __u32 reserved1:1; 688 __u32 r_nf:5; 689 } __packed; 690 691 /** 692 * struct ipu3_uapi_bnr_static_config_thr_ctrl_shd_config - Shading config 693 * 694 * @gr: Coefficient defines lens shading gain approximation for gr channel 695 * @r: Coefficient defines lens shading gain approximation for r channel 696 * @b: Coefficient defines lens shading gain approximation for b channel 697 * @gb: Coefficient defines lens shading gain approximation for gb channel 698 * 699 * Parameters for noise model (NM) adaptation of BNR due to shading correction. 700 * All above have precision of u3.3, default to 0. 701 */ 702 struct ipu3_uapi_bnr_static_config_thr_ctrl_shd_config { 703 __u8 gr; 704 __u8 r; 705 __u8 b; 706 __u8 gb; 707 } __packed; 708 709 /** 710 * struct ipu3_uapi_bnr_static_config_opt_center_config - Optical center config 711 * 712 * @x_reset: Reset value of X (col start - X center). Precision s12.0. 713 * @reserved0: reserved 714 * @y_reset: Reset value of Y (row start - Y center). Precision s12.0. 715 * @reserved2: reserved 716 * 717 * Distance from corner to optical center for NM adaptation due to shading 718 * correction (should be calculated based on shading tables) 719 */ 720 struct ipu3_uapi_bnr_static_config_opt_center_config { 721 __s32 x_reset:13; 722 __u32 reserved0:3; 723 __s32 y_reset:13; 724 __u32 reserved2:3; 725 } __packed; 726 727 /** 728 * struct ipu3_uapi_bnr_static_config_lut_config - BNR square root lookup table 729 * 730 * @values: pre-calculated values of square root function. 731 * 732 * LUT implementation of square root operation. 733 */ 734 struct ipu3_uapi_bnr_static_config_lut_config { 735 __u8 values[IPU3_UAPI_BNR_LUT_SIZE]; 736 } __packed; 737 738 /** 739 * struct ipu3_uapi_bnr_static_config_bp_ctrl_config - Detect bad pixels (bp) 740 * 741 * @bp_thr_gain: Defines the threshold that specifies how different a 742 * defect pixel can be from its neighbors. Threshold is 743 * dependent on de-noise threshold calculated by algorithm. 744 * Range [4, 31], default 4. 745 * @reserved0: reserved 746 * @defect_mode: Mode of addressed defect pixels, 747 * 0 - single defect pixel is expected, 748 * 1 - 2 adjacent defect pixels are expected, default 1. 749 * @bp_gain: Defines how 2nd derivation that passes through a defect pixel 750 * is different from 2nd derivations that pass through 751 * neighbor pixels. u4.2, range [0, 256], default 8. 752 * @reserved1: reserved 753 * @w0_coeff: Blending coefficient of defect pixel correction. 754 * Precision u4, range [0, 8], default 8. 755 * @reserved2: reserved 756 * @w1_coeff: Enable influence of incorrect defect pixel correction to be 757 * avoided. Precision u4, range [1, 8], default 8. 758 * @reserved3: reserved 759 */ 760 struct ipu3_uapi_bnr_static_config_bp_ctrl_config { 761 __u32 bp_thr_gain:5; 762 __u32 reserved0:2; 763 __u32 defect_mode:1; 764 __u32 bp_gain:6; 765 __u32 reserved1:18; 766 __u32 w0_coeff:4; 767 __u32 reserved2:4; 768 __u32 w1_coeff:4; 769 __u32 reserved3:20; 770 } __packed; 771 772 /** 773 * struct ipu3_uapi_bnr_static_config_dn_detect_ctrl_config - Denoising config 774 * 775 * @alpha: Weight of central element of smoothing filter. 776 * @beta: Weight of peripheral elements of smoothing filter, default 4. 777 * @gamma: Weight of diagonal elements of smoothing filter, default 4. 778 * 779 * beta and gamma parameter define the strength of the noise removal filter. 780 * All above has precision u0.4, range [0, 0xf] 781 * format: u0.4 (no / zero bits represent whole number, 782 * 4 bits represent the fractional part 783 * with each count representing 0.0625) 784 * e.g. 0xf translates to 0.0625x15 = 0.9375 785 * 786 * @reserved0: reserved 787 * @max_inf: Maximum increase of peripheral or diagonal element influence 788 * relative to the pre-defined value range: [0x5, 0xa] 789 * @reserved1: reserved 790 * @gd_enable: Green disparity enable control, 0 - disable, 1 - enable. 791 * @bpc_enable: Bad pixel correction enable control, 0 - disable, 1 - enable. 792 * @bnr_enable: Bayer noise removal enable control, 0 - disable, 1 - enable. 793 * @ff_enable: Fixed function enable, 0 - disable, 1 - enable. 794 * @reserved2: reserved 795 */ 796 struct ipu3_uapi_bnr_static_config_dn_detect_ctrl_config { 797 __u32 alpha:4; 798 __u32 beta:4; 799 __u32 gamma:4; 800 __u32 reserved0:4; 801 __u32 max_inf:4; 802 __u32 reserved1:7; 803 __u32 gd_enable:1; 804 __u32 bpc_enable:1; 805 __u32 bnr_enable:1; 806 __u32 ff_enable:1; 807 __u32 reserved2:1; 808 } __packed; 809 810 /** 811 * struct ipu3_uapi_bnr_static_config_opt_center_sqr_config - BNR optical square 812 * 813 * @x_sqr_reset: Reset value of X^2. 814 * @y_sqr_reset: Reset value of Y^2. 815 * 816 * Please note: 817 * 818 * #. X and Y ref to 819 * &ipu3_uapi_bnr_static_config_opt_center_config 820 * #. Both structs are used in threshold formula to calculate r^2, where r 821 * is a radius of pixel [row, col] from centor of sensor. 822 */ 823 struct ipu3_uapi_bnr_static_config_opt_center_sqr_config { 824 __u32 x_sqr_reset; 825 __u32 y_sqr_reset; 826 } __packed; 827 828 /** 829 * struct ipu3_uapi_bnr_static_config - BNR static config 830 * 831 * @wb_gains: white balance gains &ipu3_uapi_bnr_static_config_wb_gains_config 832 * @wb_gains_thr: white balance gains threshold as defined by 833 * &ipu3_uapi_bnr_static_config_wb_gains_thr_config 834 * @thr_coeffs: coefficients of threshold 835 * &ipu3_uapi_bnr_static_config_thr_coeffs_config 836 * @thr_ctrl_shd: control of shading threshold 837 * &ipu3_uapi_bnr_static_config_thr_ctrl_shd_config 838 * @opt_center: optical center &ipu3_uapi_bnr_static_config_opt_center_config 839 * 840 * Above parameters and opt_center_sqr are used for white balance and shading. 841 * 842 * @lut: lookup table &ipu3_uapi_bnr_static_config_lut_config 843 * @bp_ctrl: detect and remove bad pixels as defined in struct 844 * &ipu3_uapi_bnr_static_config_bp_ctrl_config 845 * @dn_detect_ctrl: detect and remove noise. 846 * &ipu3_uapi_bnr_static_config_dn_detect_ctrl_config 847 * @column_size: The number of pixels in column. 848 * @opt_center_sqr: Reset value of r^2 to optical center, see 849 * &ipu3_uapi_bnr_static_config_opt_center_sqr_config. 850 */ 851 struct ipu3_uapi_bnr_static_config { 852 struct ipu3_uapi_bnr_static_config_wb_gains_config wb_gains; 853 struct ipu3_uapi_bnr_static_config_wb_gains_thr_config wb_gains_thr; 854 struct ipu3_uapi_bnr_static_config_thr_coeffs_config thr_coeffs; 855 struct ipu3_uapi_bnr_static_config_thr_ctrl_shd_config thr_ctrl_shd; 856 struct ipu3_uapi_bnr_static_config_opt_center_config opt_center; 857 struct ipu3_uapi_bnr_static_config_lut_config lut; 858 struct ipu3_uapi_bnr_static_config_bp_ctrl_config bp_ctrl; 859 struct ipu3_uapi_bnr_static_config_dn_detect_ctrl_config dn_detect_ctrl; 860 __u32 column_size; 861 struct ipu3_uapi_bnr_static_config_opt_center_sqr_config opt_center_sqr; 862 } __packed; 863 864 /** 865 * struct ipu3_uapi_bnr_static_config_green_disparity - Correct green disparity 866 * 867 * @gd_red: Shading gain coeff for gr disparity level in bright red region. 868 * Precision u0.6, default 4(0.0625). 869 * @reserved0: reserved 870 * @gd_green: Shading gain coeff for gr disparity level in bright green 871 * region. Precision u0.6, default 4(0.0625). 872 * @reserved1: reserved 873 * @gd_blue: Shading gain coeff for gr disparity level in bright blue region. 874 * Precision u0.6, default 4(0.0625). 875 * @reserved2: reserved 876 * @gd_black: Maximal green disparity level in dark region (stronger disparity 877 * assumed to be image detail). Precision u14, default 80. 878 * @reserved3: reserved 879 * @gd_shading: Change maximal green disparity level according to square 880 * distance from image center. 881 * @reserved4: reserved 882 * @gd_support: Lower bound for the number of second green color pixels in 883 * current pixel neighborhood with less than threshold difference 884 * from it. 885 * 886 * The shading gain coeff of red, green, blue and black are used to calculate 887 * threshold given a pixel's color value and its coordinates in the image. 888 * 889 * @reserved5: reserved 890 * @gd_clip: Turn green disparity clip on/off, [0, 1], default 1. 891 * @gd_central_weight: Central pixel weight in 9 pixels weighted sum. 892 */ 893 struct ipu3_uapi_bnr_static_config_green_disparity { 894 __u32 gd_red:6; 895 __u32 reserved0:2; 896 __u32 gd_green:6; 897 __u32 reserved1:2; 898 __u32 gd_blue:6; 899 __u32 reserved2:10; 900 __u32 gd_black:14; 901 __u32 reserved3:2; 902 __u32 gd_shading:7; 903 __u32 reserved4:1; 904 __u32 gd_support:2; 905 __u32 reserved5:1; 906 __u32 gd_clip:1; 907 __u32 gd_central_weight:4; 908 } __packed; 909 910 /** 911 * struct ipu3_uapi_dm_config - De-mosaic parameters 912 * 913 * @dm_en: de-mosaic enable. 914 * @ch_ar_en: Checker artifacts removal enable flag. Default 0. 915 * @fcc_en: False color correction (FCC) enable flag. Default 0. 916 * @reserved0: reserved 917 * @frame_width: do not care 918 * @gamma_sc: Sharpening coefficient (coefficient of 2-d derivation of 919 * complementary color in Hamilton-Adams interpolation). 920 * u5, range [0, 31], default 8. 921 * @reserved1: reserved 922 * @lc_ctrl: Parameter that controls weights of Chroma Homogeneity metric 923 * in calculation of final homogeneity metric. 924 * u5, range [0, 31], default 7. 925 * @reserved2: reserved 926 * @cr_param1: First parameter that defines Checker artifact removal 927 * feature gain. Precision u5, range [0, 31], default 8. 928 * @reserved3: reserved 929 * @cr_param2: Second parameter that defines Checker artifact removal 930 * feature gain. Precision u5, range [0, 31], default 8. 931 * @reserved4: reserved 932 * @coring_param: Defines power of false color correction operation. 933 * low for preserving edge colors, high for preserving gray 934 * edge artifacts. 935 * Precision u1.4, range [0, 1.9375], default 4 (0.25). 936 * @reserved5: reserved 937 * 938 * The demosaic fixed function block is responsible to covert Bayer(mosaiced) 939 * images into color images based on demosaicing algorithm. 940 */ 941 struct ipu3_uapi_dm_config { 942 __u32 dm_en:1; 943 __u32 ch_ar_en:1; 944 __u32 fcc_en:1; 945 __u32 reserved0:13; 946 __u32 frame_width:16; 947 948 __u32 gamma_sc:5; 949 __u32 reserved1:3; 950 __u32 lc_ctrl:5; 951 __u32 reserved2:3; 952 __u32 cr_param1:5; 953 __u32 reserved3:3; 954 __u32 cr_param2:5; 955 __u32 reserved4:3; 956 957 __u32 coring_param:5; 958 __u32 reserved5:27; 959 } __packed; 960 961 /** 962 * struct ipu3_uapi_ccm_mat_config - Color correction matrix 963 * 964 * @coeff_m11: CCM 3x3 coefficient, range [-65536, 65535] 965 * @coeff_m12: CCM 3x3 coefficient, range [-8192, 8191] 966 * @coeff_m13: CCM 3x3 coefficient, range [-32768, 32767] 967 * @coeff_o_r: Bias 3x1 coefficient, range [-8191, 8181] 968 * @coeff_m21: CCM 3x3 coefficient, range [-32767, 32767] 969 * @coeff_m22: CCM 3x3 coefficient, range [-8192, 8191] 970 * @coeff_m23: CCM 3x3 coefficient, range [-32768, 32767] 971 * @coeff_o_g: Bias 3x1 coefficient, range [-8191, 8181] 972 * @coeff_m31: CCM 3x3 coefficient, range [-32768, 32767] 973 * @coeff_m32: CCM 3x3 coefficient, range [-8192, 8191] 974 * @coeff_m33: CCM 3x3 coefficient, range [-32768, 32767] 975 * @coeff_o_b: Bias 3x1 coefficient, range [-8191, 8181] 976 * 977 * Transform sensor specific color space to standard sRGB by applying 3x3 matrix 978 * and adding a bias vector O. The transformation is basically a rotation and 979 * translation in the 3-dimensional color spaces. Here are the defaults: 980 * 981 * 9775, -2671, 1087, 0 982 * -1071, 8303, 815, 0 983 * -23, -7887, 16103, 0 984 */ 985 struct ipu3_uapi_ccm_mat_config { 986 __s16 coeff_m11; 987 __s16 coeff_m12; 988 __s16 coeff_m13; 989 __s16 coeff_o_r; 990 __s16 coeff_m21; 991 __s16 coeff_m22; 992 __s16 coeff_m23; 993 __s16 coeff_o_g; 994 __s16 coeff_m31; 995 __s16 coeff_m32; 996 __s16 coeff_m33; 997 __s16 coeff_o_b; 998 } __packed; 999 1000 /** 1001 * struct ipu3_uapi_gamma_corr_ctrl - Gamma correction 1002 * 1003 * @enable: gamma correction enable. 1004 * @reserved: reserved 1005 */ 1006 struct ipu3_uapi_gamma_corr_ctrl { 1007 __u32 enable:1; 1008 __u32 reserved:31; 1009 } __packed; 1010 1011 /** 1012 * struct ipu3_uapi_gamma_corr_lut - Per-pixel tone mapping implemented as LUT. 1013 * 1014 * @lut: 256 tabulated values of the gamma function. LUT[1].. LUT[256] 1015 * format u13.0, range [0, 8191]. 1016 * 1017 * The tone mapping operation is done by a Piece wise linear graph 1018 * that is implemented as a lookup table(LUT). The pixel component input 1019 * intensity is the X-axis of the graph which is the table entry. 1020 */ 1021 struct ipu3_uapi_gamma_corr_lut { 1022 __u16 lut[IPU3_UAPI_GAMMA_CORR_LUT_ENTRIES]; 1023 } __packed; 1024 1025 /** 1026 * struct ipu3_uapi_gamma_config - Gamma config 1027 * 1028 * @gc_ctrl: control of gamma correction &ipu3_uapi_gamma_corr_ctrl 1029 * @gc_lut: lookup table of gamma correction &ipu3_uapi_gamma_corr_lut 1030 */ 1031 struct ipu3_uapi_gamma_config { 1032 struct ipu3_uapi_gamma_corr_ctrl gc_ctrl __attribute__((aligned(32))); 1033 struct ipu3_uapi_gamma_corr_lut gc_lut __attribute__((aligned(32))); 1034 } __packed; 1035 1036 /** 1037 * struct ipu3_uapi_csc_mat_config - Color space conversion matrix config 1038 * 1039 * @coeff_c11: Conversion matrix value, format s0.14, range [-16384, 16383]. 1040 * @coeff_c12: Conversion matrix value, format s0.14, range [-8192, 8191]. 1041 * @coeff_c13: Conversion matrix value, format s0.14, range [-16384, 16383]. 1042 * @coeff_b1: Bias 3x1 coefficient, s13.0 range [-8192, 8191]. 1043 * @coeff_c21: Conversion matrix value, format s0.14, range [-16384, 16383]. 1044 * @coeff_c22: Conversion matrix value, format s0.14, range [-8192, 8191]. 1045 * @coeff_c23: Conversion matrix value, format s0.14, range [-16384, 16383]. 1046 * @coeff_b2: Bias 3x1 coefficient, s13.0 range [-8192, 8191]. 1047 * @coeff_c31: Conversion matrix value, format s0.14, range [-16384, 16383]. 1048 * @coeff_c32: Conversion matrix value, format s0.14, range [-8192, 8191]. 1049 * @coeff_c33: Conversion matrix value, format s0.14, range [-16384, 16383]. 1050 * @coeff_b3: Bias 3x1 coefficient, s13.0 range [-8192, 8191]. 1051 * 1052 * To transform each pixel from RGB to YUV (Y - brightness/luminance, 1053 * UV -chroma) by applying the pixel's values by a 3x3 matrix and adding an 1054 * optional bias 3x1 vector. Here are the default values for the matrix: 1055 * 1056 * 4898, 9617, 1867, 0, 1057 * -2410, -4732, 7143, 0, 1058 * 10076, -8437, -1638, 0, 1059 * 1060 * (i.e. for real number 0.299, 0.299 * 2^14 becomes 4898.) 1061 */ 1062 struct ipu3_uapi_csc_mat_config { 1063 __s16 coeff_c11; 1064 __s16 coeff_c12; 1065 __s16 coeff_c13; 1066 __s16 coeff_b1; 1067 __s16 coeff_c21; 1068 __s16 coeff_c22; 1069 __s16 coeff_c23; 1070 __s16 coeff_b2; 1071 __s16 coeff_c31; 1072 __s16 coeff_c32; 1073 __s16 coeff_c33; 1074 __s16 coeff_b3; 1075 } __packed; 1076 1077 /** 1078 * struct ipu3_uapi_cds_params - Chroma down-scaling 1079 * 1080 * @ds_c00: range [0, 3] 1081 * @ds_c01: range [0, 3] 1082 * @ds_c02: range [0, 3] 1083 * @ds_c03: range [0, 3] 1084 * @ds_c10: range [0, 3] 1085 * @ds_c11: range [0, 3] 1086 * @ds_c12: range [0, 3] 1087 * @ds_c13: range [0, 3] 1088 * 1089 * In case user does not provide, above 4x2 filter will use following defaults: 1090 * 1, 3, 3, 1, 1091 * 1, 3, 3, 1, 1092 * 1093 * @ds_nf: Normalization factor for Chroma output downscaling filter, 1094 * range 0,4, default 2. 1095 * @reserved0: reserved 1096 * @csc_en: Color space conversion enable 1097 * @uv_bin_output: 0: output YUV 4.2.0, 1: output YUV 4.2.2(default). 1098 * @reserved1: reserved 1099 */ 1100 struct ipu3_uapi_cds_params { 1101 __u32 ds_c00:2; 1102 __u32 ds_c01:2; 1103 __u32 ds_c02:2; 1104 __u32 ds_c03:2; 1105 __u32 ds_c10:2; 1106 __u32 ds_c11:2; 1107 __u32 ds_c12:2; 1108 __u32 ds_c13:2; 1109 __u32 ds_nf:5; 1110 __u32 reserved0:3; 1111 __u32 csc_en:1; 1112 __u32 uv_bin_output:1; 1113 __u32 reserved1:6; 1114 } __packed; 1115 1116 /** 1117 * struct ipu3_uapi_shd_grid_config - Bayer shading(darkening) correction 1118 * 1119 * @width: Grid horizontal dimensions, u8, [8, 128], default 73 1120 * @height: Grid vertical dimensions, u8, [8, 128], default 56 1121 * @block_width_log2: Log2 of the width of the grid cell in pixel count 1122 * u4, [0, 15], default value 5. 1123 * @reserved0: reserved 1124 * @block_height_log2: Log2 of the height of the grid cell in pixel count 1125 * u4, [0, 15], default value 6. 1126 * @reserved1: reserved 1127 * @grid_height_per_slice: SHD_MAX_CELLS_PER_SET/width. 1128 * (with SHD_MAX_CELLS_PER_SET = 146). 1129 * @x_start: X value of top left corner of sensor relative to ROI 1130 * s13, [-4096, 0], default 0, only negative values. 1131 * @y_start: Y value of top left corner of sensor relative to ROI 1132 * s13, [-4096, 0], default 0, only negative values. 1133 */ 1134 struct ipu3_uapi_shd_grid_config { 1135 /* reg 0 */ 1136 __u8 width; 1137 __u8 height; 1138 __u8 block_width_log2:3; 1139 __u8 reserved0:1; 1140 __u8 block_height_log2:3; 1141 __u8 reserved1:1; 1142 __u8 grid_height_per_slice; 1143 /* reg 1 */ 1144 __s16 x_start; 1145 __s16 y_start; 1146 } __packed; 1147 1148 /** 1149 * struct ipu3_uapi_shd_general_config - Shading general config 1150 * 1151 * @init_set_vrt_offst_ul: set vertical offset, 1152 * y_start >> block_height_log2 % grid_height_per_slice. 1153 * @shd_enable: shading enable. 1154 * @gain_factor: Gain factor. Shift calculated anti shading value. Precision u2. 1155 * 0x0 - gain factor [1, 5], means no shift interpolated value. 1156 * 0x1 - gain factor [1, 9], means shift interpolated by 1. 1157 * 0x2 - gain factor [1, 17], means shift interpolated by 2. 1158 * @reserved: reserved 1159 * 1160 * Correction is performed by multiplying a gain factor for each of the 4 Bayer 1161 * channels as a function of the pixel location in the sensor. 1162 */ 1163 struct ipu3_uapi_shd_general_config { 1164 __u32 init_set_vrt_offst_ul:8; 1165 __u32 shd_enable:1; 1166 __u32 gain_factor:2; 1167 __u32 reserved:21; 1168 } __packed; 1169 1170 /** 1171 * struct ipu3_uapi_shd_black_level_config - Black level correction 1172 * 1173 * @bl_r: Bios values for green red. s11 range [-2048, 2047]. 1174 * @bl_gr: Bios values for green blue. s11 range [-2048, 2047]. 1175 * @bl_gb: Bios values for red. s11 range [-2048, 2047]. 1176 * @bl_b: Bios values for blue. s11 range [-2048, 2047]. 1177 */ 1178 struct ipu3_uapi_shd_black_level_config { 1179 __s16 bl_r; 1180 __s16 bl_gr; 1181 __s16 bl_gb; 1182 __s16 bl_b; 1183 } __packed; 1184 1185 /** 1186 * struct ipu3_uapi_shd_config_static - Shading config static 1187 * 1188 * @grid: shading grid config &ipu3_uapi_shd_grid_config 1189 * @general: shading general config &ipu3_uapi_shd_general_config 1190 * @black_level: black level config for shading correction as defined by 1191 * &ipu3_uapi_shd_black_level_config 1192 */ 1193 struct ipu3_uapi_shd_config_static { 1194 struct ipu3_uapi_shd_grid_config grid; 1195 struct ipu3_uapi_shd_general_config general; 1196 struct ipu3_uapi_shd_black_level_config black_level; 1197 } __packed; 1198 1199 /** 1200 * struct ipu3_uapi_shd_lut - Shading gain factor lookup table. 1201 * 1202 * @sets: array 1203 * @sets.r_and_gr: Red and GreenR Lookup table. 1204 * @sets.r_and_gr.r: Red shading factor. 1205 * @sets.r_and_gr.gr: GreenR shading factor. 1206 * @sets.reserved1: reserved 1207 * @sets.gb_and_b: GreenB and Blue Lookup table. 1208 * @sets.gb_and_b.gb: GreenB shading factor. 1209 * @sets.gb_and_b.b: Blue shading factor. 1210 * @sets.reserved2: reserved 1211 * 1212 * Map to shading correction LUT register set. 1213 */ 1214 struct ipu3_uapi_shd_lut { 1215 struct { 1216 struct { 1217 __u16 r; 1218 __u16 gr; 1219 } r_and_gr[IPU3_UAPI_SHD_MAX_CELLS_PER_SET]; 1220 __u8 reserved1[24]; 1221 struct { 1222 __u16 gb; 1223 __u16 b; 1224 } gb_and_b[IPU3_UAPI_SHD_MAX_CELLS_PER_SET]; 1225 __u8 reserved2[24]; 1226 } sets[IPU3_UAPI_SHD_MAX_CFG_SETS]; 1227 } __packed; 1228 1229 /** 1230 * struct ipu3_uapi_shd_config - Shading config 1231 * 1232 * @shd: shading static config, see &ipu3_uapi_shd_config_static 1233 * @shd_lut: shading lookup table &ipu3_uapi_shd_lut 1234 */ 1235 struct ipu3_uapi_shd_config { 1236 struct ipu3_uapi_shd_config_static shd __attribute__((aligned(32))); 1237 struct ipu3_uapi_shd_lut shd_lut __attribute__((aligned(32))); 1238 } __packed; 1239 1240 /* Image Enhancement Filter directed */ 1241 1242 /** 1243 * struct ipu3_uapi_iefd_cux2 - IEFd Config Unit 2 parameters 1244 * 1245 * @x0: X0 point of Config Unit, u9.0, default 0. 1246 * @x1: X1 point of Config Unit, u9.0, default 0. 1247 * @a01: Slope A of Config Unit, s4.4, default 0. 1248 * @b01: Slope B, always 0. 1249 * 1250 * Calculate weight for blending directed and non-directed denoise elements 1251 * 1252 * Note: 1253 * Each instance of Config Unit needs X coordinate of n points and 1254 * slope A factor between points calculated by driver based on calibration 1255 * parameters. 1256 * 1257 * All CU inputs are unsigned, they will be converted to signed when written 1258 * to register, i.e. a01 will be written to 9 bit register in s4.4 format. 1259 * The data precision s4.4 means 4 bits for integer parts and 4 bits for the 1260 * fractional part, the first bit indicates positive or negative value. 1261 * For userspace software (commonly the imaging library), the computation for 1262 * the CU slope values should be based on the slope resolution 1/16 (binary 1263 * 0.0001 - the minimal interval value), the slope value range is [-256, +255]. 1264 * This applies to &ipu3_uapi_iefd_cux6_ed, &ipu3_uapi_iefd_cux2_1, 1265 * &ipu3_uapi_iefd_cux2_1, &ipu3_uapi_iefd_cux4 and &ipu3_uapi_iefd_cux6_rad. 1266 */ 1267 struct ipu3_uapi_iefd_cux2 { 1268 __u32 x0:9; 1269 __u32 x1:9; 1270 __u32 a01:9; 1271 __u32 b01:5; 1272 } __packed; 1273 1274 /** 1275 * struct ipu3_uapi_iefd_cux6_ed - Calculate power of non-directed sharpening 1276 * element, Config Unit 6 for edge detail (ED). 1277 * 1278 * @x0: X coordinate of point 0, u9.0, default 0. 1279 * @x1: X coordinate of point 1, u9.0, default 0. 1280 * @x2: X coordinate of point 2, u9.0, default 0. 1281 * @reserved0: reserved 1282 * @x3: X coordinate of point 3, u9.0, default 0. 1283 * @x4: X coordinate of point 4, u9.0, default 0. 1284 * @x5: X coordinate of point 5, u9.0, default 0. 1285 * @reserved1: reserved 1286 * @a01: slope A points 01, s4.4, default 0. 1287 * @a12: slope A points 12, s4.4, default 0. 1288 * @a23: slope A points 23, s4.4, default 0. 1289 * @reserved2: reserved 1290 * @a34: slope A points 34, s4.4, default 0. 1291 * @a45: slope A points 45, s4.4, default 0. 1292 * @reserved3: reserved 1293 * @b01: slope B points 01, s4.4, default 0. 1294 * @b12: slope B points 12, s4.4, default 0. 1295 * @b23: slope B points 23, s4.4, default 0. 1296 * @reserved4: reserved 1297 * @b34: slope B points 34, s4.4, default 0. 1298 * @b45: slope B points 45, s4.4, default 0. 1299 * @reserved5: reserved. 1300 */ 1301 struct ipu3_uapi_iefd_cux6_ed { 1302 __u32 x0:9; 1303 __u32 x1:9; 1304 __u32 x2:9; 1305 __u32 reserved0:5; 1306 1307 __u32 x3:9; 1308 __u32 x4:9; 1309 __u32 x5:9; 1310 __u32 reserved1:5; 1311 1312 __u32 a01:9; 1313 __u32 a12:9; 1314 __u32 a23:9; 1315 __u32 reserved2:5; 1316 1317 __u32 a34:9; 1318 __u32 a45:9; 1319 __u32 reserved3:14; 1320 1321 __u32 b01:9; 1322 __u32 b12:9; 1323 __u32 b23:9; 1324 __u32 reserved4:5; 1325 1326 __u32 b34:9; 1327 __u32 b45:9; 1328 __u32 reserved5:14; 1329 } __packed; 1330 1331 /** 1332 * struct ipu3_uapi_iefd_cux2_1 - Calculate power of non-directed denoise 1333 * element apply. 1334 * @x0: X0 point of Config Unit, u9.0, default 0. 1335 * @x1: X1 point of Config Unit, u9.0, default 0. 1336 * @a01: Slope A of Config Unit, s4.4, default 0. 1337 * @reserved1: reserved 1338 * @b01: offset B0 of Config Unit, u7.0, default 0. 1339 * @reserved2: reserved 1340 */ 1341 struct ipu3_uapi_iefd_cux2_1 { 1342 __u32 x0:9; 1343 __u32 x1:9; 1344 __u32 a01:9; 1345 __u32 reserved1:5; 1346 1347 __u32 b01:8; 1348 __u32 reserved2:24; 1349 } __packed; 1350 1351 /** 1352 * struct ipu3_uapi_iefd_cux4 - Calculate power of non-directed sharpening 1353 * element. 1354 * 1355 * @x0: X0 point of Config Unit, u9.0, default 0. 1356 * @x1: X1 point of Config Unit, u9.0, default 0. 1357 * @x2: X2 point of Config Unit, u9.0, default 0. 1358 * @reserved0: reserved 1359 * @x3: X3 point of Config Unit, u9.0, default 0. 1360 * @a01: Slope A0 of Config Unit, s4.4, default 0. 1361 * @a12: Slope A1 of Config Unit, s4.4, default 0. 1362 * @reserved1: reserved 1363 * @a23: Slope A2 of Config Unit, s4.4, default 0. 1364 * @b01: Offset B0 of Config Unit, s7.0, default 0. 1365 * @b12: Offset B1 of Config Unit, s7.0, default 0. 1366 * @reserved2: reserved 1367 * @b23: Offset B2 of Config Unit, s7.0, default 0. 1368 * @reserved3: reserved 1369 */ 1370 struct ipu3_uapi_iefd_cux4 { 1371 __u32 x0:9; 1372 __u32 x1:9; 1373 __u32 x2:9; 1374 __u32 reserved0:5; 1375 1376 __u32 x3:9; 1377 __u32 a01:9; 1378 __u32 a12:9; 1379 __u32 reserved1:5; 1380 1381 __u32 a23:9; 1382 __u32 b01:8; 1383 __u32 b12:8; 1384 __u32 reserved2:7; 1385 1386 __u32 b23:8; 1387 __u32 reserved3:24; 1388 } __packed; 1389 1390 /** 1391 * struct ipu3_uapi_iefd_cux6_rad - Radial Config Unit (CU) 1392 * 1393 * @x0: x0 points of Config Unit radial, u8.0 1394 * @x1: x1 points of Config Unit radial, u8.0 1395 * @x2: x2 points of Config Unit radial, u8.0 1396 * @x3: x3 points of Config Unit radial, u8.0 1397 * @x4: x4 points of Config Unit radial, u8.0 1398 * @x5: x5 points of Config Unit radial, u8.0 1399 * @reserved1: reserved 1400 * @a01: Slope A of Config Unit radial, s7.8 1401 * @a12: Slope A of Config Unit radial, s7.8 1402 * @a23: Slope A of Config Unit radial, s7.8 1403 * @a34: Slope A of Config Unit radial, s7.8 1404 * @a45: Slope A of Config Unit radial, s7.8 1405 * @reserved2: reserved 1406 * @b01: Slope B of Config Unit radial, s9.0 1407 * @b12: Slope B of Config Unit radial, s9.0 1408 * @b23: Slope B of Config Unit radial, s9.0 1409 * @reserved4: reserved 1410 * @b34: Slope B of Config Unit radial, s9.0 1411 * @b45: Slope B of Config Unit radial, s9.0 1412 * @reserved5: reserved 1413 */ 1414 struct ipu3_uapi_iefd_cux6_rad { 1415 __u32 x0:8; 1416 __u32 x1:8; 1417 __u32 x2:8; 1418 __u32 x3:8; 1419 1420 __u32 x4:8; 1421 __u32 x5:8; 1422 __u32 reserved1:16; 1423 1424 __u32 a01:16; 1425 __u32 a12:16; 1426 1427 __u32 a23:16; 1428 __u32 a34:16; 1429 1430 __u32 a45:16; 1431 __u32 reserved2:16; 1432 1433 __u32 b01:10; 1434 __u32 b12:10; 1435 __u32 b23:10; 1436 __u32 reserved4:2; 1437 1438 __u32 b34:10; 1439 __u32 b45:10; 1440 __u32 reserved5:12; 1441 } __packed; 1442 1443 /** 1444 * struct ipu3_uapi_yuvp1_iefd_cfg_units - IEFd Config Units parameters 1445 * 1446 * @cu_1: calculate weight for blending directed and 1447 * non-directed denoise elements. See &ipu3_uapi_iefd_cux2 1448 * @cu_ed: calculate power of non-directed sharpening element, see 1449 * &ipu3_uapi_iefd_cux6_ed 1450 * @cu_3: calculate weight for blending directed and 1451 * non-directed denoise elements. A &ipu3_uapi_iefd_cux2 1452 * @cu_5: calculate power of non-directed denoise element apply, use 1453 * &ipu3_uapi_iefd_cux2_1 1454 * @cu_6: calculate power of non-directed sharpening element. See 1455 * &ipu3_uapi_iefd_cux4 1456 * @cu_7: calculate weight for blending directed and 1457 * non-directed denoise elements. Use &ipu3_uapi_iefd_cux2 1458 * @cu_unsharp: Config Unit of unsharp &ipu3_uapi_iefd_cux4 1459 * @cu_radial: Config Unit of radial &ipu3_uapi_iefd_cux6_rad 1460 * @cu_vssnlm: Config Unit of vssnlm &ipu3_uapi_iefd_cux2 1461 */ 1462 struct ipu3_uapi_yuvp1_iefd_cfg_units { 1463 struct ipu3_uapi_iefd_cux2 cu_1; 1464 struct ipu3_uapi_iefd_cux6_ed cu_ed; 1465 struct ipu3_uapi_iefd_cux2 cu_3; 1466 struct ipu3_uapi_iefd_cux2_1 cu_5; 1467 struct ipu3_uapi_iefd_cux4 cu_6; 1468 struct ipu3_uapi_iefd_cux2 cu_7; 1469 struct ipu3_uapi_iefd_cux4 cu_unsharp; 1470 struct ipu3_uapi_iefd_cux6_rad cu_radial; 1471 struct ipu3_uapi_iefd_cux2 cu_vssnlm; 1472 } __packed; 1473 1474 /** 1475 * struct ipu3_uapi_yuvp1_iefd_config_s - IEFd config 1476 * 1477 * @horver_diag_coeff: Gradient compensation. Compared with vertical / 1478 * horizontal (0 / 90 degree), coefficient of diagonal (45 / 1479 * 135 degree) direction should be corrected by approx. 1480 * 1/sqrt(2). 1481 * @reserved0: reserved 1482 * @clamp_stitch: Slope to stitch between clamped and unclamped edge values 1483 * @reserved1: reserved 1484 * @direct_metric_update: Update coeff for direction metric 1485 * @reserved2: reserved 1486 * @ed_horver_diag_coeff: Radial Coefficient that compensates for 1487 * different distance for vertical/horizontal and 1488 * diagonal gradient calculation (approx. 1/sqrt(2)) 1489 * @reserved3: reserved 1490 */ 1491 struct ipu3_uapi_yuvp1_iefd_config_s { 1492 __u32 horver_diag_coeff:7; 1493 __u32 reserved0:1; 1494 __u32 clamp_stitch:6; 1495 __u32 reserved1:2; 1496 __u32 direct_metric_update:5; 1497 __u32 reserved2:3; 1498 __u32 ed_horver_diag_coeff:7; 1499 __u32 reserved3:1; 1500 } __packed; 1501 1502 /** 1503 * struct ipu3_uapi_yuvp1_iefd_control - IEFd control 1504 * 1505 * @iefd_en: Enable IEFd 1506 * @denoise_en: Enable denoise 1507 * @direct_smooth_en: Enable directional smooth 1508 * @rad_en: Enable radial update 1509 * @vssnlm_en: Enable VSSNLM output filter 1510 * @reserved: reserved 1511 */ 1512 struct ipu3_uapi_yuvp1_iefd_control { 1513 __u32 iefd_en:1; 1514 __u32 denoise_en:1; 1515 __u32 direct_smooth_en:1; 1516 __u32 rad_en:1; 1517 __u32 vssnlm_en:1; 1518 __u32 reserved:27; 1519 } __packed; 1520 1521 /** 1522 * struct ipu3_uapi_sharp_cfg - Sharpening config 1523 * 1524 * @nega_lmt_txt: Sharpening limit for negative overshoots for texture. 1525 * @reserved0: reserved 1526 * @posi_lmt_txt: Sharpening limit for positive overshoots for texture. 1527 * @reserved1: reserved 1528 * @nega_lmt_dir: Sharpening limit for negative overshoots for direction (edge). 1529 * @reserved2: reserved 1530 * @posi_lmt_dir: Sharpening limit for positive overshoots for direction (edge). 1531 * @reserved3: reserved 1532 * 1533 * Fixed point type u13.0, range [0, 8191]. 1534 */ 1535 struct ipu3_uapi_sharp_cfg { 1536 __u32 nega_lmt_txt:13; 1537 __u32 reserved0:19; 1538 __u32 posi_lmt_txt:13; 1539 __u32 reserved1:19; 1540 __u32 nega_lmt_dir:13; 1541 __u32 reserved2:19; 1542 __u32 posi_lmt_dir:13; 1543 __u32 reserved3:19; 1544 } __packed; 1545 1546 /** 1547 * struct ipu3_uapi_far_w - Sharpening config for far sub-group 1548 * 1549 * @dir_shrp: Weight of wide direct sharpening, u1.6, range [0, 64], default 64. 1550 * @reserved0: reserved 1551 * @dir_dns: Weight of wide direct denoising, u1.6, range [0, 64], default 0. 1552 * @reserved1: reserved 1553 * @ndir_dns_powr: Power of non-direct denoising, 1554 * Precision u1.6, range [0, 64], default 64. 1555 * @reserved2: reserved 1556 */ 1557 struct ipu3_uapi_far_w { 1558 __u32 dir_shrp:7; 1559 __u32 reserved0:1; 1560 __u32 dir_dns:7; 1561 __u32 reserved1:1; 1562 __u32 ndir_dns_powr:7; 1563 __u32 reserved2:9; 1564 } __packed; 1565 1566 /** 1567 * struct ipu3_uapi_unsharp_cfg - Unsharp config 1568 * 1569 * @unsharp_weight: Unsharp mask blending weight. 1570 * u1.6, range [0, 64], default 16. 1571 * 0 - disabled, 64 - use only unsharp. 1572 * @reserved0: reserved 1573 * @unsharp_amount: Unsharp mask amount, u4.5, range [0, 511], default 0. 1574 * @reserved1: reserved 1575 */ 1576 struct ipu3_uapi_unsharp_cfg { 1577 __u32 unsharp_weight:7; 1578 __u32 reserved0:1; 1579 __u32 unsharp_amount:9; 1580 __u32 reserved1:15; 1581 } __packed; 1582 1583 /** 1584 * struct ipu3_uapi_yuvp1_iefd_shrp_cfg - IEFd sharpness config 1585 * 1586 * @cfg: sharpness config &ipu3_uapi_sharp_cfg 1587 * @far_w: wide range config, value as specified by &ipu3_uapi_far_w: 1588 * The 5x5 environment is separated into 2 sub-groups, the 3x3 nearest 1589 * neighbors (8 pixels called Near), and the second order neighborhood 1590 * around them (16 pixels called Far). 1591 * @unshrp_cfg: unsharpness config. &ipu3_uapi_unsharp_cfg 1592 */ 1593 struct ipu3_uapi_yuvp1_iefd_shrp_cfg { 1594 struct ipu3_uapi_sharp_cfg cfg; 1595 struct ipu3_uapi_far_w far_w; 1596 struct ipu3_uapi_unsharp_cfg unshrp_cfg; 1597 } __packed; 1598 1599 /** 1600 * struct ipu3_uapi_unsharp_coef0 - Unsharp mask coefficients 1601 * 1602 * @c00: Coeff11, s0.8, range [-255, 255], default 1. 1603 * @c01: Coeff12, s0.8, range [-255, 255], default 5. 1604 * @c02: Coeff13, s0.8, range [-255, 255], default 9. 1605 * @reserved: reserved 1606 * 1607 * Configurable registers for common sharpening support. 1608 */ 1609 struct ipu3_uapi_unsharp_coef0 { 1610 __u32 c00:9; 1611 __u32 c01:9; 1612 __u32 c02:9; 1613 __u32 reserved:5; 1614 } __packed; 1615 1616 /** 1617 * struct ipu3_uapi_unsharp_coef1 - Unsharp mask coefficients 1618 * 1619 * @c11: Coeff22, s0.8, range [-255, 255], default 29. 1620 * @c12: Coeff23, s0.8, range [-255, 255], default 55. 1621 * @c22: Coeff33, s0.8, range [-255, 255], default 96. 1622 * @reserved: reserved 1623 */ 1624 struct ipu3_uapi_unsharp_coef1 { 1625 __u32 c11:9; 1626 __u32 c12:9; 1627 __u32 c22:9; 1628 __u32 reserved:5; 1629 } __packed; 1630 1631 /** 1632 * struct ipu3_uapi_yuvp1_iefd_unshrp_cfg - Unsharp mask config 1633 * 1634 * @unsharp_coef0: unsharp coefficient 0 config. See &ipu3_uapi_unsharp_coef0 1635 * @unsharp_coef1: unsharp coefficient 1 config. See &ipu3_uapi_unsharp_coef1 1636 */ 1637 struct ipu3_uapi_yuvp1_iefd_unshrp_cfg { 1638 struct ipu3_uapi_unsharp_coef0 unsharp_coef0; 1639 struct ipu3_uapi_unsharp_coef1 unsharp_coef1; 1640 } __packed; 1641 1642 /** 1643 * struct ipu3_uapi_radial_reset_xy - Radial coordinate reset 1644 * 1645 * @x: Radial reset of x coordinate. Precision s12, [-4095, 4095], default 0. 1646 * @reserved0: reserved 1647 * @y: Radial center y coordinate. Precision s12, [-4095, 4095], default 0. 1648 * @reserved1: reserved 1649 */ 1650 struct ipu3_uapi_radial_reset_xy { 1651 __s32 x:13; 1652 __u32 reserved0:3; 1653 __s32 y:13; 1654 __u32 reserved1:3; 1655 } __packed; 1656 1657 /** 1658 * struct ipu3_uapi_radial_reset_x2 - Radial X^2 reset 1659 * 1660 * @x2: Radial reset of x^2 coordinate. Precision u24, default 0. 1661 * @reserved: reserved 1662 */ 1663 struct ipu3_uapi_radial_reset_x2 { 1664 __u32 x2:24; 1665 __u32 reserved:8; 1666 } __packed; 1667 1668 /** 1669 * struct ipu3_uapi_radial_reset_y2 - Radial Y^2 reset 1670 * 1671 * @y2: Radial reset of y^2 coordinate. Precision u24, default 0. 1672 * @reserved: reserved 1673 */ 1674 struct ipu3_uapi_radial_reset_y2 { 1675 __u32 y2:24; 1676 __u32 reserved:8; 1677 } __packed; 1678 1679 /** 1680 * struct ipu3_uapi_radial_cfg - Radial config 1681 * 1682 * @rad_nf: Radial. R^2 normalization factor is scale down by 2^ - (15 + scale) 1683 * @reserved0: reserved 1684 * @rad_inv_r2: Radial R^-2 normelized to (0.5..1). 1685 * Precision u7, range [0, 127]. 1686 * @reserved1: reserved 1687 */ 1688 struct ipu3_uapi_radial_cfg { 1689 __u32 rad_nf:4; 1690 __u32 reserved0:4; 1691 __u32 rad_inv_r2:7; 1692 __u32 reserved1:17; 1693 } __packed; 1694 1695 /** 1696 * struct ipu3_uapi_rad_far_w - Radial FAR sub-group 1697 * 1698 * @rad_dir_far_sharp_w: Weight of wide direct sharpening, u1.6, range [0, 64], 1699 * default 64. 1700 * @rad_dir_far_dns_w: Weight of wide direct denoising, u1.6, range [0, 64], 1701 * default 0. 1702 * @rad_ndir_far_dns_power: power of non-direct sharpening, u1.6, range [0, 64], 1703 * default 0. 1704 * @reserved: reserved 1705 */ 1706 struct ipu3_uapi_rad_far_w { 1707 __u32 rad_dir_far_sharp_w:8; 1708 __u32 rad_dir_far_dns_w:8; 1709 __u32 rad_ndir_far_dns_power:8; 1710 __u32 reserved:8; 1711 } __packed; 1712 1713 /** 1714 * struct ipu3_uapi_cu_cfg0 - Radius Config Unit cfg0 register 1715 * 1716 * @cu6_pow: Power of CU6. Power of non-direct sharpening, u3.4. 1717 * @reserved0: reserved 1718 * @cu_unsharp_pow: Power of unsharp mask, u2.4. 1719 * @reserved1: reserved 1720 * @rad_cu6_pow: Radial/corner CU6. Directed sharpening power, u3.4. 1721 * @reserved2: reserved 1722 * @rad_cu_unsharp_pow: Radial power of unsharp mask, u2.4. 1723 * @reserved3: reserved 1724 */ 1725 struct ipu3_uapi_cu_cfg0 { 1726 __u32 cu6_pow:7; 1727 __u32 reserved0:1; 1728 __u32 cu_unsharp_pow:7; 1729 __u32 reserved1:1; 1730 __u32 rad_cu6_pow:7; 1731 __u32 reserved2:1; 1732 __u32 rad_cu_unsharp_pow:6; 1733 __u32 reserved3:2; 1734 } __packed; 1735 1736 /** 1737 * struct ipu3_uapi_cu_cfg1 - Radius Config Unit cfg1 register 1738 * 1739 * @rad_cu6_x1: X1 point of Config Unit 6, precision u9.0. 1740 * @reserved0: reserved 1741 * @rad_cu_unsharp_x1: X1 point for Config Unit unsharp for radial/corner point 1742 * precision u9.0. 1743 * @reserved1: reserved 1744 */ 1745 struct ipu3_uapi_cu_cfg1 { 1746 __u32 rad_cu6_x1:9; 1747 __u32 reserved0:1; 1748 __u32 rad_cu_unsharp_x1:9; 1749 __u32 reserved1:13; 1750 } __packed; 1751 1752 /** 1753 * struct ipu3_uapi_yuvp1_iefd_rad_cfg - IEFd parameters changed radially over 1754 * the picture plane. 1755 * 1756 * @reset_xy: reset xy value in radial calculation. &ipu3_uapi_radial_reset_xy 1757 * @reset_x2: reset x square value in radial calculation. See struct 1758 * &ipu3_uapi_radial_reset_x2 1759 * @reset_y2: reset y square value in radial calculation. See struct 1760 * &ipu3_uapi_radial_reset_y2 1761 * @cfg: radial config defined in &ipu3_uapi_radial_cfg 1762 * @rad_far_w: weight for wide range radial. &ipu3_uapi_rad_far_w 1763 * @cu_cfg0: configuration unit 0. See &ipu3_uapi_cu_cfg0 1764 * @cu_cfg1: configuration unit 1. See &ipu3_uapi_cu_cfg1 1765 */ 1766 struct ipu3_uapi_yuvp1_iefd_rad_cfg { 1767 struct ipu3_uapi_radial_reset_xy reset_xy; 1768 struct ipu3_uapi_radial_reset_x2 reset_x2; 1769 struct ipu3_uapi_radial_reset_y2 reset_y2; 1770 struct ipu3_uapi_radial_cfg cfg; 1771 struct ipu3_uapi_rad_far_w rad_far_w; 1772 struct ipu3_uapi_cu_cfg0 cu_cfg0; 1773 struct ipu3_uapi_cu_cfg1 cu_cfg1; 1774 } __packed; 1775 1776 /* Vssnlm - Very small scale non-local mean algorithm */ 1777 1778 /** 1779 * struct ipu3_uapi_vss_lut_x - Vssnlm LUT x0/x1/x2 1780 * 1781 * @vs_x0: Vssnlm LUT x0, precision u8, range [0, 255], default 16. 1782 * @vs_x1: Vssnlm LUT x1, precision u8, range [0, 255], default 32. 1783 * @vs_x2: Vssnlm LUT x2, precision u8, range [0, 255], default 64. 1784 * @reserved2: reserved 1785 */ 1786 struct ipu3_uapi_vss_lut_x { 1787 __u32 vs_x0:8; 1788 __u32 vs_x1:8; 1789 __u32 vs_x2:8; 1790 __u32 reserved2:8; 1791 } __packed; 1792 1793 /** 1794 * struct ipu3_uapi_vss_lut_y - Vssnlm LUT y0/y1/y2 1795 * 1796 * @vs_y1: Vssnlm LUT y1, precision u4, range [0, 8], default 1. 1797 * @reserved0: reserved 1798 * @vs_y2: Vssnlm LUT y2, precision u4, range [0, 8], default 3. 1799 * @reserved1: reserved 1800 * @vs_y3: Vssnlm LUT y3, precision u4, range [0, 8], default 8. 1801 * @reserved2: reserved 1802 */ 1803 struct ipu3_uapi_vss_lut_y { 1804 __u32 vs_y1:4; 1805 __u32 reserved0:4; 1806 __u32 vs_y2:4; 1807 __u32 reserved1:4; 1808 __u32 vs_y3:4; 1809 __u32 reserved2:12; 1810 } __packed; 1811 1812 /** 1813 * struct ipu3_uapi_yuvp1_iefd_vssnlm_cfg - IEFd Vssnlm Lookup table 1814 * 1815 * @vss_lut_x: vss lookup table. See &ipu3_uapi_vss_lut_x description 1816 * @vss_lut_y: vss lookup table. See &ipu3_uapi_vss_lut_y description 1817 */ 1818 struct ipu3_uapi_yuvp1_iefd_vssnlm_cfg { 1819 struct ipu3_uapi_vss_lut_x vss_lut_x; 1820 struct ipu3_uapi_vss_lut_y vss_lut_y; 1821 } __packed; 1822 1823 /** 1824 * struct ipu3_uapi_yuvp1_iefd_config - IEFd config 1825 * 1826 * @units: configuration unit setting, &ipu3_uapi_yuvp1_iefd_cfg_units 1827 * @config: configuration, as defined by &ipu3_uapi_yuvp1_iefd_config_s 1828 * @control: control setting, as defined by &ipu3_uapi_yuvp1_iefd_control 1829 * @sharp: sharpness setting, as defined by &ipu3_uapi_yuvp1_iefd_shrp_cfg 1830 * @unsharp: unsharpness setting, as defined by &ipu3_uapi_yuvp1_iefd_unshrp_cfg 1831 * @rad: radial setting, as defined by &ipu3_uapi_yuvp1_iefd_rad_cfg 1832 * @vsslnm: vsslnm setting, as defined by &ipu3_uapi_yuvp1_iefd_vssnlm_cfg 1833 */ 1834 struct ipu3_uapi_yuvp1_iefd_config { 1835 struct ipu3_uapi_yuvp1_iefd_cfg_units units; 1836 struct ipu3_uapi_yuvp1_iefd_config_s config; 1837 struct ipu3_uapi_yuvp1_iefd_control control; 1838 struct ipu3_uapi_yuvp1_iefd_shrp_cfg sharp; 1839 struct ipu3_uapi_yuvp1_iefd_unshrp_cfg unsharp; 1840 struct ipu3_uapi_yuvp1_iefd_rad_cfg rad; 1841 struct ipu3_uapi_yuvp1_iefd_vssnlm_cfg vsslnm; 1842 } __packed; 1843 1844 /** 1845 * struct ipu3_uapi_yuvp1_yds_config - Y Down-Sampling config 1846 * 1847 * @c00: range [0, 3], default 0x0 1848 * @c01: range [0, 3], default 0x1 1849 * @c02: range [0, 3], default 0x1 1850 * @c03: range [0, 3], default 0x0 1851 * @c10: range [0, 3], default 0x0 1852 * @c11: range [0, 3], default 0x1 1853 * @c12: range [0, 3], default 0x1 1854 * @c13: range [0, 3], default 0x0 1855 * 1856 * Above are 4x2 filter coefficients for chroma output downscaling. 1857 * 1858 * @norm_factor: Normalization factor, range [0, 4], default 2 1859 * 0 - divide by 1 1860 * 1 - divide by 2 1861 * 2 - divide by 4 1862 * 3 - divide by 8 1863 * 4 - divide by 16 1864 * @reserved0: reserved 1865 * @bin_output: Down sampling on Luma channel in two optional modes 1866 * 0 - Bin output 4.2.0 (default), 1 output 4.2.2. 1867 * @reserved1: reserved 1868 */ 1869 struct ipu3_uapi_yuvp1_yds_config { 1870 __u32 c00:2; 1871 __u32 c01:2; 1872 __u32 c02:2; 1873 __u32 c03:2; 1874 __u32 c10:2; 1875 __u32 c11:2; 1876 __u32 c12:2; 1877 __u32 c13:2; 1878 __u32 norm_factor:5; 1879 __u32 reserved0:4; 1880 __u32 bin_output:1; 1881 __u32 reserved1:6; 1882 } __packed; 1883 1884 /* Chroma Noise Reduction */ 1885 1886 /** 1887 * struct ipu3_uapi_yuvp1_chnr_enable_config - Chroma noise reduction enable 1888 * 1889 * @enable: enable/disable chroma noise reduction 1890 * @yuv_mode: 0 - YUV420, 1 - YUV422 1891 * @reserved0: reserved 1892 * @col_size: number of columns in the frame, max width is 2560 1893 * @reserved1: reserved 1894 */ 1895 struct ipu3_uapi_yuvp1_chnr_enable_config { 1896 __u32 enable:1; 1897 __u32 yuv_mode:1; 1898 __u32 reserved0:14; 1899 __u32 col_size:12; 1900 __u32 reserved1:4; 1901 } __packed; 1902 1903 /** 1904 * struct ipu3_uapi_yuvp1_chnr_coring_config - Coring thresholds for UV 1905 * 1906 * @u: U coring level, u0.13, range [0.0, 1.0], default 0.0 1907 * @reserved0: reserved 1908 * @v: V coring level, u0.13, range [0.0, 1.0], default 0.0 1909 * @reserved1: reserved 1910 */ 1911 struct ipu3_uapi_yuvp1_chnr_coring_config { 1912 __u32 u:13; 1913 __u32 reserved0:3; 1914 __u32 v:13; 1915 __u32 reserved1:3; 1916 } __packed; 1917 1918 /** 1919 * struct ipu3_uapi_yuvp1_chnr_sense_gain_config - Chroma noise reduction gains 1920 * 1921 * All sensitivity gain parameters have precision u13.0, range [0, 8191]. 1922 * 1923 * @vy: Sensitivity of horizontal edge of Y, default 100 1924 * @vu: Sensitivity of horizontal edge of U, default 100 1925 * @vv: Sensitivity of horizontal edge of V, default 100 1926 * @reserved0: reserved 1927 * @hy: Sensitivity of vertical edge of Y, default 50 1928 * @hu: Sensitivity of vertical edge of U, default 50 1929 * @hv: Sensitivity of vertical edge of V, default 50 1930 * @reserved1: reserved 1931 */ 1932 struct ipu3_uapi_yuvp1_chnr_sense_gain_config { 1933 __u32 vy:8; 1934 __u32 vu:8; 1935 __u32 vv:8; 1936 __u32 reserved0:8; 1937 1938 __u32 hy:8; 1939 __u32 hu:8; 1940 __u32 hv:8; 1941 __u32 reserved1:8; 1942 } __packed; 1943 1944 /** 1945 * struct ipu3_uapi_yuvp1_chnr_iir_fir_config - Chroma IIR/FIR filter config 1946 * 1947 * @fir_0h: Value of center tap in horizontal FIR, range [0, 32], default 8. 1948 * @reserved0: reserved 1949 * @fir_1h: Value of distance 1 in horizontal FIR, range [0, 32], default 12. 1950 * @reserved1: reserved 1951 * @fir_2h: Value of distance 2 tap in horizontal FIR, range [0, 32], default 0. 1952 * @dalpha_clip_val: weight for previous row in IIR, range [1, 256], default 0. 1953 * @reserved2: reserved 1954 */ 1955 struct ipu3_uapi_yuvp1_chnr_iir_fir_config { 1956 __u32 fir_0h:6; 1957 __u32 reserved0:2; 1958 __u32 fir_1h:6; 1959 __u32 reserved1:2; 1960 __u32 fir_2h:6; 1961 __u32 dalpha_clip_val:9; 1962 __u32 reserved2:1; 1963 } __packed; 1964 1965 /** 1966 * struct ipu3_uapi_yuvp1_chnr_config - Chroma noise reduction config 1967 * 1968 * @enable: chroma noise reduction enable, see 1969 * &ipu3_uapi_yuvp1_chnr_enable_config 1970 * @coring: coring config for chroma noise reduction, see 1971 * &ipu3_uapi_yuvp1_chnr_coring_config 1972 * @sense_gain: sensitivity config for chroma noise reduction, see 1973 * ipu3_uapi_yuvp1_chnr_sense_gain_config 1974 * @iir_fir: iir and fir config for chroma noise reduction, see 1975 * ipu3_uapi_yuvp1_chnr_iir_fir_config 1976 */ 1977 struct ipu3_uapi_yuvp1_chnr_config { 1978 struct ipu3_uapi_yuvp1_chnr_enable_config enable; 1979 struct ipu3_uapi_yuvp1_chnr_coring_config coring; 1980 struct ipu3_uapi_yuvp1_chnr_sense_gain_config sense_gain; 1981 struct ipu3_uapi_yuvp1_chnr_iir_fir_config iir_fir; 1982 } __packed; 1983 1984 /* Edge Enhancement and Noise Reduction */ 1985 1986 /** 1987 * struct ipu3_uapi_yuvp1_y_ee_nr_lpf_config - Luma(Y) edge enhancement low-pass 1988 * filter coefficients 1989 * 1990 * @a_diag: Smoothing diagonal coefficient, u5.0. 1991 * @reserved0: reserved 1992 * @a_periph: Image smoothing perpherial, u5.0. 1993 * @reserved1: reserved 1994 * @a_cent: Image Smoothing center coefficient, u5.0. 1995 * @reserved2: reserved 1996 * @enable: 0: Y_EE_NR disabled, output = input; 1: Y_EE_NR enabled. 1997 */ 1998 struct ipu3_uapi_yuvp1_y_ee_nr_lpf_config { 1999 __u32 a_diag:5; 2000 __u32 reserved0:3; 2001 __u32 a_periph:5; 2002 __u32 reserved1:3; 2003 __u32 a_cent:5; 2004 __u32 reserved2:9; 2005 __u32 enable:1; 2006 } __packed; 2007 2008 /** 2009 * struct ipu3_uapi_yuvp1_y_ee_nr_sense_config - Luma(Y) edge enhancement 2010 * noise reduction sensitivity gains 2011 * 2012 * @edge_sense_0: Sensitivity of edge in dark area. u13.0, default 8191. 2013 * @reserved0: reserved 2014 * @delta_edge_sense: Difference in the sensitivity of edges between 2015 * the bright and dark areas. u13.0, default 0. 2016 * @reserved1: reserved 2017 * @corner_sense_0: Sensitivity of corner in dark area. u13.0, default 0. 2018 * @reserved2: reserved 2019 * @delta_corner_sense: Difference in the sensitivity of corners between 2020 * the bright and dark areas. u13.0, default 8191. 2021 * @reserved3: reserved 2022 */ 2023 struct ipu3_uapi_yuvp1_y_ee_nr_sense_config { 2024 __u32 edge_sense_0:13; 2025 __u32 reserved0:3; 2026 __u32 delta_edge_sense:13; 2027 __u32 reserved1:3; 2028 __u32 corner_sense_0:13; 2029 __u32 reserved2:3; 2030 __u32 delta_corner_sense:13; 2031 __u32 reserved3:3; 2032 } __packed; 2033 2034 /** 2035 * struct ipu3_uapi_yuvp1_y_ee_nr_gain_config - Luma(Y) edge enhancement 2036 * noise reduction gain config 2037 * 2038 * @gain_pos_0: Gain for positive edge in dark area. u5.0, [0, 16], default 2. 2039 * @reserved0: reserved 2040 * @delta_gain_posi: Difference in the gain of edges between the bright and 2041 * dark areas for positive edges. u5.0, [0, 16], default 0. 2042 * @reserved1: reserved 2043 * @gain_neg_0: Gain for negative edge in dark area. u5.0, [0, 16], default 8. 2044 * @reserved2: reserved 2045 * @delta_gain_neg: Difference in the gain of edges between the bright and 2046 * dark areas for negative edges. u5.0, [0, 16], default 0. 2047 * @reserved3: reserved 2048 */ 2049 struct ipu3_uapi_yuvp1_y_ee_nr_gain_config { 2050 __u32 gain_pos_0:5; 2051 __u32 reserved0:3; 2052 __u32 delta_gain_posi:5; 2053 __u32 reserved1:3; 2054 __u32 gain_neg_0:5; 2055 __u32 reserved2:3; 2056 __u32 delta_gain_neg:5; 2057 __u32 reserved3:3; 2058 } __packed; 2059 2060 /** 2061 * struct ipu3_uapi_yuvp1_y_ee_nr_clip_config - Luma(Y) edge enhancement 2062 * noise reduction clipping config 2063 * 2064 * @clip_pos_0: Limit of positive edge in dark area 2065 * u5, value [0, 16], default 8. 2066 * @reserved0: reserved 2067 * @delta_clip_posi: Difference in the limit of edges between the bright 2068 * and dark areas for positive edges. 2069 * u5, value [0, 16], default 8. 2070 * @reserved1: reserved 2071 * @clip_neg_0: Limit of negative edge in dark area 2072 * u5, value [0, 16], default 8. 2073 * @reserved2: reserved 2074 * @delta_clip_neg: Difference in the limit of edges between the bright 2075 * and dark areas for negative edges. 2076 * u5, value [0, 16], default 8. 2077 * @reserved3: reserved 2078 */ 2079 struct ipu3_uapi_yuvp1_y_ee_nr_clip_config { 2080 __u32 clip_pos_0:5; 2081 __u32 reserved0:3; 2082 __u32 delta_clip_posi:5; 2083 __u32 reserved1:3; 2084 __u32 clip_neg_0:5; 2085 __u32 reserved2:3; 2086 __u32 delta_clip_neg:5; 2087 __u32 reserved3:3; 2088 } __packed; 2089 2090 /** 2091 * struct ipu3_uapi_yuvp1_y_ee_nr_frng_config - Luma(Y) edge enhancement 2092 * noise reduction fringe config 2093 * 2094 * @gain_exp: Common exponent of gains, u4, [0, 8], default 2. 2095 * @reserved0: reserved 2096 * @min_edge: Threshold for edge and smooth stitching, u13. 2097 * @reserved1: reserved 2098 * @lin_seg_param: Power of LinSeg, u4. 2099 * @reserved2: reserved 2100 * @t1: Parameter for enabling/disabling the edge enhancement, u1.0, [0, 1], 2101 * default 1. 2102 * @t2: Parameter for enabling/disabling the smoothing, u1.0, [0, 1], 2103 * default 1. 2104 * @reserved3: reserved 2105 */ 2106 struct ipu3_uapi_yuvp1_y_ee_nr_frng_config { 2107 __u32 gain_exp:4; 2108 __u32 reserved0:28; 2109 __u32 min_edge:13; 2110 __u32 reserved1:3; 2111 __u32 lin_seg_param:4; 2112 __u32 reserved2:4; 2113 __u32 t1:1; 2114 __u32 t2:1; 2115 __u32 reserved3:6; 2116 } __packed; 2117 2118 /** 2119 * struct ipu3_uapi_yuvp1_y_ee_nr_diag_config - Luma(Y) edge enhancement 2120 * noise reduction diagonal config 2121 * 2122 * @diag_disc_g: Coefficient that prioritize diagonal edge direction on 2123 * horizontal or vertical for final enhancement. 2124 * u4.0, [1, 15], default 1. 2125 * @reserved0: reserved 2126 * @hvw_hor: Weight of horizontal/vertical edge enhancement for hv edge. 2127 * u2.2, [1, 15], default 4. 2128 * @dw_hor: Weight of diagonal edge enhancement for hv edge. 2129 * u2.2, [1, 15], default 1. 2130 * @hvw_diag: Weight of horizontal/vertical edge enhancement for diagonal edge. 2131 * u2.2, [1, 15], default 1. 2132 * @dw_diag: Weight of diagonal edge enhancement for diagonal edge. 2133 * u2.2, [1, 15], default 4. 2134 * @reserved1: reserved 2135 */ 2136 struct ipu3_uapi_yuvp1_y_ee_nr_diag_config { 2137 __u32 diag_disc_g:4; 2138 __u32 reserved0:4; 2139 __u32 hvw_hor:4; 2140 __u32 dw_hor:4; 2141 __u32 hvw_diag:4; 2142 __u32 dw_diag:4; 2143 __u32 reserved1:8; 2144 } __packed; 2145 2146 /** 2147 * struct ipu3_uapi_yuvp1_y_ee_nr_fc_coring_config - Luma(Y) edge enhancement 2148 * noise reduction false color correction (FCC) coring config 2149 * 2150 * @pos_0: Gain for positive edge in dark, u13.0, [0, 16], default 0. 2151 * @reserved0: reserved 2152 * @pos_delta: Gain for positive edge in bright, value: pos_0 + pos_delta <=16 2153 * u13.0, default 0. 2154 * @reserved1: reserved 2155 * @neg_0: Gain for negative edge in dark area, u13.0, range [0, 16], default 0. 2156 * @reserved2: reserved 2157 * @neg_delta: Gain for negative edge in bright area. neg_0 + neg_delta <=16 2158 * u13.0, default 0. 2159 * @reserved3: reserved 2160 * 2161 * Coring is a simple soft thresholding technique. 2162 */ 2163 struct ipu3_uapi_yuvp1_y_ee_nr_fc_coring_config { 2164 __u32 pos_0:13; 2165 __u32 reserved0:3; 2166 __u32 pos_delta:13; 2167 __u32 reserved1:3; 2168 __u32 neg_0:13; 2169 __u32 reserved2:3; 2170 __u32 neg_delta:13; 2171 __u32 reserved3:3; 2172 } __packed; 2173 2174 /** 2175 * struct ipu3_uapi_yuvp1_y_ee_nr_config - Edge enhancement and noise reduction 2176 * 2177 * @lpf: low-pass filter config. See &ipu3_uapi_yuvp1_y_ee_nr_lpf_config 2178 * @sense: sensitivity config. See &ipu3_uapi_yuvp1_y_ee_nr_sense_config 2179 * @gain: gain config as defined in &ipu3_uapi_yuvp1_y_ee_nr_gain_config 2180 * @clip: clip config as defined in &ipu3_uapi_yuvp1_y_ee_nr_clip_config 2181 * @frng: fringe config as defined in &ipu3_uapi_yuvp1_y_ee_nr_frng_config 2182 * @diag: diagonal edge config. See &ipu3_uapi_yuvp1_y_ee_nr_diag_config 2183 * @fc_coring: coring config for fringe control. See 2184 * &ipu3_uapi_yuvp1_y_ee_nr_fc_coring_config 2185 */ 2186 struct ipu3_uapi_yuvp1_y_ee_nr_config { 2187 struct ipu3_uapi_yuvp1_y_ee_nr_lpf_config lpf; 2188 struct ipu3_uapi_yuvp1_y_ee_nr_sense_config sense; 2189 struct ipu3_uapi_yuvp1_y_ee_nr_gain_config gain; 2190 struct ipu3_uapi_yuvp1_y_ee_nr_clip_config clip; 2191 struct ipu3_uapi_yuvp1_y_ee_nr_frng_config frng; 2192 struct ipu3_uapi_yuvp1_y_ee_nr_diag_config diag; 2193 struct ipu3_uapi_yuvp1_y_ee_nr_fc_coring_config fc_coring; 2194 } __packed; 2195 2196 /* Total Color Correction */ 2197 2198 /** 2199 * struct ipu3_uapi_yuvp2_tcc_gen_control_static_config - Total color correction 2200 * general control config 2201 * 2202 * @en: 0 - TCC disabled. Output = input 1 - TCC enabled. 2203 * @blend_shift: blend shift, Range[3, 4], default NA. 2204 * @gain_according_to_y_only: 0: Gain is calculated according to YUV, 2205 * 1: Gain is calculated according to Y only 2206 * @reserved0: reserved 2207 * @gamma: Final blending coefficients. Values[-16, 16], default NA. 2208 * @reserved1: reserved 2209 * @delta: Final blending coefficients. Values[-16, 16], default NA. 2210 * @reserved2: reserved 2211 */ 2212 struct ipu3_uapi_yuvp2_tcc_gen_control_static_config { 2213 __u32 en:1; 2214 __u32 blend_shift:3; 2215 __u32 gain_according_to_y_only:1; 2216 __u32 reserved0:11; 2217 __s32 gamma:5; 2218 __u32 reserved1:3; 2219 __s32 delta:5; 2220 __u32 reserved2:3; 2221 } __packed; 2222 2223 /** 2224 * struct ipu3_uapi_yuvp2_tcc_macc_elem_static_config - Total color correction 2225 * multi-axis color control (MACC) config 2226 * 2227 * @a: a coefficient for 2x2 MACC conversion matrix. 2228 * @reserved0: reserved 2229 * @b: b coefficient 2x2 MACC conversion matrix. 2230 * @reserved1: reserved 2231 * @c: c coefficient for 2x2 MACC conversion matrix. 2232 * @reserved2: reserved 2233 * @d: d coefficient for 2x2 MACC conversion matrix. 2234 * @reserved3: reserved 2235 */ 2236 struct ipu3_uapi_yuvp2_tcc_macc_elem_static_config { 2237 __s32 a:12; 2238 __u32 reserved0:4; 2239 __s32 b:12; 2240 __u32 reserved1:4; 2241 __s32 c:12; 2242 __u32 reserved2:4; 2243 __s32 d:12; 2244 __u32 reserved3:4; 2245 } __packed; 2246 2247 /** 2248 * struct ipu3_uapi_yuvp2_tcc_macc_table_static_config - Total color correction 2249 * multi-axis color control (MACC) table array 2250 * 2251 * @entries: config for multi axis color correction, as specified by 2252 * &ipu3_uapi_yuvp2_tcc_macc_elem_static_config 2253 */ 2254 struct ipu3_uapi_yuvp2_tcc_macc_table_static_config { 2255 struct ipu3_uapi_yuvp2_tcc_macc_elem_static_config 2256 entries[IPU3_UAPI_YUVP2_TCC_MACC_TABLE_ELEMENTS]; 2257 } __packed; 2258 2259 /** 2260 * struct ipu3_uapi_yuvp2_tcc_inv_y_lut_static_config - Total color correction 2261 * inverse y lookup table 2262 * 2263 * @entries: lookup table for inverse y estimation, and use it to estimate the 2264 * ratio between luma and chroma. Chroma by approximate the absolute 2265 * value of the radius on the chroma plane (R = sqrt(u^2+v^2) ) and 2266 * luma by approximate by 1/Y. 2267 */ 2268 struct ipu3_uapi_yuvp2_tcc_inv_y_lut_static_config { 2269 __u16 entries[IPU3_UAPI_YUVP2_TCC_INV_Y_LUT_ELEMENTS]; 2270 } __packed; 2271 2272 /** 2273 * struct ipu3_uapi_yuvp2_tcc_gain_pcwl_lut_static_config - Total color 2274 * correction lookup table for PCWL 2275 * 2276 * @entries: lookup table for gain piece wise linear transformation (PCWL) 2277 */ 2278 struct ipu3_uapi_yuvp2_tcc_gain_pcwl_lut_static_config { 2279 __u16 entries[IPU3_UAPI_YUVP2_TCC_GAIN_PCWL_LUT_ELEMENTS]; 2280 } __packed; 2281 2282 /** 2283 * struct ipu3_uapi_yuvp2_tcc_r_sqr_lut_static_config - Total color correction 2284 * lookup table for r square root 2285 * 2286 * @entries: lookup table for r square root estimation 2287 */ 2288 struct ipu3_uapi_yuvp2_tcc_r_sqr_lut_static_config { 2289 __s16 entries[IPU3_UAPI_YUVP2_TCC_R_SQR_LUT_ELEMENTS]; 2290 } __packed; 2291 2292 /** 2293 * struct ipu3_uapi_yuvp2_tcc_static_config- Total color correction static 2294 * 2295 * @gen_control: general config for Total Color Correction 2296 * @macc_table: config for multi axis color correction 2297 * @inv_y_lut: lookup table for inverse y estimation 2298 * @gain_pcwl: lookup table for gain PCWL 2299 * @r_sqr_lut: lookup table for r square root estimation. 2300 */ 2301 struct ipu3_uapi_yuvp2_tcc_static_config { 2302 struct ipu3_uapi_yuvp2_tcc_gen_control_static_config gen_control; 2303 struct ipu3_uapi_yuvp2_tcc_macc_table_static_config macc_table; 2304 struct ipu3_uapi_yuvp2_tcc_inv_y_lut_static_config inv_y_lut; 2305 struct ipu3_uapi_yuvp2_tcc_gain_pcwl_lut_static_config gain_pcwl; 2306 struct ipu3_uapi_yuvp2_tcc_r_sqr_lut_static_config r_sqr_lut; 2307 } __packed; 2308 2309 /* Advanced Noise Reduction related structs */ 2310 2311 /* 2312 * struct ipu3_uapi_anr_alpha - Advanced noise reduction alpha 2313 * 2314 * Tunable parameters that are subject to modification according to the 2315 * total gain used. 2316 */ 2317 struct ipu3_uapi_anr_alpha { 2318 __u16 gr; 2319 __u16 r; 2320 __u16 b; 2321 __u16 gb; 2322 __u16 dc_gr; 2323 __u16 dc_r; 2324 __u16 dc_b; 2325 __u16 dc_gb; 2326 } __packed; 2327 2328 /* 2329 * struct ipu3_uapi_anr_beta - Advanced noise reduction beta 2330 * 2331 * Tunable parameters that are subject to modification according to the 2332 * total gain used. 2333 */ 2334 struct ipu3_uapi_anr_beta { 2335 __u16 beta_gr; 2336 __u16 beta_r; 2337 __u16 beta_b; 2338 __u16 beta_gb; 2339 } __packed; 2340 2341 /* 2342 * struct ipu3_uapi_anr_plane_color - Advanced noise reduction per plane R, Gr, 2343 * Gb and B register settings 2344 * 2345 * Tunable parameters that are subject to modification according to the 2346 * total gain used. 2347 */ 2348 struct ipu3_uapi_anr_plane_color { 2349 __u16 reg_w_gr[16]; 2350 __u16 reg_w_r[16]; 2351 __u16 reg_w_b[16]; 2352 __u16 reg_w_gb[16]; 2353 } __packed; 2354 2355 /** 2356 * struct ipu3_uapi_anr_transform_config - Advanced noise reduction transform 2357 * 2358 * @enable: advanced noise reduction enabled. 2359 * @adaptive_treshhold_en: On IPU3, adaptive threshold is always enabled. 2360 * @reserved1: reserved 2361 * @reserved2: reserved 2362 * @alpha: using following defaults: 2363 * 13, 13, 13, 13, 0, 0, 0, 0 2364 * 11, 11, 11, 11, 0, 0, 0, 0 2365 * 14, 14, 14, 14, 0, 0, 0, 0 2366 * @beta: use following defaults: 2367 * 24, 24, 24, 24 2368 * 21, 20, 20, 21 2369 * 25, 25, 25, 25 2370 * @color: use defaults defined in driver/media/pci/intel/ipu3-tables.c 2371 * @sqrt_lut: 11 bits per element, values = 2372 * [724 768 810 849 887 2373 * 923 958 991 1024 1056 2374 * 1116 1145 1173 1201 1086 2375 * 1228 1254 1280 1305 1330 2376 * 1355 1379 1402 1425 1448] 2377 * @xreset: Reset value of X for r^2 calculation Value: col_start-X_center 2378 * Constraint: Xreset + FrameWdith=4095 Xreset= -4095, default -1632. 2379 * @reserved3: reserved 2380 * @yreset: Reset value of Y for r^2 calculation Value: row_start-Y_center 2381 * Constraint: Yreset + FrameHeight=4095 Yreset= -4095, default -1224. 2382 * @reserved4: reserved 2383 * @x_sqr_reset: Reset value of X^2 for r^2 calculation Value = (Xreset)^2 2384 * @r_normfactor: Normalization factor for R. Default 14. 2385 * @reserved5: reserved 2386 * @y_sqr_reset: Reset value of Y^2 for r^2 calculation Value = (Yreset)^2 2387 * @gain_scale: Parameter describing shading gain as a function of distance 2388 * from the image center. 2389 * A single value per frame, loaded by the driver. Default 115. 2390 */ 2391 struct ipu3_uapi_anr_transform_config { 2392 __u32 enable:1; /* 0 or 1, disabled or enabled */ 2393 __u32 adaptive_treshhold_en:1; /* On IPU3, always enabled */ 2394 2395 __u32 reserved1:30; 2396 __u8 reserved2[44]; 2397 2398 struct ipu3_uapi_anr_alpha alpha[3]; 2399 struct ipu3_uapi_anr_beta beta[3]; 2400 struct ipu3_uapi_anr_plane_color color[3]; 2401 2402 __u16 sqrt_lut[IPU3_UAPI_ANR_LUT_SIZE]; /* 11 bits per element */ 2403 2404 __s16 xreset:13; 2405 __u16 reserved3:3; 2406 __s16 yreset:13; 2407 __u16 reserved4:3; 2408 2409 __u32 x_sqr_reset:24; 2410 __u32 r_normfactor:5; 2411 __u32 reserved5:3; 2412 2413 __u32 y_sqr_reset:24; 2414 __u32 gain_scale:8; 2415 } __packed; 2416 2417 /** 2418 * struct ipu3_uapi_anr_stitch_pyramid - ANR stitch pyramid 2419 * 2420 * @entry0: pyramid LUT entry0, range [0x0, 0x3f] 2421 * @entry1: pyramid LUT entry1, range [0x0, 0x3f] 2422 * @entry2: pyramid LUT entry2, range [0x0, 0x3f] 2423 * @reserved: reserved 2424 */ 2425 struct ipu3_uapi_anr_stitch_pyramid { 2426 __u32 entry0:6; 2427 __u32 entry1:6; 2428 __u32 entry2:6; 2429 __u32 reserved:14; 2430 } __packed; 2431 2432 /** 2433 * struct ipu3_uapi_anr_stitch_config - ANR stitch config 2434 * 2435 * @anr_stitch_en: enable stitch. Enabled with 1. 2436 * @reserved: reserved 2437 * @pyramid: pyramid table as defined by &ipu3_uapi_anr_stitch_pyramid 2438 * default values: 2439 * { 1, 3, 5 }, { 7, 7, 5 }, { 3, 1, 3 }, 2440 * { 9, 15, 21 }, { 21, 15, 9 }, { 3, 5, 15 }, 2441 * { 25, 35, 35 }, { 25, 15, 5 }, { 7, 21, 35 }, 2442 * { 49, 49, 35 }, { 21, 7, 7 }, { 21, 35, 49 }, 2443 * { 49, 35, 21 }, { 7, 5, 15 }, { 25, 35, 35 }, 2444 * { 25, 15, 5 }, { 3, 9, 15 }, { 21, 21, 15 }, 2445 * { 9, 3, 1 }, { 3, 5, 7 }, { 7, 5, 3}, { 1 } 2446 */ 2447 struct ipu3_uapi_anr_stitch_config { 2448 __u32 anr_stitch_en; 2449 __u8 reserved[44]; 2450 struct ipu3_uapi_anr_stitch_pyramid pyramid[IPU3_UAPI_ANR_PYRAMID_SIZE]; 2451 } __packed; 2452 2453 /** 2454 * struct ipu3_uapi_anr_config - ANR config 2455 * 2456 * @transform: advanced noise reduction transform config as specified by 2457 * &ipu3_uapi_anr_transform_config 2458 * @stitch: create 4x4 patch from 4 surrounding 8x8 patches. 2459 */ 2460 struct ipu3_uapi_anr_config { 2461 struct ipu3_uapi_anr_transform_config transform __attribute__((aligned(32))); 2462 struct ipu3_uapi_anr_stitch_config stitch __attribute__((aligned(32))); 2463 } __packed; 2464 2465 /** 2466 * struct ipu3_uapi_acc_param - Accelerator cluster parameters 2467 * 2468 * ACC refers to the HW cluster containing all Fixed Functions (FFs). Each FF 2469 * implements a specific algorithm. 2470 * 2471 * @bnr: parameters for bayer noise reduction static config. See 2472 * &ipu3_uapi_bnr_static_config 2473 * @green_disparity: disparity static config between gr and gb channel. 2474 * See &ipu3_uapi_bnr_static_config_green_disparity 2475 * @dm: de-mosaic config. See &ipu3_uapi_dm_config 2476 * @ccm: color correction matrix. See &ipu3_uapi_ccm_mat_config 2477 * @gamma: gamma correction config. See &ipu3_uapi_gamma_config 2478 * @csc: color space conversion matrix. See &ipu3_uapi_csc_mat_config 2479 * @cds: color down sample config. See &ipu3_uapi_cds_params 2480 * @shd: lens shading correction config. See &ipu3_uapi_shd_config 2481 * @iefd: Image enhancement filter and denoise config. 2482 * &ipu3_uapi_yuvp1_iefd_config 2483 * @yds_c0: y down scaler config. &ipu3_uapi_yuvp1_yds_config 2484 * @chnr_c0: chroma noise reduction config. &ipu3_uapi_yuvp1_chnr_config 2485 * @y_ee_nr: y edge enhancement and noise reduction config. 2486 * &ipu3_uapi_yuvp1_y_ee_nr_config 2487 * @yds: y down scaler config. See &ipu3_uapi_yuvp1_yds_config 2488 * @chnr: chroma noise reduction config. See &ipu3_uapi_yuvp1_chnr_config 2489 * @yds2: y channel down scaler config. See &ipu3_uapi_yuvp1_yds_config 2490 * @tcc: total color correction config as defined in struct 2491 * &ipu3_uapi_yuvp2_tcc_static_config 2492 * @anr: advanced noise reduction config.See &ipu3_uapi_anr_config 2493 * @awb_fr: AWB filter response config. See ipu3_uapi_awb_fr_config 2494 * @ae: auto exposure config As specified by &ipu3_uapi_ae_config 2495 * @af: auto focus config. As specified by &ipu3_uapi_af_config 2496 * @awb: auto white balance config. As specified by &ipu3_uapi_awb_config 2497 */ 2498 struct ipu3_uapi_acc_param { 2499 struct ipu3_uapi_bnr_static_config bnr; 2500 struct ipu3_uapi_bnr_static_config_green_disparity 2501 green_disparity __attribute__((aligned(32))); 2502 struct ipu3_uapi_dm_config dm __attribute__((aligned(32))); 2503 struct ipu3_uapi_ccm_mat_config ccm __attribute__((aligned(32))); 2504 struct ipu3_uapi_gamma_config gamma __attribute__((aligned(32))); 2505 struct ipu3_uapi_csc_mat_config csc __attribute__((aligned(32))); 2506 struct ipu3_uapi_cds_params cds __attribute__((aligned(32))); 2507 struct ipu3_uapi_shd_config shd __attribute__((aligned(32))); 2508 struct ipu3_uapi_yuvp1_iefd_config iefd __attribute__((aligned(32))); 2509 struct ipu3_uapi_yuvp1_yds_config yds_c0 __attribute__((aligned(32))); 2510 struct ipu3_uapi_yuvp1_chnr_config chnr_c0 __attribute__((aligned(32))); 2511 struct ipu3_uapi_yuvp1_y_ee_nr_config y_ee_nr __attribute__((aligned(32))); 2512 struct ipu3_uapi_yuvp1_yds_config yds __attribute__((aligned(32))); 2513 struct ipu3_uapi_yuvp1_chnr_config chnr __attribute__((aligned(32))); 2514 struct ipu3_uapi_yuvp1_yds_config yds2 __attribute__((aligned(32))); 2515 struct ipu3_uapi_yuvp2_tcc_static_config tcc __attribute__((aligned(32))); 2516 struct ipu3_uapi_anr_config anr; 2517 struct ipu3_uapi_awb_fr_config_s awb_fr; 2518 struct ipu3_uapi_ae_config ae; 2519 struct ipu3_uapi_af_config_s af; 2520 struct ipu3_uapi_awb_config awb; 2521 } __packed; 2522 2523 /** 2524 * struct ipu3_uapi_isp_lin_vmem_params - Linearization parameters 2525 * 2526 * @lin_lutlow_gr: linearization look-up table for GR channel interpolation. 2527 * @lin_lutlow_r: linearization look-up table for R channel interpolation. 2528 * @lin_lutlow_b: linearization look-up table for B channel interpolation. 2529 * @lin_lutlow_gb: linearization look-up table for GB channel interpolation. 2530 * lin_lutlow_gr / lin_lutlow_r / lin_lutlow_b / 2531 * lin_lutlow_gb <= LIN_MAX_VALUE - 1. 2532 * @lin_lutdif_gr: lin_lutlow_gr[i+1] - lin_lutlow_gr[i]. 2533 * @lin_lutdif_r: lin_lutlow_r[i+1] - lin_lutlow_r[i]. 2534 * @lin_lutdif_b: lin_lutlow_b[i+1] - lin_lutlow_b[i]. 2535 * @lin_lutdif_gb: lin_lutlow_gb[i+1] - lin_lutlow_gb[i]. 2536 */ 2537 struct ipu3_uapi_isp_lin_vmem_params { 2538 __s16 lin_lutlow_gr[IPU3_UAPI_LIN_LUT_SIZE]; 2539 __s16 lin_lutlow_r[IPU3_UAPI_LIN_LUT_SIZE]; 2540 __s16 lin_lutlow_b[IPU3_UAPI_LIN_LUT_SIZE]; 2541 __s16 lin_lutlow_gb[IPU3_UAPI_LIN_LUT_SIZE]; 2542 __s16 lin_lutdif_gr[IPU3_UAPI_LIN_LUT_SIZE]; 2543 __s16 lin_lutdif_r[IPU3_UAPI_LIN_LUT_SIZE]; 2544 __s16 lin_lutdif_b[IPU3_UAPI_LIN_LUT_SIZE]; 2545 __s16 lin_lutdif_gb[IPU3_UAPI_LIN_LUT_SIZE]; 2546 } __packed; 2547 2548 /* Temporal Noise Reduction */ 2549 2550 /** 2551 * struct ipu3_uapi_isp_tnr3_vmem_params - Temporal noise reduction vector 2552 * memory parameters 2553 * 2554 * @slope: slope setting in interpolation curve for temporal noise reduction. 2555 * @reserved1: reserved 2556 * @sigma: knee point setting in interpolation curve for temporal 2557 * noise reduction. 2558 * @reserved2: reserved 2559 */ 2560 struct ipu3_uapi_isp_tnr3_vmem_params { 2561 __u16 slope[IPU3_UAPI_ISP_TNR3_VMEM_LEN]; 2562 __u16 reserved1[IPU3_UAPI_ISP_VEC_ELEMS 2563 - IPU3_UAPI_ISP_TNR3_VMEM_LEN]; 2564 __u16 sigma[IPU3_UAPI_ISP_TNR3_VMEM_LEN]; 2565 __u16 reserved2[IPU3_UAPI_ISP_VEC_ELEMS 2566 - IPU3_UAPI_ISP_TNR3_VMEM_LEN]; 2567 } __packed; 2568 2569 /** 2570 * struct ipu3_uapi_isp_tnr3_params - Temporal noise reduction v3 parameters 2571 * 2572 * @knee_y1: Knee point TNR3 assumes standard deviation of Y,U and 2573 * V at Y1 are TnrY1_Sigma_Y, U and V. 2574 * @knee_y2: Knee point TNR3 assumes standard deviation of Y,U and 2575 * V at Y2 are TnrY2_Sigma_Y, U and V. 2576 * @maxfb_y: Max feedback gain for Y 2577 * @maxfb_u: Max feedback gain for U 2578 * @maxfb_v: Max feedback gain for V 2579 * @round_adj_y: rounding Adjust for Y 2580 * @round_adj_u: rounding Adjust for U 2581 * @round_adj_v: rounding Adjust for V 2582 * @ref_buf_select: selection of the reference frame buffer to be used. 2583 */ 2584 struct ipu3_uapi_isp_tnr3_params { 2585 __u32 knee_y1; 2586 __u32 knee_y2; 2587 __u32 maxfb_y; 2588 __u32 maxfb_u; 2589 __u32 maxfb_v; 2590 __u32 round_adj_y; 2591 __u32 round_adj_u; 2592 __u32 round_adj_v; 2593 __u32 ref_buf_select; 2594 } __packed; 2595 2596 /* Extreme Noise Reduction version 3 */ 2597 2598 /** 2599 * struct ipu3_uapi_isp_xnr3_vmem_params - Extreme noise reduction v3 2600 * vector memory parameters 2601 * 2602 * @x: xnr3 parameters. 2603 * @a: xnr3 parameters. 2604 * @b: xnr3 parameters. 2605 * @c: xnr3 parameters. 2606 */ 2607 struct ipu3_uapi_isp_xnr3_vmem_params { 2608 __u16 x[IPU3_UAPI_ISP_VEC_ELEMS]; 2609 __u16 a[IPU3_UAPI_ISP_VEC_ELEMS]; 2610 __u16 b[IPU3_UAPI_ISP_VEC_ELEMS]; 2611 __u16 c[IPU3_UAPI_ISP_VEC_ELEMS]; 2612 } __packed; 2613 2614 /** 2615 * struct ipu3_uapi_xnr3_alpha_params - Extreme noise reduction v3 2616 * alpha tuning parameters 2617 * 2618 * @y0: Sigma for Y range similarity in dark area. 2619 * @u0: Sigma for U range similarity in dark area. 2620 * @v0: Sigma for V range similarity in dark area. 2621 * @ydiff: Sigma difference for Y between bright area and dark area. 2622 * @udiff: Sigma difference for U between bright area and dark area. 2623 * @vdiff: Sigma difference for V between bright area and dark area. 2624 */ 2625 struct ipu3_uapi_xnr3_alpha_params { 2626 __u32 y0; 2627 __u32 u0; 2628 __u32 v0; 2629 __u32 ydiff; 2630 __u32 udiff; 2631 __u32 vdiff; 2632 } __packed; 2633 2634 /** 2635 * struct ipu3_uapi_xnr3_coring_params - Extreme noise reduction v3 2636 * coring parameters 2637 * 2638 * @u0: Coring Threshold of U channel in dark area. 2639 * @v0: Coring Threshold of V channel in dark area. 2640 * @udiff: Threshold difference of U channel between bright and dark area. 2641 * @vdiff: Threshold difference of V channel between bright and dark area. 2642 */ 2643 struct ipu3_uapi_xnr3_coring_params { 2644 __u32 u0; 2645 __u32 v0; 2646 __u32 udiff; 2647 __u32 vdiff; 2648 } __packed; 2649 2650 /** 2651 * struct ipu3_uapi_xnr3_blending_params - Blending factor 2652 * 2653 * @strength: The factor for blending output with input. This is tuning 2654 * parameterHigher values lead to more aggressive XNR operation. 2655 */ 2656 struct ipu3_uapi_xnr3_blending_params { 2657 __u32 strength; 2658 } __packed; 2659 2660 /** 2661 * struct ipu3_uapi_isp_xnr3_params - Extreme noise reduction v3 parameters 2662 * 2663 * @alpha: parameters for xnr3 alpha. See &ipu3_uapi_xnr3_alpha_params 2664 * @coring: parameters for xnr3 coring. See &ipu3_uapi_xnr3_coring_params 2665 * @blending: parameters for xnr3 blending. See &ipu3_uapi_xnr3_blending_params 2666 */ 2667 struct ipu3_uapi_isp_xnr3_params { 2668 struct ipu3_uapi_xnr3_alpha_params alpha; 2669 struct ipu3_uapi_xnr3_coring_params coring; 2670 struct ipu3_uapi_xnr3_blending_params blending; 2671 } __packed; 2672 2673 /***** Obgrid (optical black level compensation) table entry *****/ 2674 2675 /** 2676 * struct ipu3_uapi_obgrid_param - Optical black level compensation parameters 2677 * 2678 * @gr: Grid table values for color GR 2679 * @r: Grid table values for color R 2680 * @b: Grid table values for color B 2681 * @gb: Grid table values for color GB 2682 * 2683 * Black level is different for red, green, and blue channels. So black level 2684 * compensation is different per channel. 2685 */ 2686 struct ipu3_uapi_obgrid_param { 2687 __u16 gr; 2688 __u16 r; 2689 __u16 b; 2690 __u16 gb; 2691 } __packed; 2692 2693 /******************* V4L2_META_FMT_IPU3_PARAMS *******************/ 2694 2695 /** 2696 * struct ipu3_uapi_flags - bits to indicate which pipeline needs update 2697 * 2698 * @gdc: 0 = no update, 1 = update. 2699 * @obgrid: 0 = no update, 1 = update. 2700 * @reserved1: Not used. 2701 * @acc_bnr: 0 = no update, 1 = update. 2702 * @acc_green_disparity: 0 = no update, 1 = update. 2703 * @acc_dm: 0 = no update, 1 = update. 2704 * @acc_ccm: 0 = no update, 1 = update. 2705 * @acc_gamma: 0 = no update, 1 = update. 2706 * @acc_csc: 0 = no update, 1 = update. 2707 * @acc_cds: 0 = no update, 1 = update. 2708 * @acc_shd: 0 = no update, 1 = update. 2709 * @reserved2: Not used. 2710 * @acc_iefd: 0 = no update, 1 = update. 2711 * @acc_yds_c0: 0 = no update, 1 = update. 2712 * @acc_chnr_c0: 0 = no update, 1 = update. 2713 * @acc_y_ee_nr: 0 = no update, 1 = update. 2714 * @acc_yds: 0 = no update, 1 = update. 2715 * @acc_chnr: 0 = no update, 1 = update. 2716 * @acc_ytm: 0 = no update, 1 = update. 2717 * @acc_yds2: 0 = no update, 1 = update. 2718 * @acc_tcc: 0 = no update, 1 = update. 2719 * @acc_dpc: 0 = no update, 1 = update. 2720 * @acc_bds: 0 = no update, 1 = update. 2721 * @acc_anr: 0 = no update, 1 = update. 2722 * @acc_awb_fr: 0 = no update, 1 = update. 2723 * @acc_ae: 0 = no update, 1 = update. 2724 * @acc_af: 0 = no update, 1 = update. 2725 * @acc_awb: 0 = no update, 1 = update. 2726 * @reserved3: Not used. 2727 * @lin_vmem_params: 0 = no update, 1 = update. 2728 * @tnr3_vmem_params: 0 = no update, 1 = update. 2729 * @xnr3_vmem_params: 0 = no update, 1 = update. 2730 * @tnr3_dmem_params: 0 = no update, 1 = update. 2731 * @xnr3_dmem_params: 0 = no update, 1 = update. 2732 * @reserved4: Not used. 2733 * @obgrid_param: 0 = no update, 1 = update. 2734 * @reserved5: Not used. 2735 */ 2736 struct ipu3_uapi_flags { 2737 __u32 gdc:1; 2738 __u32 obgrid:1; 2739 __u32 reserved1:30; 2740 2741 __u32 acc_bnr:1; 2742 __u32 acc_green_disparity:1; 2743 __u32 acc_dm:1; 2744 __u32 acc_ccm:1; 2745 __u32 acc_gamma:1; 2746 __u32 acc_csc:1; 2747 __u32 acc_cds:1; 2748 __u32 acc_shd:1; 2749 __u32 reserved2:2; 2750 __u32 acc_iefd:1; 2751 __u32 acc_yds_c0:1; 2752 __u32 acc_chnr_c0:1; 2753 __u32 acc_y_ee_nr:1; 2754 __u32 acc_yds:1; 2755 __u32 acc_chnr:1; 2756 __u32 acc_ytm:1; 2757 __u32 acc_yds2:1; 2758 __u32 acc_tcc:1; 2759 __u32 acc_dpc:1; 2760 __u32 acc_bds:1; 2761 __u32 acc_anr:1; 2762 __u32 acc_awb_fr:1; 2763 __u32 acc_ae:1; 2764 __u32 acc_af:1; 2765 __u32 acc_awb:1; 2766 __u32 reserved3:4; 2767 2768 __u32 lin_vmem_params:1; 2769 __u32 tnr3_vmem_params:1; 2770 __u32 xnr3_vmem_params:1; 2771 __u32 tnr3_dmem_params:1; 2772 __u32 xnr3_dmem_params:1; 2773 __u32 reserved4:1; 2774 __u32 obgrid_param:1; 2775 __u32 reserved5:25; 2776 } __packed; 2777 2778 /** 2779 * struct ipu3_uapi_params - V4L2_META_FMT_IPU3_PARAMS 2780 * 2781 * @use: select which parameters to apply, see &ipu3_uapi_flags 2782 * @acc_param: ACC parameters, as specified by &ipu3_uapi_acc_param 2783 * @lin_vmem_params: linearization VMEM, as specified by 2784 * &ipu3_uapi_isp_lin_vmem_params 2785 * @tnr3_vmem_params: tnr3 VMEM as specified by 2786 * &ipu3_uapi_isp_tnr3_vmem_params 2787 * @xnr3_vmem_params: xnr3 VMEM as specified by 2788 * &ipu3_uapi_isp_xnr3_vmem_params 2789 * @tnr3_dmem_params: tnr3 DMEM as specified by &ipu3_uapi_isp_tnr3_params 2790 * @xnr3_dmem_params: xnr3 DMEM as specified by &ipu3_uapi_isp_xnr3_params 2791 * @obgrid_param: obgrid parameters as specified by 2792 * &ipu3_uapi_obgrid_param 2793 * 2794 * The video queue "parameters" is of format V4L2_META_FMT_IPU3_PARAMS. 2795 * This is a "single plane" v4l2_meta_format using V4L2_BUF_TYPE_META_OUTPUT. 2796 * 2797 * struct ipu3_uapi_params as defined below contains a lot of parameters and 2798 * ipu3_uapi_flags selects which parameters to apply. 2799 */ 2800 struct ipu3_uapi_params { 2801 /* Flags which of the settings below are to be applied */ 2802 struct ipu3_uapi_flags use __attribute__((aligned(32))); 2803 2804 /* Accelerator cluster parameters */ 2805 struct ipu3_uapi_acc_param acc_param; 2806 2807 /* ISP vector address space parameters */ 2808 struct ipu3_uapi_isp_lin_vmem_params lin_vmem_params; 2809 struct ipu3_uapi_isp_tnr3_vmem_params tnr3_vmem_params; 2810 struct ipu3_uapi_isp_xnr3_vmem_params xnr3_vmem_params; 2811 2812 /* ISP data memory (DMEM) parameters */ 2813 struct ipu3_uapi_isp_tnr3_params tnr3_dmem_params; 2814 struct ipu3_uapi_isp_xnr3_params xnr3_dmem_params; 2815 2816 /* Optical black level compensation */ 2817 struct ipu3_uapi_obgrid_param obgrid_param; 2818 } __packed; 2819 2820 #endif /* __IPU3_UAPI_H */ 2821