1 /* SPDX-License-Identifier: ((GPL-2.0+ WITH Linux-syscall-note) OR MIT) */
2 /*
3  * Rockchip ISP1 userspace API
4  * Copyright (C) 2017 Rockchip Electronics Co., Ltd.
5  */
6 
7 #ifndef _UAPI_RKISP1_CONFIG_H
8 #define _UAPI_RKISP1_CONFIG_H
9 
10 #include <linux/types.h>
11 
12 /* Defect Pixel Cluster Detection */
13 #define RKISP1_CIF_ISP_MODULE_DPCC		(1U << 0)
14 /* Black Level Subtraction */
15 #define RKISP1_CIF_ISP_MODULE_BLS		(1U << 1)
16 /* Sensor De-gamma */
17 #define RKISP1_CIF_ISP_MODULE_SDG		(1U << 2)
18 /* Histogram statistics configuration */
19 #define RKISP1_CIF_ISP_MODULE_HST		(1U << 3)
20 /* Lens Shade Control */
21 #define RKISP1_CIF_ISP_MODULE_LSC		(1U << 4)
22 /* Auto White Balance Gain */
23 #define RKISP1_CIF_ISP_MODULE_AWB_GAIN		(1U << 5)
24 /* Filter */
25 #define RKISP1_CIF_ISP_MODULE_FLT		(1U << 6)
26 /* Bayer Demosaic */
27 #define RKISP1_CIF_ISP_MODULE_BDM		(1U << 7)
28 /* Cross Talk */
29 #define RKISP1_CIF_ISP_MODULE_CTK		(1U << 8)
30 /* Gamma Out Curve */
31 #define RKISP1_CIF_ISP_MODULE_GOC		(1U << 9)
32 /* Color Processing */
33 #define RKISP1_CIF_ISP_MODULE_CPROC		(1U << 10)
34 /* Auto Focus Control statistics configuration */
35 #define RKISP1_CIF_ISP_MODULE_AFC		(1U << 11)
36 /* Auto White Balancing statistics configuration */
37 #define RKISP1_CIF_ISP_MODULE_AWB		(1U << 12)
38 /* Image Effect */
39 #define RKISP1_CIF_ISP_MODULE_IE		(1U << 13)
40 /* Auto Exposure Control statistics configuration */
41 #define RKISP1_CIF_ISP_MODULE_AEC		(1U << 14)
42 /* Wide Dynamic Range */
43 #define RKISP1_CIF_ISP_MODULE_WDR		(1U << 15)
44 /* Denoise Pre-Filter */
45 #define RKISP1_CIF_ISP_MODULE_DPF		(1U << 16)
46 /* Denoise Pre-Filter Strength */
47 #define RKISP1_CIF_ISP_MODULE_DPF_STRENGTH	(1U << 17)
48 
49 #define RKISP1_CIF_ISP_CTK_COEFF_MAX            0x100
50 #define RKISP1_CIF_ISP_CTK_OFFSET_MAX           0x800
51 
52 #define RKISP1_CIF_ISP_AE_MEAN_MAX_V10		25
53 #define RKISP1_CIF_ISP_AE_MEAN_MAX_V12		81
54 #define RKISP1_CIF_ISP_AE_MEAN_MAX		RKISP1_CIF_ISP_AE_MEAN_MAX_V12
55 
56 #define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10	16
57 #define RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12	32
58 #define RKISP1_CIF_ISP_HIST_BIN_N_MAX		RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12
59 
60 #define RKISP1_CIF_ISP_AFM_MAX_WINDOWS          3
61 #define RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE       17
62 
63 #define RKISP1_CIF_ISP_BDM_MAX_TH               0xff
64 
65 /*
66  * Black level compensation
67  */
68 /* maximum value for horizontal start address */
69 #define RKISP1_CIF_ISP_BLS_START_H_MAX             0x00000fff
70 /* maximum value for horizontal stop address */
71 #define RKISP1_CIF_ISP_BLS_STOP_H_MAX              0x00000fff
72 /* maximum value for vertical start address */
73 #define RKISP1_CIF_ISP_BLS_START_V_MAX             0x00000fff
74 /* maximum value for vertical stop address */
75 #define RKISP1_CIF_ISP_BLS_STOP_V_MAX              0x00000fff
76 /* maximum is 2^18 = 262144*/
77 #define RKISP1_CIF_ISP_BLS_SAMPLES_MAX             0x00000012
78 /* maximum value for fixed black level */
79 #define RKISP1_CIF_ISP_BLS_FIX_SUB_MAX             0x00000fff
80 /* minimum value for fixed black level */
81 #define RKISP1_CIF_ISP_BLS_FIX_SUB_MIN             0xfffff000
82 /* 13 bit range (signed)*/
83 #define RKISP1_CIF_ISP_BLS_FIX_MASK                0x00001fff
84 
85 /*
86  * Automatic white balance measurements
87  */
88 #define RKISP1_CIF_ISP_AWB_MAX_GRID                1
89 #define RKISP1_CIF_ISP_AWB_MAX_FRAMES              7
90 
91 /*
92  * Gamma out
93  */
94 /* Maximum number of color samples supported */
95 #define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10   17
96 #define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12   34
97 #define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES       RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12
98 
99 /*
100  * Lens shade correction
101  */
102 #define RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE        8
103 
104 /*
105  * The following matches the tuning process,
106  * not the max capabilities of the chip.
107  */
108 #define RKISP1_CIF_ISP_LSC_SAMPLES_MAX             17
109 
110 /*
111  * Histogram calculation
112  */
113 #define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10 25
114 #define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12 81
115 #define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE     RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12
116 
117 /*
118  * Defect Pixel Cluster Correction
119  */
120 #define RKISP1_CIF_ISP_DPCC_METHODS_MAX				3
121 
122 #define RKISP1_CIF_ISP_DPCC_MODE_STAGE1_ENABLE			(1U << 2)
123 
124 #define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_G_CENTER	(1U << 0)
125 #define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_INCL_RB_CENTER	(1U << 1)
126 #define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_G_3X3		(1U << 2)
127 #define RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_STAGE1_RB_3X3		(1U << 3)
128 
129 /* 0-2 for sets 1-3 */
130 #define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_SET(n)		((n) << 0)
131 #define RKISP1_CIF_ISP_DPCC_SET_USE_STAGE1_USE_FIX_SET		(1U << 3)
132 
133 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_GREEN_ENABLE		(1U << 0)
134 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_GREEN_ENABLE		(1U << 1)
135 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_GREEN_ENABLE		(1U << 2)
136 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_GREEN_ENABLE	(1U << 3)
137 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_GREEN_ENABLE		(1U << 4)
138 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_PG_RED_BLUE_ENABLE	(1U << 8)
139 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_LC_RED_BLUE_ENABLE	(1U << 9)
140 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RO_RED_BLUE_ENABLE	(1U << 10)
141 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RND_RED_BLUE_ENABLE	(1U << 11)
142 #define RKISP1_CIF_ISP_DPCC_METHODS_SET_RG_RED_BLUE_ENABLE	(1U << 12)
143 
144 #define RKISP1_CIF_ISP_DPCC_LINE_THRESH_G(v)			((v) << 0)
145 #define RKISP1_CIF_ISP_DPCC_LINE_THRESH_RB(v)			((v) << 8)
146 #define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_G(v)			((v) << 0)
147 #define RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_RB(v)			((v) << 8)
148 #define RKISP1_CIF_ISP_DPCC_PG_FAC_G(v)				((v) << 0)
149 #define RKISP1_CIF_ISP_DPCC_PG_FAC_RB(v)			((v) << 8)
150 #define RKISP1_CIF_ISP_DPCC_RND_THRESH_G(v)			((v) << 0)
151 #define RKISP1_CIF_ISP_DPCC_RND_THRESH_RB(v)			((v) << 8)
152 #define RKISP1_CIF_ISP_DPCC_RG_FAC_G(v)				((v) << 0)
153 #define RKISP1_CIF_ISP_DPCC_RG_FAC_RB(v)			((v) << 8)
154 
155 #define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_G(n, v)			((v) << ((n) * 4))
156 #define RKISP1_CIF_ISP_DPCC_RO_LIMITS_n_RB(n, v)		((v) << ((n) * 4 + 2))
157 
158 #define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_G(n, v)			((v) << ((n) * 4))
159 #define RKISP1_CIF_ISP_DPCC_RND_OFFS_n_RB(n, v)			((v) << ((n) * 4 + 2))
160 
161 /*
162  * Denoising pre filter
163  */
164 #define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS      17
165 #define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS  6
166 
167 /*
168  * Measurement types
169  */
170 #define RKISP1_CIF_ISP_STAT_AWB           (1U << 0)
171 #define RKISP1_CIF_ISP_STAT_AUTOEXP       (1U << 1)
172 #define RKISP1_CIF_ISP_STAT_AFM           (1U << 2)
173 #define RKISP1_CIF_ISP_STAT_HIST          (1U << 3)
174 
175 /**
176  * enum rkisp1_cif_isp_version - ISP variants
177  *
178  * @RKISP1_V10: used at least in rk3288 and rk3399
179  * @RKISP1_V11: declared in the original vendor code, but not used
180  * @RKISP1_V12: used at least in rk3326 and px30
181  * @RKISP1_V13: used at least in rk1808
182  */
183 enum rkisp1_cif_isp_version {
184 	RKISP1_V10 = 10,
185 	RKISP1_V11,
186 	RKISP1_V12,
187 	RKISP1_V13,
188 };
189 
190 enum rkisp1_cif_isp_histogram_mode {
191 	RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE,
192 	RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED,
193 	RKISP1_CIF_ISP_HISTOGRAM_MODE_R_HISTOGRAM,
194 	RKISP1_CIF_ISP_HISTOGRAM_MODE_G_HISTOGRAM,
195 	RKISP1_CIF_ISP_HISTOGRAM_MODE_B_HISTOGRAM,
196 	RKISP1_CIF_ISP_HISTOGRAM_MODE_Y_HISTOGRAM
197 };
198 
199 enum rkisp1_cif_isp_awb_mode_type {
200 	RKISP1_CIF_ISP_AWB_MODE_MANUAL,
201 	RKISP1_CIF_ISP_AWB_MODE_RGB,
202 	RKISP1_CIF_ISP_AWB_MODE_YCBCR
203 };
204 
205 enum rkisp1_cif_isp_flt_mode {
206 	RKISP1_CIF_ISP_FLT_STATIC_MODE,
207 	RKISP1_CIF_ISP_FLT_DYNAMIC_MODE
208 };
209 
210 /**
211  * enum rkisp1_cif_isp_exp_ctrl_autostop - stop modes
212  * @RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0: continuous measurement
213  * @RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1: stop measuring after a complete frame
214  */
215 enum rkisp1_cif_isp_exp_ctrl_autostop {
216 	RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0 = 0,
217 	RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1 = 1,
218 };
219 
220 /**
221  * enum rkisp1_cif_isp_exp_meas_mode - Exposure measure mode
222  * @RKISP1_CIF_ISP_EXP_MEASURING_MODE_0: Y = 16 + 0.25R + 0.5G + 0.1094B
223  * @RKISP1_CIF_ISP_EXP_MEASURING_MODE_1: Y = (R + G + B) x (85/256)
224  */
225 enum rkisp1_cif_isp_exp_meas_mode {
226 	RKISP1_CIF_ISP_EXP_MEASURING_MODE_0,
227 	RKISP1_CIF_ISP_EXP_MEASURING_MODE_1,
228 };
229 
230 /*---------- PART1: Input Parameters ------------*/
231 
232 /**
233  * struct rkisp1_cif_isp_window -  measurement window.
234  *
235  * Measurements are calculated per window inside the frame.
236  * This struct represents a window for a measurement.
237  *
238  * @h_offs: the horizontal offset of the window from the left of the frame in pixels.
239  * @v_offs: the vertical offset of the window from the top of the frame in pixels.
240  * @h_size: the horizontal size of the window in pixels
241  * @v_size: the vertical size of the window in pixels.
242  */
243 struct rkisp1_cif_isp_window {
244 	__u16 h_offs;
245 	__u16 v_offs;
246 	__u16 h_size;
247 	__u16 v_size;
248 };
249 
250 /**
251  * struct rkisp1_cif_isp_bls_fixed_val - BLS fixed subtraction values
252  *
253  * The values will be subtracted from the sensor
254  * values. Therefore a negative value means addition instead of subtraction!
255  *
256  * @r: Fixed (signed!) subtraction value for Bayer pattern R
257  * @gr: Fixed (signed!) subtraction value for Bayer pattern Gr
258  * @gb: Fixed (signed!) subtraction value for Bayer pattern Gb
259  * @b: Fixed (signed!) subtraction value for Bayer pattern B
260  */
261 struct rkisp1_cif_isp_bls_fixed_val {
262 	__s16 r;
263 	__s16 gr;
264 	__s16 gb;
265 	__s16 b;
266 };
267 
268 /**
269  * struct rkisp1_cif_isp_bls_config - Configuration used by black level subtraction
270  *
271  * @enable_auto: Automatic mode activated means that the measured values
272  *		 are subtracted. Otherwise the fixed subtraction
273  *		 values will be subtracted.
274  * @en_windows: enabled window
275  * @bls_window1: Measurement window 1 size
276  * @bls_window2: Measurement window 2 size
277  * @bls_samples: Set amount of measured pixels for each Bayer position
278  *		 (A, B,C and D) to 2^bls_samples.
279  * @fixed_val: Fixed subtraction values
280  */
281 struct rkisp1_cif_isp_bls_config {
282 	__u8 enable_auto;
283 	__u8 en_windows;
284 	struct rkisp1_cif_isp_window bls_window1;
285 	struct rkisp1_cif_isp_window bls_window2;
286 	__u8 bls_samples;
287 	struct rkisp1_cif_isp_bls_fixed_val fixed_val;
288 };
289 
290 /**
291  * struct rkisp1_cif_isp_dpcc_methods_config - DPCC methods set configuration
292  *
293  * This structure stores the configuration of one set of methods for the DPCC
294  * algorithm. Multiple methods can be selected in each set (independently for
295  * the Green and Red/Blue components) through the @method field, the result is
296  * the logical AND of all enabled methods. The remaining fields set thresholds
297  * and factors for each method.
298  *
299  * @method: Method enable bits (RKISP1_CIF_ISP_DPCC_METHODS_SET_*)
300  * @line_thresh: Line threshold (RKISP1_CIF_ISP_DPCC_LINE_THRESH_*)
301  * @line_mad_fac: Line Mean Absolute Difference factor (RKISP1_CIF_ISP_DPCC_LINE_MAD_FAC_*)
302  * @pg_fac: Peak gradient factor (RKISP1_CIF_ISP_DPCC_PG_FAC_*)
303  * @rnd_thresh: Rank Neighbor Difference threshold (RKISP1_CIF_ISP_DPCC_RND_THRESH_*)
304  * @rg_fac: Rank gradient factor (RKISP1_CIF_ISP_DPCC_RG_FAC_*)
305  */
306 struct rkisp1_cif_isp_dpcc_methods_config {
307 	__u32 method;
308 	__u32 line_thresh;
309 	__u32 line_mad_fac;
310 	__u32 pg_fac;
311 	__u32 rnd_thresh;
312 	__u32 rg_fac;
313 };
314 
315 /**
316  * struct rkisp1_cif_isp_dpcc_config - Configuration used by DPCC
317  *
318  * Configuration used by Defect Pixel Cluster Correction. Three sets of methods
319  * can be configured and selected through the @set_use field. The result is the
320  * logical OR of all enabled sets.
321  *
322  * @mode: DPCC mode (RKISP1_CIF_ISP_DPCC_MODE_*)
323  * @output_mode: Interpolation output mode (RKISP1_CIF_ISP_DPCC_OUTPUT_MODE_*)
324  * @set_use: Methods sets selection (RKISP1_CIF_ISP_DPCC_SET_USE_*)
325  * @methods: Methods sets configuration
326  * @ro_limits: Rank order limits (RKISP1_CIF_ISP_DPCC_RO_LIMITS_*)
327  * @rnd_offs: Differential rank offsets for rank neighbor difference (RKISP1_CIF_ISP_DPCC_RND_OFFS_*)
328  */
329 struct rkisp1_cif_isp_dpcc_config {
330 	__u32 mode;
331 	__u32 output_mode;
332 	__u32 set_use;
333 	struct rkisp1_cif_isp_dpcc_methods_config methods[RKISP1_CIF_ISP_DPCC_METHODS_MAX];
334 	__u32 ro_limits;
335 	__u32 rnd_offs;
336 };
337 
338 /**
339  * struct rkisp1_cif_isp_gamma_corr_curve - gamma curve point definition y-axis (output).
340  *
341  * The reset values define a linear curve which has the same effect as bypass. Reset values are:
342  * gamma_y[0] = 0x0000, gamma_y[1] = 0x0100, ... gamma_y[15] = 0x0f00, gamma_y[16] = 0xfff
343  *
344  * @gamma_y: the values for the y-axis of gamma curve points. Each value is 12 bit.
345  */
346 struct rkisp1_cif_isp_gamma_corr_curve {
347 	__u16 gamma_y[RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE];
348 };
349 
350 /**
351  * struct rkisp1_cif_isp_gamma_curve_x_axis_pnts - De-Gamma Curve definition x increments
352  *		(sampling points). gamma_dx0 is for the lower samples (1-8), gamma_dx1 is for the
353  *		higher samples (9-16). The reset values for both fields is 0x44444444. This means
354  *		that each sample is 4 units away from the previous one on the x-axis.
355  *
356  * @gamma_dx0: gamma curve sample points definitions. Bits 0:2 for sample 1. Bit 3 unused.
357  *		Bits 4:6 for sample 2. bit 7 unused ... Bits 28:30 for sample 8. Bit 31 unused
358  * @gamma_dx1: gamma curve sample points definitions. Bits 0:2 for sample 9. Bit 3 unused.
359  *		Bits 4:6 for sample 10. bit 7 unused ... Bits 28:30 for sample 16. Bit 31 unused
360  */
361 struct rkisp1_cif_isp_gamma_curve_x_axis_pnts {
362 	__u32 gamma_dx0;
363 	__u32 gamma_dx1;
364 };
365 
366 /**
367  * struct rkisp1_cif_isp_sdg_config - Configuration used by sensor degamma
368  *
369  * @curve_r: gamma curve point definition axis for red
370  * @curve_g: gamma curve point definition axis for green
371  * @curve_b: gamma curve point definition axis for blue
372  * @xa_pnts: x axis increments
373  */
374 struct rkisp1_cif_isp_sdg_config {
375 	struct rkisp1_cif_isp_gamma_corr_curve curve_r;
376 	struct rkisp1_cif_isp_gamma_corr_curve curve_g;
377 	struct rkisp1_cif_isp_gamma_corr_curve curve_b;
378 	struct rkisp1_cif_isp_gamma_curve_x_axis_pnts xa_pnts;
379 };
380 
381 /**
382  * struct rkisp1_cif_isp_lsc_config - Configuration used by Lens shading correction
383  *
384  * @r_data_tbl: sample table red
385  * @gr_data_tbl: sample table green (red)
386  * @gb_data_tbl: sample table green (blue)
387  * @b_data_tbl: sample table blue
388  * @x_grad_tbl: gradient table x
389  * @y_grad_tbl: gradient table y
390  * @x_size_tbl: size table x
391  * @y_size_tbl: size table y
392  * @config_width: not used at the moment
393  * @config_height: not used at the moment
394  */
395 struct rkisp1_cif_isp_lsc_config {
396 	__u16 r_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
397 	__u16 gr_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
398 	__u16 gb_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
399 	__u16 b_data_tbl[RKISP1_CIF_ISP_LSC_SAMPLES_MAX][RKISP1_CIF_ISP_LSC_SAMPLES_MAX];
400 
401 	__u16 x_grad_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
402 	__u16 y_grad_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
403 
404 	__u16 x_size_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
405 	__u16 y_size_tbl[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];
406 	__u16 config_width;
407 	__u16 config_height;
408 };
409 
410 /**
411  * struct rkisp1_cif_isp_ie_config - Configuration used by image effects
412  *
413  * @effect: values from 'enum v4l2_colorfx'. Possible values are: V4L2_COLORFX_SEPIA,
414  *		V4L2_COLORFX_SET_CBCR, V4L2_COLORFX_AQUA, V4L2_COLORFX_EMBOSS,
415  *		V4L2_COLORFX_SKETCH,   V4L2_COLORFX_BW,   V4L2_COLORFX_NEGATIVE
416  * @color_sel: bits 0:2 - colors bitmask (001 - blue, 010 - green, 100 - red).
417  *		bits 8:15 - Threshold value of the RGB colors for the color selection effect.
418  * @eff_mat_1: 3x3 Matrix Coefficients for Emboss Effect 1
419  * @eff_mat_2: 3x3 Matrix Coefficients for Emboss Effect 2
420  * @eff_mat_3: 3x3 Matrix Coefficients for Emboss 3/Sketch 1
421  * @eff_mat_4: 3x3 Matrix Coefficients for Sketch Effect 2
422  * @eff_mat_5: 3x3 Matrix Coefficients for Sketch Effect 3
423  * @eff_tint: Chrominance increment values of tint (used for sepia effect)
424  */
425 struct rkisp1_cif_isp_ie_config {
426 	__u16 effect;
427 	__u16 color_sel;
428 	__u16 eff_mat_1;
429 	__u16 eff_mat_2;
430 	__u16 eff_mat_3;
431 	__u16 eff_mat_4;
432 	__u16 eff_mat_5;
433 	__u16 eff_tint;
434 };
435 
436 /**
437  * struct rkisp1_cif_isp_cproc_config - Configuration used by Color Processing
438  *
439  * @c_out_range: Chrominance pixel clipping range at output.
440  *		 (0 for limit, 1 for full)
441  * @y_in_range: Luminance pixel clipping range at output.
442  * @y_out_range: Luminance pixel clipping range at output.
443  * @contrast: 00~ff, 0.0~1.992
444  * @brightness: 80~7F, -128~+127
445  * @sat: saturation, 00~FF, 0.0~1.992
446  * @hue: 80~7F, -90~+87.188
447  */
448 struct rkisp1_cif_isp_cproc_config {
449 	__u8 c_out_range;
450 	__u8 y_in_range;
451 	__u8 y_out_range;
452 	__u8 contrast;
453 	__u8 brightness;
454 	__u8 sat;
455 	__u8 hue;
456 };
457 
458 /**
459  * struct rkisp1_cif_isp_awb_meas_config - Configuration for the AWB statistics
460  *
461  * @awb_mode: the awb meas mode. From enum rkisp1_cif_isp_awb_mode_type.
462  * @awb_wnd: white balance measurement window (in pixels)
463  * @max_y: only pixels values < max_y contribute to awb measurement, set to 0
464  *	   to disable this feature
465  * @min_y: only pixels values > min_y contribute to awb measurement
466  * @max_csum: Chrominance sum maximum value, only consider pixels with Cb+Cr,
467  *	      smaller than threshold for awb measurements
468  * @min_c: Chrominance minimum value, only consider pixels with Cb/Cr
469  *	   each greater than threshold value for awb measurements
470  * @frames: number of frames - 1 used for mean value calculation
471  *	    (ucFrames=0 means 1 Frame)
472  * @awb_ref_cr: reference Cr value for AWB regulation, target for AWB
473  * @awb_ref_cb: reference Cb value for AWB regulation, target for AWB
474  * @enable_ymax_cmp: enable Y_MAX compare (Not valid in RGB measurement mode.)
475  */
476 struct rkisp1_cif_isp_awb_meas_config {
477 	/*
478 	 * Note: currently the h and v offsets are mapped to grid offsets
479 	 */
480 	struct rkisp1_cif_isp_window awb_wnd;
481 	__u32 awb_mode;
482 	__u8 max_y;
483 	__u8 min_y;
484 	__u8 max_csum;
485 	__u8 min_c;
486 	__u8 frames;
487 	__u8 awb_ref_cr;
488 	__u8 awb_ref_cb;
489 	__u8 enable_ymax_cmp;
490 };
491 
492 /**
493  * struct rkisp1_cif_isp_awb_gain_config - Configuration used by auto white balance gain
494  *
495  * All fields in this struct are 10 bit, where:
496  * 0x100h = 1, unsigned integer value, range 0 to 4 with 8 bit fractional part.
497  *
498  * out_data_x = ( AWB_GAIN_X * in_data + 128) >> 8
499  *
500  * @gain_red: gain value for red component.
501  * @gain_green_r: gain value for green component in red line.
502  * @gain_blue: gain value for blue component.
503  * @gain_green_b: gain value for green component in blue line.
504  */
505 struct rkisp1_cif_isp_awb_gain_config {
506 	__u16 gain_red;
507 	__u16 gain_green_r;
508 	__u16 gain_blue;
509 	__u16 gain_green_b;
510 };
511 
512 /**
513  * struct rkisp1_cif_isp_flt_config - Configuration used by ISP filtering
514  *
515  * All 4 threshold fields (thresh_*) are 10 bits.
516  * All 6 factor fields (fac_*) are 6 bits.
517  *
518  * @mode: ISP_FILT_MODE register fields (from enum rkisp1_cif_isp_flt_mode)
519  * @grn_stage1: Green filter stage 1 select (range 0x0...0x8)
520  * @chr_h_mode: Chroma filter horizontal mode
521  * @chr_v_mode: Chroma filter vertical mode
522  * @thresh_bl0: If thresh_bl1 < sum_grad < thresh_bl0 then fac_bl0 is selected (blurring th)
523  * @thresh_bl1: If sum_grad < thresh_bl1 then fac_bl1 is selected (blurring th)
524  * @thresh_sh0: If thresh_sh0 < sum_grad < thresh_sh1 then thresh_sh0 is selected (sharpening th)
525  * @thresh_sh1: If thresh_sh1 < sum_grad then thresh_sh1 is selected (sharpening th)
526  * @lum_weight: Parameters for luminance weight function.
527  * @fac_sh1: filter factor for sharp1 level
528  * @fac_sh0: filter factor for sharp0 level
529  * @fac_mid: filter factor for mid level and for static filter mode
530  * @fac_bl0: filter factor for blur 0 level
531  * @fac_bl1: filter factor for blur 1 level (max blur)
532  */
533 struct rkisp1_cif_isp_flt_config {
534 	__u32 mode;
535 	__u8 grn_stage1;
536 	__u8 chr_h_mode;
537 	__u8 chr_v_mode;
538 	__u32 thresh_bl0;
539 	__u32 thresh_bl1;
540 	__u32 thresh_sh0;
541 	__u32 thresh_sh1;
542 	__u32 lum_weight;
543 	__u32 fac_sh1;
544 	__u32 fac_sh0;
545 	__u32 fac_mid;
546 	__u32 fac_bl0;
547 	__u32 fac_bl1;
548 };
549 
550 /**
551  * struct rkisp1_cif_isp_bdm_config - Configuration used by Bayer DeMosaic
552  *
553  * @demosaic_th: threshold for bayer demosaicing texture detection
554  */
555 struct rkisp1_cif_isp_bdm_config {
556 	__u8 demosaic_th;
557 };
558 
559 /**
560  * struct rkisp1_cif_isp_ctk_config - Configuration used by Cross Talk correction
561  *
562  * @coeff: color correction matrix. Values are 11-bit signed fixed-point numbers with 4 bit integer
563  *		and 7 bit fractional part, ranging from -8 (0x400) to +7.992 (0x3FF). 0 is
564  *		represented by 0x000 and a coefficient value of 1 as 0x080.
565  * @ct_offset: Red, Green, Blue offsets for the crosstalk correction matrix
566  */
567 struct rkisp1_cif_isp_ctk_config {
568 	__u16 coeff[3][3];
569 	__u16 ct_offset[3];
570 };
571 
572 enum rkisp1_cif_isp_goc_mode {
573 	RKISP1_CIF_ISP_GOC_MODE_LOGARITHMIC,
574 	RKISP1_CIF_ISP_GOC_MODE_EQUIDISTANT
575 };
576 
577 /**
578  * struct rkisp1_cif_isp_goc_config - Configuration used by Gamma Out correction
579  *
580  * @mode: goc mode (from enum rkisp1_cif_isp_goc_mode)
581  * @gamma_y: gamma out curve y-axis for all color components
582  *
583  * The number of entries of @gamma_y depends on the hardware revision
584  * as is reported by the hw_revision field of the struct media_device_info
585  * that is returned by ioctl MEDIA_IOC_DEVICE_INFO.
586  *
587  * Versions <= V11 have RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V10
588  * entries, versions >= V12 have RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES_V12
589  * entries. RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES is equal to the maximum
590  * of the two.
591  */
592 struct rkisp1_cif_isp_goc_config {
593 	__u32 mode;
594 	__u16 gamma_y[RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES];
595 };
596 
597 /**
598  * struct rkisp1_cif_isp_hst_config - Configuration for Histogram statistics
599  *
600  * @mode: histogram mode (from enum rkisp1_cif_isp_histogram_mode)
601  * @histogram_predivider: process every stepsize pixel, all other pixels are
602  *			  skipped
603  * @meas_window: coordinates of the measure window
604  * @hist_weight: weighting factor for sub-windows
605  *
606  * The number of entries of @hist_weight depends on the hardware revision
607  * as is reported by the hw_revision field of the struct media_device_info
608  * that is returned by ioctl MEDIA_IOC_DEVICE_INFO.
609  *
610  * Versions <= V11 have RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V10
611  * entries, versions >= V12 have RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE_V12
612  * entries. RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE is equal to the maximum
613  * of the two.
614  */
615 struct rkisp1_cif_isp_hst_config {
616 	__u32 mode;
617 	__u8 histogram_predivider;
618 	struct rkisp1_cif_isp_window meas_window;
619 	__u8 hist_weight[RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE];
620 };
621 
622 /**
623  * struct rkisp1_cif_isp_aec_config - Configuration for Auto Exposure statistics
624  *
625  * @mode: Exposure measure mode (from enum rkisp1_cif_isp_exp_meas_mode)
626  * @autostop: stop mode (from enum rkisp1_cif_isp_exp_ctrl_autostop)
627  * @meas_window: coordinates of the measure window
628  */
629 struct rkisp1_cif_isp_aec_config {
630 	__u32 mode;
631 	__u32 autostop;
632 	struct rkisp1_cif_isp_window meas_window;
633 };
634 
635 /**
636  * struct rkisp1_cif_isp_afc_config - Configuration for the Auto Focus statistics
637  *
638  * @num_afm_win: max RKISP1_CIF_ISP_AFM_MAX_WINDOWS
639  * @afm_win: coordinates of the meas window
640  * @thres: threshold used for minimizing the influence of noise
641  * @var_shift: the number of bits for the shift operation at the end of the
642  *	       calculation chain.
643  */
644 struct rkisp1_cif_isp_afc_config {
645 	__u8 num_afm_win;
646 	struct rkisp1_cif_isp_window afm_win[RKISP1_CIF_ISP_AFM_MAX_WINDOWS];
647 	__u32 thres;
648 	__u32 var_shift;
649 };
650 
651 /**
652  * enum rkisp1_cif_isp_dpf_gain_usage - dpf gain usage
653  * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED: don't use any gains in preprocessing stage
654  * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS: use only the noise function gains from
655  *				    registers DPF_NF_GAIN_R, ...
656  * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS:  use only the gains from LSC module
657  * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS: use the noise function gains and the
658  *					gains from LSC module
659  * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS: use only the gains from AWB module
660  * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS: use the gains from AWB and LSC module
661  * @RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX: upper border (only for an internal evaluation)
662  */
663 enum rkisp1_cif_isp_dpf_gain_usage {
664 	RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED,
665 	RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS,
666 	RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS,
667 	RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS,
668 	RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS,
669 	RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS,
670 	RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX
671 };
672 
673 /**
674  * enum rkisp1_cif_isp_dpf_rb_filtersize - Red and blue filter sizes
675  * @RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9: red and blue filter kernel size 13x9
676  *				   (means 7x5 active pixel)
677  * @RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9: red and blue filter kernel size 9x9
678  *				   (means 5x5 active pixel)
679  */
680 enum rkisp1_cif_isp_dpf_rb_filtersize {
681 	RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9,
682 	RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9,
683 };
684 
685 /**
686  * enum rkisp1_cif_isp_dpf_nll_scale_mode - dpf noise level scale mode
687  * @RKISP1_CIF_ISP_NLL_SCALE_LINEAR: use a linear scaling
688  * @RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC: use a logarithmic scaling
689  */
690 enum rkisp1_cif_isp_dpf_nll_scale_mode {
691 	RKISP1_CIF_ISP_NLL_SCALE_LINEAR,
692 	RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC,
693 };
694 
695 /**
696  * struct rkisp1_cif_isp_dpf_nll - Noise level lookup
697  *
698  * @coeff: Noise level Lookup coefficient
699  * @scale_mode: dpf noise level scale mode (from enum rkisp1_cif_isp_dpf_nll_scale_mode)
700  */
701 struct rkisp1_cif_isp_dpf_nll {
702 	__u16 coeff[RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS];
703 	__u32 scale_mode;
704 };
705 
706 /**
707  * struct rkisp1_cif_isp_dpf_rb_flt - Red blue filter config
708  *
709  * @fltsize: The filter size for the red and blue pixels
710  *	     (from enum rkisp1_cif_isp_dpf_rb_filtersize)
711  * @spatial_coeff: Spatial weights
712  * @r_enable: enable filter processing for red pixels
713  * @b_enable: enable filter processing for blue pixels
714  */
715 struct rkisp1_cif_isp_dpf_rb_flt {
716 	__u32 fltsize;
717 	__u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS];
718 	__u8 r_enable;
719 	__u8 b_enable;
720 };
721 
722 /**
723  * struct rkisp1_cif_isp_dpf_g_flt - Green filter Configuration
724  *
725  * @spatial_coeff: Spatial weights
726  * @gr_enable: enable filter processing for green pixels in green/red lines
727  * @gb_enable: enable filter processing for green pixels in green/blue lines
728  */
729 struct rkisp1_cif_isp_dpf_g_flt {
730 	__u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS];
731 	__u8 gr_enable;
732 	__u8 gb_enable;
733 };
734 
735 /**
736  * struct rkisp1_cif_isp_dpf_gain - Noise function Configuration
737  *
738  * @mode: dpf gain usage  (from enum rkisp1_cif_isp_dpf_gain_usage)
739  * @nf_r_gain: Noise function Gain that replaces the AWB gain for red pixels
740  * @nf_b_gain: Noise function Gain that replaces the AWB gain for blue pixels
741  * @nf_gr_gain: Noise function Gain that replaces the AWB gain
742  *		for green pixels in a red line
743  * @nf_gb_gain: Noise function Gain that replaces the AWB gain
744  *		for green pixels in a blue line
745  */
746 struct rkisp1_cif_isp_dpf_gain {
747 	__u32 mode;
748 	__u16 nf_r_gain;
749 	__u16 nf_b_gain;
750 	__u16 nf_gr_gain;
751 	__u16 nf_gb_gain;
752 };
753 
754 /**
755  * struct rkisp1_cif_isp_dpf_config - Configuration used by De-noising pre-filter
756  *
757  * @gain: noise function gain
758  * @g_flt: green filter config
759  * @rb_flt: red blue filter config
760  * @nll: noise level lookup
761  */
762 struct rkisp1_cif_isp_dpf_config {
763 	struct rkisp1_cif_isp_dpf_gain gain;
764 	struct rkisp1_cif_isp_dpf_g_flt g_flt;
765 	struct rkisp1_cif_isp_dpf_rb_flt rb_flt;
766 	struct rkisp1_cif_isp_dpf_nll nll;
767 };
768 
769 /**
770  * struct rkisp1_cif_isp_dpf_strength_config - strength of the filter
771  *
772  * @r: filter strength of the RED filter
773  * @g: filter strength of the GREEN filter
774  * @b: filter strength of the BLUE filter
775  */
776 struct rkisp1_cif_isp_dpf_strength_config {
777 	__u8 r;
778 	__u8 g;
779 	__u8 b;
780 };
781 
782 /**
783  * struct rkisp1_cif_isp_isp_other_cfg - Parameters for some blocks in rockchip isp1
784  *
785  * @dpcc_config: Defect Pixel Cluster Correction config
786  * @bls_config: Black Level Subtraction config
787  * @sdg_config: sensor degamma config
788  * @lsc_config: Lens Shade config
789  * @awb_gain_config: Auto White balance gain config
790  * @flt_config: filter config
791  * @bdm_config: demosaic config
792  * @ctk_config: cross talk config
793  * @goc_config: gamma out config
794  * @bls_config: black level subtraction config
795  * @dpf_config: De-noising pre-filter config
796  * @dpf_strength_config: dpf strength config
797  * @cproc_config: color process config
798  * @ie_config: image effects config
799  */
800 struct rkisp1_cif_isp_isp_other_cfg {
801 	struct rkisp1_cif_isp_dpcc_config dpcc_config;
802 	struct rkisp1_cif_isp_bls_config bls_config;
803 	struct rkisp1_cif_isp_sdg_config sdg_config;
804 	struct rkisp1_cif_isp_lsc_config lsc_config;
805 	struct rkisp1_cif_isp_awb_gain_config awb_gain_config;
806 	struct rkisp1_cif_isp_flt_config flt_config;
807 	struct rkisp1_cif_isp_bdm_config bdm_config;
808 	struct rkisp1_cif_isp_ctk_config ctk_config;
809 	struct rkisp1_cif_isp_goc_config goc_config;
810 	struct rkisp1_cif_isp_dpf_config dpf_config;
811 	struct rkisp1_cif_isp_dpf_strength_config dpf_strength_config;
812 	struct rkisp1_cif_isp_cproc_config cproc_config;
813 	struct rkisp1_cif_isp_ie_config ie_config;
814 };
815 
816 /**
817  * struct rkisp1_cif_isp_isp_meas_cfg - Rockchip ISP1 Measure Parameters
818  *
819  * @awb_meas_config: auto white balance config
820  * @hst_config: histogram config
821  * @aec_config: auto exposure config
822  * @afc_config: auto focus config
823  */
824 struct rkisp1_cif_isp_isp_meas_cfg {
825 	struct rkisp1_cif_isp_awb_meas_config awb_meas_config;
826 	struct rkisp1_cif_isp_hst_config hst_config;
827 	struct rkisp1_cif_isp_aec_config aec_config;
828 	struct rkisp1_cif_isp_afc_config afc_config;
829 };
830 
831 /**
832  * struct rkisp1_params_cfg - Rockchip ISP1 Input Parameters Meta Data
833  *
834  * @module_en_update: mask the enable bits of which module should be updated
835  * @module_ens: mask the enable value of each module, only update the module
836  *		which correspond bit was set in module_en_update
837  * @module_cfg_update: mask the config bits of which module should be updated
838  * @meas: measurement config
839  * @others: other config
840  */
841 struct rkisp1_params_cfg {
842 	__u32 module_en_update;
843 	__u32 module_ens;
844 	__u32 module_cfg_update;
845 
846 	struct rkisp1_cif_isp_isp_meas_cfg meas;
847 	struct rkisp1_cif_isp_isp_other_cfg others;
848 };
849 
850 /*---------- PART2: Measurement Statistics ------------*/
851 
852 /**
853  * struct rkisp1_cif_isp_awb_meas - AWB measured values
854  *
855  * @cnt: White pixel count, number of "white pixels" found during last
856  *	 measurement
857  * @mean_y_or_g: Mean value of Y within window and frames,
858  *		 Green if RGB is selected.
859  * @mean_cb_or_b: Mean value of Cb within window and frames,
860  *		  Blue if RGB is selected.
861  * @mean_cr_or_r: Mean value of Cr within window and frames,
862  *		  Red if RGB is selected.
863  */
864 struct rkisp1_cif_isp_awb_meas {
865 	__u32 cnt;
866 	__u8 mean_y_or_g;
867 	__u8 mean_cb_or_b;
868 	__u8 mean_cr_or_r;
869 };
870 
871 /**
872  * struct rkisp1_cif_isp_awb_stat - statistics automatic white balance data
873  *
874  * @awb_mean: Mean measured data
875  */
876 struct rkisp1_cif_isp_awb_stat {
877 	struct rkisp1_cif_isp_awb_meas awb_mean[RKISP1_CIF_ISP_AWB_MAX_GRID];
878 };
879 
880 /**
881  * struct rkisp1_cif_isp_bls_meas_val - BLS measured values
882  *
883  * @meas_r: Mean measured value for Bayer pattern R
884  * @meas_gr: Mean measured value for Bayer pattern Gr
885  * @meas_gb: Mean measured value for Bayer pattern Gb
886  * @meas_b: Mean measured value for Bayer pattern B
887  */
888 struct rkisp1_cif_isp_bls_meas_val {
889 	__u16 meas_r;
890 	__u16 meas_gr;
891 	__u16 meas_gb;
892 	__u16 meas_b;
893 };
894 
895 /**
896  * struct rkisp1_cif_isp_ae_stat - statistics auto exposure data
897  *
898  * @exp_mean: Mean luminance value of block xx
899  * @bls_val:  BLS measured values
900  *
901  * The number of entries of @exp_mean depends on the hardware revision
902  * as is reported by the hw_revision field of the struct media_device_info
903  * that is returned by ioctl MEDIA_IOC_DEVICE_INFO.
904  *
905  * Versions <= V11 have RKISP1_CIF_ISP_AE_MEAN_MAX_V10 entries,
906  * versions >= V12 have RKISP1_CIF_ISP_AE_MEAN_MAX_V12 entries.
907  * RKISP1_CIF_ISP_AE_MEAN_MAX is equal to the maximum of the two.
908  *
909  * Image is divided into 5x5 blocks on V10 and 9x9 blocks on V12.
910  */
911 struct rkisp1_cif_isp_ae_stat {
912 	__u8 exp_mean[RKISP1_CIF_ISP_AE_MEAN_MAX];
913 	struct rkisp1_cif_isp_bls_meas_val bls_val;
914 };
915 
916 /**
917  * struct rkisp1_cif_isp_af_meas_val - AF measured values
918  *
919  * @sum: sharpness value
920  * @lum: luminance value
921  */
922 struct rkisp1_cif_isp_af_meas_val {
923 	__u32 sum;
924 	__u32 lum;
925 };
926 
927 /**
928  * struct rkisp1_cif_isp_af_stat - statistics auto focus data
929  *
930  * @window: AF measured value of window x
931  *
932  * The module measures the sharpness in 3 windows of selectable size via
933  * register settings(ISP_AFM_*_A/B/C)
934  */
935 struct rkisp1_cif_isp_af_stat {
936 	struct rkisp1_cif_isp_af_meas_val window[RKISP1_CIF_ISP_AFM_MAX_WINDOWS];
937 };
938 
939 /**
940  * struct rkisp1_cif_isp_hist_stat - statistics histogram data
941  *
942  * @hist_bins: measured bin counters. Each bin is a 20 bits unsigned fixed point
943  *	       type. Bits 0-4 are the fractional part and bits 5-19 are the
944  *	       integer part.
945  *
946  * The window of the measurements area is divided to 5x5 sub-windows for
947  * V10/V11 and to 9x9 sub-windows for V12. The histogram is then computed for
948  * each sub-window independently and the final result is a weighted average of
949  * the histogram measurements on all sub-windows. The window of the
950  * measurements area and the weight of each sub-window are configurable using
951  * struct @rkisp1_cif_isp_hst_config.
952  *
953  * The histogram contains 16 bins in V10/V11 and 32 bins in V12/V13.
954  *
955  * The number of entries of @hist_bins depends on the hardware revision
956  * as is reported by the hw_revision field of the struct media_device_info
957  * that is returned by ioctl MEDIA_IOC_DEVICE_INFO.
958  *
959  * Versions <= V11 have RKISP1_CIF_ISP_HIST_BIN_N_MAX_V10 entries,
960  * versions >= V12 have RKISP1_CIF_ISP_HIST_BIN_N_MAX_V12 entries.
961  * RKISP1_CIF_ISP_HIST_BIN_N_MAX is equal to the maximum of the two.
962  */
963 struct rkisp1_cif_isp_hist_stat {
964 	__u32 hist_bins[RKISP1_CIF_ISP_HIST_BIN_N_MAX];
965 };
966 
967 /**
968  * struct rkisp1_cif_isp_stat - Rockchip ISP1 Statistics Data
969  *
970  * @awb: statistics data for automatic white balance
971  * @ae: statistics data for auto exposure
972  * @af: statistics data for auto focus
973  * @hist: statistics histogram data
974  */
975 struct rkisp1_cif_isp_stat {
976 	struct rkisp1_cif_isp_awb_stat awb;
977 	struct rkisp1_cif_isp_ae_stat ae;
978 	struct rkisp1_cif_isp_af_stat af;
979 	struct rkisp1_cif_isp_hist_stat hist;
980 };
981 
982 /**
983  * struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Meta Data
984  *
985  * @meas_type: measurement types (RKISP1_CIF_ISP_STAT_* definitions)
986  * @frame_id: frame ID for sync
987  * @params: statistics data
988  */
989 struct rkisp1_stat_buffer {
990 	__u32 meas_type;
991 	__u32 frame_id;
992 	struct rkisp1_cif_isp_stat params;
993 };
994 
995 #endif /* _UAPI_RKISP1_CONFIG_H */
996