1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Support for Medifield PNW Camera Imaging ISP subsystem. 4 * 5 * Copyright (c) 2010 Intel Corporation. All Rights Reserved. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License version 9 * 2 as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * 17 */ 18 19 #ifndef _ATOM_ISP_H 20 #define _ATOM_ISP_H 21 22 #include <linux/types.h> 23 #include <linux/version.h> 24 25 /* struct media_device_info.hw_revision */ 26 #define ATOMISP_HW_REVISION_MASK 0x0000ff00 27 #define ATOMISP_HW_REVISION_SHIFT 8 28 #define ATOMISP_HW_REVISION_ISP2300 0x00 29 #define ATOMISP_HW_REVISION_ISP2400 0x10 30 #define ATOMISP_HW_REVISION_ISP2401_LEGACY 0x11 31 #define ATOMISP_HW_REVISION_ISP2401 0x20 32 33 #define ATOMISP_HW_STEPPING_MASK 0x000000ff 34 #define ATOMISP_HW_STEPPING_A0 0x00 35 #define ATOMISP_HW_STEPPING_B0 0x10 36 37 /*ISP binary running mode*/ 38 #define CI_MODE_PREVIEW 0x8000 39 #define CI_MODE_VIDEO 0x4000 40 #define CI_MODE_STILL_CAPTURE 0x2000 41 #define CI_MODE_CONTINUOUS 0x1000 42 #define CI_MODE_NONE 0x0000 43 44 #define OUTPUT_MODE_FILE 0x0100 45 #define OUTPUT_MODE_TEXT 0x0200 46 47 /* 48 * Camera HAL sets this flag in v4l2_buffer reserved2 to indicate this 49 * buffer has a per-frame parameter. 50 */ 51 #define ATOMISP_BUFFER_HAS_PER_FRAME_SETTING 0x80000000 52 53 /* Custom format for RAW capture from M10MO 0x3130314d */ 54 #define V4L2_PIX_FMT_CUSTOM_M10MO_RAW v4l2_fourcc('M', '1', '0', '1') 55 56 /* Custom media bus formats being used in atomisp */ 57 #define V4L2_MBUS_FMT_CUSTOM_YUV420 0x8001 58 #define V4L2_MBUS_FMT_CUSTOM_YVU420 0x8002 59 #define V4L2_MBUS_FMT_CUSTOM_YUV422P 0x8003 60 #define V4L2_MBUS_FMT_CUSTOM_YUV444 0x8004 61 #define V4L2_MBUS_FMT_CUSTOM_NV12 0x8005 62 #define V4L2_MBUS_FMT_CUSTOM_NV21 0x8006 63 #define V4L2_MBUS_FMT_CUSTOM_NV16 0x8007 64 #define V4L2_MBUS_FMT_CUSTOM_YUYV 0x8008 65 #define V4L2_MBUS_FMT_CUSTOM_SBGGR16 0x8009 66 #define V4L2_MBUS_FMT_CUSTOM_RGB32 0x800a 67 68 /* Custom media bus format for M10MO RAW capture */ 69 #if 0 70 #define V4L2_MBUS_FMT_CUSTOM_M10MO_RAW 0x800b 71 #endif 72 73 /* Configuration used by Bayer noise reduction and YCC noise reduction */ 74 struct atomisp_nr_config { 75 /* [gain] Strength of noise reduction for Bayer NR (Used by Bayer NR) */ 76 unsigned int bnr_gain; 77 /* [gain] Strength of noise reduction for YCC NR (Used by YCC NR) */ 78 unsigned int ynr_gain; 79 /* [intensity] Sensitivity of Edge (Used by Bayer NR) */ 80 unsigned int direction; 81 /* [intensity] coring threshold for Cb (Used by YCC NR) */ 82 unsigned int threshold_cb; 83 /* [intensity] coring threshold for Cr (Used by YCC NR) */ 84 unsigned int threshold_cr; 85 }; 86 87 /* Temporal noise reduction configuration */ 88 struct atomisp_tnr_config { 89 unsigned int gain; /* [gain] Strength of NR */ 90 unsigned int threshold_y;/* [intensity] Motion sensitivity for Y */ 91 unsigned int threshold_uv;/* [intensity] Motion sensitivity for U/V */ 92 }; 93 94 /* Histogram. This contains num_elements values of type unsigned int. 95 * The data pointer is a DDR pointer (virtual address). 96 */ 97 struct atomisp_histogram { 98 unsigned int num_elements; 99 void __user *data; 100 }; 101 102 enum atomisp_ob_mode { 103 atomisp_ob_mode_none, 104 atomisp_ob_mode_fixed, 105 atomisp_ob_mode_raster 106 }; 107 108 /* Optical black level configuration */ 109 struct atomisp_ob_config { 110 /* Obtical black level mode (Fixed / Raster) */ 111 enum atomisp_ob_mode mode; 112 /* [intensity] optical black level for GR (relevant for fixed mode) */ 113 unsigned int level_gr; 114 /* [intensity] optical black level for R (relevant for fixed mode) */ 115 unsigned int level_r; 116 /* [intensity] optical black level for B (relevant for fixed mode) */ 117 unsigned int level_b; 118 /* [intensity] optical black level for GB (relevant for fixed mode) */ 119 unsigned int level_gb; 120 /* [BQ] 0..63 start position of OB area (relevant for raster mode) */ 121 unsigned short start_position; 122 /* [BQ] start..63 end position of OB area (relevant for raster mode) */ 123 unsigned short end_position; 124 }; 125 126 /* Edge enhancement (sharpen) configuration */ 127 struct atomisp_ee_config { 128 /* [gain] The strength of sharpness. u5_11 */ 129 unsigned int gain; 130 /* [intensity] The threshold that divides noises from edge. u8_8 */ 131 unsigned int threshold; 132 /* [gain] The strength of sharpness in pell-mell area. u5_11 */ 133 unsigned int detail_gain; 134 }; 135 136 struct atomisp_3a_output { 137 int ae_y; 138 int awb_cnt; 139 int awb_gr; 140 int awb_r; 141 int awb_b; 142 int awb_gb; 143 int af_hpf1; 144 int af_hpf2; 145 }; 146 147 enum atomisp_calibration_type { 148 calibration_type1, 149 calibration_type2, 150 calibration_type3 151 }; 152 153 struct atomisp_calibration_group { 154 unsigned int size; 155 unsigned int type; 156 unsigned short *calb_grp_values; 157 }; 158 159 struct atomisp_gc_config { 160 __u16 gain_k1; 161 __u16 gain_k2; 162 }; 163 164 struct atomisp_3a_config { 165 unsigned int ae_y_coef_r; /* [gain] Weight of R for Y */ 166 unsigned int ae_y_coef_g; /* [gain] Weight of G for Y */ 167 unsigned int ae_y_coef_b; /* [gain] Weight of B for Y */ 168 unsigned int awb_lg_high_raw; /* [intensity] 169 AWB level gate high for raw */ 170 unsigned int awb_lg_low; /* [intensity] AWB level gate low */ 171 unsigned int awb_lg_high; /* [intensity] AWB level gate high */ 172 int af_fir1_coef[7]; /* [factor] AF FIR coefficients of fir1 */ 173 int af_fir2_coef[7]; /* [factor] AF FIR coefficients of fir2 */ 174 }; 175 176 struct atomisp_dvs_grid_info { 177 u32 enable; 178 u32 width; 179 u32 aligned_width; 180 u32 height; 181 u32 aligned_height; 182 u32 bqs_per_grid_cell; 183 u32 num_hor_coefs; 184 u32 num_ver_coefs; 185 }; 186 187 struct atomisp_dvs_envelop { 188 unsigned int width; 189 unsigned int height; 190 }; 191 192 struct atomisp_grid_info { 193 u32 enable; 194 u32 use_dmem; 195 u32 has_histogram; 196 u32 s3a_width; 197 u32 s3a_height; 198 u32 aligned_width; 199 u32 aligned_height; 200 u32 s3a_bqs_per_grid_cell; 201 u32 deci_factor_log2; 202 u32 elem_bit_depth; 203 }; 204 205 struct atomisp_dis_vector { 206 int x; 207 int y; 208 }; 209 210 /* DVS 2.0 Coefficient types. This structure contains 4 pointers to 211 * arrays that contain the coeffients for each type. 212 */ 213 struct atomisp_dvs2_coef_types { 214 short __user *odd_real; /** real part of the odd coefficients*/ 215 short __user *odd_imag; /** imaginary part of the odd coefficients*/ 216 short __user *even_real;/** real part of the even coefficients*/ 217 short __user *even_imag;/** imaginary part of the even coefficients*/ 218 }; 219 220 /* 221 * DVS 2.0 Statistic types. This structure contains 4 pointers to 222 * arrays that contain the statistics for each type. 223 */ 224 struct atomisp_dvs2_stat_types { 225 int __user *odd_real; /** real part of the odd statistics*/ 226 int __user *odd_imag; /** imaginary part of the odd statistics*/ 227 int __user *even_real;/** real part of the even statistics*/ 228 int __user *even_imag;/** imaginary part of the even statistics*/ 229 }; 230 231 struct atomisp_dis_coefficients { 232 struct atomisp_dvs_grid_info grid_info; 233 struct atomisp_dvs2_coef_types hor_coefs; 234 struct atomisp_dvs2_coef_types ver_coefs; 235 }; 236 237 struct atomisp_dvs2_statistics { 238 struct atomisp_dvs_grid_info grid_info; 239 struct atomisp_dvs2_stat_types hor_prod; 240 struct atomisp_dvs2_stat_types ver_prod; 241 }; 242 243 struct atomisp_dis_statistics { 244 struct atomisp_dvs2_statistics dvs2_stat; 245 u32 exp_id; 246 }; 247 248 struct atomisp_3a_rgby_output { 249 u32 r; 250 u32 g; 251 u32 b; 252 u32 y; 253 }; 254 255 /* 256 * Because we have 2 pipes at max to output metadata, therefore driver will use 257 * ATOMISP_MAIN_METADATA to specify the metadata from the pipe which keeps 258 * streaming always and use ATOMISP_SEC_METADATA to specify the metadata from 259 * the pipe which is streaming by request like capture pipe of ZSL or SDV mode 260 * as secondary metadata. And for the use case which has only one pipe 261 * streaming like online capture, ATOMISP_MAIN_METADATA will be used. 262 */ 263 enum atomisp_metadata_type { 264 ATOMISP_MAIN_METADATA = 0, 265 ATOMISP_SEC_METADATA, 266 ATOMISP_METADATA_TYPE_NUM, 267 }; 268 269 struct atomisp_metadata_with_type { 270 /* to specify which type of metadata to get */ 271 enum atomisp_metadata_type type; 272 void __user *data; 273 u32 width; 274 u32 height; 275 u32 stride; /* in bytes */ 276 u32 exp_id; /* exposure ID */ 277 u32 *effective_width; /* mipi packets valid data size */ 278 }; 279 280 struct atomisp_metadata { 281 void __user *data; 282 u32 width; 283 u32 height; 284 u32 stride; /* in bytes */ 285 u32 exp_id; /* exposure ID */ 286 u32 *effective_width; /* mipi packets valid data size */ 287 }; 288 289 struct atomisp_ext_isp_ctrl { 290 u32 id; 291 u32 data; 292 }; 293 294 struct atomisp_3a_statistics { 295 struct atomisp_grid_info grid_info; 296 struct atomisp_3a_output __user *data; 297 struct atomisp_3a_rgby_output __user *rgby_data; 298 u32 exp_id; /* exposure ID */ 299 u32 isp_config_id; /* isp config ID */ 300 }; 301 302 /** 303 * struct atomisp_cont_capture_conf - continuous capture parameters 304 * @num_captures: number of still images to capture 305 * @skip_frames: number of frames to skip between 2 captures 306 * @offset: offset in ring buffer to start capture 307 * 308 * For example, to capture 1 frame from past, current, and 1 from future 309 * and skip one frame between each capture, parameters would be: 310 * num_captures:3 311 * skip_frames:1 312 * offset:-2 313 */ 314 315 struct atomisp_cont_capture_conf { 316 int num_captures; 317 unsigned int skip_frames; 318 int offset; 319 __u32 reserved[5]; 320 }; 321 322 struct atomisp_ae_window { 323 int x_left; 324 int x_right; 325 int y_top; 326 int y_bottom; 327 int weight; 328 }; 329 330 /* White Balance (Gain Adjust) */ 331 struct atomisp_wb_config { 332 unsigned int integer_bits; 333 unsigned int gr; /* unsigned <integer_bits>.<16-integer_bits> */ 334 unsigned int r; /* unsigned <integer_bits>.<16-integer_bits> */ 335 unsigned int b; /* unsigned <integer_bits>.<16-integer_bits> */ 336 unsigned int gb; /* unsigned <integer_bits>.<16-integer_bits> */ 337 }; 338 339 /* Color Space Conversion settings */ 340 struct atomisp_cc_config { 341 unsigned int fraction_bits; 342 int matrix[3 * 3]; /* RGB2YUV Color matrix, signed 343 <13-fraction_bits>.<fraction_bits> */ 344 }; 345 346 /* De pixel noise configuration */ 347 struct atomisp_de_config { 348 unsigned int pixelnoise; 349 unsigned int c1_coring_threshold; 350 unsigned int c2_coring_threshold; 351 }; 352 353 /* Chroma enhancement */ 354 struct atomisp_ce_config { 355 unsigned char uv_level_min; 356 unsigned char uv_level_max; 357 }; 358 359 /* Defect pixel correction configuration */ 360 struct atomisp_dp_config { 361 /* [intensity] The threshold of defect Pixel Correction, representing 362 * the permissible difference of intensity between one pixel and its 363 * surrounding pixels. Smaller values result in more frequent pixel 364 * corrections. u0_16 365 */ 366 unsigned int threshold; 367 /* [gain] The sensitivity of mis-correction. ISP will miss a lot of 368 * defects if the value is set too large. u8_8 369 */ 370 unsigned int gain; 371 unsigned int gr; 372 unsigned int r; 373 unsigned int b; 374 unsigned int gb; 375 }; 376 377 /* XNR threshold */ 378 struct atomisp_xnr_config { 379 __u16 threshold; 380 }; 381 382 /* metadata config */ 383 struct atomisp_metadata_config { 384 u32 metadata_height; 385 u32 metadata_stride; 386 }; 387 388 /* 389 * Generic resolution structure. 390 */ 391 struct atomisp_resolution { 392 u32 width; /** Width */ 393 u32 height; /** Height */ 394 }; 395 396 /* 397 * This specifies the coordinates (x,y) 398 */ 399 struct atomisp_zoom_point { 400 s32 x; /** x coordinate */ 401 s32 y; /** y coordinate */ 402 }; 403 404 /* 405 * This specifies the region 406 */ 407 struct atomisp_zoom_region { 408 struct atomisp_zoom_point 409 origin; /* Starting point coordinates for the region */ 410 struct atomisp_resolution resolution; /* Region resolution */ 411 }; 412 413 struct atomisp_dz_config { 414 u32 dx; /** Horizontal zoom factor */ 415 u32 dy; /** Vertical zoom factor */ 416 struct atomisp_zoom_region zoom_region; /** region for zoom */ 417 }; 418 419 struct atomisp_parm { 420 struct atomisp_grid_info info; 421 struct atomisp_dvs_grid_info dvs_grid; 422 struct atomisp_dvs_envelop dvs_envelop; 423 struct atomisp_wb_config wb_config; 424 struct atomisp_cc_config cc_config; 425 struct atomisp_ob_config ob_config; 426 struct atomisp_de_config de_config; 427 struct atomisp_dz_config dz_config; 428 struct atomisp_ce_config ce_config; 429 struct atomisp_dp_config dp_config; 430 struct atomisp_nr_config nr_config; 431 struct atomisp_ee_config ee_config; 432 struct atomisp_tnr_config tnr_config; 433 struct atomisp_metadata_config metadata_config; 434 }; 435 436 struct dvs2_bq_resolution { 437 int width_bq; /* width [BQ] */ 438 int height_bq; /* height [BQ] */ 439 }; 440 441 struct atomisp_dvs2_bq_resolutions { 442 /* GDC source image size [BQ] */ 443 struct dvs2_bq_resolution source_bq; 444 /* GDC output image size [BQ] */ 445 struct dvs2_bq_resolution output_bq; 446 /* GDC effective envelope size [BQ] */ 447 struct dvs2_bq_resolution envelope_bq; 448 /* isp pipe filter size [BQ] */ 449 struct dvs2_bq_resolution ispfilter_bq; 450 /* GDC shit size [BQ] */ 451 struct dvs2_bq_resolution gdc_shift_bq; 452 }; 453 454 struct atomisp_dvs_6axis_config { 455 u32 exp_id; 456 u32 width_y; 457 u32 height_y; 458 u32 width_uv; 459 u32 height_uv; 460 u32 *xcoords_y; 461 u32 *ycoords_y; 462 u32 *xcoords_uv; 463 u32 *ycoords_uv; 464 }; 465 466 struct atomisp_formats_config { 467 u32 video_full_range_flag; 468 }; 469 470 struct atomisp_parameters { 471 struct atomisp_wb_config *wb_config; /* White Balance config */ 472 struct atomisp_cc_config *cc_config; /* Color Correction config */ 473 struct atomisp_tnr_config *tnr_config; /* Temporal Noise Reduction */ 474 struct atomisp_ecd_config *ecd_config; /* Eigen Color Demosaicing */ 475 struct atomisp_ynr_config *ynr_config; /* Y(Luma) Noise Reduction */ 476 struct atomisp_fc_config *fc_config; /* Fringe Control */ 477 struct atomisp_formats_config *formats_config; /* Formats Control */ 478 struct atomisp_cnr_config *cnr_config; /* Chroma Noise Reduction */ 479 struct atomisp_macc_config *macc_config; /* MACC */ 480 struct atomisp_ctc_config *ctc_config; /* Chroma Tone Control */ 481 struct atomisp_aa_config *aa_config; /* Anti-Aliasing */ 482 struct atomisp_aa_config *baa_config; /* Anti-Aliasing */ 483 struct atomisp_ce_config *ce_config; 484 struct atomisp_dvs_6axis_config *dvs_6axis_config; 485 struct atomisp_ob_config *ob_config; /* Objective Black config */ 486 struct atomisp_dp_config *dp_config; /* Dead Pixel config */ 487 struct atomisp_nr_config *nr_config; /* Noise Reduction config */ 488 struct atomisp_ee_config *ee_config; /* Edge Enhancement config */ 489 struct atomisp_de_config *de_config; /* Demosaic config */ 490 struct atomisp_gc_config *gc_config; /* Gamma Correction config */ 491 struct atomisp_anr_config *anr_config; /* Advanced Noise Reduction */ 492 struct atomisp_3a_config *a3a_config; /* 3A Statistics config */ 493 struct atomisp_xnr_config *xnr_config; /* eXtra Noise Reduction */ 494 struct atomisp_dz_config *dz_config; /* Digital Zoom */ 495 struct atomisp_cc_config *yuv2rgb_cc_config; /* Color 496 Correction config */ 497 struct atomisp_cc_config *rgb2yuv_cc_config; /* Color 498 Correction config */ 499 struct atomisp_macc_table *macc_table; 500 struct atomisp_gamma_table *gamma_table; 501 struct atomisp_ctc_table *ctc_table; 502 struct atomisp_xnr_table *xnr_table; 503 struct atomisp_rgb_gamma_table *r_gamma_table; 504 struct atomisp_rgb_gamma_table *g_gamma_table; 505 struct atomisp_rgb_gamma_table *b_gamma_table; 506 struct atomisp_vector *motion_vector; /* For 2-axis DVS */ 507 struct atomisp_shading_table *shading_table; 508 struct atomisp_morph_table *morph_table; 509 struct atomisp_dvs_coefficients *dvs_coefs; /* DVS 1.0 coefficients */ 510 struct atomisp_dis_coefficients *dvs2_coefs; /* DVS 2.0 coefficients */ 511 struct atomisp_capture_config *capture_config; 512 struct atomisp_anr_thres *anr_thres; 513 514 void *lin_2500_config; /* Skylake: Linearization config */ 515 void *obgrid_2500_config; /* Skylake: OBGRID config */ 516 void *bnr_2500_config; /* Skylake: bayer denoise config */ 517 void *shd_2500_config; /* Skylake: shading config */ 518 void *dm_2500_config; /* Skylake: demosaic config */ 519 void *rgbpp_2500_config; /* Skylake: RGBPP config */ 520 void *dvs_stat_2500_config; /* Skylake: DVS STAT config */ 521 void *lace_stat_2500_config; /* Skylake: LACE STAT config */ 522 void *yuvp1_2500_config; /* Skylake: yuvp1 config */ 523 void *yuvp2_2500_config; /* Skylake: yuvp2 config */ 524 void *tnr_2500_config; /* Skylake: TNR config */ 525 void *dpc_2500_config; /* Skylake: DPC config */ 526 void *awb_2500_config; /* Skylake: auto white balance config */ 527 void *awb_fr_2500_config; /* Skylake: auto white balance filter response config */ 528 void *anr_2500_config; /* Skylake: ANR config */ 529 void *af_2500_config; /* Skylake: auto focus config */ 530 void *ae_2500_config; /* Skylake: auto exposure config */ 531 void *bds_2500_config; /* Skylake: bayer downscaler config */ 532 void *dvs_2500_config; /* Skylake: digital video stabilization config */ 533 void *res_mgr_2500_config; 534 535 /* 536 * Output frame pointer the config is to be applied to (optional), 537 * set to NULL to make this config is applied as global. 538 */ 539 void *output_frame; 540 /* 541 * Unique ID to track which config was actually applied to a particular 542 * frame, driver will send this id back with output frame together. 543 */ 544 u32 isp_config_id; 545 546 /* 547 * Switch to control per_frame setting: 548 * 0: this is a global setting 549 * 1: this is a per_frame setting 550 * PLEASE KEEP THIS AT THE END OF THE STRUCTURE!! 551 */ 552 u32 per_frame_setting; 553 }; 554 555 #define ATOMISP_GAMMA_TABLE_SIZE 1024 556 struct atomisp_gamma_table { 557 unsigned short data[ATOMISP_GAMMA_TABLE_SIZE]; 558 }; 559 560 /* Morphing table for advanced ISP. 561 * Each line of width elements takes up COORD_TABLE_EXT_WIDTH elements 562 * in memory. 563 */ 564 #define ATOMISP_MORPH_TABLE_NUM_PLANES 6 565 struct atomisp_morph_table { 566 unsigned int enabled; 567 568 unsigned int height; 569 unsigned int width; /* number of valid elements per line */ 570 unsigned short __user *coordinates_x[ATOMISP_MORPH_TABLE_NUM_PLANES]; 571 unsigned short __user *coordinates_y[ATOMISP_MORPH_TABLE_NUM_PLANES]; 572 }; 573 574 #define ATOMISP_NUM_SC_COLORS 4 575 #define ATOMISP_SC_FLAG_QUERY BIT(0) 576 577 struct atomisp_shading_table { 578 __u32 enable; 579 580 __u32 sensor_width; 581 __u32 sensor_height; 582 __u32 width; 583 __u32 height; 584 __u32 fraction_bits; 585 586 __u16 *data[ATOMISP_NUM_SC_COLORS]; 587 }; 588 589 /* parameter for MACC */ 590 #define ATOMISP_NUM_MACC_AXES 16 591 struct atomisp_macc_table { 592 short data[4 * ATOMISP_NUM_MACC_AXES]; 593 }; 594 595 struct atomisp_macc_config { 596 int color_effect; 597 struct atomisp_macc_table table; 598 }; 599 600 /* Parameter for ctc parameter control */ 601 #define ATOMISP_CTC_TABLE_SIZE 1024 602 struct atomisp_ctc_table { 603 unsigned short data[ATOMISP_CTC_TABLE_SIZE]; 604 }; 605 606 /* Parameter for overlay image loading */ 607 struct atomisp_overlay { 608 /* the frame containing the overlay data The overlay frame width should 609 * be the multiples of 2*ISP_VEC_NELEMS. The overlay frame height 610 * should be the multiples of 2. 611 */ 612 struct v4l2_framebuffer *frame; 613 /* Y value of overlay background */ 614 unsigned char bg_y; 615 /* U value of overlay background */ 616 char bg_u; 617 /* V value of overlay background */ 618 char bg_v; 619 /* the blending percent of input data for Y subpixels */ 620 unsigned char blend_input_perc_y; 621 /* the blending percent of input data for U subpixels */ 622 unsigned char blend_input_perc_u; 623 /* the blending percent of input data for V subpixels */ 624 unsigned char blend_input_perc_v; 625 /* the blending percent of overlay data for Y subpixels */ 626 unsigned char blend_overlay_perc_y; 627 /* the blending percent of overlay data for U subpixels */ 628 unsigned char blend_overlay_perc_u; 629 /* the blending percent of overlay data for V subpixels */ 630 unsigned char blend_overlay_perc_v; 631 /* the overlay start x pixel position on output frame It should be the 632 multiples of 2*ISP_VEC_NELEMS. */ 633 unsigned int overlay_start_x; 634 /* the overlay start y pixel position on output frame It should be the 635 multiples of 2. */ 636 unsigned int overlay_start_y; 637 }; 638 639 struct atomisp_exposure { 640 unsigned int integration_time[8]; 641 unsigned int shutter_speed[8]; 642 unsigned int gain[4]; 643 unsigned int aperture; 644 }; 645 646 /* For texture streaming. */ 647 struct atomisp_bc_video_package { 648 int ioctl_cmd; 649 int device_id; 650 int inputparam; 651 int outputparam; 652 }; 653 654 enum atomisp_focus_hp { 655 ATOMISP_FOCUS_HP_IN_PROGRESS = (1U << 2), 656 ATOMISP_FOCUS_HP_COMPLETE = (2U << 2), 657 ATOMISP_FOCUS_HP_FAILED = (3U << 2) 658 }; 659 660 /* Masks */ 661 #define ATOMISP_FOCUS_STATUS_MOVING BIT(0) 662 #define ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE BIT(1) 663 #define ATOMISP_FOCUS_STATUS_HOME_POSITION (3U << 2) 664 665 enum atomisp_camera_port { 666 ATOMISP_CAMERA_PORT_SECONDARY, 667 ATOMISP_CAMERA_PORT_PRIMARY, 668 ATOMISP_CAMERA_PORT_TERTIARY, 669 ATOMISP_CAMERA_NR_PORTS 670 }; 671 672 /* Flash modes. Default is off. 673 * Setting a flash to TORCH or INDICATOR mode will automatically 674 * turn it on. Setting it to FLASH mode will not turn on the flash 675 * until the FLASH_STROBE command is sent. */ 676 enum atomisp_flash_mode { 677 ATOMISP_FLASH_MODE_OFF, 678 ATOMISP_FLASH_MODE_FLASH, 679 ATOMISP_FLASH_MODE_TORCH, 680 ATOMISP_FLASH_MODE_INDICATOR, 681 }; 682 683 /* Flash statuses, used by atomisp driver to check before starting 684 * flash and after having started flash. */ 685 enum atomisp_flash_status { 686 ATOMISP_FLASH_STATUS_OK, 687 ATOMISP_FLASH_STATUS_HW_ERROR, 688 ATOMISP_FLASH_STATUS_INTERRUPTED, 689 ATOMISP_FLASH_STATUS_TIMEOUT, 690 }; 691 692 /* Frame status. This is used to detect corrupted frames and flash 693 * exposed frames. Usually, the first 2 frames coming out of the sensor 694 * are corrupted. When using flash, the frame before and the frame after 695 * the flash exposed frame may be partially exposed by flash. The ISP 696 * statistics for these frames should not be used by the 3A library. 697 * The frame status value can be found in the "reserved" field in the 698 * v4l2_buffer struct. */ 699 enum atomisp_frame_status { 700 ATOMISP_FRAME_STATUS_OK, 701 ATOMISP_FRAME_STATUS_CORRUPTED, 702 ATOMISP_FRAME_STATUS_FLASH_EXPOSED, 703 ATOMISP_FRAME_STATUS_FLASH_PARTIAL, 704 ATOMISP_FRAME_STATUS_FLASH_FAILED, 705 }; 706 707 enum atomisp_ext_isp_id { 708 EXT_ISP_CID_ISO = 0, 709 EXT_ISP_CID_CAPTURE_HDR, 710 EXT_ISP_CID_CAPTURE_LLS, 711 EXT_ISP_CID_FOCUS_MODE, 712 EXT_ISP_CID_FOCUS_EXECUTION, 713 EXT_ISP_CID_TOUCH_POSX, 714 EXT_ISP_CID_TOUCH_POSY, 715 EXT_ISP_CID_CAF_STATUS, 716 EXT_ISP_CID_AF_STATUS, 717 EXT_ISP_CID_GET_AF_MODE, 718 EXT_ISP_CID_CAPTURE_BURST, 719 EXT_ISP_CID_FLASH_MODE, 720 EXT_ISP_CID_ZOOM, 721 EXT_ISP_CID_SHOT_MODE 722 }; 723 724 #define EXT_ISP_FOCUS_MODE_NORMAL 0 725 #define EXT_ISP_FOCUS_MODE_MACRO 1 726 #define EXT_ISP_FOCUS_MODE_TOUCH_AF 2 727 #define EXT_ISP_FOCUS_MODE_PREVIEW_CAF 3 728 #define EXT_ISP_FOCUS_MODE_MOVIE_CAF 4 729 #define EXT_ISP_FOCUS_MODE_FACE_CAF 5 730 #define EXT_ISP_FOCUS_MODE_TOUCH_MACRO 6 731 #define EXT_ISP_FOCUS_MODE_TOUCH_CAF 7 732 733 #define EXT_ISP_FOCUS_STOP 0 734 #define EXT_ISP_FOCUS_SEARCH 1 735 #define EXT_ISP_PAN_FOCUSING 2 736 737 #define EXT_ISP_CAF_RESTART_CHECK 1 738 #define EXT_ISP_CAF_STATUS_FOCUSING 2 739 #define EXT_ISP_CAF_STATUS_SUCCESS 3 740 #define EXT_ISP_CAF_STATUS_FAIL 4 741 742 #define EXT_ISP_AF_STATUS_INVALID 1 743 #define EXT_ISP_AF_STATUS_FOCUSING 2 744 #define EXT_ISP_AF_STATUS_SUCCESS 3 745 #define EXT_ISP_AF_STATUS_FAIL 4 746 747 enum atomisp_burst_capture_options { 748 EXT_ISP_BURST_CAPTURE_CTRL_START = 0, 749 EXT_ISP_BURST_CAPTURE_CTRL_STOP 750 }; 751 752 #define EXT_ISP_FLASH_MODE_OFF 0 753 #define EXT_ISP_FLASH_MODE_ON 1 754 #define EXT_ISP_FLASH_MODE_AUTO 2 755 #define EXT_ISP_LED_TORCH_OFF 3 756 #define EXT_ISP_LED_TORCH_ON 4 757 758 #define EXT_ISP_SHOT_MODE_AUTO 0 759 #define EXT_ISP_SHOT_MODE_BEAUTY_FACE 1 760 #define EXT_ISP_SHOT_MODE_BEST_PHOTO 2 761 #define EXT_ISP_SHOT_MODE_DRAMA 3 762 #define EXT_ISP_SHOT_MODE_BEST_FACE 4 763 #define EXT_ISP_SHOT_MODE_ERASER 5 764 #define EXT_ISP_SHOT_MODE_PANORAMA 6 765 #define EXT_ISP_SHOT_MODE_RICH_TONE_HDR 7 766 #define EXT_ISP_SHOT_MODE_NIGHT 8 767 #define EXT_ISP_SHOT_MODE_SOUND_SHOT 9 768 #define EXT_ISP_SHOT_MODE_ANIMATED_PHOTO 10 769 #define EXT_ISP_SHOT_MODE_SPORTS 11 770 771 /* 772 * Set Senor run mode 773 */ 774 struct atomisp_s_runmode { 775 __u32 mode; 776 }; 777 778 struct atomisp_update_exposure { 779 unsigned int gain; 780 unsigned int digi_gain; 781 unsigned int update_gain; 782 unsigned int update_digi_gain; 783 }; 784 785 /* 786 * V4L2 private internal data interface. 787 * ----------------------------------------------------------------------------- 788 * struct v4l2_private_int_data - request private data stored in video device 789 * internal memory. 790 * @size: sanity check to ensure userspace's buffer fits whole private data. 791 * If not, kernel will make partial copy (or nothing if @size == 0). 792 * @size is always corrected for the minimum necessary if IOCTL returns 793 * no error. 794 * @data: pointer to userspace buffer. 795 */ 796 struct v4l2_private_int_data { 797 __u32 size; 798 void __user *data; 799 __u32 reserved[2]; 800 }; 801 802 enum atomisp_sensor_ae_bracketing_mode { 803 SENSOR_AE_BRACKETING_MODE_OFF = 0, 804 SENSOR_AE_BRACKETING_MODE_SINGLE, /* back to SW standby after bracketing */ 805 SENSOR_AE_BRACKETING_MODE_SINGLE_TO_STREAMING, /* back to normal streaming after bracketing */ 806 SENSOR_AE_BRACKETING_MODE_LOOP, /* continue AE bracketing in loop mode */ 807 }; 808 809 struct atomisp_sensor_ae_bracketing_info { 810 unsigned int modes; /* bit mask to indicate supported modes */ 811 unsigned int lut_depth; 812 }; 813 814 struct atomisp_sensor_ae_bracketing_lut_entry { 815 __u16 coarse_integration_time; 816 __u16 analog_gain; 817 __u16 digital_gain; 818 }; 819 820 struct atomisp_sensor_ae_bracketing_lut { 821 struct atomisp_sensor_ae_bracketing_lut_entry *lut; 822 unsigned int lut_size; 823 }; 824 825 /*Private IOCTLs for ISP */ 826 #define ATOMISP_IOC_G_XNR \ 827 _IOR('v', BASE_VIDIOC_PRIVATE + 0, int) 828 #define ATOMISP_IOC_S_XNR \ 829 _IOW('v', BASE_VIDIOC_PRIVATE + 0, int) 830 #define ATOMISP_IOC_G_NR \ 831 _IOR('v', BASE_VIDIOC_PRIVATE + 1, struct atomisp_nr_config) 832 #define ATOMISP_IOC_S_NR \ 833 _IOW('v', BASE_VIDIOC_PRIVATE + 1, struct atomisp_nr_config) 834 #define ATOMISP_IOC_G_TNR \ 835 _IOR('v', BASE_VIDIOC_PRIVATE + 2, struct atomisp_tnr_config) 836 #define ATOMISP_IOC_S_TNR \ 837 _IOW('v', BASE_VIDIOC_PRIVATE + 2, struct atomisp_tnr_config) 838 #define ATOMISP_IOC_G_HISTOGRAM \ 839 _IOWR('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_histogram) 840 #define ATOMISP_IOC_S_HISTOGRAM \ 841 _IOW('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_histogram) 842 #define ATOMISP_IOC_G_BLACK_LEVEL_COMP \ 843 _IOR('v', BASE_VIDIOC_PRIVATE + 4, struct atomisp_ob_config) 844 #define ATOMISP_IOC_S_BLACK_LEVEL_COMP \ 845 _IOW('v', BASE_VIDIOC_PRIVATE + 4, struct atomisp_ob_config) 846 #define ATOMISP_IOC_G_EE \ 847 _IOR('v', BASE_VIDIOC_PRIVATE + 5, struct atomisp_ee_config) 848 #define ATOMISP_IOC_S_EE \ 849 _IOW('v', BASE_VIDIOC_PRIVATE + 5, struct atomisp_ee_config) 850 /* Digital Image Stabilization: 851 * 1. get dis statistics: reads DIS statistics from ISP (every frame) 852 * 2. set dis coefficients: set DIS filter coefficients (one time) 853 * 3. set dis motion vecotr: set motion vector (result of DIS, every frame) 854 */ 855 #define ATOMISP_IOC_G_DIS_STAT \ 856 _IOWR('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_statistics) 857 858 #define ATOMISP_IOC_G_DVS2_BQ_RESOLUTIONS \ 859 _IOR('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dvs2_bq_resolutions) 860 861 #define ATOMISP_IOC_S_DIS_COEFS \ 862 _IOW('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_coefficients) 863 864 #define ATOMISP_IOC_S_DIS_VECTOR \ 865 _IOW('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dvs_6axis_config) 866 867 #define ATOMISP_IOC_G_3A_STAT \ 868 _IOWR('v', BASE_VIDIOC_PRIVATE + 7, struct atomisp_3a_statistics) 869 #define ATOMISP_IOC_G_ISP_PARM \ 870 _IOR('v', BASE_VIDIOC_PRIVATE + 8, struct atomisp_parm) 871 #define ATOMISP_IOC_S_ISP_PARM \ 872 _IOW('v', BASE_VIDIOC_PRIVATE + 8, struct atomisp_parm) 873 #define ATOMISP_IOC_G_ISP_GAMMA \ 874 _IOR('v', BASE_VIDIOC_PRIVATE + 9, struct atomisp_gamma_table) 875 #define ATOMISP_IOC_S_ISP_GAMMA \ 876 _IOW('v', BASE_VIDIOC_PRIVATE + 9, struct atomisp_gamma_table) 877 #define ATOMISP_IOC_G_ISP_GDC_TAB \ 878 _IOR('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_morph_table) 879 #define ATOMISP_IOC_S_ISP_GDC_TAB \ 880 _IOW('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_morph_table) 881 882 /* macc parameter control*/ 883 #define ATOMISP_IOC_G_ISP_MACC \ 884 _IOR('v', BASE_VIDIOC_PRIVATE + 12, struct atomisp_macc_config) 885 #define ATOMISP_IOC_S_ISP_MACC \ 886 _IOW('v', BASE_VIDIOC_PRIVATE + 12, struct atomisp_macc_config) 887 888 /* Defect pixel detection & Correction */ 889 #define ATOMISP_IOC_G_ISP_BAD_PIXEL_DETECTION \ 890 _IOR('v', BASE_VIDIOC_PRIVATE + 13, struct atomisp_dp_config) 891 #define ATOMISP_IOC_S_ISP_BAD_PIXEL_DETECTION \ 892 _IOW('v', BASE_VIDIOC_PRIVATE + 13, struct atomisp_dp_config) 893 894 /* False Color Correction */ 895 #define ATOMISP_IOC_G_ISP_FALSE_COLOR_CORRECTION \ 896 _IOR('v', BASE_VIDIOC_PRIVATE + 14, struct atomisp_de_config) 897 #define ATOMISP_IOC_S_ISP_FALSE_COLOR_CORRECTION \ 898 _IOW('v', BASE_VIDIOC_PRIVATE + 14, struct atomisp_de_config) 899 900 /* ctc parameter control */ 901 #define ATOMISP_IOC_G_ISP_CTC \ 902 _IOR('v', BASE_VIDIOC_PRIVATE + 15, struct atomisp_ctc_table) 903 #define ATOMISP_IOC_S_ISP_CTC \ 904 _IOW('v', BASE_VIDIOC_PRIVATE + 15, struct atomisp_ctc_table) 905 906 /* white balance Correction */ 907 #define ATOMISP_IOC_G_ISP_WHITE_BALANCE \ 908 _IOR('v', BASE_VIDIOC_PRIVATE + 16, struct atomisp_wb_config) 909 #define ATOMISP_IOC_S_ISP_WHITE_BALANCE \ 910 _IOW('v', BASE_VIDIOC_PRIVATE + 16, struct atomisp_wb_config) 911 912 /* fpn table loading */ 913 #define ATOMISP_IOC_S_ISP_FPN_TABLE \ 914 _IOW('v', BASE_VIDIOC_PRIVATE + 17, struct v4l2_framebuffer) 915 916 /* overlay image loading */ 917 #define ATOMISP_IOC_G_ISP_OVERLAY \ 918 _IOWR('v', BASE_VIDIOC_PRIVATE + 18, struct atomisp_overlay) 919 #define ATOMISP_IOC_S_ISP_OVERLAY \ 920 _IOW('v', BASE_VIDIOC_PRIVATE + 18, struct atomisp_overlay) 921 922 /* bcd driver bridge */ 923 #define ATOMISP_IOC_CAMERA_BRIDGE \ 924 _IOWR('v', BASE_VIDIOC_PRIVATE + 19, struct atomisp_bc_video_package) 925 926 #define ATOMISP_IOC_S_EXPOSURE \ 927 _IOW('v', BASE_VIDIOC_PRIVATE + 21, struct atomisp_exposure) 928 929 /* sensor calibration registers group */ 930 #define ATOMISP_IOC_G_SENSOR_CALIBRATION_GROUP \ 931 _IOWR('v', BASE_VIDIOC_PRIVATE + 22, struct atomisp_calibration_group) 932 933 /* white balance Correction */ 934 #define ATOMISP_IOC_G_3A_CONFIG \ 935 _IOR('v', BASE_VIDIOC_PRIVATE + 23, struct atomisp_3a_config) 936 #define ATOMISP_IOC_S_3A_CONFIG \ 937 _IOW('v', BASE_VIDIOC_PRIVATE + 23, struct atomisp_3a_config) 938 939 /* sensor OTP memory read */ 940 #define ATOMISP_IOC_G_SENSOR_PRIV_INT_DATA \ 941 _IOWR('v', BASE_VIDIOC_PRIVATE + 26, struct v4l2_private_int_data) 942 943 /* LCS (shading) table write */ 944 #define ATOMISP_IOC_S_ISP_SHD_TAB \ 945 _IOWR('v', BASE_VIDIOC_PRIVATE + 27, struct atomisp_shading_table) 946 947 /* Gamma Correction */ 948 #define ATOMISP_IOC_G_ISP_GAMMA_CORRECTION \ 949 _IOR('v', BASE_VIDIOC_PRIVATE + 28, struct atomisp_gc_config) 950 951 #define ATOMISP_IOC_S_ISP_GAMMA_CORRECTION \ 952 _IOW('v', BASE_VIDIOC_PRIVATE + 28, struct atomisp_gc_config) 953 954 /* motor internal memory read */ 955 #define ATOMISP_IOC_G_MOTOR_PRIV_INT_DATA \ 956 _IOWR('v', BASE_VIDIOC_PRIVATE + 29, struct v4l2_private_int_data) 957 958 #define ATOMISP_IOC_S_PARAMETERS \ 959 _IOW('v', BASE_VIDIOC_PRIVATE + 32, struct atomisp_parameters) 960 961 #define ATOMISP_IOC_S_CONT_CAPTURE_CONFIG \ 962 _IOWR('v', BASE_VIDIOC_PRIVATE + 33, struct atomisp_cont_capture_conf) 963 964 #define ATOMISP_IOC_G_METADATA \ 965 _IOWR('v', BASE_VIDIOC_PRIVATE + 34, struct atomisp_metadata) 966 967 #define ATOMISP_IOC_G_METADATA_BY_TYPE \ 968 _IOWR('v', BASE_VIDIOC_PRIVATE + 34, struct atomisp_metadata_with_type) 969 970 #define ATOMISP_IOC_EXT_ISP_CTRL \ 971 _IOWR('v', BASE_VIDIOC_PRIVATE + 35, struct atomisp_ext_isp_ctrl) 972 973 #define ATOMISP_IOC_EXP_ID_UNLOCK \ 974 _IOW('v', BASE_VIDIOC_PRIVATE + 36, int) 975 976 #define ATOMISP_IOC_EXP_ID_CAPTURE \ 977 _IOW('v', BASE_VIDIOC_PRIVATE + 37, int) 978 979 #define ATOMISP_IOC_S_ENABLE_DZ_CAPT_PIPE \ 980 _IOWR('v', BASE_VIDIOC_PRIVATE + 38, unsigned int) 981 982 #define ATOMISP_IOC_G_FORMATS_CONFIG \ 983 _IOR('v', BASE_VIDIOC_PRIVATE + 39, struct atomisp_formats_config) 984 985 #define ATOMISP_IOC_S_FORMATS_CONFIG \ 986 _IOW('v', BASE_VIDIOC_PRIVATE + 39, struct atomisp_formats_config) 987 988 #define ATOMISP_IOC_S_EXPOSURE_WINDOW \ 989 _IOW('v', BASE_VIDIOC_PRIVATE + 40, struct atomisp_ae_window) 990 991 #define ATOMISP_IOC_INJECT_A_FAKE_EVENT \ 992 _IOW('v', BASE_VIDIOC_PRIVATE + 42, int) 993 994 #define ATOMISP_IOC_G_SENSOR_AE_BRACKETING_INFO \ 995 _IOR('v', BASE_VIDIOC_PRIVATE + 43, struct atomisp_sensor_ae_bracketing_info) 996 997 #define ATOMISP_IOC_S_SENSOR_AE_BRACKETING_MODE \ 998 _IOW('v', BASE_VIDIOC_PRIVATE + 43, unsigned int) 999 1000 #define ATOMISP_IOC_G_SENSOR_AE_BRACKETING_MODE \ 1001 _IOR('v', BASE_VIDIOC_PRIVATE + 43, unsigned int) 1002 1003 #define ATOMISP_IOC_S_SENSOR_AE_BRACKETING_LUT \ 1004 _IOW('v', BASE_VIDIOC_PRIVATE + 43, struct atomisp_sensor_ae_bracketing_lut) 1005 1006 #define ATOMISP_IOC_G_INVALID_FRAME_NUM \ 1007 _IOR('v', BASE_VIDIOC_PRIVATE + 44, unsigned int) 1008 1009 #define ATOMISP_IOC_S_ARRAY_RESOLUTION \ 1010 _IOW('v', BASE_VIDIOC_PRIVATE + 45, struct atomisp_resolution) 1011 1012 /* for depth mode sensor frame sync compensation */ 1013 #define ATOMISP_IOC_G_DEPTH_SYNC_COMP \ 1014 _IOR('v', BASE_VIDIOC_PRIVATE + 46, unsigned int) 1015 1016 #define ATOMISP_IOC_S_SENSOR_EE_CONFIG \ 1017 _IOW('v', BASE_VIDIOC_PRIVATE + 47, unsigned int) 1018 1019 #define ATOMISP_IOC_S_SENSOR_RUNMODE \ 1020 _IOW('v', BASE_VIDIOC_PRIVATE + 48, struct atomisp_s_runmode) 1021 1022 #define ATOMISP_IOC_G_UPDATE_EXPOSURE \ 1023 _IOWR('v', BASE_VIDIOC_PRIVATE + 49, struct atomisp_update_exposure) 1024 1025 /* 1026 * Reserved ioctls. We have customer implementing it internally. 1027 * We can't use both numbers to not cause ABI conflict. 1028 * Anyway, those ioctls are hacks and not implemented by us: 1029 * 1030 * #define ATOMISP_IOC_G_SENSOR_REG \ 1031 * _IOW('v', BASE_VIDIOC_PRIVATE + 55, struct atomisp_sensor_regs) 1032 * #define ATOMISP_IOC_S_SENSOR_REG \ 1033 * _IOW('v', BASE_VIDIOC_PRIVATE + 56, struct atomisp_sensor_regs) 1034 */ 1035 1036 /* ISP Private control IDs */ 1037 #define V4L2_CID_ATOMISP_BAD_PIXEL_DETECTION \ 1038 (V4L2_CID_PRIVATE_BASE + 0) 1039 #define V4L2_CID_ATOMISP_POSTPROCESS_GDC_CAC \ 1040 (V4L2_CID_PRIVATE_BASE + 1) 1041 #define V4L2_CID_ATOMISP_VIDEO_STABLIZATION \ 1042 (V4L2_CID_PRIVATE_BASE + 2) 1043 #define V4L2_CID_ATOMISP_FIXED_PATTERN_NR \ 1044 (V4L2_CID_PRIVATE_BASE + 3) 1045 #define V4L2_CID_ATOMISP_FALSE_COLOR_CORRECTION \ 1046 (V4L2_CID_PRIVATE_BASE + 4) 1047 #define V4L2_CID_ATOMISP_LOW_LIGHT \ 1048 (V4L2_CID_PRIVATE_BASE + 5) 1049 1050 /* Camera class: 1051 * Exposure, Flash and privacy (indicator) light controls, to be upstreamed */ 1052 #define V4L2_CID_CAMERA_LASTP1 (V4L2_CID_CAMERA_CLASS_BASE + 1024) 1053 1054 /* Flash related CIDs, see also: 1055 * http://linuxtv.org/downloads/v4l-dvb-apis/extended-controls.html\ 1056 * #flash-controls */ 1057 1058 /* Request a number of flash-exposed frames. The frame status can be 1059 * found in the reserved field in the v4l2_buffer struct. */ 1060 #define V4L2_CID_REQUEST_FLASH (V4L2_CID_CAMERA_LASTP1 + 3) 1061 /* Query flash driver status. See enum atomisp_flash_status above. */ 1062 #define V4L2_CID_FLASH_STATUS (V4L2_CID_CAMERA_LASTP1 + 5) 1063 /* Set the flash mode (see enum atomisp_flash_mode) */ 1064 #define V4L2_CID_FLASH_MODE (V4L2_CID_CAMERA_LASTP1 + 10) 1065 1066 /* VCM slew control */ 1067 #define V4L2_CID_VCM_SLEW (V4L2_CID_CAMERA_LASTP1 + 11) 1068 /* VCM step time */ 1069 #define V4L2_CID_VCM_TIMING (V4L2_CID_CAMERA_LASTP1 + 12) 1070 1071 /* Query Focus Status */ 1072 #define V4L2_CID_FOCUS_STATUS (V4L2_CID_CAMERA_LASTP1 + 14) 1073 1074 /* number of frames to skip at stream start */ 1075 #define V4L2_CID_G_SKIP_FRAMES (V4L2_CID_CAMERA_LASTP1 + 17) 1076 1077 /* Query sensor's 2A status */ 1078 #define V4L2_CID_2A_STATUS (V4L2_CID_CAMERA_LASTP1 + 18) 1079 #define V4L2_2A_STATUS_AE_READY BIT(0) 1080 #define V4L2_2A_STATUS_AWB_READY BIT(1) 1081 1082 #define V4L2_CID_FMT_AUTO (V4L2_CID_CAMERA_LASTP1 + 19) 1083 1084 #define V4L2_CID_RUN_MODE (V4L2_CID_CAMERA_LASTP1 + 20) 1085 #define ATOMISP_RUN_MODE_VIDEO 1 1086 #define ATOMISP_RUN_MODE_STILL_CAPTURE 2 1087 #define ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE 3 1088 #define ATOMISP_RUN_MODE_PREVIEW 4 1089 #define ATOMISP_RUN_MODE_SDV 5 1090 1091 #define V4L2_CID_ENABLE_VFPP (V4L2_CID_CAMERA_LASTP1 + 21) 1092 #define V4L2_CID_ATOMISP_CONTINUOUS_MODE (V4L2_CID_CAMERA_LASTP1 + 22) 1093 #define V4L2_CID_ATOMISP_CONTINUOUS_RAW_BUFFER_SIZE \ 1094 (V4L2_CID_CAMERA_LASTP1 + 23) 1095 #define V4L2_CID_ATOMISP_CONTINUOUS_VIEWFINDER \ 1096 (V4L2_CID_CAMERA_LASTP1 + 24) 1097 1098 #define V4L2_CID_VFPP (V4L2_CID_CAMERA_LASTP1 + 25) 1099 #define ATOMISP_VFPP_ENABLE 0 1100 #define ATOMISP_VFPP_DISABLE_SCALER 1 1101 #define ATOMISP_VFPP_DISABLE_LOWLAT 2 1102 1103 /* Query real flash status register value */ 1104 #define V4L2_CID_FLASH_STATUS_REGISTER (V4L2_CID_CAMERA_LASTP1 + 26) 1105 1106 #define V4L2_CID_START_ZSL_CAPTURE (V4L2_CID_CAMERA_LASTP1 + 28) 1107 /* Lock and unlock raw buffer */ 1108 #define V4L2_CID_ENABLE_RAW_BUFFER_LOCK (V4L2_CID_CAMERA_LASTP1 + 29) 1109 1110 #define V4L2_CID_DEPTH_MODE (V4L2_CID_CAMERA_LASTP1 + 30) 1111 1112 #define V4L2_CID_EXPOSURE_ZONE_NUM (V4L2_CID_CAMERA_LASTP1 + 31) 1113 /* Disable digital zoom */ 1114 #define V4L2_CID_DISABLE_DZ (V4L2_CID_CAMERA_LASTP1 + 32) 1115 1116 #define V4L2_CID_TEST_PATTERN_COLOR_R (V4L2_CID_CAMERA_LASTP1 + 33) 1117 #define V4L2_CID_TEST_PATTERN_COLOR_GR (V4L2_CID_CAMERA_LASTP1 + 34) 1118 #define V4L2_CID_TEST_PATTERN_COLOR_GB (V4L2_CID_CAMERA_LASTP1 + 35) 1119 #define V4L2_CID_TEST_PATTERN_COLOR_B (V4L2_CID_CAMERA_LASTP1 + 36) 1120 1121 #define V4L2_CID_ATOMISP_SELECT_ISP_VERSION (V4L2_CID_CAMERA_LASTP1 + 38) 1122 1123 #define V4L2_BUF_FLAG_BUFFER_INVALID 0x0400 1124 #define V4L2_BUF_FLAG_BUFFER_VALID 0x0800 1125 1126 #define V4L2_BUF_TYPE_VIDEO_CAPTURE_ION (V4L2_BUF_TYPE_PRIVATE + 1024) 1127 1128 #define V4L2_EVENT_ATOMISP_3A_STATS_READY (V4L2_EVENT_PRIVATE_START + 1) 1129 #define V4L2_EVENT_ATOMISP_METADATA_READY (V4L2_EVENT_PRIVATE_START + 2) 1130 #define V4L2_EVENT_ATOMISP_RAW_BUFFERS_ALLOC_DONE (V4L2_EVENT_PRIVATE_START + 3) 1131 #define V4L2_EVENT_ATOMISP_ACC_COMPLETE (V4L2_EVENT_PRIVATE_START + 4) 1132 #define V4L2_EVENT_ATOMISP_PAUSE_BUFFER (V4L2_EVENT_PRIVATE_START + 5) 1133 #define V4L2_EVENT_ATOMISP_CSS_RESET (V4L2_EVENT_PRIVATE_START + 6) 1134 /* Nonstandard color effects for V4L2_CID_COLORFX */ 1135 enum { 1136 V4L2_COLORFX_SKIN_WHITEN_LOW = 1001, 1137 V4L2_COLORFX_SKIN_WHITEN_HIGH = 1002, 1138 V4L2_COLORFX_WARM = 1003, 1139 V4L2_COLORFX_COLD = 1004, 1140 V4L2_COLORFX_WASHED = 1005, 1141 V4L2_COLORFX_RED = 1006, 1142 V4L2_COLORFX_GREEN = 1007, 1143 V4L2_COLORFX_BLUE = 1008, 1144 V4L2_COLORFX_PINK = 1009, 1145 V4L2_COLORFX_YELLOW = 1010, 1146 V4L2_COLORFX_PURPLE = 1011, 1147 }; 1148 1149 #endif /* _ATOM_ISP_H */ 1150