1
2
3
4
5 #ifndef _DM355_CCDC_H
6 #define _DM355_CCDC_H
7 #include <media/davinci/ccdc_types.h>
8 #include <media/davinci/vpfe_types.h>
9
10
11 enum ccdc_sample_length {
12 CCDC_SAMPLE_1PIXELS,
13 CCDC_SAMPLE_2PIXELS,
14 CCDC_SAMPLE_4PIXELS,
15 CCDC_SAMPLE_8PIXELS,
16 CCDC_SAMPLE_16PIXELS
17 };
18
19
20 enum ccdc_sample_line {
21 CCDC_SAMPLE_1LINES,
22 CCDC_SAMPLE_2LINES,
23 CCDC_SAMPLE_4LINES,
24 CCDC_SAMPLE_8LINES,
25 CCDC_SAMPLE_16LINES
26 };
27
28
29 enum ccdc_gamma_width {
30 CCDC_GAMMA_BITS_13_4,
31 CCDC_GAMMA_BITS_12_3,
32 CCDC_GAMMA_BITS_11_2,
33 CCDC_GAMMA_BITS_10_1,
34 CCDC_GAMMA_BITS_09_0
35 };
36
37 enum ccdc_colpats {
38 CCDC_RED,
39 CCDC_GREEN_RED,
40 CCDC_GREEN_BLUE,
41 CCDC_BLUE
42 };
43
44 struct ccdc_col_pat {
45 enum ccdc_colpats olop;
46 enum ccdc_colpats olep;
47 enum ccdc_colpats elop;
48 enum ccdc_colpats elep;
49 };
50
51 enum ccdc_datasft {
52 CCDC_DATA_NO_SHIFT,
53 CCDC_DATA_SHIFT_1BIT,
54 CCDC_DATA_SHIFT_2BIT,
55 CCDC_DATA_SHIFT_3BIT,
56 CCDC_DATA_SHIFT_4BIT,
57 CCDC_DATA_SHIFT_5BIT,
58 CCDC_DATA_SHIFT_6BIT
59 };
60
61 enum ccdc_data_size {
62 CCDC_DATA_16BITS,
63 CCDC_DATA_15BITS,
64 CCDC_DATA_14BITS,
65 CCDC_DATA_13BITS,
66 CCDC_DATA_12BITS,
67 CCDC_DATA_11BITS,
68 CCDC_DATA_10BITS,
69 CCDC_DATA_8BITS
70 };
71 enum ccdc_mfilt1 {
72 CCDC_NO_MEDIAN_FILTER1,
73 CCDC_AVERAGE_FILTER1,
74 CCDC_MEDIAN_FILTER1
75 };
76
77 enum ccdc_mfilt2 {
78 CCDC_NO_MEDIAN_FILTER2,
79 CCDC_AVERAGE_FILTER2,
80 CCDC_MEDIAN_FILTER2
81 };
82
83
84 struct ccdc_a_law {
85
86 unsigned char enable;
87
88 enum ccdc_gamma_width gamma_wd;
89 };
90
91
92 struct ccdc_black_clamp {
93
94 unsigned char b_clamp_enable;
95
96 enum ccdc_sample_length sample_pixel;
97
98 enum ccdc_sample_line sample_ln;
99
100 unsigned short start_pixel;
101
102 unsigned short sgain;
103 unsigned short dc_sub;
104 };
105
106
107 struct ccdc_black_compensation {
108
109 unsigned char r;
110
111 unsigned char gr;
112
113 unsigned char b;
114
115 unsigned char gb;
116 };
117
118 struct ccdc_float {
119 int integer;
120 unsigned int decimal;
121 };
122
123 #define CCDC_CSC_COEFF_TABLE_SIZE 16
124
125 struct ccdc_csc {
126 unsigned char enable;
127
128
129
130
131
132 struct ccdc_float coeff[CCDC_CSC_COEFF_TABLE_SIZE];
133 };
134
135
136 enum ccdc_vdf_csl {
137 CCDC_VDF_NORMAL,
138 CCDC_VDF_HORZ_INTERPOL_SAT,
139 CCDC_VDF_HORZ_INTERPOL
140 };
141
142 enum ccdc_vdf_cuda {
143 CCDC_VDF_WHOLE_LINE_CORRECT,
144 CCDC_VDF_UPPER_DISABLE
145 };
146
147 enum ccdc_dfc_mwr {
148 CCDC_DFC_MWR_WRITE_COMPLETE,
149 CCDC_DFC_WRITE_REG
150 };
151
152 enum ccdc_dfc_mrd {
153 CCDC_DFC_READ_COMPLETE,
154 CCDC_DFC_READ_REG
155 };
156
157 enum ccdc_dfc_ma_rst {
158 CCDC_DFC_INCR_ADDR,
159 CCDC_DFC_CLR_ADDR
160 };
161
162 enum ccdc_dfc_mclr {
163 CCDC_DFC_CLEAR_COMPLETE,
164 CCDC_DFC_CLEAR
165 };
166
167 struct ccdc_dft_corr_ctl {
168 enum ccdc_vdf_csl vdfcsl;
169 enum ccdc_vdf_cuda vdfcuda;
170 unsigned int vdflsft;
171 };
172
173 struct ccdc_dft_corr_mem_ctl {
174 enum ccdc_dfc_mwr dfcmwr;
175 enum ccdc_dfc_mrd dfcmrd;
176 enum ccdc_dfc_ma_rst dfcmarst;
177 enum ccdc_dfc_mclr dfcmclr;
178 };
179
180 #define CCDC_DFT_TABLE_SIZE 16
181
182
183
184
185
186 struct ccdc_vertical_dft {
187 unsigned char ver_dft_en;
188 unsigned char gen_dft_en;
189 unsigned int saturation_ctl;
190 struct ccdc_dft_corr_ctl dft_corr_ctl;
191 struct ccdc_dft_corr_mem_ctl dft_corr_mem_ctl;
192 int table_size;
193 unsigned int dft_corr_horz[CCDC_DFT_TABLE_SIZE];
194 unsigned int dft_corr_vert[CCDC_DFT_TABLE_SIZE];
195 unsigned int dft_corr_sub1[CCDC_DFT_TABLE_SIZE];
196 unsigned int dft_corr_sub2[CCDC_DFT_TABLE_SIZE];
197 unsigned int dft_corr_sub3[CCDC_DFT_TABLE_SIZE];
198 };
199
200 struct ccdc_data_offset {
201 unsigned char horz_offset;
202 unsigned char vert_offset;
203 };
204
205
206
207
208
209 struct ccdc_config_params_raw {
210
211 enum ccdc_datasft datasft;
212
213 enum ccdc_data_size data_sz;
214
215 enum ccdc_mfilt1 mfilt1;
216 enum ccdc_mfilt2 mfilt2;
217
218 unsigned char lpf_enable;
219
220 int med_filt_thres;
221
222
223
224
225 struct ccdc_data_offset data_offset;
226
227 struct ccdc_a_law alaw;
228
229 struct ccdc_black_clamp blk_clamp;
230
231 struct ccdc_black_compensation blk_comp;
232
233 struct ccdc_vertical_dft vertical_dft;
234
235 struct ccdc_csc csc;
236
237 struct ccdc_col_pat col_pat_field0;
238 struct ccdc_col_pat col_pat_field1;
239 };
240
241 #ifdef __KERNEL__
242 #include <linux/io.h>
243
244 #define CCDC_WIN_PAL {0, 0, 720, 576}
245 #define CCDC_WIN_VGA {0, 0, 640, 480}
246
247 struct ccdc_params_ycbcr {
248
249 enum ccdc_pixfmt pix_fmt;
250
251 enum ccdc_frmfmt frm_fmt;
252
253 struct v4l2_rect win;
254
255 enum vpfe_pin_pol fid_pol;
256
257 enum vpfe_pin_pol vd_pol;
258
259 enum vpfe_pin_pol hd_pol;
260
261 int bt656_enable;
262
263 enum ccdc_pixorder pix_order;
264
265 enum ccdc_buftype buf_type;
266 };
267
268
269 struct ccdc_gain {
270 unsigned short r_ye;
271 unsigned short gr_cy;
272 unsigned short gb_g;
273 unsigned short b_mg;
274 };
275
276
277 struct ccdc_params_raw {
278
279 enum ccdc_pixfmt pix_fmt;
280
281 enum ccdc_frmfmt frm_fmt;
282
283 struct v4l2_rect win;
284
285 enum vpfe_pin_pol fid_pol;
286
287 enum vpfe_pin_pol vd_pol;
288
289 enum vpfe_pin_pol hd_pol;
290
291 enum ccdc_buftype buf_type;
292
293 struct ccdc_gain gain;
294
295 unsigned int ccdc_offset;
296
297 unsigned char horz_flip_enable;
298
299
300
301
302 unsigned char image_invert_enable;
303
304 struct ccdc_config_params_raw config_params;
305 };
306
307 #endif
308 #endif