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