aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/davinci/isif_regs.h269
-rw-r--r--include/media/davinci/isif.h531
2 files changed, 800 insertions, 0 deletions
diff --git a/drivers/media/video/davinci/isif_regs.h b/drivers/media/video/davinci/isif_regs.h
new file mode 100644
index 000000000000..f7b8893a2957
--- /dev/null
+++ b/drivers/media/video/davinci/isif_regs.h
@@ -0,0 +1,269 @@
1/*
2 * Copyright (C) 2008-2009 Texas Instruments Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18#ifndef _ISIF_REGS_H
19#define _ISIF_REGS_H
20
21/* ISIF registers relative offsets */
22#define SYNCEN 0x00
23#define MODESET 0x04
24#define HDW 0x08
25#define VDW 0x0c
26#define PPLN 0x10
27#define LPFR 0x14
28#define SPH 0x18
29#define LNH 0x1c
30#define SLV0 0x20
31#define SLV1 0x24
32#define LNV 0x28
33#define CULH 0x2c
34#define CULV 0x30
35#define HSIZE 0x34
36#define SDOFST 0x38
37#define CADU 0x3c
38#define CADL 0x40
39#define LINCFG0 0x44
40#define LINCFG1 0x48
41#define CCOLP 0x4c
42#define CRGAIN 0x50
43#define CGRGAIN 0x54
44#define CGBGAIN 0x58
45#define CBGAIN 0x5c
46#define COFSTA 0x60
47#define FLSHCFG0 0x64
48#define FLSHCFG1 0x68
49#define FLSHCFG2 0x6c
50#define VDINT0 0x70
51#define VDINT1 0x74
52#define VDINT2 0x78
53#define MISC 0x7c
54#define CGAMMAWD 0x80
55#define REC656IF 0x84
56#define CCDCFG 0x88
57/*****************************************************
58* Defect Correction registers
59*****************************************************/
60#define DFCCTL 0x8c
61#define VDFSATLV 0x90
62#define DFCMEMCTL 0x94
63#define DFCMEM0 0x98
64#define DFCMEM1 0x9c
65#define DFCMEM2 0xa0
66#define DFCMEM3 0xa4
67#define DFCMEM4 0xa8
68/****************************************************
69* Black Clamp registers
70****************************************************/
71#define CLAMPCFG 0xac
72#define CLDCOFST 0xb0
73#define CLSV 0xb4
74#define CLHWIN0 0xb8
75#define CLHWIN1 0xbc
76#define CLHWIN2 0xc0
77#define CLVRV 0xc4
78#define CLVWIN0 0xc8
79#define CLVWIN1 0xcc
80#define CLVWIN2 0xd0
81#define CLVWIN3 0xd4
82/****************************************************
83* Lense Shading Correction
84****************************************************/
85#define DATAHOFST 0xd8
86#define DATAVOFST 0xdc
87#define LSCHVAL 0xe0
88#define LSCVVAL 0xe4
89#define TWODLSCCFG 0xe8
90#define TWODLSCOFST 0xec
91#define TWODLSCINI 0xf0
92#define TWODLSCGRBU 0xf4
93#define TWODLSCGRBL 0xf8
94#define TWODLSCGROF 0xfc
95#define TWODLSCORBU 0x100
96#define TWODLSCORBL 0x104
97#define TWODLSCOROF 0x108
98#define TWODLSCIRQEN 0x10c
99#define TWODLSCIRQST 0x110
100/****************************************************
101* Data formatter
102****************************************************/
103#define FMTCFG 0x114
104#define FMTPLEN 0x118
105#define FMTSPH 0x11c
106#define FMTLNH 0x120
107#define FMTSLV 0x124
108#define FMTLNV 0x128
109#define FMTRLEN 0x12c
110#define FMTHCNT 0x130
111#define FMTAPTR_BASE 0x134
112/* Below macro for addresses FMTAPTR0 - FMTAPTR15 */
113#define FMTAPTR(i) (FMTAPTR_BASE + (i * 4))
114#define FMTPGMVF0 0x174
115#define FMTPGMVF1 0x178
116#define FMTPGMAPU0 0x17c
117#define FMTPGMAPU1 0x180
118#define FMTPGMAPS0 0x184
119#define FMTPGMAPS1 0x188
120#define FMTPGMAPS2 0x18c
121#define FMTPGMAPS3 0x190
122#define FMTPGMAPS4 0x194
123#define FMTPGMAPS5 0x198
124#define FMTPGMAPS6 0x19c
125#define FMTPGMAPS7 0x1a0
126/************************************************
127* Color Space Converter
128************************************************/
129#define CSCCTL 0x1a4
130#define CSCM0 0x1a8
131#define CSCM1 0x1ac
132#define CSCM2 0x1b0
133#define CSCM3 0x1b4
134#define CSCM4 0x1b8
135#define CSCM5 0x1bc
136#define CSCM6 0x1c0
137#define CSCM7 0x1c4
138#define OBWIN0 0x1c8
139#define OBWIN1 0x1cc
140#define OBWIN2 0x1d0
141#define OBWIN3 0x1d4
142#define OBVAL0 0x1d8
143#define OBVAL1 0x1dc
144#define OBVAL2 0x1e0
145#define OBVAL3 0x1e4
146#define OBVAL4 0x1e8
147#define OBVAL5 0x1ec
148#define OBVAL6 0x1f0
149#define OBVAL7 0x1f4
150#define CLKCTL 0x1f8
151
152/* Masks & Shifts below */
153#define START_PX_HOR_MASK 0x7FFF
154#define NUM_PX_HOR_MASK 0x7FFF
155#define START_VER_ONE_MASK 0x7FFF
156#define START_VER_TWO_MASK 0x7FFF
157#define NUM_LINES_VER 0x7FFF
158
159/* gain - offset masks */
160#define GAIN_INTEGER_SHIFT 9
161#define OFFSET_MASK 0xFFF
162#define GAIN_SDRAM_EN_SHIFT 12
163#define GAIN_IPIPE_EN_SHIFT 13
164#define GAIN_H3A_EN_SHIFT 14
165#define OFST_SDRAM_EN_SHIFT 8
166#define OFST_IPIPE_EN_SHIFT 9
167#define OFST_H3A_EN_SHIFT 10
168#define GAIN_OFFSET_EN_MASK 0x7700
169
170/* Culling */
171#define CULL_PAT_EVEN_LINE_SHIFT 8
172
173/* CCDCFG register */
174#define ISIF_YCINSWP_RAW (0x00 << 4)
175#define ISIF_YCINSWP_YCBCR (0x01 << 4)
176#define ISIF_CCDCFG_FIDMD_LATCH_VSYNC (0x00 << 6)
177#define ISIF_CCDCFG_WENLOG_AND (0x00 << 8)
178#define ISIF_CCDCFG_TRGSEL_WEN (0x00 << 9)
179#define ISIF_CCDCFG_EXTRG_DISABLE (0x00 << 10)
180#define ISIF_LATCH_ON_VSYNC_DISABLE (0x01 << 15)
181#define ISIF_LATCH_ON_VSYNC_ENABLE (0x00 << 15)
182#define ISIF_DATA_PACK_MASK 3
183#define ISIF_DATA_PACK16 0
184#define ISIF_DATA_PACK12 1
185#define ISIF_DATA_PACK8 2
186#define ISIF_PIX_ORDER_SHIFT 11
187#define ISIF_BW656_ENABLE (0x01 << 5)
188
189/* MODESET registers */
190#define ISIF_VDHDOUT_INPUT (0x00 << 0)
191#define ISIF_INPUT_SHIFT 12
192#define ISIF_RAW_INPUT_MODE 0
193#define ISIF_FID_POL_SHIFT 4
194#define ISIF_HD_POL_SHIFT 3
195#define ISIF_VD_POL_SHIFT 2
196#define ISIF_DATAPOL_NORMAL 0
197#define ISIF_DATAPOL_SHIFT 6
198#define ISIF_EXWEN_DISABLE 0
199#define ISIF_EXWEN_SHIFT 5
200#define ISIF_FRM_FMT_SHIFT 7
201#define ISIF_DATASFT_SHIFT 8
202#define ISIF_LPF_SHIFT 14
203#define ISIF_LPF_MASK 1
204
205/* GAMMAWD registers */
206#define ISIF_ALAW_GAMA_WD_MASK 0xF
207#define ISIF_ALAW_GAMA_WD_SHIFT 1
208#define ISIF_ALAW_ENABLE 1
209#define ISIF_GAMMAWD_CFA_SHIFT 5
210
211/* HSIZE registers */
212#define ISIF_HSIZE_FLIP_MASK 1
213#define ISIF_HSIZE_FLIP_SHIFT 12
214
215/* MISC registers */
216#define ISIF_DPCM_EN_SHIFT 12
217#define ISIF_DPCM_PREDICTOR_SHIFT 13
218
219/* Black clamp related */
220#define ISIF_BC_MODE_COLOR_SHIFT 4
221#define ISIF_HORZ_BC_MODE_SHIFT 1
222#define ISIF_HORZ_BC_WIN_SEL_SHIFT 5
223#define ISIF_HORZ_BC_PIX_LIMIT_SHIFT 6
224#define ISIF_HORZ_BC_WIN_H_SIZE_SHIFT 8
225#define ISIF_HORZ_BC_WIN_V_SIZE_SHIFT 12
226#define ISIF_VERT_BC_RST_VAL_SEL_SHIFT 4
227#define ISIF_VERT_BC_LINE_AVE_COEF_SHIFT 8
228
229/* VDFC registers */
230#define ISIF_VDFC_EN_SHIFT 4
231#define ISIF_VDFC_CORR_MOD_SHIFT 5
232#define ISIF_VDFC_CORR_WHOLE_LN_SHIFT 7
233#define ISIF_VDFC_LEVEL_SHFT_SHIFT 8
234#define ISIF_VDFC_POS_MASK 0x1FFF
235#define ISIF_DFCMEMCTL_DFCMARST_SHIFT 2
236
237/* CSC registers */
238#define ISIF_CSC_COEF_INTEG_MASK 7
239#define ISIF_CSC_COEF_DECIMAL_MASK 0x1f
240#define ISIF_CSC_COEF_INTEG_SHIFT 5
241#define ISIF_CSCM_MSB_SHIFT 8
242#define ISIF_DF_CSC_SPH_MASK 0x1FFF
243#define ISIF_DF_CSC_LNH_MASK 0x1FFF
244#define ISIF_DF_CSC_SLV_MASK 0x1FFF
245#define ISIF_DF_CSC_LNV_MASK 0x1FFF
246#define ISIF_DF_NUMLINES 0x7FFF
247#define ISIF_DF_NUMPIX 0x1FFF
248
249/* Offsets for LSC/DFC/Gain */
250#define ISIF_DATA_H_OFFSET_MASK 0x1FFF
251#define ISIF_DATA_V_OFFSET_MASK 0x1FFF
252
253/* Linearization */
254#define ISIF_LIN_CORRSFT_SHIFT 4
255#define ISIF_LIN_SCALE_FACT_INTEG_SHIFT 10
256
257
258/* Pattern registers */
259#define ISIF_PG_EN (1 << 3)
260#define ISIF_SEL_PG_SRC (3 << 4)
261#define ISIF_PG_VD_POL_SHIFT 0
262#define ISIF_PG_HD_POL_SHIFT 1
263
264/*random other junk*/
265#define ISIF_SYNCEN_VDHDEN_MASK (1 << 0)
266#define ISIF_SYNCEN_WEN_MASK (1 << 1)
267#define ISIF_SYNCEN_WEN_SHIFT 1
268
269#endif
diff --git a/include/media/davinci/isif.h b/include/media/davinci/isif.h
new file mode 100644
index 000000000000..b0b74ad618cc
--- /dev/null
+++ b/include/media/davinci/isif.h
@@ -0,0 +1,531 @@
1/*
2 * Copyright (C) 2008-2009 Texas Instruments Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * isif header file
19 */
20#ifndef _ISIF_H
21#define _ISIF_H
22
23#include <media/davinci/ccdc_types.h>
24#include <media/davinci/vpfe_types.h>
25
26/* isif float type S8Q8/U8Q8 */
27struct isif_float_8 {
28 /* 8 bit integer part */
29 __u8 integer;
30 /* 8 bit decimal part */
31 __u8 decimal;
32};
33
34/* isif float type U16Q16/S16Q16 */
35struct isif_float_16 {
36 /* 16 bit integer part */
37 __u16 integer;
38 /* 16 bit decimal part */
39 __u16 decimal;
40};
41
42/************************************************************************
43 * Vertical Defect Correction parameters
44 ***********************************************************************/
45/* Defect Correction (DFC) table entry */
46struct isif_vdfc_entry {
47 /* vertical position of defect */
48 __u16 pos_vert;
49 /* horizontal position of defect */
50 __u16 pos_horz;
51 /*
52 * Defect level of Vertical line defect position. This is subtracted
53 * from the data at the defect position
54 */
55 __u8 level_at_pos;
56 /*
57 * Defect level of the pixels upper than the vertical line defect.
58 * This is subtracted from the data
59 */
60 __u8 level_up_pixels;
61 /*
62 * Defect level of the pixels lower than the vertical line defect.
63 * This is subtracted from the data
64 */
65 __u8 level_low_pixels;
66};
67
68#define ISIF_VDFC_TABLE_SIZE 8
69struct isif_dfc {
70 /* enable vertical defect correction */
71 __u8 en;
72 /* Defect level subtraction. Just fed through if saturating */
73#define ISIF_VDFC_NORMAL 0
74 /*
75 * Defect level subtraction. Horizontal interpolation ((i-2)+(i+2))/2
76 * if data saturating
77 */
78#define ISIF_VDFC_HORZ_INTERPOL_IF_SAT 1
79 /* Horizontal interpolation (((i-2)+(i+2))/2) */
80#define ISIF_VDFC_HORZ_INTERPOL 2
81 /* one of the vertical defect correction modes above */
82 __u8 corr_mode;
83 /* 0 - whole line corrected, 1 - not pixels upper than the defect */
84 __u8 corr_whole_line;
85#define ISIF_VDFC_NO_SHIFT 0
86#define ISIF_VDFC_SHIFT_1 1
87#define ISIF_VDFC_SHIFT_2 2
88#define ISIF_VDFC_SHIFT_3 3
89#define ISIF_VDFC_SHIFT_4 4
90 /*
91 * defect level shift value. level_at_pos, level_upper_pos,
92 * and level_lower_pos can be shifted up by this value. Choose
93 * one of the values above
94 */
95 __u8 def_level_shift;
96 /* defect saturation level */
97 __u16 def_sat_level;
98 /* number of vertical defects. Max is ISIF_VDFC_TABLE_SIZE */
99 __u16 num_vdefects;
100 /* VDFC table ptr */
101 struct isif_vdfc_entry table[ISIF_VDFC_TABLE_SIZE];
102};
103
104struct isif_horz_bclamp {
105
106 /* Horizontal clamp disabled. Only vertical clamp value is subtracted */
107#define ISIF_HORZ_BC_DISABLE 0
108 /*
109 * Horizontal clamp value is calculated and subtracted from image data
110 * along with vertical clamp value
111 */
112#define ISIF_HORZ_BC_CLAMP_CALC_ENABLED 1
113 /*
114 * Horizontal clamp value calculated from previous image is subtracted
115 * from image data along with vertical clamp value.
116 */
117#define ISIF_HORZ_BC_CLAMP_NOT_UPDATED 2
118 /* horizontal clamp mode. One of the values above */
119 __u8 mode;
120 /*
121 * pixel value limit enable.
122 * 0 - limit disabled
123 * 1 - pixel value limited to 1023
124 */
125 __u8 clamp_pix_limit;
126 /* Select Most left window for bc calculation */
127#define ISIF_SEL_MOST_LEFT_WIN 0
128 /* Select Most right window for bc calculation */
129#define ISIF_SEL_MOST_RIGHT_WIN 1
130 /* Select most left or right window for clamp val calculation */
131 __u8 base_win_sel_calc;
132 /* Window count per color for calculation. range 1-32 */
133 __u8 win_count_calc;
134 /* Window start position - horizontal for calculation. 0 - 8191 */
135 __u16 win_start_h_calc;
136 /* Window start position - vertical for calculation 0 - 8191 */
137 __u16 win_start_v_calc;
138#define ISIF_HORZ_BC_SZ_H_2PIXELS 0
139#define ISIF_HORZ_BC_SZ_H_4PIXELS 1
140#define ISIF_HORZ_BC_SZ_H_8PIXELS 2
141#define ISIF_HORZ_BC_SZ_H_16PIXELS 3
142 /* Width of the sample window in pixels for calculation */
143 __u8 win_h_sz_calc;
144#define ISIF_HORZ_BC_SZ_V_32PIXELS 0
145#define ISIF_HORZ_BC_SZ_V_64PIXELS 1
146#define ISIF_HORZ_BC_SZ_V_128PIXELS 2
147#define ISIF_HORZ_BC_SZ_V_256PIXELS 3
148 /* Height of the sample window in pixels for calculation */
149 __u8 win_v_sz_calc;
150};
151
152/************************************************************************
153 * Black Clamp parameters
154 ***********************************************************************/
155struct isif_vert_bclamp {
156 /* Reset value used is the clamp value calculated */
157#define ISIF_VERT_BC_USE_HORZ_CLAMP_VAL 0
158 /* Reset value used is reset_clamp_val configured */
159#define ISIF_VERT_BC_USE_CONFIG_CLAMP_VAL 1
160 /* No update, previous image value is used */
161#define ISIF_VERT_BC_NO_UPDATE 2
162 /*
163 * Reset value selector for vertical clamp calculation. Use one of
164 * the above values
165 */
166 __u8 reset_val_sel;
167 /* U8Q8. Line average coefficient used in vertical clamp calculation */
168 __u8 line_ave_coef;
169 /* Height of the optical black region for calculation */
170 __u16 ob_v_sz_calc;
171 /* Optical black region start position - horizontal. 0 - 8191 */
172 __u16 ob_start_h;
173 /* Optical black region start position - vertical 0 - 8191 */
174 __u16 ob_start_v;
175};
176
177struct isif_black_clamp {
178 /*
179 * This offset value is added irrespective of the clamp enable status.
180 * S13
181 */
182 __u16 dc_offset;
183 /*
184 * Enable black/digital clamp value to be subtracted from the image data
185 */
186 __u8 en;
187 /*
188 * black clamp mode. same/separate clamp for 4 colors
189 * 0 - disable - same clamp value for all colors
190 * 1 - clamp value calculated separately for all colors
191 */
192 __u8 bc_mode_color;
193 /* Vrtical start position for bc subtraction */
194 __u16 vert_start_sub;
195 /* Black clamp for horizontal direction */
196 struct isif_horz_bclamp horz;
197 /* Black clamp for vertical direction */
198 struct isif_vert_bclamp vert;
199};
200
201/*************************************************************************
202** Color Space Convertion (CSC)
203*************************************************************************/
204#define ISIF_CSC_NUM_COEFF 16
205struct isif_color_space_conv {
206 /* Enable color space conversion */
207 __u8 en;
208 /*
209 * csc coeffient table. S8Q5, M00 at index 0, M01 at index 1, and
210 * so forth
211 */
212 struct isif_float_8 coeff[ISIF_CSC_NUM_COEFF];
213};
214
215
216/*************************************************************************
217** Black Compensation parameters
218*************************************************************************/
219struct isif_black_comp {
220 /* Comp for Red */
221 __s8 r_comp;
222 /* Comp for Gr */
223 __s8 gr_comp;
224 /* Comp for Blue */
225 __s8 b_comp;
226 /* Comp for Gb */
227 __s8 gb_comp;
228};
229
230/*************************************************************************
231** Gain parameters
232*************************************************************************/
233struct isif_gain {
234 /* Gain for Red or ye */
235 struct isif_float_16 r_ye;
236 /* Gain for Gr or cy */
237 struct isif_float_16 gr_cy;
238 /* Gain for Gb or g */
239 struct isif_float_16 gb_g;
240 /* Gain for Blue or mg */
241 struct isif_float_16 b_mg;
242};
243
244#define ISIF_LINEAR_TAB_SIZE 192
245/*************************************************************************
246** Linearization parameters
247*************************************************************************/
248struct isif_linearize {
249 /* Enable or Disable linearization of data */
250 __u8 en;
251 /* Shift value applied */
252 __u8 corr_shft;
253 /* scale factor applied U11Q10 */
254 struct isif_float_16 scale_fact;
255 /* Size of the linear table */
256 __u16 table[ISIF_LINEAR_TAB_SIZE];
257};
258
259/* Color patterns */
260#define ISIF_RED 0
261#define ISIF_GREEN_RED 1
262#define ISIF_GREEN_BLUE 2
263#define ISIF_BLUE 3
264struct isif_col_pat {
265 __u8 olop;
266 __u8 olep;
267 __u8 elop;
268 __u8 elep;
269};
270
271/*************************************************************************
272** Data formatter parameters
273*************************************************************************/
274struct isif_fmtplen {
275 /*
276 * number of program entries for SET0, range 1 - 16
277 * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
278 * ISIF_COMBINE
279 */
280 __u16 plen0;
281 /*
282 * number of program entries for SET1, range 1 - 16
283 * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
284 * ISIF_COMBINE
285 */
286 __u16 plen1;
287 /**
288 * number of program entries for SET2, range 1 - 16
289 * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
290 * ISIF_COMBINE
291 */
292 __u16 plen2;
293 /**
294 * number of program entries for SET3, range 1 - 16
295 * when fmtmode is ISIF_SPLIT, 1 - 8 when fmtmode is
296 * ISIF_COMBINE
297 */
298 __u16 plen3;
299};
300
301struct isif_fmt_cfg {
302#define ISIF_SPLIT 0
303#define ISIF_COMBINE 1
304 /* Split or combine or line alternate */
305 __u8 fmtmode;
306 /* enable or disable line alternating mode */
307 __u8 ln_alter_en;
308#define ISIF_1LINE 0
309#define ISIF_2LINES 1
310#define ISIF_3LINES 2
311#define ISIF_4LINES 3
312 /* Split/combine line number */
313 __u8 lnum;
314 /* Address increment Range 1 - 16 */
315 __u8 addrinc;
316};
317
318struct isif_fmt_addr_ptr {
319 /* Initial address */
320 __u32 init_addr;
321 /* output line number */
322#define ISIF_1STLINE 0
323#define ISIF_2NDLINE 1
324#define ISIF_3RDLINE 2
325#define ISIF_4THLINE 3
326 __u8 out_line;
327};
328
329struct isif_fmtpgm_ap {
330 /* program address pointer */
331 __u8 pgm_aptr;
332 /* program address increment or decrement */
333 __u8 pgmupdt;
334};
335
336struct isif_data_formatter {
337 /* Enable/Disable data formatter */
338 __u8 en;
339 /* data formatter configuration */
340 struct isif_fmt_cfg cfg;
341 /* Formatter program entries length */
342 struct isif_fmtplen plen;
343 /* first pixel in a line fed to formatter */
344 __u16 fmtrlen;
345 /* HD interval for output line. Only valid when split line */
346 __u16 fmthcnt;
347 /* formatter address pointers */
348 struct isif_fmt_addr_ptr fmtaddr_ptr[16];
349 /* program enable/disable */
350 __u8 pgm_en[32];
351 /* program address pointers */
352 struct isif_fmtpgm_ap fmtpgm_ap[32];
353};
354
355struct isif_df_csc {
356 /* Color Space Conversion confguration, 0 - csc, 1 - df */
357 __u8 df_or_csc;
358 /* csc configuration valid if df_or_csc is 0 */
359 struct isif_color_space_conv csc;
360 /* data formatter configuration valid if df_or_csc is 1 */
361 struct isif_data_formatter df;
362 /* start pixel in a line at the input */
363 __u32 start_pix;
364 /* number of pixels in input line */
365 __u32 num_pixels;
366 /* start line at the input */
367 __u32 start_line;
368 /* number of lines at the input */
369 __u32 num_lines;
370};
371
372struct isif_gain_offsets_adj {
373 /* Gain adjustment per color */
374 struct isif_gain gain;
375 /* Offset adjustment */
376 __u16 offset;
377 /* Enable or Disable Gain adjustment for SDRAM data */
378 __u8 gain_sdram_en;
379 /* Enable or Disable Gain adjustment for IPIPE data */
380 __u8 gain_ipipe_en;
381 /* Enable or Disable Gain adjustment for H3A data */
382 __u8 gain_h3a_en;
383 /* Enable or Disable Gain adjustment for SDRAM data */
384 __u8 offset_sdram_en;
385 /* Enable or Disable Gain adjustment for IPIPE data */
386 __u8 offset_ipipe_en;
387 /* Enable or Disable Gain adjustment for H3A data */
388 __u8 offset_h3a_en;
389};
390
391struct isif_cul {
392 /* Horizontal Cull pattern for odd lines */
393 __u8 hcpat_odd;
394 /* Horizontal Cull pattern for even lines */
395 __u8 hcpat_even;
396 /* Vertical Cull pattern */
397 __u8 vcpat;
398 /* Enable or disable lpf. Apply when cull is enabled */
399 __u8 en_lpf;
400};
401
402struct isif_compress {
403#define ISIF_ALAW 0
404#define ISIF_DPCM 1
405#define ISIF_NO_COMPRESSION 2
406 /* Compression Algorithm used */
407 __u8 alg;
408 /* Choose Predictor1 for DPCM compression */
409#define ISIF_DPCM_PRED1 0
410 /* Choose Predictor2 for DPCM compression */
411#define ISIF_DPCM_PRED2 1
412 /* Predictor for DPCM compression */
413 __u8 pred;
414};
415
416/* all the stuff in this struct will be provided by userland */
417struct isif_config_params_raw {
418 /* Linearization parameters for image sensor data input */
419 struct isif_linearize linearize;
420 /* Data formatter or CSC */
421 struct isif_df_csc df_csc;
422 /* Defect Pixel Correction (DFC) confguration */
423 struct isif_dfc dfc;
424 /* Black/Digital Clamp configuration */
425 struct isif_black_clamp bclamp;
426 /* Gain, offset adjustments */
427 struct isif_gain_offsets_adj gain_offset;
428 /* Culling */
429 struct isif_cul culling;
430 /* A-Law and DPCM compression options */
431 struct isif_compress compress;
432 /* horizontal offset for Gain/LSC/DFC */
433 __u16 horz_offset;
434 /* vertical offset for Gain/LSC/DFC */
435 __u16 vert_offset;
436 /* color pattern for field 0 */
437 struct isif_col_pat col_pat_field0;
438 /* color pattern for field 1 */
439 struct isif_col_pat col_pat_field1;
440#define ISIF_NO_SHIFT 0
441#define ISIF_1BIT_SHIFT 1
442#define ISIF_2BIT_SHIFT 2
443#define ISIF_3BIT_SHIFT 3
444#define ISIF_4BIT_SHIFT 4
445#define ISIF_5BIT_SHIFT 5
446#define ISIF_6BIT_SHIFT 6
447 /* Data shift applied before storing to SDRAM */
448 __u8 data_shift;
449 /* enable input test pattern generation */
450 __u8 test_pat_gen;
451};
452
453#ifdef __KERNEL__
454struct isif_ycbcr_config {
455 /* isif pixel format */
456 enum ccdc_pixfmt pix_fmt;
457 /* isif frame format */
458 enum ccdc_frmfmt frm_fmt;
459 /* ISIF crop window */
460 struct v4l2_rect win;
461 /* field polarity */
462 enum vpfe_pin_pol fid_pol;
463 /* interface VD polarity */
464 enum vpfe_pin_pol vd_pol;
465 /* interface HD polarity */
466 enum vpfe_pin_pol hd_pol;
467 /* isif pix order. Only used for ycbcr capture */
468 enum ccdc_pixorder pix_order;
469 /* isif buffer type. Only used for ycbcr capture */
470 enum ccdc_buftype buf_type;
471};
472
473/* MSB of image data connected to sensor port */
474enum isif_data_msb {
475 ISIF_BIT_MSB_15,
476 ISIF_BIT_MSB_14,
477 ISIF_BIT_MSB_13,
478 ISIF_BIT_MSB_12,
479 ISIF_BIT_MSB_11,
480 ISIF_BIT_MSB_10,
481 ISIF_BIT_MSB_9,
482 ISIF_BIT_MSB_8,
483 ISIF_BIT_MSB_7
484};
485
486enum isif_cfa_pattern {
487 ISIF_CFA_PAT_MOSAIC,
488 ISIF_CFA_PAT_STRIPE
489};
490
491struct isif_params_raw {
492 /* isif pixel format */
493 enum ccdc_pixfmt pix_fmt;
494 /* isif frame format */
495 enum ccdc_frmfmt frm_fmt;
496 /* video window */
497 struct v4l2_rect win;
498 /* field polarity */
499 enum vpfe_pin_pol fid_pol;
500 /* interface VD polarity */
501 enum vpfe_pin_pol vd_pol;
502 /* interface HD polarity */
503 enum vpfe_pin_pol hd_pol;
504 /* buffer type. Applicable for interlaced mode */
505 enum ccdc_buftype buf_type;
506 /* Gain values */
507 struct isif_gain gain;
508 /* cfa pattern */
509 enum isif_cfa_pattern cfa_pat;
510 /* Data MSB position */
511 enum isif_data_msb data_msb;
512 /* Enable horizontal flip */
513 unsigned char horz_flip_en;
514 /* Enable image invert vertically */
515 unsigned char image_invert_en;
516
517 /* all the userland defined stuff*/
518 struct isif_config_params_raw config_params;
519};
520
521enum isif_data_pack {
522 ISIF_PACK_16BIT,
523 ISIF_PACK_12BIT,
524 ISIF_PACK_8BIT
525};
526
527#define ISIF_WIN_NTSC {0, 0, 720, 480}
528#define ISIF_WIN_VGA {0, 0, 640, 480}
529
530#endif
531#endif