[{"id":2550,"web_url":"https://patchwork.libcamera.org/comment/2550/","msgid":"<4a27a8d5-636e-d789-72eb-c95de75b8e13@ideasonboard.com>","date":"2019-08-29T15:20:25","subject":"Re: [libcamera-devel] [PATCH 11/13] include: linux: Add\n\trkisp1-config.h kernel header","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Niklas,\n\nOn 28/08/2019 02:17, Niklas Söderlund wrote:\n> Add kernel header for Rockchip ISP1 from the rkisp1 patch set. As the\n> driver is currently out of tree, the header file is not exported as part\n> of the standard kernel uAPI.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nI'll consider this a given, and assume it's taken verbatim ... but do we\nneed to make sure that it is correctly exported and run through any uAPI\nconversions necessary?\n\nPerhaps no change is necessary from the uapi-export process for this\nheader, but worth checking. Like do the \"__attribute__ ((packed));\"\nusages change to anything?\n\nOr is that the style used by the export process?\n\nWhen confirmed it's suitable for userspace consumption:\n\nAcked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> ---\n>  include/linux/rkisp1-config.h | 798 ++++++++++++++++++++++++++++++++++\n>  include/linux/videodev2.h     |   4 +\n>  2 files changed, 802 insertions(+)\n>  create mode 100644 include/linux/rkisp1-config.h\n> \n> diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\n> new file mode 100644\n> index 0000000000000000..53748672dfea4dcb\n> --- /dev/null\n> +++ b/include/linux/rkisp1-config.h\n> @@ -0,0 +1,798 @@\n> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)\n> +/*\n> + * Rockchip isp1 driver\n> + * Copyright (C) 2017 Rockchip Electronics Co., Ltd.\n> + */\n> +\n> +/*\n> + * References:\n> + * REF_01 - ISP_user_manual, Rev 2.57\n> + */\n> +\n> +#ifndef _RKISP1_CONFIG_H\n> +#define _RKISP1_CONFIG_H\n> +\n> +#include <linux/types.h>\n> +#include <linux/v4l2-controls.h>\n> +\n> +#define CIFISP_MODULE_DPCC              (1 << 0)\n> +#define CIFISP_MODULE_BLS               (1 << 1)\n> +#define CIFISP_MODULE_SDG               (1 << 2)\n> +#define CIFISP_MODULE_HST               (1 << 3)\n> +#define CIFISP_MODULE_LSC               (1 << 4)\n> +#define CIFISP_MODULE_AWB_GAIN          (1 << 5)\n> +#define CIFISP_MODULE_FLT               (1 << 6)\n> +#define CIFISP_MODULE_BDM               (1 << 7)\n> +#define CIFISP_MODULE_CTK               (1 << 8)\n> +#define CIFISP_MODULE_GOC               (1 << 9)\n> +#define CIFISP_MODULE_CPROC             (1 << 10)\n> +#define CIFISP_MODULE_AFC               (1 << 11)\n> +#define CIFISP_MODULE_AWB               (1 << 12)\n> +#define CIFISP_MODULE_IE                (1 << 13)\n> +#define CIFISP_MODULE_AEC               (1 << 14)\n> +#define CIFISP_MODULE_WDR               (1 << 15)\n> +#define CIFISP_MODULE_DPF               (1 << 16)\n> +#define CIFISP_MODULE_DPF_STRENGTH      (1 << 17)\n> +\n> +#define CIFISP_CTK_COEFF_MAX            0x100\n> +#define CIFISP_CTK_OFFSET_MAX           0x800\n> +\n> +#define CIFISP_AE_MEAN_MAX              25\n> +#define CIFISP_HIST_BIN_N_MAX           16\n> +#define CIFISP_AFM_MAX_WINDOWS          3\n> +#define CIFISP_DEGAMMA_CURVE_SIZE       17\n> +\n> +#define CIFISP_BDM_MAX_TH               0xFF\n> +\n> +/*\n> + * Black level compensation\n> + */\n> +/* maximum value for horizontal start address */\n> +#define CIFISP_BLS_START_H_MAX             0x00000FFF\n> +/* maximum value for horizontal stop address */\n> +#define CIFISP_BLS_STOP_H_MAX              0x00000FFF\n> +/* maximum value for vertical start address */\n> +#define CIFISP_BLS_START_V_MAX             0x00000FFF\n> +/* maximum value for vertical stop address */\n> +#define CIFISP_BLS_STOP_V_MAX              0x00000FFF\n> +/* maximum is 2^18 = 262144*/\n> +#define CIFISP_BLS_SAMPLES_MAX             0x00000012\n> +/* maximum value for fixed black level */\n> +#define CIFISP_BLS_FIX_SUB_MAX             0x00000FFF\n> +/* minimum value for fixed black level */\n> +#define CIFISP_BLS_FIX_SUB_MIN             0xFFFFF000\n> +/* 13 bit range (signed)*/\n> +#define CIFISP_BLS_FIX_MASK                0x00001FFF\n> +\n> +/*\n> + * Automatic white balance measurments\n> + */\n> +#define CIFISP_AWB_MAX_GRID                1\n> +#define CIFISP_AWB_MAX_FRAMES              7\n> +\n> +/*\n> + * Gamma out\n> + */\n> +/* Maximum number of color samples supported */\n> +#define CIFISP_GAMMA_OUT_MAX_SAMPLES       17\n> +\n> +/*\n> + * Lens shade correction\n> + */\n> +#define CIFISP_LSC_GRAD_TBL_SIZE           8\n> +#define CIFISP_LSC_SIZE_TBL_SIZE           8\n> +/*\n> + * The following matches the tuning process,\n> + * not the max capabilities of the chip.\n> + * Last value unused.\n> + */\n> +#define\tCIFISP_LSC_DATA_TBL_SIZE           290\n> +\n> +/*\n> + * Histogram calculation\n> + */\n> +/* Last 3 values unused. */\n> +#define CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28\n> +\n> +/*\n> + * Defect Pixel Cluster Correction\n> + */\n> +#define CIFISP_DPCC_METHODS_MAX       3\n> +\n> +/*\n> + * Denoising pre filter\n> + */\n> +#define CIFISP_DPF_MAX_NLF_COEFFS      17\n> +#define CIFISP_DPF_MAX_SPATIAL_COEFFS  6\n> +\n> +/*\n> + * Measurement types\n> + */\n> +#define CIFISP_STAT_AWB           (1 << 0)\n> +#define CIFISP_STAT_AUTOEXP       (1 << 1)\n> +#define CIFISP_STAT_AFM_FIN       (1 << 2)\n> +#define CIFISP_STAT_HIST          (1 << 3)\n> +\n> +enum cifisp_histogram_mode {\n> +\tCIFISP_HISTOGRAM_MODE_DISABLE,\n> +\tCIFISP_HISTOGRAM_MODE_RGB_COMBINED,\n> +\tCIFISP_HISTOGRAM_MODE_R_HISTOGRAM,\n> +\tCIFISP_HISTOGRAM_MODE_G_HISTOGRAM,\n> +\tCIFISP_HISTOGRAM_MODE_B_HISTOGRAM,\n> +\tCIFISP_HISTOGRAM_MODE_Y_HISTOGRAM\n> +};\n> +\n> +enum cifisp_awb_mode_type {\n> +\tCIFISP_AWB_MODE_MANUAL,\n> +\tCIFISP_AWB_MODE_RGB,\n> +\tCIFISP_AWB_MODE_YCBCR\n> +};\n> +\n> +enum cifisp_flt_mode {\n> +\tCIFISP_FLT_STATIC_MODE,\n> +\tCIFISP_FLT_DYNAMIC_MODE\n> +};\n> +\n> +/**\n> + * enum cifisp_exp_ctrl_autostop - stop modes\n> + * @CIFISP_EXP_CTRL_AUTOSTOP_0: continuous measurement\n> + * @CIFISP_EXP_CTRL_AUTOSTOP_1: stop measuring after a complete frame\n> + */\n> +enum cifisp_exp_ctrl_autostop {\n> +\tCIFISP_EXP_CTRL_AUTOSTOP_0 = 0,\n> +\tCIFISP_EXP_CTRL_AUTOSTOP_1 = 1,\n> +};\n> +\n> +/**\n> + * enum cifisp_exp_meas_mode - Exposure measure mode\n> + * @CIFISP_EXP_MEASURING_MODE_0: Y = 16 + 0.25R + 0.5G + 0.1094B\n> + * @CIFISP_EXP_MEASURING_MODE_1: Y = (R + G + B) x (85/256)\n> + */\n> +enum cifisp_exp_meas_mode {\n> +\tCIFISP_EXP_MEASURING_MODE_0,\n> +\tCIFISP_EXP_MEASURING_MODE_1,\n> +};\n> +\n> +/*---------- PART1: Input Parameters ------------*/\n> +\n> +struct cifisp_window {\n> +\t__u16 h_offs;\n> +\t__u16 v_offs;\n> +\t__u16 h_size;\n> +\t__u16 v_size;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_bls_fixed_val - BLS fixed subtraction values\n> + *\n> + * The values will be subtracted from the sensor\n> + * values. Therefore a negative value means addition instead of subtraction!\n> + *\n> + * @r: Fixed (signed!) subtraction value for Bayer pattern R\n> + * @gr: Fixed (signed!) subtraction value for Bayer pattern Gr\n> + * @gb: Fixed (signed!) subtraction value for Bayer pattern Gb\n> + * @b: Fixed (signed!) subtraction value for Bayer pattern B\n> + */\n> +struct cifisp_bls_fixed_val {\n> +\t__s16 r;\n> +\t__s16 gr;\n> +\t__s16 gb;\n> +\t__s16 b;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_bls_config - Configuration used by black level subtraction\n> + *\n> + * @enable_auto: Automatic mode activated means that the measured values\n> + * are subtracted. Otherwise the fixed subtraction\n> + * values will be subtracted.\n> + * @en_windows: enabled window\n> + * @bls_window1: Measurement window 1 size\n> + * @bls_window2: Measurement window 2 size\n> + * @bls_samples: Set amount of measured pixels for each Bayer position\n> + * (A, B,C and D) to 2^bls_samples.\n> + * @cifisp_bls_fixed_val: Fixed subtraction values\n> + */\n> +struct cifisp_bls_config {\n> +\t__u8 enable_auto;\n> +\t__u8 en_windows;\n> +\tstruct cifisp_window bls_window1;\n> +\tstruct cifisp_window bls_window2;\n> +\t__u8 bls_samples;\n> +\tstruct cifisp_bls_fixed_val fixed_val;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_dpcc_methods_config - Methods Configuration used by Defect Pixel Cluster Correction\n> + *\n> + * @method: Method enable bits\n> + * @line_thresh: Line threshold\n> + * @line_mad_fac: Line MAD factor\n> + * @pg_fac: Peak gradient factor\n> + * @rnd_thresh: Rank Neighbor Difference threshold\n> + * @rg_fac: Rank gradient factor\n> + */\n> +struct cifisp_dpcc_methods_config {\n> +\t__u32 method;\n> +\t__u32 line_thresh;\n> +\t__u32 line_mad_fac;\n> +\t__u32 pg_fac;\n> +\t__u32 rnd_thresh;\n> +\t__u32 rg_fac;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_dpcc_methods_config - Configuration used by Defect Pixel Cluster Correction\n> + *\n> + * @mode: dpcc output mode\n> + * @output_mode: whether use hard coded methods\n> + * @set_use: stage1 methods set\n> + * @methods: methods config\n> + * @ro_limits: rank order limits\n> + * @rnd_offs: differential rank offsets for rank neighbor difference\n> + */\n> +struct cifisp_dpcc_config {\n> +\t__u32 mode;\n> +\t__u32 output_mode;\n> +\t__u32 set_use;\n> +\tstruct cifisp_dpcc_methods_config methods[CIFISP_DPCC_METHODS_MAX];\n> +\t__u32 ro_limits;\n> +\t__u32 rnd_offs;\n> +} __attribute__ ((packed));\n> +\n> +struct cifisp_gamma_corr_curve {\n> +\t__u16 gamma_y[CIFISP_DEGAMMA_CURVE_SIZE];\n> +} __attribute__ ((packed));\n> +\n> +struct cifisp_gamma_curve_x_axis_pnts {\n> +\t__u32 gamma_dx0;\n> +\t__u32 gamma_dx1;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_gamma_corr_curve - Configuration used by sensor degamma\n> + *\n> + * @curve_x: gamma curve point definition axis for x\n> + * @xa_pnts: x increments\n> + */\n> +struct cifisp_sdg_config {\n> +\tstruct cifisp_gamma_corr_curve curve_r;\n> +\tstruct cifisp_gamma_corr_curve curve_g;\n> +\tstruct cifisp_gamma_corr_curve curve_b;\n> +\tstruct cifisp_gamma_curve_x_axis_pnts xa_pnts;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_lsc_config - Configuration used by Lens shading correction\n> + *\n> + * refer to REF_01 for details\n> + */\n> +struct cifisp_lsc_config {\n> +\t__u32 r_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n> +\t__u32 gr_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n> +\t__u32 gb_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n> +\t__u32 b_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n> +\n> +\t__u32 x_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];\n> +\t__u32 y_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];\n> +\n> +\t__u32 x_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];\n> +\t__u32 y_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];\n> +\t__u16 config_width;\n> +\t__u16 config_height;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_ie_config - Configuration used by image effects\n> + *\n> + * @eff_mat_1: 3x3 Matrix Coefficients for Emboss Effect 1\n> + * @eff_mat_2: 3x3 Matrix Coefficients for Emboss Effect 2\n> + * @eff_mat_3: 3x3 Matrix Coefficients for Emboss 3/Sketch 1\n> + * @eff_mat_4: 3x3 Matrix Coefficients for Sketch Effect 2\n> + * @eff_mat_5: 3x3 Matrix Coefficients for Sketch Effect 3\n> + * @eff_tint: Chrominance increment values of tint (used for sepia effect)\n> + */\n> +struct cifisp_ie_config {\n> +\t__u16 effect;\n> +\t__u16 color_sel;\n> +\t__u16 eff_mat_1;\n> +\t__u16 eff_mat_2;\n> +\t__u16 eff_mat_3;\n> +\t__u16 eff_mat_4;\n> +\t__u16 eff_mat_5;\n> +\t__u16 eff_tint;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_cproc_config - Configuration used by Color Processing\n> + *\n> + * @c_out_range: Chrominance pixel clipping range at output. (0 for limit, 1 for full)\n> + * @y_in_range: Luminance pixel clipping range at output.\n> + * @y_out_range: Luminance pixel clipping range at output.\n> + * @contrast: 00~ff, 0.0~1.992\n> + * @brightness: 80~7F, -128~+127\n> + * @sat: saturation, 00~FF, 0.0~1.992\n> + * @hue: 80~7F, -90~+87.188\n> + */\n> +struct cifisp_cproc_config {\n> +\t__u8 c_out_range;\n> +\t__u8 y_in_range;\n> +\t__u8 y_out_range;\n> +\t__u8 contrast;\n> +\t__u8 brightness;\n> +\t__u8 sat;\n> +\t__u8 hue;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_awb_meas_config - Configuration used by auto white balance\n> + *\n> + * @awb_wnd: white balance measurement window (in pixels) (from enum cifisp_awb_mode_type)\n> + * @max_y: only pixels values < max_y contribute to awb measurement, set to 0 to disable this feature\n> + * @min_y: only pixels values > min_y contribute to awb measurement\n> + * @max_csum: Chrominance sum maximum value, only consider pixels with Cb+Cr, \n> + * smaller than threshold for awb measurements\n> + * @min_c: Chrominance minimum value, only consider pixels with Cb/Cr\n> + * each greater than threshold value for awb measurements\n> + * @frames: number of frames - 1 used for mean value calculation (ucFrames=0 means 1 Frame)\n> + * @awb_ref_cr: reference Cr value for AWB regulation, target for AWB\n> + * @awb_ref_cb: reference Cb value for AWB regulation, target for AWB\n> + */\n> +struct cifisp_awb_meas_config {\n> +\t/*\n> +\t * Note: currently the h and v offsets are mapped to grid offsets\n> +\t */\n> +\tstruct cifisp_window awb_wnd;\n> +\t__u32 awb_mode;\n> +\t__u8 max_y;\n> +\t__u8 min_y;\n> +\t__u8 max_csum;\n> +\t__u8 min_c;\n> +\t__u8 frames;\n> +\t__u8 awb_ref_cr;\n> +\t__u8 awb_ref_cb;\n> +\t__u8 enable_ymax_cmp;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_awb_gain_config - Configuration used by auto white balance gain\n> + *\n> + * out_data_x = ( AWB_GEAIN_X * in_data + 128) >> 8\n> + */\n> +struct cifisp_awb_gain_config {\n> +\t__u16 gain_red;\n> +\t__u16 gain_green_r;\n> +\t__u16 gain_blue;\n> +\t__u16 gain_green_b;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_flt_config - Configuration used by ISP filtering\n> + *\n> + * @mode: ISP_FILT_MODE register fields (from enum cifisp_flt_mode)\n> + * @grn_stage1: ISP_FILT_MODE register fields\n> + * @chr_h_mode: ISP_FILT_MODE register fields\n> + * @chr_v_mode: ISP_FILT_MODE register fields\n> + *\n> + * refer to REF_01 for details.\n> + */\n> +\n> +struct cifisp_flt_config {\n> +\t__u32 mode;\n> +\t__u8 grn_stage1;\n> +\t__u8 chr_h_mode;\n> +\t__u8 chr_v_mode;\n> +\t__u32 thresh_bl0;\n> +\t__u32 thresh_bl1;\n> +\t__u32 thresh_sh0;\n> +\t__u32 thresh_sh1;\n> +\t__u32 lum_weight;\n> +\t__u32 fac_sh1;\n> +\t__u32 fac_sh0;\n> +\t__u32 fac_mid;\n> +\t__u32 fac_bl0;\n> +\t__u32 fac_bl1;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_bdm_config - Configuration used by Bayer DeMosaic\n> + *\n> + * @demosaic_th: threshod for bayer demosaicing texture detection\n> + */\n> +struct cifisp_bdm_config {\n> +\t__u8 demosaic_th;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_ctk_config - Configuration used by Cross Talk correction\n> + *\n> + * @coeff: color correction matrix\n> + * @ct_offset_b: offset for the crosstalk correction matrix\n> + */\n> +struct cifisp_ctk_config {\n> +\t__u16 coeff0;\n> +\t__u16 coeff1;\n> +\t__u16 coeff2;\n> +\t__u16 coeff3;\n> +\t__u16 coeff4;\n> +\t__u16 coeff5;\n> +\t__u16 coeff6;\n> +\t__u16 coeff7;\n> +\t__u16 coeff8;\n> +\t__u16 ct_offset_r;\n> +\t__u16 ct_offset_g;\n> +\t__u16 ct_offset_b;\n> +} __attribute__ ((packed));\n> +\n> +enum cifisp_goc_mode {\n> +\tCIFISP_GOC_MODE_LOGARITHMIC,\n> +\tCIFISP_GOC_MODE_EQUIDISTANT\n> +};\n> +\n> +/**\n> + * struct cifisp_goc_config - Configuration used by Gamma Out correction\n> + *\n> + * @mode: goc mode (from enum cifisp_goc_mode)\n> + * @gamma_y: gamma out curve y-axis for all color components\n> + */\n> +struct cifisp_goc_config {\n> +\t__u32 mode;\n> +\t__u16 gamma_y[CIFISP_GAMMA_OUT_MAX_SAMPLES];\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_hst_config - Configuration used by Histogram\n> + *\n> + * @mode: histogram mode (from enum cifisp_histogram_mode)\n> + * @histogram_predivider: process every stepsize pixel, all other pixels are skipped\n> + * @meas_window: coordinates of the measure window\n> + * @hist_weight: weighting factor for sub-windows\n> + */\n> +struct cifisp_hst_config {\n> +\t__u32 mode;\n> +\t__u8 histogram_predivider;\n> +\tstruct cifisp_window meas_window;\n> +\t__u8 hist_weight[CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE];\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_aec_config - Configuration used by Auto Exposure Control\n> + *\n> + * @mode: Exposure measure mode (from enum cifisp_exp_meas_mode)\n> + * @autostop: stop mode (from enum cifisp_exp_ctrl_autostop)\n> + * @meas_window: coordinates of the measure window\n> + */\n> +struct cifisp_aec_config {\n> +\t__u32 mode;\n> +\t__u32 autostop;\n> +\tstruct cifisp_window meas_window;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_afc_config - Configuration used by Auto Focus Control\n> + *\n> + * @num_afm_win: max CIFISP_AFM_MAX_WINDOWS\n> + * @afm_win: coordinates of the meas window\n> + * @thres: threshold used for minimizing the influence of noise\n> + * @var_shift: the number of bits for the shift operation at the end of the calculation chain.\n> + */\n> +struct cifisp_afc_config {\n> +\t__u8 num_afm_win;\n> +\tstruct cifisp_window afm_win[CIFISP_AFM_MAX_WINDOWS];\n> +\t__u32 thres;\n> +\t__u32 var_shift;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * enum cifisp_dpf_gain_usage - dpf gain usage\n> + * @CIFISP_DPF_GAIN_USAGE_DISABLED: don't use any gains in preprocessing stage\n> + * @CIFISP_DPF_GAIN_USAGE_NF_GAINS: use only the noise function gains from registers DPF_NF_GAIN_R, ...\n> + * @CIFISP_DPF_GAIN_USAGE_LSC_GAINS:  use only the gains from LSC module\n> + * @CIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS: use the noise function gains and the gains from LSC module\n> + * @CIFISP_DPF_GAIN_USAGE_AWB_GAINS: use only the gains from AWB module\n> + * @CIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS: use the gains from AWB and LSC module\n> + * @CIFISP_DPF_GAIN_USAGE_MAX: upper border (only for an internal evaluation)\n> + */\n> +enum cifisp_dpf_gain_usage {\n> +\tCIFISP_DPF_GAIN_USAGE_DISABLED,\n> +\tCIFISP_DPF_GAIN_USAGE_NF_GAINS,\n> +\tCIFISP_DPF_GAIN_USAGE_LSC_GAINS,\n> +\tCIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS,\n> +\tCIFISP_DPF_GAIN_USAGE_AWB_GAINS,\n> +\tCIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS,\n> +\tCIFISP_DPF_GAIN_USAGE_MAX\n> +};\n> +\n> +/**\n> + * enum cifisp_dpf_gain_usage - dpf gain usage\n> + * @CIFISP_DPF_RB_FILTERSIZE_13x9: red and blue filter kernel size 13x9 (means 7x5 active pixel)\n> + * @CIFISP_DPF_RB_FILTERSIZE_9x9: red and blue filter kernel size 9x9 (means 5x5 active pixel)\n> + */\n> +enum cifisp_dpf_rb_filtersize {\n> +\tCIFISP_DPF_RB_FILTERSIZE_13x9,\n> +\tCIFISP_DPF_RB_FILTERSIZE_9x9,\n> +};\n> +\n> +/**\n> + * enum cifisp_dpf_nll_scale_mode - dpf noise level scale mode\n> + * @CIFISP_NLL_SCALE_LINEAR: use a linear scaling\n> + * @CIFISP_NLL_SCALE_LOGARITHMIC: use a logarithmic scaling\n> + */\n> +enum cifisp_dpf_nll_scale_mode {\n> +\tCIFISP_NLL_SCALE_LINEAR,\n> +\tCIFISP_NLL_SCALE_LOGARITHMIC,\n> +};\n> +\n> +/**\n> + * struct cifisp_dpf_nll - Noise level lookup\n> + *\n> + * @coeff: Noise level Lookup coefficient\n> + * @scale_mode: dpf noise level scale mode (from enum cifisp_dpf_nll_scale_mode)\n> + */\n> +struct cifisp_dpf_nll {\n> +\t__u16 coeff[CIFISP_DPF_MAX_NLF_COEFFS];\n> +\t__u32 scale_mode;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_dpf_rb_flt - Red blue filter config\n> + *\n> + * @fltsize: The filter size for the red and blue pixels\n> + * (from enum cifisp_dpf_rb_filtersize)\n> + * @spatial_coeff: Spatial weights\n> + * @r_enable: enable filter processing for red pixels\n> + * @b_enable: enable filter processing for blue pixels\n> + */\n> +struct cifisp_dpf_rb_flt {\n> +\t__u32 fltsize;\n> +\t__u8 spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];\n> +\t__u8 r_enable;\n> +\t__u8 b_enable;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_dpf_g_flt - Green filter Configuration\n> + *\n> + * @spatial_coeff: Spatial weights\n> + * @gr_enable: enable filter processing for green pixels in green/red lines\n> + * @gb_enable: enable filter processing for green pixels in green/blue lines\n> + */\n> +struct cifisp_dpf_g_flt {\n> +\t__u8 spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];\n> +\t__u8 gr_enable;\n> +\t__u8 gb_enable;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_dpf_gain - Noise function Configuration\n> + *\n> + * @mode: dpf gain usage  (from enum cifisp_dpf_gain_usage)\n> + * @nf_r_gain: Noise function Gain that replaces the AWB gain for red pixels\n> + * @nf_b_gain: Noise function Gain that replaces the AWB gain for blue pixels\n> + * @nf_gr_gain: Noise function Gain that replaces the AWB gain\n> + * for green pixels in a red line\n> + * @nf_gb_gain: Noise function Gain that replaces the AWB gain\n> + * for green pixels in a blue line\n> + */\n> +struct cifisp_dpf_gain {\n> +\t__u32 mode;\n> +\t__u16 nf_r_gain;\n> +\t__u16 nf_b_gain;\n> +\t__u16 nf_gr_gain;\n> +\t__u16 nf_gb_gain;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_dpf_config - Configuration used by De-noising pre-filter\n> + *\n> + * @gain: noise function gain\n> + * @g_flt: green filter config\n> + * @rb_flt: red blue filter config\n> + * @nll: noise level lookup\n> + */\n> +struct cifisp_dpf_config {\n> +\tstruct cifisp_dpf_gain gain;\n> +\tstruct cifisp_dpf_g_flt g_flt;\n> +\tstruct cifisp_dpf_rb_flt rb_flt;\n> +\tstruct cifisp_dpf_nll nll;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_dpf_strength_config - strength of the filter\n> + *\n> + * @r: filter strength of the RED filter\n> + * @g: filter strength of the GREEN filter\n> + * @b: filter strength of the BLUE filter\n> + */\n> +struct cifisp_dpf_strength_config {\n> +\t__u8 r;\n> +\t__u8 g;\n> +\t__u8 b;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_isp_other_cfg - Parameters for some blocks in rockchip isp1\n> + *\n> + * @dpcc_config: Defect Pixel Cluster Correction config\n> + * @bls_config: Black Level Subtraction config\n> + * @sdg_config: sensor degamma config\n> + * @lsc_config: Lens Shade config\n> + * @awb_gain_config: Auto White balance gain config\n> + * @flt_config: filter config\n> + * @bdm_config: demosaic config\n> + * @ctk_config: cross talk config\n> + * @goc_config: gamma out config\n> + * @bls_config: black level subtraction config\n> + * @dpf_config: De-noising pre-filter config\n> + * @dpf_strength_config: dpf strength config\n> + * @cproc_config: color process config\n> + * @ie_config: image effects config\n> + */\n> +struct cifisp_isp_other_cfg {\n> +\tstruct cifisp_dpcc_config dpcc_config;\n> +\tstruct cifisp_bls_config bls_config;\n> +\tstruct cifisp_sdg_config sdg_config;\n> +\tstruct cifisp_lsc_config lsc_config;\n> +\tstruct cifisp_awb_gain_config awb_gain_config;\n> +\tstruct cifisp_flt_config flt_config;\n> +\tstruct cifisp_bdm_config bdm_config;\n> +\tstruct cifisp_ctk_config ctk_config;\n> +\tstruct cifisp_goc_config goc_config;\n> +\tstruct cifisp_dpf_config dpf_config;\n> +\tstruct cifisp_dpf_strength_config dpf_strength_config;\n> +\tstruct cifisp_cproc_config cproc_config;\n> +\tstruct cifisp_ie_config ie_config;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_isp_meas_cfg - Rockchip ISP1 Measure Parameters\n> + *\n> + * @awb_meas_config: auto white balance config\n> + * @hst_config: histogram config\n> + * @aec_config: auto exposure config\n> + * @afc_config: auto focus config\n> + */\n> +struct cifisp_isp_meas_cfg {\n> +\tstruct cifisp_awb_meas_config awb_meas_config;\n> +\tstruct cifisp_hst_config hst_config;\n> +\tstruct cifisp_aec_config aec_config;\n> +\tstruct cifisp_afc_config afc_config;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct rkisp1_isp_params_cfg - Rockchip ISP1 Input Parameters Meta Data\n> + *\n> + * @module_en_update: mask the enable bits of which module should be updated\n> + * @module_ens: mask the enable value of each module, only update the module\n> + * which correspond bit was set in module_en_update\n> + * @module_cfg_update: mask the config bits of which module should be updated\n> + * @meas: measurement config\n> + * @others: other config\n> + */\n> +struct rkisp1_isp_params_cfg {\n> +\t__u32 module_en_update;\n> +\t__u32 module_ens;\n> +\t__u32 module_cfg_update;\n> +\n> +\tstruct cifisp_isp_meas_cfg meas;\n> +\tstruct cifisp_isp_other_cfg others;\n> +} __attribute__ ((packed));\n> +\n> +/*---------- PART2: Measurement Statistics ------------*/\n> +\n> +/**\n> + * struct cifisp_bls_meas_val - AWB measured values\n> + *\n> + * @cnt: White pixel count, number of \"white pixels\" found during laster measurement\n> + * @mean_y_or_g: Mean value of Y within window and frames, Green if RGB is selected.\n> + * @mean_cb_or_b: Mean value of Cb within window and frames, Blue if RGB is selected.\n> + * @mean_cr_or_r: Mean value of Cr within window and frames, Red if RGB is selected.\n> + */\n> +struct cifisp_awb_meas {\n> +\t__u32 cnt;\n> +\t__u8 mean_y_or_g;\n> +\t__u8 mean_cb_or_b;\n> +\t__u8 mean_cr_or_r;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_awb_stat - statistics automatic white balance data\n> + *\n> + * @awb_mean: Mean measured data\n> + */\n> +struct cifisp_awb_stat {\n> +\tstruct cifisp_awb_meas awb_mean[CIFISP_AWB_MAX_GRID];\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_bls_meas_val - BLS measured values\n> + *\n> + * @meas_r: Mean measured value for Bayer pattern R\n> + * @meas_gr: Mean measured value for Bayer pattern Gr\n> + * @meas_gb: Mean measured value for Bayer pattern Gb\n> + * @meas_b: Mean measured value for Bayer pattern B\n> + */\n> +struct cifisp_bls_meas_val {\n> +\t__u16 meas_r;\n> +\t__u16 meas_gr;\n> +\t__u16 meas_gb;\n> +\t__u16 meas_b;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_ae_stat - statistics auto exposure data\n> + *\n> + * @exp_mean: Mean luminance value of block xx\n> + * @bls_val:  BLS measured values\n> + *\n> + * Image is divided into 5x5 blocks.\n> + */\n> +struct cifisp_ae_stat {\n> +\t__u8 exp_mean[CIFISP_AE_MEAN_MAX];\n> +\tstruct cifisp_bls_meas_val bls_val;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_af_meas_val - AF measured values\n> + *\n> + * @sum: sharpness, refer to REF_01 for definition\n> + * @lum: luminance, refer to REF_01 for definition\n> + */\n> +struct cifisp_af_meas_val {\n> +\t__u32 sum;\n> +\t__u32 lum;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_af_stat - statistics auto focus data\n> + *\n> + * @window: AF measured value of window x\n> + *\n> + * The module measures the sharpness in 3 windows of selectable size via\n> + * register settings(ISP_AFM_*_A/B/C)\n> + */\n> +struct cifisp_af_stat {\n> +\tstruct cifisp_af_meas_val window[CIFISP_AFM_MAX_WINDOWS];\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct cifisp_hist_stat - statistics histogram data\n> + *\n> + * @hist_bins: measured bin counters\n> + *\n> + * Measurement window divided into 25 sub-windows, set\n> + * with ISP_HIST_XXX\n> + */\n> +struct cifisp_hist_stat {\n> +\t__u16 hist_bins[CIFISP_HIST_BIN_N_MAX];\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Data\n> + *\n> + * @cifisp_awb_stat: statistics data for automatic white balance\n> + * @cifisp_ae_stat: statistics data for auto exposure\n> + * @cifisp_af_stat: statistics data for auto focus\n> + * @cifisp_hist_stat: statistics histogram data\n> + */\n> +struct cifisp_stat {\n> +\tstruct cifisp_awb_stat awb;\n> +\tstruct cifisp_ae_stat ae;\n> +\tstruct cifisp_af_stat af;\n> +\tstruct cifisp_hist_stat hist;\n> +} __attribute__ ((packed));\n> +\n> +/**\n> + * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Meta Data\n> + *\n> + * @meas_type: measurement types (CIFISP_STAT_ definitions)\n> + * @frame_id: frame ID for sync\n> + * @params: statistics data\n> + */\n> +struct rkisp1_stat_buffer {\n> +\t__u32 meas_type;\n> +\t__u32 frame_id;\n> +\tstruct cifisp_stat params;\n> +} __attribute__ ((packed));\n> +\n> +#endif /* _RKISP1_CONFIG_H */\n> diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\n> index 5e739270116d3a21..2639518e2f58c796 100644\n> --- a/include/linux/videodev2.h\n> +++ b/include/linux/videodev2.h\n> @@ -727,6 +727,10 @@ struct v4l2_pix_format {\n>  #define V4L2_META_FMT_UVC         v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */\n>  #define V4L2_META_FMT_D4XX        v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */\n>  \n> +/* Vendor specific - used for IPU3 camera sub-system */\n> +#define V4L2_META_FMT_RK_ISP1_PARAMS   v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 params */\n> +#define V4L2_META_FMT_RK_ISP1_STAT_3A  v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A statistics */\n> +\n>  /* priv field value to indicates that subsequent fields are valid. */\n>  #define V4L2_PIX_FMT_PRIV_MAGIC\t\t0xfeedcafe\n>  \n>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5DFBE60BE5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Aug 2019 17:20:28 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E3038741;\n\tThu, 29 Aug 2019 17:20:27 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1567092028;\n\tbh=1NyghtDdQSsQAXACLLwGFNeYDF7koC1Uh8E6FSoRTJo=;\n\th=Reply-To:Subject:To:References:From:Date:In-Reply-To:From;\n\tb=u5cGyuQCMoCy5X8gSoJGr0v8xmPRgxUhw75S1qgLVaveTw09M5zJ82tCyv1zgtHa8\n\tKajF8zjKbNAoE3WZe1Wqqe7BkHh9OWjeEt0luddPqc8RLeX37WNOlWaLmvlp/e/O1O\n\tIoOecKePoPSBFE3Y0YHadhyo2+TrC9jG7gb2jVWs=","Reply-To":"kieran.bingham@ideasonboard.com","To":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20190828011710.32128-1-niklas.soderlund@ragnatech.se>\n\t<20190828011710.32128-12-niklas.soderlund@ragnatech.se>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\t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","Organization":"Ideas on Board","Message-ID":"<4a27a8d5-636e-d789-72eb-c95de75b8e13@ideasonboard.com>","Date":"Thu, 29 Aug 2019 16:20:25 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.8.0","MIME-Version":"1.0","In-Reply-To":"<20190828011710.32128-12-niklas.soderlund@ragnatech.se>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 11/13] include: linux: Add\n\trkisp1-config.h kernel header","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 29 Aug 2019 15:20:28 -0000"}},{"id":2559,"web_url":"https://patchwork.libcamera.org/comment/2559/","msgid":"<20190829214256.GG8479@bigcity.dyn.berto.se>","date":"2019-08-29T21:42:56","subject":"Re: [libcamera-devel] [PATCH 11/13] include: linux: Add\n\trkisp1-config.h kernel header","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Kieran,\n\nThanks for your feedback.\n\nOn 2019-08-29 16:20:25 +0100, Kieran Bingham wrote:\n> Hi Niklas,\n> \n> On 28/08/2019 02:17, Niklas Söderlund wrote:\n> > Add kernel header for Rockchip ISP1 from the rkisp1 patch set. As the\n> > driver is currently out of tree, the header file is not exported as part\n> > of the standard kernel uAPI.\n> > \n> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> \n> I'll consider this a given, and assume it's taken verbatim ... but do we\n> need to make sure that it is correctly exported and run through any uAPI\n> conversions necessary?\n> \n> Perhaps no change is necessary from the uapi-export process for this\n> header, but worth checking. Like do the \"__attribute__ ((packed));\"\n> usages change to anything?\n\nI did run it thru the scripts/headers_install.sh helper to export it, so \nit *should* have the same style as any other uapi header.\n\n> \n> Or is that the style used by the export process?\n> \n> When confirmed it's suitable for userspace consumption:\n> \n> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nThanks I will collect your tag, but I'm still a bit divided if we should \nmerge this before the rkisp1 driver hits upstream.\n\n> \n> \n> > ---\n> >  include/linux/rkisp1-config.h | 798 ++++++++++++++++++++++++++++++++++\n> >  include/linux/videodev2.h     |   4 +\n> >  2 files changed, 802 insertions(+)\n> >  create mode 100644 include/linux/rkisp1-config.h\n> > \n> > diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h\n> > new file mode 100644\n> > index 0000000000000000..53748672dfea4dcb\n> > --- /dev/null\n> > +++ b/include/linux/rkisp1-config.h\n> > @@ -0,0 +1,798 @@\n> > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)\n> > +/*\n> > + * Rockchip isp1 driver\n> > + * Copyright (C) 2017 Rockchip Electronics Co., Ltd.\n> > + */\n> > +\n> > +/*\n> > + * References:\n> > + * REF_01 - ISP_user_manual, Rev 2.57\n> > + */\n> > +\n> > +#ifndef _RKISP1_CONFIG_H\n> > +#define _RKISP1_CONFIG_H\n> > +\n> > +#include <linux/types.h>\n> > +#include <linux/v4l2-controls.h>\n> > +\n> > +#define CIFISP_MODULE_DPCC              (1 << 0)\n> > +#define CIFISP_MODULE_BLS               (1 << 1)\n> > +#define CIFISP_MODULE_SDG               (1 << 2)\n> > +#define CIFISP_MODULE_HST               (1 << 3)\n> > +#define CIFISP_MODULE_LSC               (1 << 4)\n> > +#define CIFISP_MODULE_AWB_GAIN          (1 << 5)\n> > +#define CIFISP_MODULE_FLT               (1 << 6)\n> > +#define CIFISP_MODULE_BDM               (1 << 7)\n> > +#define CIFISP_MODULE_CTK               (1 << 8)\n> > +#define CIFISP_MODULE_GOC               (1 << 9)\n> > +#define CIFISP_MODULE_CPROC             (1 << 10)\n> > +#define CIFISP_MODULE_AFC               (1 << 11)\n> > +#define CIFISP_MODULE_AWB               (1 << 12)\n> > +#define CIFISP_MODULE_IE                (1 << 13)\n> > +#define CIFISP_MODULE_AEC               (1 << 14)\n> > +#define CIFISP_MODULE_WDR               (1 << 15)\n> > +#define CIFISP_MODULE_DPF               (1 << 16)\n> > +#define CIFISP_MODULE_DPF_STRENGTH      (1 << 17)\n> > +\n> > +#define CIFISP_CTK_COEFF_MAX            0x100\n> > +#define CIFISP_CTK_OFFSET_MAX           0x800\n> > +\n> > +#define CIFISP_AE_MEAN_MAX              25\n> > +#define CIFISP_HIST_BIN_N_MAX           16\n> > +#define CIFISP_AFM_MAX_WINDOWS          3\n> > +#define CIFISP_DEGAMMA_CURVE_SIZE       17\n> > +\n> > +#define CIFISP_BDM_MAX_TH               0xFF\n> > +\n> > +/*\n> > + * Black level compensation\n> > + */\n> > +/* maximum value for horizontal start address */\n> > +#define CIFISP_BLS_START_H_MAX             0x00000FFF\n> > +/* maximum value for horizontal stop address */\n> > +#define CIFISP_BLS_STOP_H_MAX              0x00000FFF\n> > +/* maximum value for vertical start address */\n> > +#define CIFISP_BLS_START_V_MAX             0x00000FFF\n> > +/* maximum value for vertical stop address */\n> > +#define CIFISP_BLS_STOP_V_MAX              0x00000FFF\n> > +/* maximum is 2^18 = 262144*/\n> > +#define CIFISP_BLS_SAMPLES_MAX             0x00000012\n> > +/* maximum value for fixed black level */\n> > +#define CIFISP_BLS_FIX_SUB_MAX             0x00000FFF\n> > +/* minimum value for fixed black level */\n> > +#define CIFISP_BLS_FIX_SUB_MIN             0xFFFFF000\n> > +/* 13 bit range (signed)*/\n> > +#define CIFISP_BLS_FIX_MASK                0x00001FFF\n> > +\n> > +/*\n> > + * Automatic white balance measurments\n> > + */\n> > +#define CIFISP_AWB_MAX_GRID                1\n> > +#define CIFISP_AWB_MAX_FRAMES              7\n> > +\n> > +/*\n> > + * Gamma out\n> > + */\n> > +/* Maximum number of color samples supported */\n> > +#define CIFISP_GAMMA_OUT_MAX_SAMPLES       17\n> > +\n> > +/*\n> > + * Lens shade correction\n> > + */\n> > +#define CIFISP_LSC_GRAD_TBL_SIZE           8\n> > +#define CIFISP_LSC_SIZE_TBL_SIZE           8\n> > +/*\n> > + * The following matches the tuning process,\n> > + * not the max capabilities of the chip.\n> > + * Last value unused.\n> > + */\n> > +#define\tCIFISP_LSC_DATA_TBL_SIZE           290\n> > +\n> > +/*\n> > + * Histogram calculation\n> > + */\n> > +/* Last 3 values unused. */\n> > +#define CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28\n> > +\n> > +/*\n> > + * Defect Pixel Cluster Correction\n> > + */\n> > +#define CIFISP_DPCC_METHODS_MAX       3\n> > +\n> > +/*\n> > + * Denoising pre filter\n> > + */\n> > +#define CIFISP_DPF_MAX_NLF_COEFFS      17\n> > +#define CIFISP_DPF_MAX_SPATIAL_COEFFS  6\n> > +\n> > +/*\n> > + * Measurement types\n> > + */\n> > +#define CIFISP_STAT_AWB           (1 << 0)\n> > +#define CIFISP_STAT_AUTOEXP       (1 << 1)\n> > +#define CIFISP_STAT_AFM_FIN       (1 << 2)\n> > +#define CIFISP_STAT_HIST          (1 << 3)\n> > +\n> > +enum cifisp_histogram_mode {\n> > +\tCIFISP_HISTOGRAM_MODE_DISABLE,\n> > +\tCIFISP_HISTOGRAM_MODE_RGB_COMBINED,\n> > +\tCIFISP_HISTOGRAM_MODE_R_HISTOGRAM,\n> > +\tCIFISP_HISTOGRAM_MODE_G_HISTOGRAM,\n> > +\tCIFISP_HISTOGRAM_MODE_B_HISTOGRAM,\n> > +\tCIFISP_HISTOGRAM_MODE_Y_HISTOGRAM\n> > +};\n> > +\n> > +enum cifisp_awb_mode_type {\n> > +\tCIFISP_AWB_MODE_MANUAL,\n> > +\tCIFISP_AWB_MODE_RGB,\n> > +\tCIFISP_AWB_MODE_YCBCR\n> > +};\n> > +\n> > +enum cifisp_flt_mode {\n> > +\tCIFISP_FLT_STATIC_MODE,\n> > +\tCIFISP_FLT_DYNAMIC_MODE\n> > +};\n> > +\n> > +/**\n> > + * enum cifisp_exp_ctrl_autostop - stop modes\n> > + * @CIFISP_EXP_CTRL_AUTOSTOP_0: continuous measurement\n> > + * @CIFISP_EXP_CTRL_AUTOSTOP_1: stop measuring after a complete frame\n> > + */\n> > +enum cifisp_exp_ctrl_autostop {\n> > +\tCIFISP_EXP_CTRL_AUTOSTOP_0 = 0,\n> > +\tCIFISP_EXP_CTRL_AUTOSTOP_1 = 1,\n> > +};\n> > +\n> > +/**\n> > + * enum cifisp_exp_meas_mode - Exposure measure mode\n> > + * @CIFISP_EXP_MEASURING_MODE_0: Y = 16 + 0.25R + 0.5G + 0.1094B\n> > + * @CIFISP_EXP_MEASURING_MODE_1: Y = (R + G + B) x (85/256)\n> > + */\n> > +enum cifisp_exp_meas_mode {\n> > +\tCIFISP_EXP_MEASURING_MODE_0,\n> > +\tCIFISP_EXP_MEASURING_MODE_1,\n> > +};\n> > +\n> > +/*---------- PART1: Input Parameters ------------*/\n> > +\n> > +struct cifisp_window {\n> > +\t__u16 h_offs;\n> > +\t__u16 v_offs;\n> > +\t__u16 h_size;\n> > +\t__u16 v_size;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_bls_fixed_val - BLS fixed subtraction values\n> > + *\n> > + * The values will be subtracted from the sensor\n> > + * values. Therefore a negative value means addition instead of subtraction!\n> > + *\n> > + * @r: Fixed (signed!) subtraction value for Bayer pattern R\n> > + * @gr: Fixed (signed!) subtraction value for Bayer pattern Gr\n> > + * @gb: Fixed (signed!) subtraction value for Bayer pattern Gb\n> > + * @b: Fixed (signed!) subtraction value for Bayer pattern B\n> > + */\n> > +struct cifisp_bls_fixed_val {\n> > +\t__s16 r;\n> > +\t__s16 gr;\n> > +\t__s16 gb;\n> > +\t__s16 b;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_bls_config - Configuration used by black level subtraction\n> > + *\n> > + * @enable_auto: Automatic mode activated means that the measured values\n> > + * are subtracted. Otherwise the fixed subtraction\n> > + * values will be subtracted.\n> > + * @en_windows: enabled window\n> > + * @bls_window1: Measurement window 1 size\n> > + * @bls_window2: Measurement window 2 size\n> > + * @bls_samples: Set amount of measured pixels for each Bayer position\n> > + * (A, B,C and D) to 2^bls_samples.\n> > + * @cifisp_bls_fixed_val: Fixed subtraction values\n> > + */\n> > +struct cifisp_bls_config {\n> > +\t__u8 enable_auto;\n> > +\t__u8 en_windows;\n> > +\tstruct cifisp_window bls_window1;\n> > +\tstruct cifisp_window bls_window2;\n> > +\t__u8 bls_samples;\n> > +\tstruct cifisp_bls_fixed_val fixed_val;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_dpcc_methods_config - Methods Configuration used by Defect Pixel Cluster Correction\n> > + *\n> > + * @method: Method enable bits\n> > + * @line_thresh: Line threshold\n> > + * @line_mad_fac: Line MAD factor\n> > + * @pg_fac: Peak gradient factor\n> > + * @rnd_thresh: Rank Neighbor Difference threshold\n> > + * @rg_fac: Rank gradient factor\n> > + */\n> > +struct cifisp_dpcc_methods_config {\n> > +\t__u32 method;\n> > +\t__u32 line_thresh;\n> > +\t__u32 line_mad_fac;\n> > +\t__u32 pg_fac;\n> > +\t__u32 rnd_thresh;\n> > +\t__u32 rg_fac;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_dpcc_methods_config - Configuration used by Defect Pixel Cluster Correction\n> > + *\n> > + * @mode: dpcc output mode\n> > + * @output_mode: whether use hard coded methods\n> > + * @set_use: stage1 methods set\n> > + * @methods: methods config\n> > + * @ro_limits: rank order limits\n> > + * @rnd_offs: differential rank offsets for rank neighbor difference\n> > + */\n> > +struct cifisp_dpcc_config {\n> > +\t__u32 mode;\n> > +\t__u32 output_mode;\n> > +\t__u32 set_use;\n> > +\tstruct cifisp_dpcc_methods_config methods[CIFISP_DPCC_METHODS_MAX];\n> > +\t__u32 ro_limits;\n> > +\t__u32 rnd_offs;\n> > +} __attribute__ ((packed));\n> > +\n> > +struct cifisp_gamma_corr_curve {\n> > +\t__u16 gamma_y[CIFISP_DEGAMMA_CURVE_SIZE];\n> > +} __attribute__ ((packed));\n> > +\n> > +struct cifisp_gamma_curve_x_axis_pnts {\n> > +\t__u32 gamma_dx0;\n> > +\t__u32 gamma_dx1;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_gamma_corr_curve - Configuration used by sensor degamma\n> > + *\n> > + * @curve_x: gamma curve point definition axis for x\n> > + * @xa_pnts: x increments\n> > + */\n> > +struct cifisp_sdg_config {\n> > +\tstruct cifisp_gamma_corr_curve curve_r;\n> > +\tstruct cifisp_gamma_corr_curve curve_g;\n> > +\tstruct cifisp_gamma_corr_curve curve_b;\n> > +\tstruct cifisp_gamma_curve_x_axis_pnts xa_pnts;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_lsc_config - Configuration used by Lens shading correction\n> > + *\n> > + * refer to REF_01 for details\n> > + */\n> > +struct cifisp_lsc_config {\n> > +\t__u32 r_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n> > +\t__u32 gr_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n> > +\t__u32 gb_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n> > +\t__u32 b_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];\n> > +\n> > +\t__u32 x_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];\n> > +\t__u32 y_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];\n> > +\n> > +\t__u32 x_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];\n> > +\t__u32 y_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];\n> > +\t__u16 config_width;\n> > +\t__u16 config_height;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_ie_config - Configuration used by image effects\n> > + *\n> > + * @eff_mat_1: 3x3 Matrix Coefficients for Emboss Effect 1\n> > + * @eff_mat_2: 3x3 Matrix Coefficients for Emboss Effect 2\n> > + * @eff_mat_3: 3x3 Matrix Coefficients for Emboss 3/Sketch 1\n> > + * @eff_mat_4: 3x3 Matrix Coefficients for Sketch Effect 2\n> > + * @eff_mat_5: 3x3 Matrix Coefficients for Sketch Effect 3\n> > + * @eff_tint: Chrominance increment values of tint (used for sepia effect)\n> > + */\n> > +struct cifisp_ie_config {\n> > +\t__u16 effect;\n> > +\t__u16 color_sel;\n> > +\t__u16 eff_mat_1;\n> > +\t__u16 eff_mat_2;\n> > +\t__u16 eff_mat_3;\n> > +\t__u16 eff_mat_4;\n> > +\t__u16 eff_mat_5;\n> > +\t__u16 eff_tint;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_cproc_config - Configuration used by Color Processing\n> > + *\n> > + * @c_out_range: Chrominance pixel clipping range at output. (0 for limit, 1 for full)\n> > + * @y_in_range: Luminance pixel clipping range at output.\n> > + * @y_out_range: Luminance pixel clipping range at output.\n> > + * @contrast: 00~ff, 0.0~1.992\n> > + * @brightness: 80~7F, -128~+127\n> > + * @sat: saturation, 00~FF, 0.0~1.992\n> > + * @hue: 80~7F, -90~+87.188\n> > + */\n> > +struct cifisp_cproc_config {\n> > +\t__u8 c_out_range;\n> > +\t__u8 y_in_range;\n> > +\t__u8 y_out_range;\n> > +\t__u8 contrast;\n> > +\t__u8 brightness;\n> > +\t__u8 sat;\n> > +\t__u8 hue;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_awb_meas_config - Configuration used by auto white balance\n> > + *\n> > + * @awb_wnd: white balance measurement window (in pixels) (from enum cifisp_awb_mode_type)\n> > + * @max_y: only pixels values < max_y contribute to awb measurement, set to 0 to disable this feature\n> > + * @min_y: only pixels values > min_y contribute to awb measurement\n> > + * @max_csum: Chrominance sum maximum value, only consider pixels with Cb+Cr, \n> > + * smaller than threshold for awb measurements\n> > + * @min_c: Chrominance minimum value, only consider pixels with Cb/Cr\n> > + * each greater than threshold value for awb measurements\n> > + * @frames: number of frames - 1 used for mean value calculation (ucFrames=0 means 1 Frame)\n> > + * @awb_ref_cr: reference Cr value for AWB regulation, target for AWB\n> > + * @awb_ref_cb: reference Cb value for AWB regulation, target for AWB\n> > + */\n> > +struct cifisp_awb_meas_config {\n> > +\t/*\n> > +\t * Note: currently the h and v offsets are mapped to grid offsets\n> > +\t */\n> > +\tstruct cifisp_window awb_wnd;\n> > +\t__u32 awb_mode;\n> > +\t__u8 max_y;\n> > +\t__u8 min_y;\n> > +\t__u8 max_csum;\n> > +\t__u8 min_c;\n> > +\t__u8 frames;\n> > +\t__u8 awb_ref_cr;\n> > +\t__u8 awb_ref_cb;\n> > +\t__u8 enable_ymax_cmp;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_awb_gain_config - Configuration used by auto white balance gain\n> > + *\n> > + * out_data_x = ( AWB_GEAIN_X * in_data + 128) >> 8\n> > + */\n> > +struct cifisp_awb_gain_config {\n> > +\t__u16 gain_red;\n> > +\t__u16 gain_green_r;\n> > +\t__u16 gain_blue;\n> > +\t__u16 gain_green_b;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_flt_config - Configuration used by ISP filtering\n> > + *\n> > + * @mode: ISP_FILT_MODE register fields (from enum cifisp_flt_mode)\n> > + * @grn_stage1: ISP_FILT_MODE register fields\n> > + * @chr_h_mode: ISP_FILT_MODE register fields\n> > + * @chr_v_mode: ISP_FILT_MODE register fields\n> > + *\n> > + * refer to REF_01 for details.\n> > + */\n> > +\n> > +struct cifisp_flt_config {\n> > +\t__u32 mode;\n> > +\t__u8 grn_stage1;\n> > +\t__u8 chr_h_mode;\n> > +\t__u8 chr_v_mode;\n> > +\t__u32 thresh_bl0;\n> > +\t__u32 thresh_bl1;\n> > +\t__u32 thresh_sh0;\n> > +\t__u32 thresh_sh1;\n> > +\t__u32 lum_weight;\n> > +\t__u32 fac_sh1;\n> > +\t__u32 fac_sh0;\n> > +\t__u32 fac_mid;\n> > +\t__u32 fac_bl0;\n> > +\t__u32 fac_bl1;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_bdm_config - Configuration used by Bayer DeMosaic\n> > + *\n> > + * @demosaic_th: threshod for bayer demosaicing texture detection\n> > + */\n> > +struct cifisp_bdm_config {\n> > +\t__u8 demosaic_th;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_ctk_config - Configuration used by Cross Talk correction\n> > + *\n> > + * @coeff: color correction matrix\n> > + * @ct_offset_b: offset for the crosstalk correction matrix\n> > + */\n> > +struct cifisp_ctk_config {\n> > +\t__u16 coeff0;\n> > +\t__u16 coeff1;\n> > +\t__u16 coeff2;\n> > +\t__u16 coeff3;\n> > +\t__u16 coeff4;\n> > +\t__u16 coeff5;\n> > +\t__u16 coeff6;\n> > +\t__u16 coeff7;\n> > +\t__u16 coeff8;\n> > +\t__u16 ct_offset_r;\n> > +\t__u16 ct_offset_g;\n> > +\t__u16 ct_offset_b;\n> > +} __attribute__ ((packed));\n> > +\n> > +enum cifisp_goc_mode {\n> > +\tCIFISP_GOC_MODE_LOGARITHMIC,\n> > +\tCIFISP_GOC_MODE_EQUIDISTANT\n> > +};\n> > +\n> > +/**\n> > + * struct cifisp_goc_config - Configuration used by Gamma Out correction\n> > + *\n> > + * @mode: goc mode (from enum cifisp_goc_mode)\n> > + * @gamma_y: gamma out curve y-axis for all color components\n> > + */\n> > +struct cifisp_goc_config {\n> > +\t__u32 mode;\n> > +\t__u16 gamma_y[CIFISP_GAMMA_OUT_MAX_SAMPLES];\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_hst_config - Configuration used by Histogram\n> > + *\n> > + * @mode: histogram mode (from enum cifisp_histogram_mode)\n> > + * @histogram_predivider: process every stepsize pixel, all other pixels are skipped\n> > + * @meas_window: coordinates of the measure window\n> > + * @hist_weight: weighting factor for sub-windows\n> > + */\n> > +struct cifisp_hst_config {\n> > +\t__u32 mode;\n> > +\t__u8 histogram_predivider;\n> > +\tstruct cifisp_window meas_window;\n> > +\t__u8 hist_weight[CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE];\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_aec_config - Configuration used by Auto Exposure Control\n> > + *\n> > + * @mode: Exposure measure mode (from enum cifisp_exp_meas_mode)\n> > + * @autostop: stop mode (from enum cifisp_exp_ctrl_autostop)\n> > + * @meas_window: coordinates of the measure window\n> > + */\n> > +struct cifisp_aec_config {\n> > +\t__u32 mode;\n> > +\t__u32 autostop;\n> > +\tstruct cifisp_window meas_window;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_afc_config - Configuration used by Auto Focus Control\n> > + *\n> > + * @num_afm_win: max CIFISP_AFM_MAX_WINDOWS\n> > + * @afm_win: coordinates of the meas window\n> > + * @thres: threshold used for minimizing the influence of noise\n> > + * @var_shift: the number of bits for the shift operation at the end of the calculation chain.\n> > + */\n> > +struct cifisp_afc_config {\n> > +\t__u8 num_afm_win;\n> > +\tstruct cifisp_window afm_win[CIFISP_AFM_MAX_WINDOWS];\n> > +\t__u32 thres;\n> > +\t__u32 var_shift;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * enum cifisp_dpf_gain_usage - dpf gain usage\n> > + * @CIFISP_DPF_GAIN_USAGE_DISABLED: don't use any gains in preprocessing stage\n> > + * @CIFISP_DPF_GAIN_USAGE_NF_GAINS: use only the noise function gains from registers DPF_NF_GAIN_R, ...\n> > + * @CIFISP_DPF_GAIN_USAGE_LSC_GAINS:  use only the gains from LSC module\n> > + * @CIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS: use the noise function gains and the gains from LSC module\n> > + * @CIFISP_DPF_GAIN_USAGE_AWB_GAINS: use only the gains from AWB module\n> > + * @CIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS: use the gains from AWB and LSC module\n> > + * @CIFISP_DPF_GAIN_USAGE_MAX: upper border (only for an internal evaluation)\n> > + */\n> > +enum cifisp_dpf_gain_usage {\n> > +\tCIFISP_DPF_GAIN_USAGE_DISABLED,\n> > +\tCIFISP_DPF_GAIN_USAGE_NF_GAINS,\n> > +\tCIFISP_DPF_GAIN_USAGE_LSC_GAINS,\n> > +\tCIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS,\n> > +\tCIFISP_DPF_GAIN_USAGE_AWB_GAINS,\n> > +\tCIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS,\n> > +\tCIFISP_DPF_GAIN_USAGE_MAX\n> > +};\n> > +\n> > +/**\n> > + * enum cifisp_dpf_gain_usage - dpf gain usage\n> > + * @CIFISP_DPF_RB_FILTERSIZE_13x9: red and blue filter kernel size 13x9 (means 7x5 active pixel)\n> > + * @CIFISP_DPF_RB_FILTERSIZE_9x9: red and blue filter kernel size 9x9 (means 5x5 active pixel)\n> > + */\n> > +enum cifisp_dpf_rb_filtersize {\n> > +\tCIFISP_DPF_RB_FILTERSIZE_13x9,\n> > +\tCIFISP_DPF_RB_FILTERSIZE_9x9,\n> > +};\n> > +\n> > +/**\n> > + * enum cifisp_dpf_nll_scale_mode - dpf noise level scale mode\n> > + * @CIFISP_NLL_SCALE_LINEAR: use a linear scaling\n> > + * @CIFISP_NLL_SCALE_LOGARITHMIC: use a logarithmic scaling\n> > + */\n> > +enum cifisp_dpf_nll_scale_mode {\n> > +\tCIFISP_NLL_SCALE_LINEAR,\n> > +\tCIFISP_NLL_SCALE_LOGARITHMIC,\n> > +};\n> > +\n> > +/**\n> > + * struct cifisp_dpf_nll - Noise level lookup\n> > + *\n> > + * @coeff: Noise level Lookup coefficient\n> > + * @scale_mode: dpf noise level scale mode (from enum cifisp_dpf_nll_scale_mode)\n> > + */\n> > +struct cifisp_dpf_nll {\n> > +\t__u16 coeff[CIFISP_DPF_MAX_NLF_COEFFS];\n> > +\t__u32 scale_mode;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_dpf_rb_flt - Red blue filter config\n> > + *\n> > + * @fltsize: The filter size for the red and blue pixels\n> > + * (from enum cifisp_dpf_rb_filtersize)\n> > + * @spatial_coeff: Spatial weights\n> > + * @r_enable: enable filter processing for red pixels\n> > + * @b_enable: enable filter processing for blue pixels\n> > + */\n> > +struct cifisp_dpf_rb_flt {\n> > +\t__u32 fltsize;\n> > +\t__u8 spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];\n> > +\t__u8 r_enable;\n> > +\t__u8 b_enable;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_dpf_g_flt - Green filter Configuration\n> > + *\n> > + * @spatial_coeff: Spatial weights\n> > + * @gr_enable: enable filter processing for green pixels in green/red lines\n> > + * @gb_enable: enable filter processing for green pixels in green/blue lines\n> > + */\n> > +struct cifisp_dpf_g_flt {\n> > +\t__u8 spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];\n> > +\t__u8 gr_enable;\n> > +\t__u8 gb_enable;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_dpf_gain - Noise function Configuration\n> > + *\n> > + * @mode: dpf gain usage  (from enum cifisp_dpf_gain_usage)\n> > + * @nf_r_gain: Noise function Gain that replaces the AWB gain for red pixels\n> > + * @nf_b_gain: Noise function Gain that replaces the AWB gain for blue pixels\n> > + * @nf_gr_gain: Noise function Gain that replaces the AWB gain\n> > + * for green pixels in a red line\n> > + * @nf_gb_gain: Noise function Gain that replaces the AWB gain\n> > + * for green pixels in a blue line\n> > + */\n> > +struct cifisp_dpf_gain {\n> > +\t__u32 mode;\n> > +\t__u16 nf_r_gain;\n> > +\t__u16 nf_b_gain;\n> > +\t__u16 nf_gr_gain;\n> > +\t__u16 nf_gb_gain;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_dpf_config - Configuration used by De-noising pre-filter\n> > + *\n> > + * @gain: noise function gain\n> > + * @g_flt: green filter config\n> > + * @rb_flt: red blue filter config\n> > + * @nll: noise level lookup\n> > + */\n> > +struct cifisp_dpf_config {\n> > +\tstruct cifisp_dpf_gain gain;\n> > +\tstruct cifisp_dpf_g_flt g_flt;\n> > +\tstruct cifisp_dpf_rb_flt rb_flt;\n> > +\tstruct cifisp_dpf_nll nll;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_dpf_strength_config - strength of the filter\n> > + *\n> > + * @r: filter strength of the RED filter\n> > + * @g: filter strength of the GREEN filter\n> > + * @b: filter strength of the BLUE filter\n> > + */\n> > +struct cifisp_dpf_strength_config {\n> > +\t__u8 r;\n> > +\t__u8 g;\n> > +\t__u8 b;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_isp_other_cfg - Parameters for some blocks in rockchip isp1\n> > + *\n> > + * @dpcc_config: Defect Pixel Cluster Correction config\n> > + * @bls_config: Black Level Subtraction config\n> > + * @sdg_config: sensor degamma config\n> > + * @lsc_config: Lens Shade config\n> > + * @awb_gain_config: Auto White balance gain config\n> > + * @flt_config: filter config\n> > + * @bdm_config: demosaic config\n> > + * @ctk_config: cross talk config\n> > + * @goc_config: gamma out config\n> > + * @bls_config: black level subtraction config\n> > + * @dpf_config: De-noising pre-filter config\n> > + * @dpf_strength_config: dpf strength config\n> > + * @cproc_config: color process config\n> > + * @ie_config: image effects config\n> > + */\n> > +struct cifisp_isp_other_cfg {\n> > +\tstruct cifisp_dpcc_config dpcc_config;\n> > +\tstruct cifisp_bls_config bls_config;\n> > +\tstruct cifisp_sdg_config sdg_config;\n> > +\tstruct cifisp_lsc_config lsc_config;\n> > +\tstruct cifisp_awb_gain_config awb_gain_config;\n> > +\tstruct cifisp_flt_config flt_config;\n> > +\tstruct cifisp_bdm_config bdm_config;\n> > +\tstruct cifisp_ctk_config ctk_config;\n> > +\tstruct cifisp_goc_config goc_config;\n> > +\tstruct cifisp_dpf_config dpf_config;\n> > +\tstruct cifisp_dpf_strength_config dpf_strength_config;\n> > +\tstruct cifisp_cproc_config cproc_config;\n> > +\tstruct cifisp_ie_config ie_config;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_isp_meas_cfg - Rockchip ISP1 Measure Parameters\n> > + *\n> > + * @awb_meas_config: auto white balance config\n> > + * @hst_config: histogram config\n> > + * @aec_config: auto exposure config\n> > + * @afc_config: auto focus config\n> > + */\n> > +struct cifisp_isp_meas_cfg {\n> > +\tstruct cifisp_awb_meas_config awb_meas_config;\n> > +\tstruct cifisp_hst_config hst_config;\n> > +\tstruct cifisp_aec_config aec_config;\n> > +\tstruct cifisp_afc_config afc_config;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct rkisp1_isp_params_cfg - Rockchip ISP1 Input Parameters Meta Data\n> > + *\n> > + * @module_en_update: mask the enable bits of which module should be updated\n> > + * @module_ens: mask the enable value of each module, only update the module\n> > + * which correspond bit was set in module_en_update\n> > + * @module_cfg_update: mask the config bits of which module should be updated\n> > + * @meas: measurement config\n> > + * @others: other config\n> > + */\n> > +struct rkisp1_isp_params_cfg {\n> > +\t__u32 module_en_update;\n> > +\t__u32 module_ens;\n> > +\t__u32 module_cfg_update;\n> > +\n> > +\tstruct cifisp_isp_meas_cfg meas;\n> > +\tstruct cifisp_isp_other_cfg others;\n> > +} __attribute__ ((packed));\n> > +\n> > +/*---------- PART2: Measurement Statistics ------------*/\n> > +\n> > +/**\n> > + * struct cifisp_bls_meas_val - AWB measured values\n> > + *\n> > + * @cnt: White pixel count, number of \"white pixels\" found during laster measurement\n> > + * @mean_y_or_g: Mean value of Y within window and frames, Green if RGB is selected.\n> > + * @mean_cb_or_b: Mean value of Cb within window and frames, Blue if RGB is selected.\n> > + * @mean_cr_or_r: Mean value of Cr within window and frames, Red if RGB is selected.\n> > + */\n> > +struct cifisp_awb_meas {\n> > +\t__u32 cnt;\n> > +\t__u8 mean_y_or_g;\n> > +\t__u8 mean_cb_or_b;\n> > +\t__u8 mean_cr_or_r;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_awb_stat - statistics automatic white balance data\n> > + *\n> > + * @awb_mean: Mean measured data\n> > + */\n> > +struct cifisp_awb_stat {\n> > +\tstruct cifisp_awb_meas awb_mean[CIFISP_AWB_MAX_GRID];\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_bls_meas_val - BLS measured values\n> > + *\n> > + * @meas_r: Mean measured value for Bayer pattern R\n> > + * @meas_gr: Mean measured value for Bayer pattern Gr\n> > + * @meas_gb: Mean measured value for Bayer pattern Gb\n> > + * @meas_b: Mean measured value for Bayer pattern B\n> > + */\n> > +struct cifisp_bls_meas_val {\n> > +\t__u16 meas_r;\n> > +\t__u16 meas_gr;\n> > +\t__u16 meas_gb;\n> > +\t__u16 meas_b;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_ae_stat - statistics auto exposure data\n> > + *\n> > + * @exp_mean: Mean luminance value of block xx\n> > + * @bls_val:  BLS measured values\n> > + *\n> > + * Image is divided into 5x5 blocks.\n> > + */\n> > +struct cifisp_ae_stat {\n> > +\t__u8 exp_mean[CIFISP_AE_MEAN_MAX];\n> > +\tstruct cifisp_bls_meas_val bls_val;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_af_meas_val - AF measured values\n> > + *\n> > + * @sum: sharpness, refer to REF_01 for definition\n> > + * @lum: luminance, refer to REF_01 for definition\n> > + */\n> > +struct cifisp_af_meas_val {\n> > +\t__u32 sum;\n> > +\t__u32 lum;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_af_stat - statistics auto focus data\n> > + *\n> > + * @window: AF measured value of window x\n> > + *\n> > + * The module measures the sharpness in 3 windows of selectable size via\n> > + * register settings(ISP_AFM_*_A/B/C)\n> > + */\n> > +struct cifisp_af_stat {\n> > +\tstruct cifisp_af_meas_val window[CIFISP_AFM_MAX_WINDOWS];\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct cifisp_hist_stat - statistics histogram data\n> > + *\n> > + * @hist_bins: measured bin counters\n> > + *\n> > + * Measurement window divided into 25 sub-windows, set\n> > + * with ISP_HIST_XXX\n> > + */\n> > +struct cifisp_hist_stat {\n> > +\t__u16 hist_bins[CIFISP_HIST_BIN_N_MAX];\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Data\n> > + *\n> > + * @cifisp_awb_stat: statistics data for automatic white balance\n> > + * @cifisp_ae_stat: statistics data for auto exposure\n> > + * @cifisp_af_stat: statistics data for auto focus\n> > + * @cifisp_hist_stat: statistics histogram data\n> > + */\n> > +struct cifisp_stat {\n> > +\tstruct cifisp_awb_stat awb;\n> > +\tstruct cifisp_ae_stat ae;\n> > +\tstruct cifisp_af_stat af;\n> > +\tstruct cifisp_hist_stat hist;\n> > +} __attribute__ ((packed));\n> > +\n> > +/**\n> > + * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Meta Data\n> > + *\n> > + * @meas_type: measurement types (CIFISP_STAT_ definitions)\n> > + * @frame_id: frame ID for sync\n> > + * @params: statistics data\n> > + */\n> > +struct rkisp1_stat_buffer {\n> > +\t__u32 meas_type;\n> > +\t__u32 frame_id;\n> > +\tstruct cifisp_stat params;\n> > +} __attribute__ ((packed));\n> > +\n> > +#endif /* _RKISP1_CONFIG_H */\n> > diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\n> > index 5e739270116d3a21..2639518e2f58c796 100644\n> > --- a/include/linux/videodev2.h\n> > +++ b/include/linux/videodev2.h\n> > @@ -727,6 +727,10 @@ struct v4l2_pix_format {\n> >  #define V4L2_META_FMT_UVC         v4l2_fourcc('U', 'V', 'C', 'H') /* UVC Payload Header metadata */\n> >  #define V4L2_META_FMT_D4XX        v4l2_fourcc('D', '4', 'X', 'X') /* D4XX Payload Header metadata */\n> >  \n> > +/* Vendor specific - used for IPU3 camera sub-system */\n> > +#define V4L2_META_FMT_RK_ISP1_PARAMS   v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 params */\n> > +#define V4L2_META_FMT_RK_ISP1_STAT_3A  v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A statistics */\n> > +\n> >  /* priv field value to indicates that subsequent fields are valid. */\n> >  #define V4L2_PIX_FMT_PRIV_MAGIC\t\t0xfeedcafe\n> >  \n> > \n> \n> -- \n> Regards\n> --\n> Kieran","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x144.google.com (mail-lf1-x144.google.com\n\t[IPv6:2a00:1450:4864:20::144])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 94D3F60BE5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Aug 2019 23:42:58 +0200 (CEST)","by mail-lf1-x144.google.com with SMTP id c12so3703524lfh.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Aug 2019 14:42:58 -0700 (PDT)","from localhost (h-177-236.A463.priv.bahnhof.se. [217.31.177.236])\n\tby smtp.gmail.com with ESMTPSA id\n\tz20sm526617ljz.24.2019.08.29.14.42.56\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 29 Aug 2019 14:42:57 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=F/+x48bsLQiYbpNJfXBUvX15ZZgU4IvHhCW6x36Rup0=;\n\tb=nFg+S50nuG1oUHX5zE9QWCtNgDEKZFCf4Uio+aVNFQ3Xc+wxqjmXUv6cnEyyQp11V7\n\tsojlA5OmWOctQ0jbe/PyQv9wptukkkw77jJ4Ykd6JDzZK4KtFzWsVUZc+r+ps9/zBEFW\n\twVMJaq/rMo8ImaNg74haCyKPLsK2wR3V8Edr1IGLUeOjLd4ob5Z83AHWOx2KMOV3xjxs\n\tZJRc6UXL0+TDoJx2YATrirVBERSLO6cVXfsBcskcxsOLKc2dzim+3hJVxdTc+9GTHHrd\n\tMyuJ1G0txRzVDeA6HhnE3+MbLIhDDvbxvUbuMHB3SmsjJM+/8KG1hG1FNi4nZYrZ9rIR\n\thS8Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=F/+x48bsLQiYbpNJfXBUvX15ZZgU4IvHhCW6x36Rup0=;\n\tb=Y9Bb6olMYUZj8ps3O8eqj9fCWCOlE5SEfUu+ANQayCuEh4/m4HB9EEV6OCSnWkDJhe\n\tvJo6CeUv3GzErCkORH+vD+BxFwhxRm80JWOw/11SKTxkN7frJw8apl05gEKeFOSd5dXq\n\tGU93ph9EoiyQ+jFkB8x4U7G6/jMLQCWpz1SdP3V+swX6ezNvx5cCZTyAXivHZNw2HQRg\n\t5PLVoDtaV2imKfVf/3JcaLBWaMvlQQGTdI0L0WAW4sbAfa2jmskwF5h+3uDJqkA3O0UB\n\tyUCI0acFI6FCbXVMM9XEBcQsXed8hiRoUWD2IOXMWpz68cXvVEI9wyyuJBbcckqqqVD7\n\tDiBw==","X-Gm-Message-State":"APjAAAVzdHjGskKVEmc3MAmJZAaS78BEvrOnW4L9SjKa5yUHj0veFsfT\n\tdkKic4zAvJTYePsWtRAT1jjTLw==","X-Google-Smtp-Source":"APXvYqzVZXHEx91tbUpzODiFGF/DHnpIhBD2Omj1yY38JfyzoZy3eK/2hI3Ruxm2FaxYAI+vv+ktdw==","X-Received":"by 2002:ac2:51a3:: with SMTP id f3mr7277376lfk.94.1567114977649; \n\tThu, 29 Aug 2019 14:42:57 -0700 (PDT)","Date":"Thu, 29 Aug 2019 23:42:56 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190829214256.GG8479@bigcity.dyn.berto.se>","References":"<20190828011710.32128-1-niklas.soderlund@ragnatech.se>\n\t<20190828011710.32128-12-niklas.soderlund@ragnatech.se>\n\t<4a27a8d5-636e-d789-72eb-c95de75b8e13@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<4a27a8d5-636e-d789-72eb-c95de75b8e13@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH 11/13] include: linux: Add\n\trkisp1-config.h kernel header","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 29 Aug 2019 21:42:58 -0000"}}]