Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * omap3isp.h
0004  *
0005  * TI OMAP3 ISP - User-space API
0006  *
0007  * Copyright (C) 2010 Nokia Corporation
0008  * Copyright (C) 2009 Texas Instruments, Inc.
0009  *
0010  * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
0011  *       Sakari Ailus <sakari.ailus@iki.fi>
0012  *
0013  * This program is free software; you can redistribute it and/or modify
0014  * it under the terms of the GNU General Public License version 2 as
0015  * published by the Free Software Foundation.
0016  *
0017  * This program is distributed in the hope that it will be useful, but
0018  * WITHOUT ANY WARRANTY; without even the implied warranty of
0019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0020  * General Public License for more details.
0021  *
0022  * You should have received a copy of the GNU General Public License
0023  * along with this program; if not, write to the Free Software
0024  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
0025  * 02110-1301 USA
0026  */
0027 
0028 #ifndef OMAP3_ISP_USER_H
0029 #define OMAP3_ISP_USER_H
0030 
0031 #include <linux/types.h>
0032 #include <linux/videodev2.h>
0033 
0034 /*
0035  * Private IOCTLs
0036  *
0037  * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration
0038  * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration
0039  * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration
0040  * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration
0041  * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration
0042  * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data
0043  * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module
0044  */
0045 
0046 #define VIDIOC_OMAP3ISP_CCDC_CFG \
0047     _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config)
0048 #define VIDIOC_OMAP3ISP_PRV_CFG \
0049     _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config)
0050 #define VIDIOC_OMAP3ISP_AEWB_CFG \
0051     _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config)
0052 #define VIDIOC_OMAP3ISP_HIST_CFG \
0053     _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config)
0054 #define VIDIOC_OMAP3ISP_AF_CFG \
0055     _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config)
0056 #define VIDIOC_OMAP3ISP_STAT_REQ \
0057     _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data)
0058 #define VIDIOC_OMAP3ISP_STAT_REQ_TIME32 \
0059     _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data_time32)
0060 #define VIDIOC_OMAP3ISP_STAT_EN \
0061     _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long)
0062 
0063 /*
0064  * Events
0065  *
0066  * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
0067  * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
0068  * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
0069  */
0070 
0071 #define V4L2_EVENT_OMAP3ISP_CLASS   (V4L2_EVENT_PRIVATE_START | 0x100)
0072 #define V4L2_EVENT_OMAP3ISP_AEWB    (V4L2_EVENT_OMAP3ISP_CLASS | 0x1)
0073 #define V4L2_EVENT_OMAP3ISP_AF      (V4L2_EVENT_OMAP3ISP_CLASS | 0x2)
0074 #define V4L2_EVENT_OMAP3ISP_HIST    (V4L2_EVENT_OMAP3ISP_CLASS | 0x3)
0075 
0076 struct omap3isp_stat_event_status {
0077     __u32 frame_number;
0078     __u16 config_counter;
0079     __u8 buf_err;
0080 };
0081 
0082 /* AE/AWB related structures and flags*/
0083 
0084 /* H3A Range Constants */
0085 #define OMAP3ISP_AEWB_MAX_SATURATION_LIM    1023
0086 #define OMAP3ISP_AEWB_MIN_WIN_H         2
0087 #define OMAP3ISP_AEWB_MAX_WIN_H         256
0088 #define OMAP3ISP_AEWB_MIN_WIN_W         6
0089 #define OMAP3ISP_AEWB_MAX_WIN_W         256
0090 #define OMAP3ISP_AEWB_MIN_WINVC         1
0091 #define OMAP3ISP_AEWB_MIN_WINHC         1
0092 #define OMAP3ISP_AEWB_MAX_WINVC         128
0093 #define OMAP3ISP_AEWB_MAX_WINHC         36
0094 #define OMAP3ISP_AEWB_MAX_WINSTART      4095
0095 #define OMAP3ISP_AEWB_MIN_SUB_INC       2
0096 #define OMAP3ISP_AEWB_MAX_SUB_INC       32
0097 #define OMAP3ISP_AEWB_MAX_BUF_SIZE      83600
0098 
0099 #define OMAP3ISP_AF_IIRSH_MIN           0
0100 #define OMAP3ISP_AF_IIRSH_MAX           4095
0101 #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN  1
0102 #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX  36
0103 #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN    1
0104 #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX    128
0105 #define OMAP3ISP_AF_PAXEL_INCREMENT_MIN     2
0106 #define OMAP3ISP_AF_PAXEL_INCREMENT_MAX     32
0107 #define OMAP3ISP_AF_PAXEL_HEIGHT_MIN        2
0108 #define OMAP3ISP_AF_PAXEL_HEIGHT_MAX        256
0109 #define OMAP3ISP_AF_PAXEL_WIDTH_MIN     16
0110 #define OMAP3ISP_AF_PAXEL_WIDTH_MAX     256
0111 #define OMAP3ISP_AF_PAXEL_HZSTART_MIN       1
0112 #define OMAP3ISP_AF_PAXEL_HZSTART_MAX       4095
0113 #define OMAP3ISP_AF_PAXEL_VTSTART_MIN       0
0114 #define OMAP3ISP_AF_PAXEL_VTSTART_MAX       4095
0115 #define OMAP3ISP_AF_THRESHOLD_MAX       255
0116 #define OMAP3ISP_AF_COEF_MAX            4095
0117 #define OMAP3ISP_AF_PAXEL_SIZE          48
0118 #define OMAP3ISP_AF_MAX_BUF_SIZE        221184
0119 
0120 /**
0121  * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values
0122  * saturation_limit: Saturation limit.
0123  * @win_height: Window Height. Range 2 - 256, even values only.
0124  * @win_width: Window Width. Range 6 - 256, even values only.
0125  * @ver_win_count: Vertical Window Count. Range 1 - 128.
0126  * @hor_win_count: Horizontal Window Count. Range 1 - 36.
0127  * @ver_win_start: Vertical Window Start. Range 0 - 4095.
0128  * @hor_win_start: Horizontal Window Start. Range 0 - 4095.
0129  * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095.
0130  * @blk_win_height: Black Window Height. Range 2 - 256, even values only.
0131  * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even
0132  *                     values only.
0133  * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even
0134  *                     values only.
0135  * @alaw_enable: AEW ALAW EN flag.
0136  */
0137 struct omap3isp_h3a_aewb_config {
0138     /*
0139      * Common fields.
0140      * They should be the first ones and must be in the same order as in
0141      * ispstat_generic_config struct.
0142      */
0143     __u32 buf_size;
0144     __u16 config_counter;
0145 
0146     /* Private fields */
0147     __u16 saturation_limit;
0148     __u16 win_height;
0149     __u16 win_width;
0150     __u16 ver_win_count;
0151     __u16 hor_win_count;
0152     __u16 ver_win_start;
0153     __u16 hor_win_start;
0154     __u16 blk_ver_win_start;
0155     __u16 blk_win_height;
0156     __u16 subsample_ver_inc;
0157     __u16 subsample_hor_inc;
0158     __u8 alaw_enable;
0159 };
0160 
0161 /**
0162  * struct omap3isp_stat_data - Statistic data sent to or received from user
0163  * @ts: Timestamp of returned framestats.
0164  * @buf: Pointer to pass to user.
0165  * @buf_size: Size of buffer.
0166  * @frame_number: Frame number of requested stats.
0167  * @cur_frame: Current frame number being processed.
0168  * @config_counter: Number of the configuration associated with the data.
0169  */
0170 struct omap3isp_stat_data {
0171 #ifdef __KERNEL__
0172     struct {
0173         __s64   tv_sec;
0174         __s64   tv_usec;
0175     } ts;
0176 #else
0177     struct timeval ts;
0178 #endif
0179     void __user *buf;
0180     __struct_group(/* no tag */, frame, /* no attrs */,
0181         __u32 buf_size;
0182         __u16 frame_number;
0183         __u16 cur_frame;
0184         __u16 config_counter;
0185     );
0186 };
0187 
0188 #ifdef __KERNEL__
0189 struct omap3isp_stat_data_time32 {
0190     struct {
0191         __s32   tv_sec;
0192         __s32   tv_usec;
0193     } ts;
0194     __u32 buf;
0195     __struct_group(/* no tag */, frame, /* no attrs */,
0196         __u32 buf_size;
0197         __u16 frame_number;
0198         __u16 cur_frame;
0199         __u16 config_counter;
0200     );
0201 };
0202 #endif
0203 
0204 /* Histogram related structs */
0205 
0206 /* Flags for number of bins */
0207 #define OMAP3ISP_HIST_BINS_32       0
0208 #define OMAP3ISP_HIST_BINS_64       1
0209 #define OMAP3ISP_HIST_BINS_128      2
0210 #define OMAP3ISP_HIST_BINS_256      3
0211 
0212 /* Number of bins * 4 colors * 4-bytes word */
0213 #define OMAP3ISP_HIST_MEM_SIZE_BINS(n)  ((1 << ((n)+5))*4*4)
0214 
0215 #define OMAP3ISP_HIST_MEM_SIZE      1024
0216 #define OMAP3ISP_HIST_MIN_REGIONS   1
0217 #define OMAP3ISP_HIST_MAX_REGIONS   4
0218 #define OMAP3ISP_HIST_MAX_WB_GAIN   255
0219 #define OMAP3ISP_HIST_MIN_WB_GAIN   0
0220 #define OMAP3ISP_HIST_MAX_BIT_WIDTH 14
0221 #define OMAP3ISP_HIST_MIN_BIT_WIDTH 8
0222 #define OMAP3ISP_HIST_MAX_WG        4
0223 #define OMAP3ISP_HIST_MAX_BUF_SIZE  4096
0224 
0225 /* Source */
0226 #define OMAP3ISP_HIST_SOURCE_CCDC   0
0227 #define OMAP3ISP_HIST_SOURCE_MEM    1
0228 
0229 /* CFA pattern */
0230 #define OMAP3ISP_HIST_CFA_BAYER     0
0231 #define OMAP3ISP_HIST_CFA_FOVEONX3  1
0232 
0233 struct omap3isp_hist_region {
0234     __u16 h_start;
0235     __u16 h_end;
0236     __u16 v_start;
0237     __u16 v_end;
0238 };
0239 
0240 struct omap3isp_hist_config {
0241     /*
0242      * Common fields.
0243      * They should be the first ones and must be in the same order as in
0244      * ispstat_generic_config struct.
0245      */
0246     __u32 buf_size;
0247     __u16 config_counter;
0248 
0249     __u8 num_acc_frames;    /* Num of image frames to be processed and
0250                    accumulated for each histogram frame */
0251     __u16 hist_bins;    /* number of bins: 32, 64, 128, or 256 */
0252     __u8 cfa;       /* BAYER or FOVEON X3 */
0253     __u8 wg[OMAP3ISP_HIST_MAX_WG];  /* White Balance Gain */
0254     __u8 num_regions;   /* number of regions to be configured */
0255     struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS];
0256 };
0257 
0258 /* Auto Focus related structs */
0259 
0260 #define OMAP3ISP_AF_NUM_COEF        11
0261 
0262 enum omap3isp_h3a_af_fvmode {
0263     OMAP3ISP_AF_MODE_SUMMED = 0,
0264     OMAP3ISP_AF_MODE_PEAK = 1
0265 };
0266 
0267 /* Red, Green, and blue pixel location in the AF windows */
0268 enum omap3isp_h3a_af_rgbpos {
0269     OMAP3ISP_AF_GR_GB_BAYER = 0,    /* GR and GB as Bayer pattern */
0270     OMAP3ISP_AF_RG_GB_BAYER = 1,    /* RG and GB as Bayer pattern */
0271     OMAP3ISP_AF_GR_BG_BAYER = 2,    /* GR and BG as Bayer pattern */
0272     OMAP3ISP_AF_RG_BG_BAYER = 3,    /* RG and BG as Bayer pattern */
0273     OMAP3ISP_AF_GG_RB_CUSTOM = 4,   /* GG and RB as custom pattern */
0274     OMAP3ISP_AF_RB_GG_CUSTOM = 5    /* RB and GG as custom pattern */
0275 };
0276 
0277 /* Contains the information regarding the Horizontal Median Filter */
0278 struct omap3isp_h3a_af_hmf {
0279     __u8 enable;    /* Status of Horizontal Median Filter */
0280     __u8 threshold; /* Threshold Value for Horizontal Median Filter */
0281 };
0282 
0283 /* Contains the information regarding the IIR Filters */
0284 struct omap3isp_h3a_af_iir {
0285     __u16 h_start;          /* IIR horizontal start */
0286     __u16 coeff_set0[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 0 */
0287     __u16 coeff_set1[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 1 */
0288 };
0289 
0290 /* Contains the information regarding the Paxels Structure in AF Engine */
0291 struct omap3isp_h3a_af_paxel {
0292     __u16 h_start;  /* Horizontal Start Position */
0293     __u16 v_start;  /* Vertical Start Position */
0294     __u8 width; /* Width of the Paxel */
0295     __u8 height;    /* Height of the Paxel */
0296     __u8 h_cnt; /* Horizontal Count */
0297     __u8 v_cnt; /* vertical Count */
0298     __u8 line_inc;  /* Line Increment */
0299 };
0300 
0301 /* Contains the parameters required for hardware set up of AF Engine */
0302 struct omap3isp_h3a_af_config {
0303     /*
0304      * Common fields.
0305      * They should be the first ones and must be in the same order as in
0306      * ispstat_generic_config struct.
0307      */
0308     __u32 buf_size;
0309     __u16 config_counter;
0310 
0311     struct omap3isp_h3a_af_hmf hmf;     /* HMF configurations */
0312     struct omap3isp_h3a_af_iir iir;     /* IIR filter configurations */
0313     struct omap3isp_h3a_af_paxel paxel; /* Paxel parameters */
0314     enum omap3isp_h3a_af_rgbpos rgb_pos;    /* RGB Positions */
0315     enum omap3isp_h3a_af_fvmode fvmode; /* Accumulator mode */
0316     __u8 alaw_enable;           /* AF ALAW status */
0317 };
0318 
0319 /* ISP CCDC structs */
0320 
0321 /* Abstraction layer CCDC configurations */
0322 #define OMAP3ISP_CCDC_ALAW      (1 << 0)
0323 #define OMAP3ISP_CCDC_LPF       (1 << 1)
0324 #define OMAP3ISP_CCDC_BLCLAMP       (1 << 2)
0325 #define OMAP3ISP_CCDC_BCOMP     (1 << 3)
0326 #define OMAP3ISP_CCDC_FPC       (1 << 4)
0327 #define OMAP3ISP_CCDC_CULL      (1 << 5)
0328 #define OMAP3ISP_CCDC_CONFIG_LSC    (1 << 7)
0329 #define OMAP3ISP_CCDC_TBL_LSC       (1 << 8)
0330 
0331 #define OMAP3ISP_RGB_MAX        3
0332 
0333 /* Enumeration constants for Alaw input width */
0334 enum omap3isp_alaw_ipwidth {
0335     OMAP3ISP_ALAW_BIT12_3 = 0x3,
0336     OMAP3ISP_ALAW_BIT11_2 = 0x4,
0337     OMAP3ISP_ALAW_BIT10_1 = 0x5,
0338     OMAP3ISP_ALAW_BIT9_0 = 0x6
0339 };
0340 
0341 /**
0342  * struct omap3isp_ccdc_lsc_config - LSC configuration
0343  * @offset: Table Offset of the gain table.
0344  * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
0345  * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
0346  * @gain_format: Gain table format.
0347  * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
0348  * @fmtlnh: Number of pixels in horizontal direction to use for the data
0349  *          reformatter.
0350  * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
0351  * @fmtlnv: Number of lines in vertical direction for the data reformatter.
0352  * @initial_x: X position, in pixels, of the first active pixel in reference
0353  *             to the first active paxel. Must be an even number.
0354  * @initial_y: Y position, in pixels, of the first active pixel in reference
0355  *             to the first active paxel. Must be an even number.
0356  * @size: Size of LSC gain table. Filled when loaded from userspace.
0357  */
0358 struct omap3isp_ccdc_lsc_config {
0359     __u16 offset;
0360     __u8 gain_mode_n;
0361     __u8 gain_mode_m;
0362     __u8 gain_format;
0363     __u16 fmtsph;
0364     __u16 fmtlnh;
0365     __u16 fmtslv;
0366     __u16 fmtlnv;
0367     __u8 initial_x;
0368     __u8 initial_y;
0369     __u32 size;
0370 };
0371 
0372 /**
0373  * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract
0374  * @obgain: Optical black average gain.
0375  * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.
0376  * @oblines: Optical Black Sample lines.
0377  * @oblen: Optical Black Sample Length.
0378  * @dcsubval: Digital Black Clamp subtract value.
0379  */
0380 struct omap3isp_ccdc_bclamp {
0381     __u8 obgain;
0382     __u8 obstpixel;
0383     __u8 oblines;
0384     __u8 oblen;
0385     __u16 dcsubval;
0386 };
0387 
0388 /**
0389  * struct omap3isp_ccdc_fpc - Faulty Pixels Correction
0390  * @fpnum: Number of faulty pixels to be corrected in the frame.
0391  * @fpcaddr: Memory address of the FPC Table
0392  */
0393 struct omap3isp_ccdc_fpc {
0394     __u16 fpnum;
0395     __u32 fpcaddr;
0396 };
0397 
0398 /**
0399  * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters
0400  * @b_mg: B/Mg pixels. 2's complement. -128 to +127.
0401  * @gb_g: Gb/G pixels. 2's complement. -128 to +127.
0402  * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127.
0403  * @r_ye: R/Ye pixels. 2's complement. -128 to +127.
0404  */
0405 struct omap3isp_ccdc_blcomp {
0406     __u8 b_mg;
0407     __u8 gb_g;
0408     __u8 gr_cy;
0409     __u8 r_ye;
0410 };
0411 
0412 /**
0413  * omap3isp_ccdc_culling - Culling parameters
0414  * @v_pattern: Vertical culling pattern.
0415  * @h_odd: Horizontal Culling pattern for odd lines.
0416  * @h_even: Horizontal Culling pattern for even lines.
0417  */
0418 struct omap3isp_ccdc_culling {
0419     __u8 v_pattern;
0420     __u16 h_odd;
0421     __u16 h_even;
0422 };
0423 
0424 /**
0425  * omap3isp_ccdc_update_config - CCDC configuration
0426  * @update: Specifies which CCDC registers should be updated.
0427  * @flag: Specifies which CCDC functions should be enabled.
0428  * @alawip: Enable/Disable A-Law compression.
0429  * @bclamp: Black clamp control register.
0430  * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement.
0431  * @fpc: Number of faulty pixels corrected in the frame, address of FPC table.
0432  * @cull: Cull control register.
0433  * @lsc: Pointer to LSC gain table.
0434  */
0435 struct omap3isp_ccdc_update_config {
0436     __u16 update;
0437     __u16 flag;
0438     enum omap3isp_alaw_ipwidth alawip;
0439     struct omap3isp_ccdc_bclamp __user *bclamp;
0440     struct omap3isp_ccdc_blcomp __user *blcomp;
0441     struct omap3isp_ccdc_fpc __user *fpc;
0442     struct omap3isp_ccdc_lsc_config __user *lsc_cfg;
0443     struct omap3isp_ccdc_culling __user *cull;
0444     __u8 __user *lsc;
0445 };
0446 
0447 /* Preview configurations */
0448 #define OMAP3ISP_PREV_LUMAENH       (1 << 0)
0449 #define OMAP3ISP_PREV_INVALAW       (1 << 1)
0450 #define OMAP3ISP_PREV_HRZ_MED       (1 << 2)
0451 #define OMAP3ISP_PREV_CFA       (1 << 3)
0452 #define OMAP3ISP_PREV_CHROMA_SUPP   (1 << 4)
0453 #define OMAP3ISP_PREV_WB        (1 << 5)
0454 #define OMAP3ISP_PREV_BLKADJ        (1 << 6)
0455 #define OMAP3ISP_PREV_RGB2RGB       (1 << 7)
0456 #define OMAP3ISP_PREV_COLOR_CONV    (1 << 8)
0457 #define OMAP3ISP_PREV_YC_LIMIT      (1 << 9)
0458 #define OMAP3ISP_PREV_DEFECT_COR    (1 << 10)
0459 /* Bit 11 was OMAP3ISP_PREV_GAMMABYPASS, now merged with OMAP3ISP_PREV_GAMMA */
0460 #define OMAP3ISP_PREV_DRK_FRM_CAPTURE   (1 << 12)
0461 #define OMAP3ISP_PREV_DRK_FRM_SUBTRACT  (1 << 13)
0462 #define OMAP3ISP_PREV_LENS_SHADING  (1 << 14)
0463 #define OMAP3ISP_PREV_NF        (1 << 15)
0464 #define OMAP3ISP_PREV_GAMMA     (1 << 16)
0465 
0466 #define OMAP3ISP_PREV_NF_TBL_SIZE   64
0467 #define OMAP3ISP_PREV_CFA_TBL_SIZE  576
0468 #define OMAP3ISP_PREV_CFA_BLK_SIZE  (OMAP3ISP_PREV_CFA_TBL_SIZE / 4)
0469 #define OMAP3ISP_PREV_GAMMA_TBL_SIZE    1024
0470 #define OMAP3ISP_PREV_YENH_TBL_SIZE 128
0471 
0472 #define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS   4
0473 
0474 /**
0475  * struct omap3isp_prev_hmed - Horizontal Median Filter
0476  * @odddist: Distance between consecutive pixels of same color in the odd line.
0477  * @evendist: Distance between consecutive pixels of same color in the even
0478  *            line.
0479  * @thres: Horizontal median filter threshold.
0480  */
0481 struct omap3isp_prev_hmed {
0482     __u8 odddist;
0483     __u8 evendist;
0484     __u8 thres;
0485 };
0486 
0487 /*
0488  * Enumeration for CFA Formats supported by preview
0489  */
0490 enum omap3isp_cfa_fmt {
0491     OMAP3ISP_CFAFMT_BAYER,
0492     OMAP3ISP_CFAFMT_SONYVGA,
0493     OMAP3ISP_CFAFMT_RGBFOVEON,
0494     OMAP3ISP_CFAFMT_DNSPL,
0495     OMAP3ISP_CFAFMT_HONEYCOMB,
0496     OMAP3ISP_CFAFMT_RRGGBBFOVEON
0497 };
0498 
0499 /**
0500  * struct omap3isp_prev_cfa - CFA Interpolation
0501  * @format: CFA Format Enum value supported by preview.
0502  * @gradthrs_vert: CFA Gradient Threshold - Vertical.
0503  * @gradthrs_horz: CFA Gradient Threshold - Horizontal.
0504  * @table: Pointer to the CFA table.
0505  */
0506 struct omap3isp_prev_cfa {
0507     enum omap3isp_cfa_fmt format;
0508     __u8 gradthrs_vert;
0509     __u8 gradthrs_horz;
0510     __u32 table[4][OMAP3ISP_PREV_CFA_BLK_SIZE];
0511 };
0512 
0513 /**
0514  * struct omap3isp_prev_csup - Chrominance Suppression
0515  * @gain: Gain.
0516  * @thres: Threshold.
0517  * @hypf_en: Flag to enable/disable the High Pass Filter.
0518  */
0519 struct omap3isp_prev_csup {
0520     __u8 gain;
0521     __u8 thres;
0522     __u8 hypf_en;
0523 };
0524 
0525 /**
0526  * struct omap3isp_prev_wbal - White Balance
0527  * @dgain: Digital gain (U10Q8).
0528  * @coef3: White balance gain - COEF 3 (U8Q5).
0529  * @coef2: White balance gain - COEF 2 (U8Q5).
0530  * @coef1: White balance gain - COEF 1 (U8Q5).
0531  * @coef0: White balance gain - COEF 0 (U8Q5).
0532  */
0533 struct omap3isp_prev_wbal {
0534     __u16 dgain;
0535     __u8 coef3;
0536     __u8 coef2;
0537     __u8 coef1;
0538     __u8 coef0;
0539 };
0540 
0541 /**
0542  * struct omap3isp_prev_blkadj - Black Level Adjustment
0543  * @red: Black level offset adjustment for Red in 2's complement format
0544  * @green: Black level offset adjustment for Green in 2's complement format
0545  * @blue: Black level offset adjustment for Blue in 2's complement format
0546  */
0547 struct omap3isp_prev_blkadj {
0548     /*Black level offset adjustment for Red in 2's complement format */
0549     __u8 red;
0550     /*Black level offset adjustment for Green in 2's complement format */
0551     __u8 green;
0552     /* Black level offset adjustment for Blue in 2's complement format */
0553     __u8 blue;
0554 };
0555 
0556 /**
0557  * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending
0558  * @matrix: Blending values(S12Q8 format)
0559  *              [RR] [GR] [BR]
0560  *              [RG] [GG] [BG]
0561  *              [RB] [GB] [BB]
0562  * @offset: Blending offset value for R,G,B in 2's complement integer format.
0563  */
0564 struct omap3isp_prev_rgbtorgb {
0565     __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
0566     __u16 offset[OMAP3ISP_RGB_MAX];
0567 };
0568 
0569 /**
0570  * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr
0571  * @matrix: Color space conversion coefficients(S10Q8)
0572  *              [CSCRY]  [CSCGY]  [CSCBY]
0573  *              [CSCRCB] [CSCGCB] [CSCBCB]
0574  *              [CSCRCR] [CSCGCR] [CSCBCR]
0575  * @offset: CSC offset values for Y offset, CB offset and CR offset respectively
0576  */
0577 struct omap3isp_prev_csc {
0578     __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
0579     __s16 offset[OMAP3ISP_RGB_MAX];
0580 };
0581 
0582 /**
0583  * struct omap3isp_prev_yclimit - Y, C Value Limit
0584  * @minC: Minimum C value
0585  * @maxC: Maximum C value
0586  * @minY: Minimum Y value
0587  * @maxY: Maximum Y value
0588  */
0589 struct omap3isp_prev_yclimit {
0590     __u8 minC;
0591     __u8 maxC;
0592     __u8 minY;
0593     __u8 maxY;
0594 };
0595 
0596 /**
0597  * struct omap3isp_prev_dcor - Defect correction
0598  * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF
0599  * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct
0600  */
0601 struct omap3isp_prev_dcor {
0602     __u8 couplet_mode_en;
0603     __u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS];
0604 };
0605 
0606 /**
0607  * struct omap3isp_prev_nf - Noise Filter
0608  * @spread: Spread value to be used in Noise Filter
0609  * @table: Pointer to the Noise Filter table
0610  */
0611 struct omap3isp_prev_nf {
0612     __u8 spread;
0613     __u32 table[OMAP3ISP_PREV_NF_TBL_SIZE];
0614 };
0615 
0616 /**
0617  * struct omap3isp_prev_gtables - Gamma correction tables
0618  * @red: Array for red gamma table.
0619  * @green: Array for green gamma table.
0620  * @blue: Array for blue gamma table.
0621  */
0622 struct omap3isp_prev_gtables {
0623     __u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
0624     __u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
0625     __u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
0626 };
0627 
0628 /**
0629  * struct omap3isp_prev_luma - Luma enhancement
0630  * @table: Array for luma enhancement table.
0631  */
0632 struct omap3isp_prev_luma {
0633     __u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE];
0634 };
0635 
0636 /**
0637  * struct omap3isp_prev_update_config - Preview engine configuration (user)
0638  * @update: Specifies which ISP Preview registers should be updated.
0639  * @flag: Specifies which ISP Preview functions should be enabled.
0640  * @shading_shift: 3bit value of shift used in shading compensation.
0641  * @luma: Pointer to luma enhancement structure.
0642  * @hmed: Pointer to structure containing the odd and even distance.
0643  *        between the pixels in the image along with the filter threshold.
0644  * @cfa: Pointer to structure containing the CFA interpolation table, CFA.
0645  *       format in the image, vertical and horizontal gradient threshold.
0646  * @csup: Pointer to Structure for Chrominance Suppression coefficients.
0647  * @wbal: Pointer to structure for White Balance.
0648  * @blkadj: Pointer to structure for Black Adjustment.
0649  * @rgb2rgb: Pointer to structure for RGB to RGB Blending.
0650  * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr.
0651  * @yclimit: Pointer to structure for Y, C Value Limit.
0652  * @dcor: Pointer to structure for defect correction.
0653  * @nf: Pointer to structure for Noise Filter
0654  * @gamma: Pointer to gamma structure.
0655  */
0656 struct omap3isp_prev_update_config {
0657     __u32 update;
0658     __u32 flag;
0659     __u32 shading_shift;
0660     struct omap3isp_prev_luma __user *luma;
0661     struct omap3isp_prev_hmed __user *hmed;
0662     struct omap3isp_prev_cfa __user *cfa;
0663     struct omap3isp_prev_csup __user *csup;
0664     struct omap3isp_prev_wbal __user *wbal;
0665     struct omap3isp_prev_blkadj __user *blkadj;
0666     struct omap3isp_prev_rgbtorgb __user *rgb2rgb;
0667     struct omap3isp_prev_csc __user *csc;
0668     struct omap3isp_prev_yclimit __user *yclimit;
0669     struct omap3isp_prev_dcor __user *dcor;
0670     struct omap3isp_prev_nf __user *nf;
0671     struct omap3isp_prev_gtables __user *gamma;
0672 };
0673 
0674 #endif  /* OMAP3_ISP_USER_H */