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