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