1 /*
2  * omap3isp.h
3  *
4  * TI OMAP3 ISP - User-space API
5  *
6  * Copyright (C) 2010 Nokia Corporation
7  * Copyright (C) 2009 Texas Instruments, Inc.
8  *
9  * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10  *	     Sakari Ailus <sakari.ailus@iki.fi>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2 as
14  * published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24  * 02110-1301 USA
25  */
26 
27 #ifndef OMAP3_ISP_USER_H
28 #define OMAP3_ISP_USER_H
29 
30 #include <linux/types.h>
31 
32 /*
33  * Private IOCTLs
34  *
35  * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration
36  * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration
37  * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration
38  * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration
39  * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration
40  * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data
41  * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module
42  */
43 
44 #define VIDIOC_OMAP3ISP_CCDC_CFG \
45 	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config)
46 #define VIDIOC_OMAP3ISP_PRV_CFG \
47 	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config)
48 #define VIDIOC_OMAP3ISP_AEWB_CFG \
49 	_IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config)
50 #define VIDIOC_OMAP3ISP_HIST_CFG \
51 	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config)
52 #define VIDIOC_OMAP3ISP_AF_CFG \
53 	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config)
54 #define VIDIOC_OMAP3ISP_STAT_REQ \
55 	_IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data)
56 #define VIDIOC_OMAP3ISP_STAT_EN \
57 	_IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long)
58 
59 /*
60  * Events
61  *
62  * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
63  * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
64  * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
65  */
66 
67 #define V4L2_EVENT_OMAP3ISP_CLASS	(V4L2_EVENT_PRIVATE_START | 0x100)
68 #define V4L2_EVENT_OMAP3ISP_AEWB	(V4L2_EVENT_OMAP3ISP_CLASS | 0x1)
69 #define V4L2_EVENT_OMAP3ISP_AF		(V4L2_EVENT_OMAP3ISP_CLASS | 0x2)
70 #define V4L2_EVENT_OMAP3ISP_HIST	(V4L2_EVENT_OMAP3ISP_CLASS | 0x3)
71 
72 struct omap3isp_stat_event_status {
73 	__u32 frame_number;
74 	__u16 config_counter;
75 	__u8 buf_err;
76 };
77 
78 /* AE/AWB related structures and flags*/
79 
80 /* H3A Range Constants */
81 #define OMAP3ISP_AEWB_MAX_SATURATION_LIM	1023
82 #define OMAP3ISP_AEWB_MIN_WIN_H			2
83 #define OMAP3ISP_AEWB_MAX_WIN_H			256
84 #define OMAP3ISP_AEWB_MIN_WIN_W			6
85 #define OMAP3ISP_AEWB_MAX_WIN_W			256
86 #define OMAP3ISP_AEWB_MIN_WINVC			1
87 #define OMAP3ISP_AEWB_MIN_WINHC			1
88 #define OMAP3ISP_AEWB_MAX_WINVC			128
89 #define OMAP3ISP_AEWB_MAX_WINHC			36
90 #define OMAP3ISP_AEWB_MAX_WINSTART		4095
91 #define OMAP3ISP_AEWB_MIN_SUB_INC		2
92 #define OMAP3ISP_AEWB_MAX_SUB_INC		32
93 #define OMAP3ISP_AEWB_MAX_BUF_SIZE		83600
94 
95 #define OMAP3ISP_AF_IIRSH_MIN			0
96 #define OMAP3ISP_AF_IIRSH_MAX			4095
97 #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN	1
98 #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX	36
99 #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN	1
100 #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX	128
101 #define OMAP3ISP_AF_PAXEL_INCREMENT_MIN		2
102 #define OMAP3ISP_AF_PAXEL_INCREMENT_MAX		32
103 #define OMAP3ISP_AF_PAXEL_HEIGHT_MIN		2
104 #define OMAP3ISP_AF_PAXEL_HEIGHT_MAX		256
105 #define OMAP3ISP_AF_PAXEL_WIDTH_MIN		16
106 #define OMAP3ISP_AF_PAXEL_WIDTH_MAX		256
107 #define OMAP3ISP_AF_PAXEL_HZSTART_MIN		1
108 #define OMAP3ISP_AF_PAXEL_HZSTART_MAX		4095
109 #define OMAP3ISP_AF_PAXEL_VTSTART_MIN		0
110 #define OMAP3ISP_AF_PAXEL_VTSTART_MAX		4095
111 #define OMAP3ISP_AF_THRESHOLD_MAX		255
112 #define OMAP3ISP_AF_COEF_MAX			4095
113 #define OMAP3ISP_AF_PAXEL_SIZE			48
114 #define OMAP3ISP_AF_MAX_BUF_SIZE		221184
115 
116 /**
117  * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values
118  * saturation_limit: Saturation limit.
119  * @win_height: Window Height. Range 2 - 256, even values only.
120  * @win_width: Window Width. Range 6 - 256, even values only.
121  * @ver_win_count: Vertical Window Count. Range 1 - 128.
122  * @hor_win_count: Horizontal Window Count. Range 1 - 36.
123  * @ver_win_start: Vertical Window Start. Range 0 - 4095.
124  * @hor_win_start: Horizontal Window Start. Range 0 - 4095.
125  * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095.
126  * @blk_win_height: Black Window Height. Range 2 - 256, even values only.
127  * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even
128  *                     values only.
129  * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even
130  *                     values only.
131  * @alaw_enable: AEW ALAW EN flag.
132  */
133 struct omap3isp_h3a_aewb_config {
134 	/*
135 	 * Common fields.
136 	 * They should be the first ones and must be in the same order as in
137 	 * ispstat_generic_config struct.
138 	 */
139 	__u32 buf_size;
140 	__u16 config_counter;
141 
142 	/* Private fields */
143 	__u16 saturation_limit;
144 	__u16 win_height;
145 	__u16 win_width;
146 	__u16 ver_win_count;
147 	__u16 hor_win_count;
148 	__u16 ver_win_start;
149 	__u16 hor_win_start;
150 	__u16 blk_ver_win_start;
151 	__u16 blk_win_height;
152 	__u16 subsample_ver_inc;
153 	__u16 subsample_hor_inc;
154 	__u8 alaw_enable;
155 };
156 
157 /**
158  * struct omap3isp_stat_data - Statistic data sent to or received from user
159  * @ts: Timestamp of returned framestats.
160  * @buf: Pointer to pass to user.
161  * @frame_number: Frame number of requested stats.
162  * @cur_frame: Current frame number being processed.
163  * @config_counter: Number of the configuration associated with the data.
164  */
165 struct omap3isp_stat_data {
166 	struct timeval ts;
167 	void __user *buf;
168 	__u32 buf_size;
169 	__u16 frame_number;
170 	__u16 cur_frame;
171 	__u16 config_counter;
172 };
173 
174 
175 /* Histogram related structs */
176 
177 /* Flags for number of bins */
178 #define OMAP3ISP_HIST_BINS_32		0
179 #define OMAP3ISP_HIST_BINS_64		1
180 #define OMAP3ISP_HIST_BINS_128		2
181 #define OMAP3ISP_HIST_BINS_256		3
182 
183 /* Number of bins * 4 colors * 4-bytes word */
184 #define OMAP3ISP_HIST_MEM_SIZE_BINS(n)	((1 << ((n)+5))*4*4)
185 
186 #define OMAP3ISP_HIST_MEM_SIZE		1024
187 #define OMAP3ISP_HIST_MIN_REGIONS	1
188 #define OMAP3ISP_HIST_MAX_REGIONS	4
189 #define OMAP3ISP_HIST_MAX_WB_GAIN	255
190 #define OMAP3ISP_HIST_MIN_WB_GAIN	0
191 #define OMAP3ISP_HIST_MAX_BIT_WIDTH	14
192 #define OMAP3ISP_HIST_MIN_BIT_WIDTH	8
193 #define OMAP3ISP_HIST_MAX_WG		4
194 #define OMAP3ISP_HIST_MAX_BUF_SIZE	4096
195 
196 /* Source */
197 #define OMAP3ISP_HIST_SOURCE_CCDC	0
198 #define OMAP3ISP_HIST_SOURCE_MEM	1
199 
200 /* CFA pattern */
201 #define OMAP3ISP_HIST_CFA_BAYER		0
202 #define OMAP3ISP_HIST_CFA_FOVEONX3	1
203 
204 struct omap3isp_hist_region {
205 	__u16 h_start;
206 	__u16 h_end;
207 	__u16 v_start;
208 	__u16 v_end;
209 };
210 
211 struct omap3isp_hist_config {
212 	/*
213 	 * Common fields.
214 	 * They should be the first ones and must be in the same order as in
215 	 * ispstat_generic_config struct.
216 	 */
217 	__u32 buf_size;
218 	__u16 config_counter;
219 
220 	__u8 num_acc_frames;	/* Num of image frames to be processed and
221 				   accumulated for each histogram frame */
222 	__u16 hist_bins;	/* number of bins: 32, 64, 128, or 256 */
223 	__u8 cfa;		/* BAYER or FOVEON X3 */
224 	__u8 wg[OMAP3ISP_HIST_MAX_WG];	/* White Balance Gain */
225 	__u8 num_regions;	/* number of regions to be configured */
226 	struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS];
227 };
228 
229 /* Auto Focus related structs */
230 
231 #define OMAP3ISP_AF_NUM_COEF		11
232 
233 enum omap3isp_h3a_af_fvmode {
234 	OMAP3ISP_AF_MODE_SUMMED = 0,
235 	OMAP3ISP_AF_MODE_PEAK = 1
236 };
237 
238 /* Red, Green, and blue pixel location in the AF windows */
239 enum omap3isp_h3a_af_rgbpos {
240 	OMAP3ISP_AF_GR_GB_BAYER = 0,	/* GR and GB as Bayer pattern */
241 	OMAP3ISP_AF_RG_GB_BAYER = 1,	/* RG and GB as Bayer pattern */
242 	OMAP3ISP_AF_GR_BG_BAYER = 2,	/* GR and BG as Bayer pattern */
243 	OMAP3ISP_AF_RG_BG_BAYER = 3,	/* RG and BG as Bayer pattern */
244 	OMAP3ISP_AF_GG_RB_CUSTOM = 4,	/* GG and RB as custom pattern */
245 	OMAP3ISP_AF_RB_GG_CUSTOM = 5	/* RB and GG as custom pattern */
246 };
247 
248 /* Contains the information regarding the Horizontal Median Filter */
249 struct omap3isp_h3a_af_hmf {
250 	__u8 enable;	/* Status of Horizontal Median Filter */
251 	__u8 threshold;	/* Threshold Value for Horizontal Median Filter */
252 };
253 
254 /* Contains the information regarding the IIR Filters */
255 struct omap3isp_h3a_af_iir {
256 	__u16 h_start;			/* IIR horizontal start */
257 	__u16 coeff_set0[OMAP3ISP_AF_NUM_COEF];	/* Filter coefficient, set 0 */
258 	__u16 coeff_set1[OMAP3ISP_AF_NUM_COEF];	/* Filter coefficient, set 1 */
259 };
260 
261 /* Contains the information regarding the Paxels Structure in AF Engine */
262 struct omap3isp_h3a_af_paxel {
263 	__u16 h_start;	/* Horizontal Start Position */
264 	__u16 v_start;	/* Vertical Start Position */
265 	__u8 width;	/* Width of the Paxel */
266 	__u8 height;	/* Height of the Paxel */
267 	__u8 h_cnt;	/* Horizontal Count */
268 	__u8 v_cnt;	/* vertical Count */
269 	__u8 line_inc;	/* Line Increment */
270 };
271 
272 /* Contains the parameters required for hardware set up of AF Engine */
273 struct omap3isp_h3a_af_config {
274 	/*
275 	 * Common fields.
276 	 * They should be the first ones and must be in the same order as in
277 	 * ispstat_generic_config struct.
278 	 */
279 	__u32 buf_size;
280 	__u16 config_counter;
281 
282 	struct omap3isp_h3a_af_hmf hmf;		/* HMF configurations */
283 	struct omap3isp_h3a_af_iir iir;		/* IIR filter configurations */
284 	struct omap3isp_h3a_af_paxel paxel;	/* Paxel parameters */
285 	enum omap3isp_h3a_af_rgbpos rgb_pos;	/* RGB Positions */
286 	enum omap3isp_h3a_af_fvmode fvmode;	/* Accumulator mode */
287 	__u8 alaw_enable;			/* AF ALAW status */
288 };
289 
290 /* ISP CCDC structs */
291 
292 /* Abstraction layer CCDC configurations */
293 #define OMAP3ISP_CCDC_ALAW		(1 << 0)
294 #define OMAP3ISP_CCDC_LPF		(1 << 1)
295 #define OMAP3ISP_CCDC_BLCLAMP		(1 << 2)
296 #define OMAP3ISP_CCDC_BCOMP		(1 << 3)
297 #define OMAP3ISP_CCDC_FPC		(1 << 4)
298 #define OMAP3ISP_CCDC_CULL		(1 << 5)
299 #define OMAP3ISP_CCDC_CONFIG_LSC	(1 << 7)
300 #define OMAP3ISP_CCDC_TBL_LSC		(1 << 8)
301 
302 #define OMAP3ISP_RGB_MAX		3
303 
304 /* Enumeration constants for Alaw input width */
305 enum omap3isp_alaw_ipwidth {
306 	OMAP3ISP_ALAW_BIT12_3 = 0x3,
307 	OMAP3ISP_ALAW_BIT11_2 = 0x4,
308 	OMAP3ISP_ALAW_BIT10_1 = 0x5,
309 	OMAP3ISP_ALAW_BIT9_0 = 0x6
310 };
311 
312 /**
313  * struct omap3isp_ccdc_lsc_config - LSC configuration
314  * @offset: Table Offset of the gain table.
315  * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
316  * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
317  * @gain_format: Gain table format.
318  * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
319  * @fmtlnh: Number of pixels in horizontal direction to use for the data
320  *          reformatter.
321  * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
322  * @fmtlnv: Number of lines in vertical direction for the data reformatter.
323  * @initial_x: X position, in pixels, of the first active pixel in reference
324  *             to the first active paxel. Must be an even number.
325  * @initial_y: Y position, in pixels, of the first active pixel in reference
326  *             to the first active paxel. Must be an even number.
327  * @size: Size of LSC gain table. Filled when loaded from userspace.
328  */
329 struct omap3isp_ccdc_lsc_config {
330 	__u16 offset;
331 	__u8 gain_mode_n;
332 	__u8 gain_mode_m;
333 	__u8 gain_format;
334 	__u16 fmtsph;
335 	__u16 fmtlnh;
336 	__u16 fmtslv;
337 	__u16 fmtlnv;
338 	__u8 initial_x;
339 	__u8 initial_y;
340 	__u32 size;
341 };
342 
343 /**
344  * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract
345  * @obgain: Optical black average gain.
346  * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.
347  * @oblines: Optical Black Sample lines.
348  * @oblen: Optical Black Sample Length.
349  * @dcsubval: Digital Black Clamp subtract value.
350  */
351 struct omap3isp_ccdc_bclamp {
352 	__u8 obgain;
353 	__u8 obstpixel;
354 	__u8 oblines;
355 	__u8 oblen;
356 	__u16 dcsubval;
357 };
358 
359 /**
360  * struct omap3isp_ccdc_fpc - Faulty Pixels Correction
361  * @fpnum: Number of faulty pixels to be corrected in the frame.
362  * @fpcaddr: Memory address of the FPC Table
363  */
364 struct omap3isp_ccdc_fpc {
365 	__u16 fpnum;
366 	__u32 fpcaddr;
367 };
368 
369 /**
370  * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters
371  * @b_mg: B/Mg pixels. 2's complement. -128 to +127.
372  * @gb_g: Gb/G pixels. 2's complement. -128 to +127.
373  * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127.
374  * @r_ye: R/Ye pixels. 2's complement. -128 to +127.
375  */
376 struct omap3isp_ccdc_blcomp {
377 	__u8 b_mg;
378 	__u8 gb_g;
379 	__u8 gr_cy;
380 	__u8 r_ye;
381 };
382 
383 /**
384  * omap3isp_ccdc_culling - Culling parameters
385  * @v_pattern: Vertical culling pattern.
386  * @h_odd: Horizontal Culling pattern for odd lines.
387  * @h_even: Horizontal Culling pattern for even lines.
388  */
389 struct omap3isp_ccdc_culling {
390 	__u8 v_pattern;
391 	__u16 h_odd;
392 	__u16 h_even;
393 };
394 
395 /**
396  * omap3isp_ccdc_update_config - CCDC configuration
397  * @update: Specifies which CCDC registers should be updated.
398  * @flag: Specifies which CCDC functions should be enabled.
399  * @alawip: Enable/Disable A-Law compression.
400  * @bclamp: Black clamp control register.
401  * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement.
402  * @fpc: Number of faulty pixels corrected in the frame, address of FPC table.
403  * @cull: Cull control register.
404  * @lsc: Pointer to LSC gain table.
405  */
406 struct omap3isp_ccdc_update_config {
407 	__u16 update;
408 	__u16 flag;
409 	enum omap3isp_alaw_ipwidth alawip;
410 	struct omap3isp_ccdc_bclamp __user *bclamp;
411 	struct omap3isp_ccdc_blcomp __user *blcomp;
412 	struct omap3isp_ccdc_fpc __user *fpc;
413 	struct omap3isp_ccdc_lsc_config __user *lsc_cfg;
414 	struct omap3isp_ccdc_culling __user *cull;
415 	__u8 __user *lsc;
416 };
417 
418 /* Preview configurations */
419 #define OMAP3ISP_PREV_LUMAENH		(1 << 0)
420 #define OMAP3ISP_PREV_INVALAW		(1 << 1)
421 #define OMAP3ISP_PREV_HRZ_MED		(1 << 2)
422 #define OMAP3ISP_PREV_CFA		(1 << 3)
423 #define OMAP3ISP_PREV_CHROMA_SUPP	(1 << 4)
424 #define OMAP3ISP_PREV_WB		(1 << 5)
425 #define OMAP3ISP_PREV_BLKADJ		(1 << 6)
426 #define OMAP3ISP_PREV_RGB2RGB		(1 << 7)
427 #define OMAP3ISP_PREV_COLOR_CONV	(1 << 8)
428 #define OMAP3ISP_PREV_YC_LIMIT		(1 << 9)
429 #define OMAP3ISP_PREV_DEFECT_COR	(1 << 10)
430 #define OMAP3ISP_PREV_GAMMABYPASS	(1 << 11)
431 #define OMAP3ISP_PREV_DRK_FRM_CAPTURE	(1 << 12)
432 #define OMAP3ISP_PREV_DRK_FRM_SUBTRACT	(1 << 13)
433 #define OMAP3ISP_PREV_LENS_SHADING	(1 << 14)
434 #define OMAP3ISP_PREV_NF		(1 << 15)
435 #define OMAP3ISP_PREV_GAMMA		(1 << 16)
436 
437 #define OMAP3ISP_PREV_NF_TBL_SIZE	64
438 #define OMAP3ISP_PREV_CFA_TBL_SIZE	576
439 #define OMAP3ISP_PREV_GAMMA_TBL_SIZE	1024
440 #define OMAP3ISP_PREV_YENH_TBL_SIZE	128
441 
442 #define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS	4
443 
444 /**
445  * struct omap3isp_prev_hmed - Horizontal Median Filter
446  * @odddist: Distance between consecutive pixels of same color in the odd line.
447  * @evendist: Distance between consecutive pixels of same color in the even
448  *            line.
449  * @thres: Horizontal median filter threshold.
450  */
451 struct omap3isp_prev_hmed {
452 	__u8 odddist;
453 	__u8 evendist;
454 	__u8 thres;
455 };
456 
457 /*
458  * Enumeration for CFA Formats supported by preview
459  */
460 enum omap3isp_cfa_fmt {
461 	OMAP3ISP_CFAFMT_BAYER,
462 	OMAP3ISP_CFAFMT_SONYVGA,
463 	OMAP3ISP_CFAFMT_RGBFOVEON,
464 	OMAP3ISP_CFAFMT_DNSPL,
465 	OMAP3ISP_CFAFMT_HONEYCOMB,
466 	OMAP3ISP_CFAFMT_RRGGBBFOVEON
467 };
468 
469 /**
470  * struct omap3isp_prev_cfa - CFA Interpolation
471  * @format: CFA Format Enum value supported by preview.
472  * @gradthrs_vert: CFA Gradient Threshold - Vertical.
473  * @gradthrs_horz: CFA Gradient Threshold - Horizontal.
474  * @table: Pointer to the CFA table.
475  */
476 struct omap3isp_prev_cfa {
477 	enum omap3isp_cfa_fmt format;
478 	__u8 gradthrs_vert;
479 	__u8 gradthrs_horz;
480 	__u32 table[OMAP3ISP_PREV_CFA_TBL_SIZE];
481 };
482 
483 /**
484  * struct omap3isp_prev_csup - Chrominance Suppression
485  * @gain: Gain.
486  * @thres: Threshold.
487  * @hypf_en: Flag to enable/disable the High Pass Filter.
488  */
489 struct omap3isp_prev_csup {
490 	__u8 gain;
491 	__u8 thres;
492 	__u8 hypf_en;
493 };
494 
495 /**
496  * struct omap3isp_prev_wbal - White Balance
497  * @dgain: Digital gain (U10Q8).
498  * @coef3: White balance gain - COEF 3 (U8Q5).
499  * @coef2: White balance gain - COEF 2 (U8Q5).
500  * @coef1: White balance gain - COEF 1 (U8Q5).
501  * @coef0: White balance gain - COEF 0 (U8Q5).
502  */
503 struct omap3isp_prev_wbal {
504 	__u16 dgain;
505 	__u8 coef3;
506 	__u8 coef2;
507 	__u8 coef1;
508 	__u8 coef0;
509 };
510 
511 /**
512  * struct omap3isp_prev_blkadj - Black Level Adjustment
513  * @red: Black level offset adjustment for Red in 2's complement format
514  * @green: Black level offset adjustment for Green in 2's complement format
515  * @blue: Black level offset adjustment for Blue in 2's complement format
516  */
517 struct omap3isp_prev_blkadj {
518 	/*Black level offset adjustment for Red in 2's complement format */
519 	__u8 red;
520 	/*Black level offset adjustment for Green in 2's complement format */
521 	__u8 green;
522 	/* Black level offset adjustment for Blue in 2's complement format */
523 	__u8 blue;
524 };
525 
526 /**
527  * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending
528  * @matrix: Blending values(S12Q8 format)
529  *              [RR] [GR] [BR]
530  *              [RG] [GG] [BG]
531  *              [RB] [GB] [BB]
532  * @offset: Blending offset value for R,G,B in 2's complement integer format.
533  */
534 struct omap3isp_prev_rgbtorgb {
535 	__u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
536 	__u16 offset[OMAP3ISP_RGB_MAX];
537 };
538 
539 /**
540  * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr
541  * @matrix: Color space conversion coefficients(S10Q8)
542  *              [CSCRY]  [CSCGY]  [CSCBY]
543  *              [CSCRCB] [CSCGCB] [CSCBCB]
544  *              [CSCRCR] [CSCGCR] [CSCBCR]
545  * @offset: CSC offset values for Y offset, CB offset and CR offset respectively
546  */
547 struct omap3isp_prev_csc {
548 	__u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
549 	__s16 offset[OMAP3ISP_RGB_MAX];
550 };
551 
552 /**
553  * struct omap3isp_prev_yclimit - Y, C Value Limit
554  * @minC: Minimum C value
555  * @maxC: Maximum C value
556  * @minY: Minimum Y value
557  * @maxY: Maximum Y value
558  */
559 struct omap3isp_prev_yclimit {
560 	__u8 minC;
561 	__u8 maxC;
562 	__u8 minY;
563 	__u8 maxY;
564 };
565 
566 /**
567  * struct omap3isp_prev_dcor - Defect correction
568  * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF
569  * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct
570  */
571 struct omap3isp_prev_dcor {
572 	__u8 couplet_mode_en;
573 	__u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS];
574 };
575 
576 /**
577  * struct omap3isp_prev_nf - Noise Filter
578  * @spread: Spread value to be used in Noise Filter
579  * @table: Pointer to the Noise Filter table
580  */
581 struct omap3isp_prev_nf {
582 	__u8 spread;
583 	__u32 table[OMAP3ISP_PREV_NF_TBL_SIZE];
584 };
585 
586 /**
587  * struct omap3isp_prev_gtables - Gamma correction tables
588  * @red: Array for red gamma table.
589  * @green: Array for green gamma table.
590  * @blue: Array for blue gamma table.
591  */
592 struct omap3isp_prev_gtables {
593 	__u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
594 	__u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
595 	__u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
596 };
597 
598 /**
599  * struct omap3isp_prev_luma - Luma enhancement
600  * @table: Array for luma enhancement table.
601  */
602 struct omap3isp_prev_luma {
603 	__u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE];
604 };
605 
606 /**
607  * struct omap3isp_prev_update_config - Preview engine configuration (user)
608  * @update: Specifies which ISP Preview registers should be updated.
609  * @flag: Specifies which ISP Preview functions should be enabled.
610  * @shading_shift: 3bit value of shift used in shading compensation.
611  * @luma: Pointer to luma enhancement structure.
612  * @hmed: Pointer to structure containing the odd and even distance.
613  *        between the pixels in the image along with the filter threshold.
614  * @cfa: Pointer to structure containing the CFA interpolation table, CFA.
615  *       format in the image, vertical and horizontal gradient threshold.
616  * @csup: Pointer to Structure for Chrominance Suppression coefficients.
617  * @wbal: Pointer to structure for White Balance.
618  * @blkadj: Pointer to structure for Black Adjustment.
619  * @rgb2rgb: Pointer to structure for RGB to RGB Blending.
620  * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr.
621  * @yclimit: Pointer to structure for Y, C Value Limit.
622  * @dcor: Pointer to structure for defect correction.
623  * @nf: Pointer to structure for Noise Filter
624  * @gamma: Pointer to gamma structure.
625  */
626 struct omap3isp_prev_update_config {
627 	__u32 update;
628 	__u32 flag;
629 	__u32 shading_shift;
630 	struct omap3isp_prev_luma __user *luma;
631 	struct omap3isp_prev_hmed __user *hmed;
632 	struct omap3isp_prev_cfa __user *cfa;
633 	struct omap3isp_prev_csup __user *csup;
634 	struct omap3isp_prev_wbal __user *wbal;
635 	struct omap3isp_prev_blkadj __user *blkadj;
636 	struct omap3isp_prev_rgbtorgb __user *rgb2rgb;
637 	struct omap3isp_prev_csc __user *csc;
638 	struct omap3isp_prev_yclimit __user *yclimit;
639 	struct omap3isp_prev_dcor __user *dcor;
640 	struct omap3isp_prev_nf __user *nf;
641 	struct omap3isp_prev_gtables __user *gamma;
642 };
643 
644 #endif	/* OMAP3_ISP_USER_H */
645