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