[{"id":2613,"web_url":"https://patchwork.libcamera.org/comment/2613/","msgid":"<20190904223607.GP5433@pendragon.ideasonboard.com>","date":"2019-09-04T22:36:07","subject":"Re: [libcamera-devel] [PATCH v2 12/14] include: linux: Add\n\trkisp1-config.h kernel header","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Fri, Aug 30, 2019 at 01:26:51AM +0200, 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\nCould you mention which version this came from ? A link to\nlore.kernel.org would be best if possible.\n\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  include/linux/rkisp1-config.h | 798 ++++++++++++++++++++++++++++++++++\n>  include/linux/videodev2.h     |   4 +\n\nvideodev2.h isn't mentioned in the commit message. Apart from that,\n\nAcked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\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>","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6AAB260BB2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Sep 2019 00:36:14 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D9EB5440;\n\tThu,  5 Sep 2019 00:36:13 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1567636574;\n\tbh=FXx0wCHxS+L6NaibHFr9PmvNjhPdwcw24A3/tjeatbQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=chbdJvC83FSAoYTePjYyayb1OWMvEAYTVBvDofcyrZkl4R0te0rrS2hhmCKw3t7tL\n\tEXM9q1i0Xaa+WWtHAelNHt/XQGXX+/dRLUPNoP9G2WN1gaPYY3ndF3WVQBbMvz+LkQ\n\tr8Ac1SHWL8KqaZwedzRUWC0g+czQMnWk+0/Lh25g=","Date":"Thu, 5 Sep 2019 01:36:07 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190904223607.GP5433@pendragon.ideasonboard.com>","References":"<20190829232653.13214-1-niklas.soderlund@ragnatech.se>\n\t<20190829232653.13214-13-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190829232653.13214-13-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 12/14] 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":"Wed, 04 Sep 2019 22:36:14 -0000"}}]