[libcamera-devel] [PATCH 2/2] include: linux: Update rkisp1 header
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Sep 28 22:18:17 CEST 2020
Hi Niklas,
Thank you for the patch.
On Mon, Sep 28, 2020 at 10:13:11PM +0200, Niklas Söderlund wrote:
> Refresh the RkISP1 user-space header to match the latest state in the
> media-tree [1]. This requires update of symbol names in the RkISP1 IPA
> but there is no functional change.
>
> Unfortunately the upstream header has a few problems that needs to be
> fixed before it can be used.
>
> 1. The SPDX header does not satisfy the Linux scripts/headers_install.sh
> so the installation step have to be done manually (dropping _UAPI
> prefix from header include guard). Issue is reported upstream.
>
> 2. The BIT() macro is used in the header but unfortunately this macro
> is not accessible in user-space headers. Fix this by reverting back
> to open code setting the bit without macro. Fix submitted upstream
> and acked by maintainer.
>
> 1. d7a81a5b07313535 ("media: staging: rkisp1: uapi: remove __packed")
> 2. [PATCH] staging: rkisp1: uapi: Do not use BIT() macro
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
Acked-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
By the way, the BIT() macro is meant to avoid the undefined behaviour of
(1 << 31). It may be nice to write
#define CIFISP_MODULE_DPCC (1U << 0)
instead in UAPI headers.
> ---
> include/linux/rkisp1-config.h | 720 +++++++++++++++++++---------------
> src/ipa/rkisp1/rkisp1.cpp | 20 +-
> 2 files changed, 406 insertions(+), 334 deletions(-)
>
> diff --git a/include/linux/rkisp1-config.h b/include/linux/rkisp1-config.h
> index f0d1bd82e857fd79..a795a2a4f6bd7ad4 100644
> --- a/include/linux/rkisp1-config.h
> +++ b/include/linux/rkisp1-config.h
> @@ -1,169 +1,195 @@
> /* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
> /*
> - * Rockchip isp1 driver
> + * Rockchip ISP1 userspace API
> * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
> */
>
> -/*
> - * TODO: Improve documentation, mostly regarding abbreviation and hardware
> - * specificities.
> - */
> -
> #ifndef _RKISP1_CONFIG_H
> #define _RKISP1_CONFIG_H
>
> #include <linux/types.h>
> -#include <linux/v4l2-controls.h>
>
> -#define CIFISP_MODULE_DPCC (1 << 0)
> -#define CIFISP_MODULE_BLS (1 << 1)
> -#define CIFISP_MODULE_SDG (1 << 2)
> -#define CIFISP_MODULE_HST (1 << 3)
> -#define CIFISP_MODULE_LSC (1 << 4)
> -#define CIFISP_MODULE_AWB_GAIN (1 << 5)
> -#define CIFISP_MODULE_FLT (1 << 6)
> -#define CIFISP_MODULE_BDM (1 << 7)
> -#define CIFISP_MODULE_CTK (1 << 8)
> -#define CIFISP_MODULE_GOC (1 << 9)
> -#define CIFISP_MODULE_CPROC (1 << 10)
> -#define CIFISP_MODULE_AFC (1 << 11)
> -#define CIFISP_MODULE_AWB (1 << 12)
> -#define CIFISP_MODULE_IE (1 << 13)
> -#define CIFISP_MODULE_AEC (1 << 14)
> -#define CIFISP_MODULE_WDR (1 << 15)
> -#define CIFISP_MODULE_DPF (1 << 16)
> -#define CIFISP_MODULE_DPF_STRENGTH (1 << 17)
> +/* Vendor specific - used for RK_ISP1 camera sub-system */
> +#define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 params */
> +#define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A statistics */
>
> -#define CIFISP_CTK_COEFF_MAX 0x100
> -#define CIFISP_CTK_OFFSET_MAX 0x800
> +/* Defect Pixel Cluster Detection */
> +#define RKISP1_CIF_ISP_MODULE_DPCC (1 << 0)
> +/* Black Level Subtraction */
> +#define RKISP1_CIF_ISP_MODULE_BLS (1 << 1)
> +/* Sensor De-gamma */
> +#define RKISP1_CIF_ISP_MODULE_SDG (1 << 2)
> +/* Histogram */
> +#define RKISP1_CIF_ISP_MODULE_HST (1 << 3)
> +/* Lens Shade Control */
> +#define RKISP1_CIF_ISP_MODULE_LSC (1 << 4)
> +/* Auto White Balance Gain */
> +#define RKISP1_CIF_ISP_MODULE_AWB_GAIN (1 << 5)
> +/* Filter */
> +#define RKISP1_CIF_ISP_MODULE_FLT (1 << 6)
> +/* Bayer Demosaic */
> +#define RKISP1_CIF_ISP_MODULE_BDM (1 << 7)
> +/* Cross Talk */
> +#define RKISP1_CIF_ISP_MODULE_CTK (1 << 8)
> +/* Gamma Out Curve */
> +#define RKISP1_CIF_ISP_MODULE_GOC (1 << 9)
> +/* Color Processing */
> +#define RKISP1_CIF_ISP_MODULE_CPROC (1 << 10)
> +/* Auto Focus Control */
> +#define RKISP1_CIF_ISP_MODULE_AFC (1 << 11)
> +/* Auto White Balancing */
> +#define RKISP1_CIF_ISP_MODULE_AWB (1 << 12)
> +/* Image Effect */
> +#define RKISP1_CIF_ISP_MODULE_IE (1 << 13)
> +/* Auto Exposure Control */
> +#define RKISP1_CIF_ISP_MODULE_AEC (1 << 14)
> +/* Wide Dynamic Range */
> +#define RKISP1_CIF_ISP_MODULE_WDR (1 << 15)
> +/* Denoise Pre-Filter */
> +#define RKISP1_CIF_ISP_MODULE_DPF (1 << 16)
> +/* Denoise Pre-Filter Strength */
> +#define RKISP1_CIF_ISP_MODULE_DPF_STRENGTH (1 << 17)
>
> -#define CIFISP_AE_MEAN_MAX 25
> -#define CIFISP_HIST_BIN_N_MAX 16
> -#define CIFISP_AFM_MAX_WINDOWS 3
> -#define CIFISP_DEGAMMA_CURVE_SIZE 17
> +#define RKISP1_CIF_ISP_CTK_COEFF_MAX 0x100
> +#define RKISP1_CIF_ISP_CTK_OFFSET_MAX 0x800
>
> -#define CIFISP_BDM_MAX_TH 0xFF
> +#define RKISP1_CIF_ISP_AE_MEAN_MAX 25
> +#define RKISP1_CIF_ISP_HIST_BIN_N_MAX 16
> +#define RKISP1_CIF_ISP_AFM_MAX_WINDOWS 3
> +#define RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE 17
> +
> +#define RKISP1_CIF_ISP_BDM_MAX_TH 0xff
>
> /*
> * Black level compensation
> */
> /* maximum value for horizontal start address */
> -#define CIFISP_BLS_START_H_MAX 0x00000FFF
> +#define RKISP1_CIF_ISP_BLS_START_H_MAX 0x00000fff
> /* maximum value for horizontal stop address */
> -#define CIFISP_BLS_STOP_H_MAX 0x00000FFF
> +#define RKISP1_CIF_ISP_BLS_STOP_H_MAX 0x00000fff
> /* maximum value for vertical start address */
> -#define CIFISP_BLS_START_V_MAX 0x00000FFF
> +#define RKISP1_CIF_ISP_BLS_START_V_MAX 0x00000fff
> /* maximum value for vertical stop address */
> -#define CIFISP_BLS_STOP_V_MAX 0x00000FFF
> +#define RKISP1_CIF_ISP_BLS_STOP_V_MAX 0x00000fff
> /* maximum is 2^18 = 262144*/
> -#define CIFISP_BLS_SAMPLES_MAX 0x00000012
> +#define RKISP1_CIF_ISP_BLS_SAMPLES_MAX 0x00000012
> /* maximum value for fixed black level */
> -#define CIFISP_BLS_FIX_SUB_MAX 0x00000FFF
> +#define RKISP1_CIF_ISP_BLS_FIX_SUB_MAX 0x00000fff
> /* minimum value for fixed black level */
> -#define CIFISP_BLS_FIX_SUB_MIN 0xFFFFF000
> +#define RKISP1_CIF_ISP_BLS_FIX_SUB_MIN 0xfffff000
> /* 13 bit range (signed)*/
> -#define CIFISP_BLS_FIX_MASK 0x00001FFF
> +#define RKISP1_CIF_ISP_BLS_FIX_MASK 0x00001fff
>
> /*
> - * Automatic white balance measurments
> + * Automatic white balance measurements
> */
> -#define CIFISP_AWB_MAX_GRID 1
> -#define CIFISP_AWB_MAX_FRAMES 7
> +#define RKISP1_CIF_ISP_AWB_MAX_GRID 1
> +#define RKISP1_CIF_ISP_AWB_MAX_FRAMES 7
>
> /*
> * Gamma out
> */
> /* Maximum number of color samples supported */
> -#define CIFISP_GAMMA_OUT_MAX_SAMPLES 17
> +#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES 17
>
> /*
> * Lens shade correction
> */
> -#define CIFISP_LSC_GRAD_TBL_SIZE 8
> -#define CIFISP_LSC_SIZE_TBL_SIZE 8
> +#define RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE 8
> +
> /*
> * The following matches the tuning process,
> * not the max capabilities of the chip.
> - * Last value unused.
> */
> -#define CIFISP_LSC_DATA_TBL_SIZE 290
> +#define RKISP1_CIF_ISP_LSC_SAMPLES_MAX 17
>
> /*
> * Histogram calculation
> */
> /* Last 3 values unused. */
> -#define CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28
> +#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28
>
> /*
> * Defect Pixel Cluster Correction
> */
> -#define CIFISP_DPCC_METHODS_MAX 3
> +#define RKISP1_CIF_ISP_DPCC_METHODS_MAX 3
>
> /*
> * Denoising pre filter
> */
> -#define CIFISP_DPF_MAX_NLF_COEFFS 17
> -#define CIFISP_DPF_MAX_SPATIAL_COEFFS 6
> +#define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS 17
> +#define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6
>
> /*
> * Measurement types
> */
> -#define CIFISP_STAT_AWB (1 << 0)
> -#define CIFISP_STAT_AUTOEXP (1 << 1)
> -#define CIFISP_STAT_AFM_FIN (1 << 2)
> -#define CIFISP_STAT_HIST (1 << 3)
> +#define RKISP1_CIF_ISP_STAT_AWB (1 << 0)
> +#define RKISP1_CIF_ISP_STAT_AUTOEXP (1 << 1)
> +#define RKISP1_CIF_ISP_STAT_AFM (1 << 2)
> +#define RKISP1_CIF_ISP_STAT_HIST (1 << 3)
>
> -enum cifisp_histogram_mode {
> - CIFISP_HISTOGRAM_MODE_DISABLE,
> - CIFISP_HISTOGRAM_MODE_RGB_COMBINED,
> - CIFISP_HISTOGRAM_MODE_R_HISTOGRAM,
> - CIFISP_HISTOGRAM_MODE_G_HISTOGRAM,
> - CIFISP_HISTOGRAM_MODE_B_HISTOGRAM,
> - CIFISP_HISTOGRAM_MODE_Y_HISTOGRAM
> +enum rkisp1_cif_isp_histogram_mode {
> + RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
> + RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
> + RKISP1_CIF_ISP_HISTOGRAM_MODE_R_HISTOGRAM,
> + RKISP1_CIF_ISP_HISTOGRAM_MODE_G_HISTOGRAM,
> + RKISP1_CIF_ISP_HISTOGRAM_MODE_B_HISTOGRAM,
> + RKISP1_CIF_ISP_HISTOGRAM_MODE_Y_HISTOGRAM
> };
>
> -enum cifisp_awb_mode_type {
> - CIFISP_AWB_MODE_MANUAL,
> - CIFISP_AWB_MODE_RGB,
> - CIFISP_AWB_MODE_YCBCR
> +enum rkisp1_cif_isp_awb_mode_type {
> + RKISP1_CIF_ISP_AWB_MODE_MANUAL,
> + RKISP1_CIF_ISP_AWB_MODE_RGB,
> + RKISP1_CIF_ISP_AWB_MODE_YCBCR
> };
>
> -enum cifisp_flt_mode {
> - CIFISP_FLT_STATIC_MODE,
> - CIFISP_FLT_DYNAMIC_MODE
> +enum rkisp1_cif_isp_flt_mode {
> + RKISP1_CIF_ISP_FLT_STATIC_MODE,
> + RKISP1_CIF_ISP_FLT_DYNAMIC_MODE
> };
>
> /**
> - * enum cifisp_exp_ctrl_autostop - stop modes
> - * @CIFISP_EXP_CTRL_AUTOSTOP_0: continuous measurement
> - * @CIFISP_EXP_CTRL_AUTOSTOP_1: stop measuring after a complete frame
> + * enum rkisp1_cif_isp_exp_ctrl_autostop - stop modes
> + * @RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0: continuous measurement
> + * @RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1: stop measuring after a complete frame
> */
> -enum cifisp_exp_ctrl_autostop {
> - CIFISP_EXP_CTRL_AUTOSTOP_0 = 0,
> - CIFISP_EXP_CTRL_AUTOSTOP_1 = 1,
> +enum rkisp1_cif_isp_exp_ctrl_autostop {
> + RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0 = 0,
> + RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1 = 1,
> };
>
> /**
> - * enum cifisp_exp_meas_mode - Exposure measure mode
> - * @CIFISP_EXP_MEASURING_MODE_0: Y = 16 + 0.25R + 0.5G + 0.1094B
> - * @CIFISP_EXP_MEASURING_MODE_1: Y = (R + G + B) x (85/256)
> + * enum rkisp1_cif_isp_exp_meas_mode - Exposure measure mode
> + * @RKISP1_CIF_ISP_EXP_MEASURING_MODE_0: Y = 16 + 0.25R + 0.5G + 0.1094B
> + * @RKISP1_CIF_ISP_EXP_MEASURING_MODE_1: Y = (R + G + B) x (85/256)
> */
> -enum cifisp_exp_meas_mode {
> - CIFISP_EXP_MEASURING_MODE_0,
> - CIFISP_EXP_MEASURING_MODE_1,
> +enum rkisp1_cif_isp_exp_meas_mode {
> + RKISP1_CIF_ISP_EXP_MEASURING_MODE_0,
> + RKISP1_CIF_ISP_EXP_MEASURING_MODE_1,
> };
>
> /*---------- PART1: Input Parameters ------------*/
>
> -struct cifisp_window {
> +/**
> + * struct rkisp1_cif_isp_window - measurement window.
> + *
> + * Measurements are calculated per window inside the frame.
> + * This struct represents a window for a measurement.
> + *
> + * @h_offs: the horizontal offset of the window from the left of the frame in pixels.
> + * @v_offs: the vertical offset of the window from the top of the frame in pixels.
> + * @h_size: the horizontal size of the window in pixels
> + * @v_size: the vertical size of the window in pixels.
> + */
> +struct rkisp1_cif_isp_window {
> __u16 h_offs;
> __u16 v_offs;
> __u16 h_size;
> __u16 v_size;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_bls_fixed_val - BLS fixed subtraction values
> + * struct rkisp1_cif_isp_bls_fixed_val - BLS fixed subtraction values
> *
> * The values will be subtracted from the sensor
> * values. Therefore a negative value means addition instead of subtraction!
> @@ -173,15 +199,15 @@ struct cifisp_window {
> * @gb: Fixed (signed!) subtraction value for Bayer pattern Gb
> * @b: Fixed (signed!) subtraction value for Bayer pattern B
> */
> -struct cifisp_bls_fixed_val {
> +struct rkisp1_cif_isp_bls_fixed_val {
> __s16 r;
> __s16 gr;
> __s16 gb;
> __s16 b;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_bls_config - Configuration used by black level subtraction
> + * struct rkisp1_cif_isp_bls_config - Configuration used by black level subtraction
> *
> * @enable_auto: Automatic mode activated means that the measured values
> * are subtracted. Otherwise the fixed subtraction
> @@ -191,19 +217,19 @@ struct cifisp_bls_fixed_val {
> * @bls_window2: Measurement window 2 size
> * @bls_samples: Set amount of measured pixels for each Bayer position
> * (A, B,C and D) to 2^bls_samples.
> - * @cifisp_bls_fixed_val: Fixed subtraction values
> + * @fixed_val: Fixed subtraction values
> */
> -struct cifisp_bls_config {
> +struct rkisp1_cif_isp_bls_config {
> __u8 enable_auto;
> __u8 en_windows;
> - struct cifisp_window bls_window1;
> - struct cifisp_window bls_window2;
> + struct rkisp1_cif_isp_window bls_window1;
> + struct rkisp1_cif_isp_window bls_window2;
> __u8 bls_samples;
> - struct cifisp_bls_fixed_val fixed_val;
> -} __attribute__ ((packed));
> + struct rkisp1_cif_isp_bls_fixed_val fixed_val;
> +};
>
> /**
> - * struct cifisp_dpcc_methods_config - Methods Configuration used by DPCC
> + * struct rkisp1_cif_isp_dpcc_methods_config - Methods Configuration used by DPCC
> *
> * Methods Configuration used by Defect Pixel Cluster Correction
> *
> @@ -214,17 +240,17 @@ struct cifisp_bls_config {
> * @rnd_thresh: Rank Neighbor Difference threshold
> * @rg_fac: Rank gradient factor
> */
> -struct cifisp_dpcc_methods_config {
> +struct rkisp1_cif_isp_dpcc_methods_config {
> __u32 method;
> __u32 line_thresh;
> __u32 line_mad_fac;
> __u32 pg_fac;
> __u32 rnd_thresh;
> __u32 rg_fac;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_dpcc_methods_config - Configuration used by DPCC
> + * struct rkisp1_cif_isp_dpcc_config - Configuration used by DPCC
> *
> * Configuration used by Defect Pixel Cluster Correction
> *
> @@ -235,60 +261,95 @@ struct cifisp_dpcc_methods_config {
> * @ro_limits: rank order limits
> * @rnd_offs: differential rank offsets for rank neighbor difference
> */
> -struct cifisp_dpcc_config {
> +struct rkisp1_cif_isp_dpcc_config {
> __u32 mode;
> __u32 output_mode;
> __u32 set_use;
> - struct cifisp_dpcc_methods_config methods[CIFISP_DPCC_METHODS_MAX];
> + struct rkisp1_cif_isp_dpcc_methods_config methods[RKISP1_CIF_ISP_DPCC_METHODS_MAX];
> __u32 ro_limits;
> __u32 rnd_offs;
> -} __attribute__ ((packed));
> +};
>
> -struct cifisp_gamma_corr_curve {
> - __u16 gamma_y[CIFISP_DEGAMMA_CURVE_SIZE];
> -} __attribute__ ((packed));
> +/**
> + * struct rkisp1_cif_isp_gamma_corr_curve - gamma curve point definition y-axis (output).
> + *
> + * The reset values define a linear curve which has the same effect as bypass. Reset values are:
> + * gamma_y[0] = 0x0000, gamma_y[1] = 0x0100, ... gamma_y[15] = 0x0f00, gamma_y[16] = 0xfff
> + *
> + * @gamma_y: the values for the y-axis of gamma curve points. Each value is 12 bit.
> + */
> +struct rkisp1_cif_isp_gamma_corr_curve {
> + __u16 gamma_y[RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE];
> +};
>
> -struct cifisp_gamma_curve_x_axis_pnts {
> +/**
> + * struct rkisp1_cif_isp_gamma_curve_x_axis_pnts - De-Gamma Curve definition x increments
> + * (sampling points). gamma_dx0 is for the lower samples (1-8), gamma_dx1 is for the
> + * higher samples (9-16). The reset values for both fields is 0x44444444. This means
> + * that each sample is 4 units away from the previous one on the x-axis.
> + *
> + * @gamma_dx0: gamma curve sample points definitions. Bits 0:2 for sample 1. Bit 3 unused.
> + * Bits 4:6 for sample 2. bit 7 unused ... Bits 28:30 for sample 8. Bit 31 unused
> + * @gamma_dx1: gamma curve sample points definitions. Bits 0:2 for sample 9. Bit 3 unused.
> + * Bits 4:6 for sample 10. bit 7 unused ... Bits 28:30 for sample 16. Bit 31 unused
> + */
> +struct rkisp1_cif_isp_gamma_curve_x_axis_pnts {
> __u32 gamma_dx0;
> __u32 gamma_dx1;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_gamma_corr_curve - Configuration used by sensor degamma
> + * struct rkisp1_cif_isp_sdg_config - Configuration used by sensor degamma
> *
> - * @curve_x: gamma curve point definition axis for x
> - * @xa_pnts: x increments
> + * @curve_r: gamma curve point definition axis for red
> + * @curve_g: gamma curve point definition axis for green
> + * @curve_b: gamma curve point definition axis for blue
> + * @xa_pnts: x axis increments
> */
> -struct cifisp_sdg_config {
> - struct cifisp_gamma_corr_curve curve_r;
> - struct cifisp_gamma_corr_curve curve_g;
> - struct cifisp_gamma_corr_curve curve_b;
> - struct cifisp_gamma_curve_x_axis_pnts xa_pnts;
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_sdg_config {
> + struct rkisp1_cif_isp_gamma_corr_curve curve_r;
> + struct rkisp1_cif_isp_gamma_corr_curve curve_g;
> + struct rkisp1_cif_isp_gamma_corr_curve curve_b;
> + struct rkisp1_cif_isp_gamma_curve_x_axis_pnts xa_pnts;
> +};
>
> /**
> - * struct cifisp_lsc_config - Configuration used by Lens shading correction
> + * struct rkisp1_cif_isp_lsc_config - Configuration used by Lens shading correction
> *
> - * refer to REF_01 for details
> + * @r_data_tbl: sample table red
> + * @gr_data_tbl: sample table green (red)
> + * @gb_data_tbl: sample table green (blue)
> + * @b_data_tbl: sample table blue
> + * @x_grad_tbl: gradient table x
> + * @y_grad_tbl: gradient table y
> + * @x_size_tbl: size table x
> + * @y_size_tbl: size table y
> + * @config_width: not used at the moment
> + * @config_height: not used at the moment
> */
> -struct cifisp_lsc_config {
> - __u32 r_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];
> - __u32 gr_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];
> - __u32 gb_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];
> - __u32 b_data_tbl[CIFISP_LSC_DATA_TBL_SIZE];
> +struct rkisp1_cif_isp_lsc_config {
> + __u16 r_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
> + __u16 gr_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
> + __u16 gb_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
> + __u16 b_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
>
> - __u32 x_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];
> - __u32 y_grad_tbl[CIFISP_LSC_GRAD_TBL_SIZE];
> + __u16 x_grad_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
> + __u16 y_grad_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
>
> - __u32 x_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];
> - __u32 y_size_tbl[CIFISP_LSC_SIZE_TBL_SIZE];
> + __u16 x_size_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
> + __u16 y_size_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
> __u16 config_width;
> __u16 config_height;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_ie_config - Configuration used by image effects
> + * struct rkisp1_cif_isp_ie_config - Configuration used by image effects
> *
> + * @effect: values from 'enum v4l2_colorfx'. Possible values are: V4L2_COLORFX_SEPIA,
> + * V4L2_COLORFX_SET_CBCR, V4L2_COLORFX_AQUA, V4L2_COLORFX_EMBOSS,
> + * V4L2_COLORFX_SKETCH, V4L2_COLORFX_BW, V4L2_COLORFX_NEGATIVE
> + * @color_sel: bits 0:2 - colors bitmask (001 - blue, 010 - green, 100 - red).
> + * bits 8:15 - Threshold value of the RGB colors for the color selection effect.
> * @eff_mat_1: 3x3 Matrix Coefficients for Emboss Effect 1
> * @eff_mat_2: 3x3 Matrix Coefficients for Emboss Effect 2
> * @eff_mat_3: 3x3 Matrix Coefficients for Emboss 3/Sketch 1
> @@ -296,7 +357,7 @@ struct cifisp_lsc_config {
> * @eff_mat_5: 3x3 Matrix Coefficients for Sketch Effect 3
> * @eff_tint: Chrominance increment values of tint (used for sepia effect)
> */
> -struct cifisp_ie_config {
> +struct rkisp1_cif_isp_ie_config {
> __u16 effect;
> __u16 color_sel;
> __u16 eff_mat_1;
> @@ -305,10 +366,10 @@ struct cifisp_ie_config {
> __u16 eff_mat_4;
> __u16 eff_mat_5;
> __u16 eff_tint;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_cproc_config - Configuration used by Color Processing
> + * struct rkisp1_cif_isp_cproc_config - Configuration used by Color Processing
> *
> * @c_out_range: Chrominance pixel clipping range at output.
> * (0 for limit, 1 for full)
> @@ -319,7 +380,7 @@ struct cifisp_ie_config {
> * @sat: saturation, 00~FF, 0.0~1.992
> * @hue: 80~7F, -90~+87.188
> */
> -struct cifisp_cproc_config {
> +struct rkisp1_cif_isp_cproc_config {
> __u8 c_out_range;
> __u8 y_in_range;
> __u8 y_out_range;
> @@ -327,13 +388,13 @@ struct cifisp_cproc_config {
> __u8 brightness;
> __u8 sat;
> __u8 hue;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_awb_meas_config - Configuration used by auto white balance
> + * struct rkisp1_cif_isp_awb_meas_config - Configuration used by auto white balance
> *
> + * @awb_mode: the awb meas mode. From enum rkisp1_cif_isp_awb_mode_type.
> * @awb_wnd: white balance measurement window (in pixels)
> - * (from enum cifisp_awb_mode_type)
> * @max_y: only pixels values < max_y contribute to awb measurement, set to 0
> * to disable this feature
> * @min_y: only pixels values > min_y contribute to awb measurement
> @@ -345,12 +406,13 @@ struct cifisp_cproc_config {
> * (ucFrames=0 means 1 Frame)
> * @awb_ref_cr: reference Cr value for AWB regulation, target for AWB
> * @awb_ref_cb: reference Cb value for AWB regulation, target for AWB
> + * @enable_ymax_cmp: enable Y_MAX compare (Not valid in RGB measurement mode.)
> */
> -struct cifisp_awb_meas_config {
> +struct rkisp1_cif_isp_awb_meas_config {
> /*
> * Note: currently the h and v offsets are mapped to grid offsets
> */
> - struct cifisp_window awb_wnd;
> + struct rkisp1_cif_isp_window awb_wnd;
> __u32 awb_mode;
> __u8 max_y;
> __u8 min_y;
> @@ -360,32 +422,50 @@ struct cifisp_awb_meas_config {
> __u8 awb_ref_cr;
> __u8 awb_ref_cb;
> __u8 enable_ymax_cmp;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_awb_gain_config - Configuration used by auto white balance gain
> + * struct rkisp1_cif_isp_awb_gain_config - Configuration used by auto white balance gain
> *
> - * out_data_x = ( AWB_GEAIN_X * in_data + 128) >> 8
> + * All fields in this struct are 10 bit, where:
> + * 0x100h = 1, unsigned integer value, range 0 to 4 with 8 bit fractional part.
> + *
> + * out_data_x = ( AWB_GAIN_X * in_data + 128) >> 8
> + *
> + * @gain_red: gain value for red component.
> + * @gain_green_r: gain value for green component in red line.
> + * @gain_blue: gain value for blue component.
> + * @gain_green_b: gain value for green component in blue line.
> */
> -struct cifisp_awb_gain_config {
> +struct rkisp1_cif_isp_awb_gain_config {
> __u16 gain_red;
> __u16 gain_green_r;
> __u16 gain_blue;
> __u16 gain_green_b;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_flt_config - Configuration used by ISP filtering
> + * struct rkisp1_cif_isp_flt_config - Configuration used by ISP filtering
> *
> - * @mode: ISP_FILT_MODE register fields (from enum cifisp_flt_mode)
> - * @grn_stage1: ISP_FILT_MODE register fields
> - * @chr_h_mode: ISP_FILT_MODE register fields
> - * @chr_v_mode: ISP_FILT_MODE register fields
> + * All 4 threshold fields (thresh_*) are 10 bits.
> + * All 6 factor fields (fac_*) are 6 bits.
> *
> - * refer to REF_01 for details.
> + * @mode: ISP_FILT_MODE register fields (from enum rkisp1_cif_isp_flt_mode)
> + * @grn_stage1: Green filter stage 1 select (range 0x0...0x8)
> + * @chr_h_mode: Chroma filter horizontal mode
> + * @chr_v_mode: Chroma filter vertical mode
> + * @thresh_bl0: If thresh_bl1 < sum_grad < thresh_bl0 then fac_bl0 is selected (blurring th)
> + * @thresh_bl1: If sum_grad < thresh_bl1 then fac_bl1 is selected (blurring th)
> + * @thresh_sh0: If thresh_sh0 < sum_grad < thresh_sh1 then thresh_sh0 is selected (sharpening th)
> + * @thresh_sh1: If thresh_sh1 < sum_grad then thresh_sh1 is selected (sharpening th)
> + * @lum_weight: Parameters for luminance weight function.
> + * @fac_sh1: filter factor for sharp1 level
> + * @fac_sh0: filter factor for sharp0 level
> + * @fac_mid: filter factor for mid level and for static filter mode
> + * @fac_bl0: filter factor for blur 0 level
> + * @fac_bl1: filter factor for blur 1 level (max blur)
> */
> -
> -struct cifisp_flt_config {
> +struct rkisp1_cif_isp_flt_config {
> __u32 mode;
> __u8 grn_stage1;
> __u8 chr_h_mode;
> @@ -400,187 +480,179 @@ struct cifisp_flt_config {
> __u32 fac_mid;
> __u32 fac_bl0;
> __u32 fac_bl1;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_bdm_config - Configuration used by Bayer DeMosaic
> + * struct rkisp1_cif_isp_bdm_config - Configuration used by Bayer DeMosaic
> *
> - * @demosaic_th: threshod for bayer demosaicing texture detection
> + * @demosaic_th: threshold for bayer demosaicing texture detection
> */
> -struct cifisp_bdm_config {
> +struct rkisp1_cif_isp_bdm_config {
> __u8 demosaic_th;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_ctk_config - Configuration used by Cross Talk correction
> + * struct rkisp1_cif_isp_ctk_config - Configuration used by Cross Talk correction
> *
> - * @coeff: color correction matrix
> - * @ct_offset_b: offset for the crosstalk correction matrix
> + * @coeff: color correction matrix. Values are 11-bit signed fixed-point numbers with 4 bit integer
> + * and 7 bit fractional part, ranging from -8 (0x400) to +7.992 (0x3FF). 0 is
> + * represented by 0x000 and a coefficient value of 1 as 0x080.
> + * @ct_offset: Red, Green, Blue offsets for the crosstalk correction matrix
> */
> -struct cifisp_ctk_config {
> - __u16 coeff0;
> - __u16 coeff1;
> - __u16 coeff2;
> - __u16 coeff3;
> - __u16 coeff4;
> - __u16 coeff5;
> - __u16 coeff6;
> - __u16 coeff7;
> - __u16 coeff8;
> - __u16 ct_offset_r;
> - __u16 ct_offset_g;
> - __u16 ct_offset_b;
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_ctk_config {
> + __u16 coeff[3][3];
> + __u16 ct_offset[3];
> +};
>
> -enum cifisp_goc_mode {
> - CIFISP_GOC_MODE_LOGARITHMIC,
> - CIFISP_GOC_MODE_EQUIDISTANT
> +enum rkisp1_cif_isp_goc_mode {
> + RKISP1_CIF_ISP_GOC_MODE_LOGARITHMIC,
> + RKISP1_CIF_ISP_GOC_MODE_EQUIDISTANT
> };
>
> /**
> - * struct cifisp_goc_config - Configuration used by Gamma Out correction
> + * struct rkisp1_cif_isp_goc_config - Configuration used by Gamma Out correction
> *
> - * @mode: goc mode (from enum cifisp_goc_mode)
> + * @mode: goc mode (from enum rkisp1_cif_isp_goc_mode)
> * @gamma_y: gamma out curve y-axis for all color components
> */
> -struct cifisp_goc_config {
> +struct rkisp1_cif_isp_goc_config {
> __u32 mode;
> - __u16 gamma_y[CIFISP_GAMMA_OUT_MAX_SAMPLES];
> -} __attribute__ ((packed));
> + __u16 gamma_y[RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES];
> +};
>
> /**
> - * struct cifisp_hst_config - Configuration used by Histogram
> + * struct rkisp1_cif_isp_hst_config - Configuration used by Histogram
> *
> - * @mode: histogram mode (from enum cifisp_histogram_mode)
> + * @mode: histogram mode (from enum rkisp1_cif_isp_histogram_mode)
> * @histogram_predivider: process every stepsize pixel, all other pixels are
> * skipped
> * @meas_window: coordinates of the measure window
> * @hist_weight: weighting factor for sub-windows
> */
> -struct cifisp_hst_config {
> +struct rkisp1_cif_isp_hst_config {
> __u32 mode;
> __u8 histogram_predivider;
> - struct cifisp_window meas_window;
> - __u8 hist_weight[CIFISP_HISTOGRAM_WEIGHT_GRIDS_SIZE];
> -} __attribute__ ((packed));
> + struct rkisp1_cif_isp_window meas_window;
> + __u8 hist_weight[RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE];
> +};
>
> /**
> - * struct cifisp_aec_config - Configuration used by Auto Exposure Control
> + * struct rkisp1_cif_isp_aec_config - Configuration used by Auto Exposure Control
> *
> - * @mode: Exposure measure mode (from enum cifisp_exp_meas_mode)
> - * @autostop: stop mode (from enum cifisp_exp_ctrl_autostop)
> + * @mode: Exposure measure mode (from enum rkisp1_cif_isp_exp_meas_mode)
> + * @autostop: stop mode (from enum rkisp1_cif_isp_exp_ctrl_autostop)
> * @meas_window: coordinates of the measure window
> */
> -struct cifisp_aec_config {
> +struct rkisp1_cif_isp_aec_config {
> __u32 mode;
> __u32 autostop;
> - struct cifisp_window meas_window;
> -} __attribute__ ((packed));
> + struct rkisp1_cif_isp_window meas_window;
> +};
>
> /**
> - * struct cifisp_afc_config - Configuration used by Auto Focus Control
> + * struct rkisp1_cif_isp_afc_config - Configuration used by Auto Focus Control
> *
> - * @num_afm_win: max CIFISP_AFM_MAX_WINDOWS
> + * @num_afm_win: max RKISP1_CIF_ISP_AFM_MAX_WINDOWS
> * @afm_win: coordinates of the meas window
> * @thres: threshold used for minimizing the influence of noise
> * @var_shift: the number of bits for the shift operation at the end of the
> * calculation chain.
> */
> -struct cifisp_afc_config {
> +struct rkisp1_cif_isp_afc_config {
> __u8 num_afm_win;
> - struct cifisp_window afm_win[CIFISP_AFM_MAX_WINDOWS];
> + struct rkisp1_cif_isp_window afm_win[RKISP1_CIF_ISP_AFM_MAX_WINDOWS];
> __u32 thres;
> __u32 var_shift;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * enum cifisp_dpf_gain_usage - dpf gain usage
> - * @CIFISP_DPF_GAIN_USAGE_DISABLED: don't use any gains in preprocessing stage
> - * @CIFISP_DPF_GAIN_USAGE_NF_GAINS: use only the noise function gains from
> + * enum rkisp1_cif_isp_dpf_gain_usage - dpf gain usage
> + * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED: don't use any gains in preprocessing stage
> + * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS: use only the noise function gains from
> * registers DPF_NF_GAIN_R, ...
> - * @CIFISP_DPF_GAIN_USAGE_LSC_GAINS: use only the gains from LSC module
> - * @CIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS: use the noise function gains and the
> + * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS: use only the gains from LSC module
> + * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS: use the noise function gains and the
> * gains from LSC module
> - * @CIFISP_DPF_GAIN_USAGE_AWB_GAINS: use only the gains from AWB module
> - * @CIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS: use the gains from AWB and LSC module
> - * @CIFISP_DPF_GAIN_USAGE_MAX: upper border (only for an internal evaluation)
> + * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS: use only the gains from AWB module
> + * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS: use the gains from AWB and LSC module
> + * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX: upper border (only for an internal evaluation)
> */
> -enum cifisp_dpf_gain_usage {
> - CIFISP_DPF_GAIN_USAGE_DISABLED,
> - CIFISP_DPF_GAIN_USAGE_NF_GAINS,
> - CIFISP_DPF_GAIN_USAGE_LSC_GAINS,
> - CIFISP_DPF_GAIN_USAGE_NF_LSC_GAINS,
> - CIFISP_DPF_GAIN_USAGE_AWB_GAINS,
> - CIFISP_DPF_GAIN_USAGE_AWB_LSC_GAINS,
> - CIFISP_DPF_GAIN_USAGE_MAX
> +enum rkisp1_cif_isp_dpf_gain_usage {
> + RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED,
> + RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS,
> + RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS,
> + RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS,
> + RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS,
> + RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS,
> + RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX
> };
>
> /**
> - * enum cifisp_dpf_gain_usage - dpf gain usage
> - * @CIFISP_DPF_RB_FILTERSIZE_13x9: red and blue filter kernel size 13x9
> + * enum rkisp1_cif_isp_dpf_rb_filtersize - Red and blue filter sizes
> + * @RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9: red and blue filter kernel size 13x9
> * (means 7x5 active pixel)
> - * @CIFISP_DPF_RB_FILTERSIZE_9x9: red and blue filter kernel size 9x9
> + * @RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9: red and blue filter kernel size 9x9
> * (means 5x5 active pixel)
> */
> -enum cifisp_dpf_rb_filtersize {
> - CIFISP_DPF_RB_FILTERSIZE_13x9,
> - CIFISP_DPF_RB_FILTERSIZE_9x9,
> +enum rkisp1_cif_isp_dpf_rb_filtersize {
> + RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9,
> + RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9,
> };
>
> /**
> - * enum cifisp_dpf_nll_scale_mode - dpf noise level scale mode
> - * @CIFISP_NLL_SCALE_LINEAR: use a linear scaling
> - * @CIFISP_NLL_SCALE_LOGARITHMIC: use a logarithmic scaling
> + * enum rkisp1_cif_isp_dpf_nll_scale_mode - dpf noise level scale mode
> + * @RKISP1_CIF_ISP_NLL_SCALE_LINEAR: use a linear scaling
> + * @RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC: use a logarithmic scaling
> */
> -enum cifisp_dpf_nll_scale_mode {
> - CIFISP_NLL_SCALE_LINEAR,
> - CIFISP_NLL_SCALE_LOGARITHMIC,
> +enum rkisp1_cif_isp_dpf_nll_scale_mode {
> + RKISP1_CIF_ISP_NLL_SCALE_LINEAR,
> + RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC,
> };
>
> /**
> - * struct cifisp_dpf_nll - Noise level lookup
> + * struct rkisp1_cif_isp_dpf_nll - Noise level lookup
> *
> * @coeff: Noise level Lookup coefficient
> - * @scale_mode: dpf noise level scale mode (from enum cifisp_dpf_nll_scale_mode)
> + * @scale_mode: dpf noise level scale mode (from enum rkisp1_cif_isp_dpf_nll_scale_mode)
> */
> -struct cifisp_dpf_nll {
> - __u16 coeff[CIFISP_DPF_MAX_NLF_COEFFS];
> +struct rkisp1_cif_isp_dpf_nll {
> + __u16 coeff[RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS];
> __u32 scale_mode;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_dpf_rb_flt - Red blue filter config
> + * struct rkisp1_cif_isp_dpf_rb_flt - Red blue filter config
> *
> * @fltsize: The filter size for the red and blue pixels
> - * (from enum cifisp_dpf_rb_filtersize)
> + * (from enum rkisp1_cif_isp_dpf_rb_filtersize)
> * @spatial_coeff: Spatial weights
> * @r_enable: enable filter processing for red pixels
> * @b_enable: enable filter processing for blue pixels
> */
> -struct cifisp_dpf_rb_flt {
> +struct rkisp1_cif_isp_dpf_rb_flt {
> __u32 fltsize;
> - __u8 spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];
> + __u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS];
> __u8 r_enable;
> __u8 b_enable;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_dpf_g_flt - Green filter Configuration
> + * struct rkisp1_cif_isp_dpf_g_flt - Green filter Configuration
> *
> * @spatial_coeff: Spatial weights
> * @gr_enable: enable filter processing for green pixels in green/red lines
> * @gb_enable: enable filter processing for green pixels in green/blue lines
> */
> -struct cifisp_dpf_g_flt {
> - __u8 spatial_coeff[CIFISP_DPF_MAX_SPATIAL_COEFFS];
> +struct rkisp1_cif_isp_dpf_g_flt {
> + __u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS];
> __u8 gr_enable;
> __u8 gb_enable;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_dpf_gain - Noise function Configuration
> + * struct rkisp1_cif_isp_dpf_gain - Noise function Configuration
> *
> - * @mode: dpf gain usage (from enum cifisp_dpf_gain_usage)
> + * @mode: dpf gain usage (from enum rkisp1_cif_isp_dpf_gain_usage)
> * @nf_r_gain: Noise function Gain that replaces the AWB gain for red pixels
> * @nf_b_gain: Noise function Gain that replaces the AWB gain for blue pixels
> * @nf_gr_gain: Noise function Gain that replaces the AWB gain
> @@ -588,44 +660,44 @@ struct cifisp_dpf_g_flt {
> * @nf_gb_gain: Noise function Gain that replaces the AWB gain
> * for green pixels in a blue line
> */
> -struct cifisp_dpf_gain {
> +struct rkisp1_cif_isp_dpf_gain {
> __u32 mode;
> __u16 nf_r_gain;
> __u16 nf_b_gain;
> __u16 nf_gr_gain;
> __u16 nf_gb_gain;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_dpf_config - Configuration used by De-noising pre-filter
> + * struct rkisp1_cif_isp_dpf_config - Configuration used by De-noising pre-filter
> *
> * @gain: noise function gain
> * @g_flt: green filter config
> * @rb_flt: red blue filter config
> * @nll: noise level lookup
> */
> -struct cifisp_dpf_config {
> - struct cifisp_dpf_gain gain;
> - struct cifisp_dpf_g_flt g_flt;
> - struct cifisp_dpf_rb_flt rb_flt;
> - struct cifisp_dpf_nll nll;
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_dpf_config {
> + struct rkisp1_cif_isp_dpf_gain gain;
> + struct rkisp1_cif_isp_dpf_g_flt g_flt;
> + struct rkisp1_cif_isp_dpf_rb_flt rb_flt;
> + struct rkisp1_cif_isp_dpf_nll nll;
> +};
>
> /**
> - * struct cifisp_dpf_strength_config - strength of the filter
> + * struct rkisp1_cif_isp_dpf_strength_config - strength of the filter
> *
> * @r: filter strength of the RED filter
> * @g: filter strength of the GREEN filter
> * @b: filter strength of the BLUE filter
> */
> -struct cifisp_dpf_strength_config {
> +struct rkisp1_cif_isp_dpf_strength_config {
> __u8 r;
> __u8 g;
> __u8 b;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_isp_other_cfg - Parameters for some blocks in rockchip isp1
> + * struct rkisp1_cif_isp_isp_other_cfg - Parameters for some blocks in rockchip isp1
> *
> * @dpcc_config: Defect Pixel Cluster Correction config
> * @bls_config: Black Level Subtraction config
> @@ -642,39 +714,39 @@ struct cifisp_dpf_strength_config {
> * @cproc_config: color process config
> * @ie_config: image effects config
> */
> -struct cifisp_isp_other_cfg {
> - struct cifisp_dpcc_config dpcc_config;
> - struct cifisp_bls_config bls_config;
> - struct cifisp_sdg_config sdg_config;
> - struct cifisp_lsc_config lsc_config;
> - struct cifisp_awb_gain_config awb_gain_config;
> - struct cifisp_flt_config flt_config;
> - struct cifisp_bdm_config bdm_config;
> - struct cifisp_ctk_config ctk_config;
> - struct cifisp_goc_config goc_config;
> - struct cifisp_dpf_config dpf_config;
> - struct cifisp_dpf_strength_config dpf_strength_config;
> - struct cifisp_cproc_config cproc_config;
> - struct cifisp_ie_config ie_config;
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_isp_other_cfg {
> + struct rkisp1_cif_isp_dpcc_config dpcc_config;
> + struct rkisp1_cif_isp_bls_config bls_config;
> + struct rkisp1_cif_isp_sdg_config sdg_config;
> + struct rkisp1_cif_isp_lsc_config lsc_config;
> + struct rkisp1_cif_isp_awb_gain_config awb_gain_config;
> + struct rkisp1_cif_isp_flt_config flt_config;
> + struct rkisp1_cif_isp_bdm_config bdm_config;
> + struct rkisp1_cif_isp_ctk_config ctk_config;
> + struct rkisp1_cif_isp_goc_config goc_config;
> + struct rkisp1_cif_isp_dpf_config dpf_config;
> + struct rkisp1_cif_isp_dpf_strength_config dpf_strength_config;
> + struct rkisp1_cif_isp_cproc_config cproc_config;
> + struct rkisp1_cif_isp_ie_config ie_config;
> +};
>
> /**
> - * struct cifisp_isp_meas_cfg - Rockchip ISP1 Measure Parameters
> + * struct rkisp1_cif_isp_isp_meas_cfg - Rockchip ISP1 Measure Parameters
> *
> * @awb_meas_config: auto white balance config
> * @hst_config: histogram config
> * @aec_config: auto exposure config
> * @afc_config: auto focus config
> */
> -struct cifisp_isp_meas_cfg {
> - struct cifisp_awb_meas_config awb_meas_config;
> - struct cifisp_hst_config hst_config;
> - struct cifisp_aec_config aec_config;
> - struct cifisp_afc_config afc_config;
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_isp_meas_cfg {
> + struct rkisp1_cif_isp_awb_meas_config awb_meas_config;
> + struct rkisp1_cif_isp_hst_config hst_config;
> + struct rkisp1_cif_isp_aec_config aec_config;
> + struct rkisp1_cif_isp_afc_config afc_config;
> +};
>
> /**
> - * struct rkisp1_isp_params_cfg - Rockchip ISP1 Input Parameters Meta Data
> + * struct rkisp1_params_cfg - Rockchip ISP1 Input Parameters Meta Data
> *
> * @module_en_update: mask the enable bits of which module should be updated
> * @module_ens: mask the enable value of each module, only update the module
> @@ -683,21 +755,21 @@ struct cifisp_isp_meas_cfg {
> * @meas: measurement config
> * @others: other config
> */
> -struct rkisp1_isp_params_cfg {
> +struct rkisp1_params_cfg {
> __u32 module_en_update;
> __u32 module_ens;
> __u32 module_cfg_update;
>
> - struct cifisp_isp_meas_cfg meas;
> - struct cifisp_isp_other_cfg others;
> -} __attribute__ ((packed));
> + struct rkisp1_cif_isp_isp_meas_cfg meas;
> + struct rkisp1_cif_isp_isp_other_cfg others;
> +};
>
> /*---------- PART2: Measurement Statistics ------------*/
>
> /**
> - * struct cifisp_bls_meas_val - AWB measured values
> + * struct rkisp1_cif_isp_awb_meas - AWB measured values
> *
> - * @cnt: White pixel count, number of "white pixels" found during laster
> + * @cnt: White pixel count, number of "white pixels" found during last
> * measurement
> * @mean_y_or_g: Mean value of Y within window and frames,
> * Green if RGB is selected.
> @@ -706,111 +778,111 @@ struct rkisp1_isp_params_cfg {
> * @mean_cr_or_r: Mean value of Cr within window and frames,
> * Red if RGB is selected.
> */
> -struct cifisp_awb_meas {
> +struct rkisp1_cif_isp_awb_meas {
> __u32 cnt;
> __u8 mean_y_or_g;
> __u8 mean_cb_or_b;
> __u8 mean_cr_or_r;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_awb_stat - statistics automatic white balance data
> + * struct rkisp1_cif_isp_awb_stat - statistics automatic white balance data
> *
> * @awb_mean: Mean measured data
> */
> -struct cifisp_awb_stat {
> - struct cifisp_awb_meas awb_mean[CIFISP_AWB_MAX_GRID];
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_awb_stat {
> + struct rkisp1_cif_isp_awb_meas awb_mean[RKISP1_CIF_ISP_AWB_MAX_GRID];
> +};
>
> /**
> - * struct cifisp_bls_meas_val - BLS measured values
> + * struct rkisp1_cif_isp_bls_meas_val - BLS measured values
> *
> * @meas_r: Mean measured value for Bayer pattern R
> * @meas_gr: Mean measured value for Bayer pattern Gr
> * @meas_gb: Mean measured value for Bayer pattern Gb
> * @meas_b: Mean measured value for Bayer pattern B
> */
> -struct cifisp_bls_meas_val {
> +struct rkisp1_cif_isp_bls_meas_val {
> __u16 meas_r;
> __u16 meas_gr;
> __u16 meas_gb;
> __u16 meas_b;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_ae_stat - statistics auto exposure data
> + * struct rkisp1_cif_isp_ae_stat - statistics auto exposure data
> *
> * @exp_mean: Mean luminance value of block xx
> * @bls_val: BLS measured values
> *
> * Image is divided into 5x5 blocks.
> */
> -struct cifisp_ae_stat {
> - __u8 exp_mean[CIFISP_AE_MEAN_MAX];
> - struct cifisp_bls_meas_val bls_val;
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_ae_stat {
> + __u8 exp_mean[RKISP1_CIF_ISP_AE_MEAN_MAX];
> + struct rkisp1_cif_isp_bls_meas_val bls_val;
> +};
>
> /**
> - * struct cifisp_af_meas_val - AF measured values
> + * struct rkisp1_cif_isp_af_meas_val - AF measured values
> *
> - * @sum: sharpness, refer to REF_01 for definition
> - * @lum: luminance, refer to REF_01 for definition
> + * @sum: sharpness value
> + * @lum: luminance value
> */
> -struct cifisp_af_meas_val {
> +struct rkisp1_cif_isp_af_meas_val {
> __u32 sum;
> __u32 lum;
> -} __attribute__ ((packed));
> +};
>
> /**
> - * struct cifisp_af_stat - statistics auto focus data
> + * struct rkisp1_cif_isp_af_stat - statistics auto focus data
> *
> * @window: AF measured value of window x
> *
> * The module measures the sharpness in 3 windows of selectable size via
> * register settings(ISP_AFM_*_A/B/C)
> */
> -struct cifisp_af_stat {
> - struct cifisp_af_meas_val window[CIFISP_AFM_MAX_WINDOWS];
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_af_stat {
> + struct rkisp1_cif_isp_af_meas_val window[RKISP1_CIF_ISP_AFM_MAX_WINDOWS];
> +};
>
> /**
> - * struct cifisp_hist_stat - statistics histogram data
> + * struct rkisp1_cif_isp_hist_stat - statistics histogram data
> *
> * @hist_bins: measured bin counters
> *
> * Measurement window divided into 25 sub-windows, set
> * with ISP_HIST_XXX
> */
> -struct cifisp_hist_stat {
> - __u16 hist_bins[CIFISP_HIST_BIN_N_MAX];
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_hist_stat {
> + __u16 hist_bins[RKISP1_CIF_ISP_HIST_BIN_N_MAX];
> +};
>
> /**
> - * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Data
> + * struct rkisp1_cif_isp_stat - Rockchip ISP1 Statistics Data
> *
> - * @cifisp_awb_stat: statistics data for automatic white balance
> - * @cifisp_ae_stat: statistics data for auto exposure
> - * @cifisp_af_stat: statistics data for auto focus
> - * @cifisp_hist_stat: statistics histogram data
> + * @awb: statistics data for automatic white balance
> + * @ae: statistics data for auto exposure
> + * @af: statistics data for auto focus
> + * @hist: statistics histogram data
> */
> -struct cifisp_stat {
> - struct cifisp_awb_stat awb;
> - struct cifisp_ae_stat ae;
> - struct cifisp_af_stat af;
> - struct cifisp_hist_stat hist;
> -} __attribute__ ((packed));
> +struct rkisp1_cif_isp_stat {
> + struct rkisp1_cif_isp_awb_stat awb;
> + struct rkisp1_cif_isp_ae_stat ae;
> + struct rkisp1_cif_isp_af_stat af;
> + struct rkisp1_cif_isp_hist_stat hist;
> +};
>
> /**
> * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Meta Data
> *
> - * @meas_type: measurement types (CIFISP_STAT_ definitions)
> + * @meas_type: measurement types (RKISP1_CIF_ISP_STAT_* definitions)
> * @frame_id: frame ID for sync
> * @params: statistics data
> */
> struct rkisp1_stat_buffer {
> __u32 meas_type;
> __u32 frame_id;
> - struct cifisp_stat params;
> -} __attribute__ ((packed));
> + struct rkisp1_cif_isp_stat params;
> +};
>
> #endif /* _RKISP1_CONFIG_H */
> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
> index 0f5f8a8b436e60ff..07d7f1b2ddd81bbd 100644
> --- a/src/ipa/rkisp1/rkisp1.cpp
> +++ b/src/ipa/rkisp1/rkisp1.cpp
> @@ -50,7 +50,7 @@ public:
> void processEvent(const IPAOperationData &event) override;
>
> private:
> - void queueRequest(unsigned int frame, rkisp1_isp_params_cfg *params,
> + void queueRequest(unsigned int frame, rkisp1_params_cfg *params,
> const ControlList &controls);
> void updateStatistics(unsigned int frame,
> const rkisp1_stat_buffer *stats);
> @@ -176,8 +176,8 @@ void IPARkISP1::processEvent(const IPAOperationData &event)
> unsigned int frame = event.data[0];
> unsigned int bufferId = event.data[1];
>
> - rkisp1_isp_params_cfg *params =
> - static_cast<rkisp1_isp_params_cfg *>(buffersMemory_[bufferId]);
> + rkisp1_params_cfg *params =
> + static_cast<rkisp1_params_cfg *>(buffersMemory_[bufferId]);
>
> queueRequest(frame, params, event.controls[0]);
> break;
> @@ -188,7 +188,7 @@ void IPARkISP1::processEvent(const IPAOperationData &event)
> }
> }
>
> -void IPARkISP1::queueRequest(unsigned int frame, rkisp1_isp_params_cfg *params,
> +void IPARkISP1::queueRequest(unsigned int frame, rkisp1_params_cfg *params,
> const ControlList &controls)
> {
> /* Prepare parameters buffer. */
> @@ -198,9 +198,9 @@ void IPARkISP1::queueRequest(unsigned int frame, rkisp1_isp_params_cfg *params,
> if (controls.contains(controls::AeEnable)) {
> autoExposure_ = controls.get(controls::AeEnable);
> if (autoExposure_)
> - params->module_ens = CIFISP_MODULE_AEC;
> + params->module_ens = RKISP1_CIF_ISP_MODULE_AEC;
>
> - params->module_en_update = CIFISP_MODULE_AEC;
> + params->module_en_update = RKISP1_CIF_ISP_MODULE_AEC;
> }
>
> IPAOperationData op;
> @@ -212,17 +212,17 @@ void IPARkISP1::queueRequest(unsigned int frame, rkisp1_isp_params_cfg *params,
> void IPARkISP1::updateStatistics(unsigned int frame,
> const rkisp1_stat_buffer *stats)
> {
> - const cifisp_stat *params = &stats->params;
> + const rkisp1_cif_isp_stat *params = &stats->params;
> unsigned int aeState = 0;
>
> - if (stats->meas_type & CIFISP_STAT_AUTOEXP) {
> - const cifisp_ae_stat *ae = ¶ms->ae;
> + if (stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP) {
> + const rkisp1_cif_isp_ae_stat *ae = ¶ms->ae;
>
> const unsigned int target = 60;
>
> unsigned int value = 0;
> unsigned int num = 0;
> - for (int i = 0; i < CIFISP_AE_MEAN_MAX; i++) {
> + for (int i = 0; i < RKISP1_CIF_ISP_AE_MEAN_MAX; i++) {
> if (ae->exp_mean[i] <= 15)
> continue;
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list