diff options
author | Muralidharan Karicheri <m-karicheri2@ti.com> | 2009-07-03 04:23:07 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-18 23:18:15 -0400 |
commit | dd2ceb1a4028dc9644ed4df80cea9c05ca0b5f6d (patch) | |
tree | 275bc7ebf9dbb24aa9264d6cc572221b15971aaf /include/media/davinci | |
parent | 638c97400829a43eecc2ad924a0f5143b6c56a6d (diff) |
V4L/DVB (12250): v4l: dm355 ccdc module for vpfe capture driver
Adds ccdc hw module for DM355 CCDC. This registers with the bridge
driver a set of hw_ops for configuring the CCDC for a specific
decoder device connected to vpfe.
Reviewed by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed by: Laurent Pinchart <laurent.pinchart@skynet.be>
Reviewed by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Muralidharan Karicheri <m-karicheri2@ti.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/davinci')
-rw-r--r-- | include/media/davinci/dm355_ccdc.h | 321 |
1 files changed, 321 insertions, 0 deletions
diff --git a/include/media/davinci/dm355_ccdc.h b/include/media/davinci/dm355_ccdc.h new file mode 100644 index 000000000000..df8a7b107477 --- /dev/null +++ b/include/media/davinci/dm355_ccdc.h | |||
@@ -0,0 +1,321 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2005-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 _DM355_CCDC_H | ||
19 | #define _DM355_CCDC_H | ||
20 | #include <media/davinci/ccdc_types.h> | ||
21 | #include <media/davinci/vpfe_types.h> | ||
22 | |||
23 | /* enum for No of pixel per line to be avg. in Black Clamping */ | ||
24 | enum 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 | /* enum for No of lines in Black Clamping */ | ||
33 | enum 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 | /* enum for Alaw gama width */ | ||
42 | enum 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 | |||
50 | enum ccdc_colpats { | ||
51 | CCDC_RED, | ||
52 | CCDC_GREEN_RED, | ||
53 | CCDC_GREEN_BLUE, | ||
54 | CCDC_BLUE | ||
55 | }; | ||
56 | |||
57 | struct 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 | |||
64 | enum 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 | |||
74 | enum 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 | }; | ||
84 | enum ccdc_mfilt1 { | ||
85 | CCDC_NO_MEDIAN_FILTER1, | ||
86 | CCDC_AVERAGE_FILTER1, | ||
87 | CCDC_MEDIAN_FILTER1 | ||
88 | }; | ||
89 | |||
90 | enum ccdc_mfilt2 { | ||
91 | CCDC_NO_MEDIAN_FILTER2, | ||
92 | CCDC_AVERAGE_FILTER2, | ||
93 | CCDC_MEDIAN_FILTER2 | ||
94 | }; | ||
95 | |||
96 | /* structure for ALaw */ | ||
97 | struct ccdc_a_law { | ||
98 | /* Enable/disable A-Law */ | ||
99 | unsigned char enable; | ||
100 | /* Gama Width Input */ | ||
101 | enum ccdc_gamma_width gama_wd; | ||
102 | }; | ||
103 | |||
104 | /* structure for Black Clamping */ | ||
105 | struct ccdc_black_clamp { | ||
106 | /* only if bClampEnable is TRUE */ | ||
107 | unsigned char b_clamp_enable; | ||
108 | /* only if bClampEnable is TRUE */ | ||
109 | enum ccdc_sample_length sample_pixel; | ||
110 | /* only if bClampEnable is TRUE */ | ||
111 | enum ccdc_sample_line sample_ln; | ||
112 | /* only if bClampEnable is TRUE */ | ||
113 | unsigned short start_pixel; | ||
114 | /* only if bClampEnable is FALSE */ | ||
115 | unsigned short sgain; | ||
116 | unsigned short dc_sub; | ||
117 | }; | ||
118 | |||
119 | /* structure for Black Level Compensation */ | ||
120 | struct ccdc_black_compensation { | ||
121 | /* Constant value to subtract from Red component */ | ||
122 | unsigned char r; | ||
123 | /* Constant value to subtract from Gr component */ | ||
124 | unsigned char gr; | ||
125 | /* Constant value to subtract from Blue component */ | ||
126 | unsigned char b; | ||
127 | /* Constant value to subtract from Gb component */ | ||
128 | unsigned char gb; | ||
129 | }; | ||
130 | |||
131 | struct ccdc_float { | ||
132 | int integer; | ||
133 | unsigned int decimal; | ||
134 | }; | ||
135 | |||
136 | #define CCDC_CSC_COEFF_TABLE_SIZE 16 | ||
137 | /* structure for color space converter */ | ||
138 | struct ccdc_csc { | ||
139 | unsigned char enable; | ||
140 | /* | ||
141 | * S8Q5. Use 2 decimal precision, user values range from -3.00 to 3.99. | ||
142 | * example - to use 1.03, set integer part as 1, and decimal part as 3 | ||
143 | * to use -1.03, set integer part as -1 and decimal part as 3 | ||
144 | */ | ||
145 | struct ccdc_float coeff[CCDC_CSC_COEFF_TABLE_SIZE]; | ||
146 | }; | ||
147 | |||
148 | /* Structures for Vertical Defect Correction*/ | ||
149 | enum ccdc_vdf_csl { | ||
150 | CCDC_VDF_NORMAL, | ||
151 | CCDC_VDF_HORZ_INTERPOL_SAT, | ||
152 | CCDC_VDF_HORZ_INTERPOL | ||
153 | }; | ||
154 | |||
155 | enum ccdc_vdf_cuda { | ||
156 | CCDC_VDF_WHOLE_LINE_CORRECT, | ||
157 | CCDC_VDF_UPPER_DISABLE | ||
158 | }; | ||
159 | |||
160 | enum ccdc_dfc_mwr { | ||
161 | CCDC_DFC_MWR_WRITE_COMPLETE, | ||
162 | CCDC_DFC_WRITE_REG | ||
163 | }; | ||
164 | |||
165 | enum ccdc_dfc_mrd { | ||
166 | CCDC_DFC_READ_COMPLETE, | ||
167 | CCDC_DFC_READ_REG | ||
168 | }; | ||
169 | |||
170 | enum ccdc_dfc_ma_rst { | ||
171 | CCDC_DFC_INCR_ADDR, | ||
172 | CCDC_DFC_CLR_ADDR | ||
173 | }; | ||
174 | |||
175 | enum ccdc_dfc_mclr { | ||
176 | CCDC_DFC_CLEAR_COMPLETE, | ||
177 | CCDC_DFC_CLEAR | ||
178 | }; | ||
179 | |||
180 | struct ccdc_dft_corr_ctl { | ||
181 | enum ccdc_vdf_csl vdfcsl; | ||
182 | enum ccdc_vdf_cuda vdfcuda; | ||
183 | unsigned int vdflsft; | ||
184 | }; | ||
185 | |||
186 | struct 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 | * Main Structure for vertical defect correction. Vertical defect | ||
196 | * correction can correct upto 16 defects if defects less than 16 | ||
197 | * then pad the rest with 0 | ||
198 | */ | ||
199 | struct 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 | |||
213 | struct ccdc_data_offset { | ||
214 | unsigned char horz_offset; | ||
215 | unsigned char vert_offset; | ||
216 | }; | ||
217 | |||
218 | /* | ||
219 | * Structure for CCDC configuration parameters for raw capture mode passed | ||
220 | * by application | ||
221 | */ | ||
222 | struct ccdc_config_params_raw { | ||
223 | /* data shift to be applied before storing */ | ||
224 | enum ccdc_datasft datasft; | ||
225 | /* data size value from 8 to 16 bits */ | ||
226 | enum ccdc_data_size data_sz; | ||
227 | /* median filter for sdram */ | ||
228 | enum ccdc_mfilt1 mfilt1; | ||
229 | enum ccdc_mfilt2 mfilt2; | ||
230 | /* low pass filter enable/disable */ | ||
231 | unsigned char lpf_enable; | ||
232 | /* Threshold of median filter */ | ||
233 | int med_filt_thres; | ||
234 | /* | ||
235 | * horz and vertical data offset. Appliable for defect correction | ||
236 | * and lsc | ||
237 | */ | ||
238 | struct ccdc_data_offset data_offset; | ||
239 | /* Structure for Optional A-Law */ | ||
240 | struct ccdc_a_law alaw; | ||
241 | /* Structure for Optical Black Clamp */ | ||
242 | struct ccdc_black_clamp blk_clamp; | ||
243 | /* Structure for Black Compensation */ | ||
244 | struct ccdc_black_compensation blk_comp; | ||
245 | /* struture for vertical Defect Correction Module Configuration */ | ||
246 | struct ccdc_vertical_dft vertical_dft; | ||
247 | /* structure for color space converter Module Configuration */ | ||
248 | struct ccdc_csc csc; | ||
249 | /* color patters for bayer capture */ | ||
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 | |||
260 | struct ccdc_params_ycbcr { | ||
261 | /* pixel format */ | ||
262 | enum ccdc_pixfmt pix_fmt; | ||
263 | /* progressive or interlaced frame */ | ||
264 | enum ccdc_frmfmt frm_fmt; | ||
265 | /* video window */ | ||
266 | struct v4l2_rect win; | ||
267 | /* field id polarity */ | ||
268 | enum vpfe_pin_pol fid_pol; | ||
269 | /* vertical sync polarity */ | ||
270 | enum vpfe_pin_pol vd_pol; | ||
271 | /* horizontal sync polarity */ | ||
272 | enum vpfe_pin_pol hd_pol; | ||
273 | /* enable BT.656 embedded sync mode */ | ||
274 | int bt656_enable; | ||
275 | /* cb:y:cr:y or y:cb:y:cr in memory */ | ||
276 | enum ccdc_pixorder pix_order; | ||
277 | /* interleaved or separated fields */ | ||
278 | enum ccdc_buftype buf_type; | ||
279 | }; | ||
280 | |||
281 | /* Gain applied to Raw Bayer data */ | ||
282 | struct 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 | /* Structure for CCDC configuration parameters for raw capture mode */ | ||
290 | struct ccdc_params_raw { | ||
291 | /* pixel format */ | ||
292 | enum ccdc_pixfmt pix_fmt; | ||
293 | /* progressive or interlaced frame */ | ||
294 | enum ccdc_frmfmt frm_fmt; | ||
295 | /* video window */ | ||
296 | struct v4l2_rect win; | ||
297 | /* field id polarity */ | ||
298 | enum vpfe_pin_pol fid_pol; | ||
299 | /* vertical sync polarity */ | ||
300 | enum vpfe_pin_pol vd_pol; | ||
301 | /* horizontal sync polarity */ | ||
302 | enum vpfe_pin_pol hd_pol; | ||
303 | /* interleaved or separated fields */ | ||
304 | enum ccdc_buftype buf_type; | ||
305 | /* Gain values */ | ||
306 | struct ccdc_gain gain; | ||
307 | /* offset */ | ||
308 | unsigned int ccdc_offset; | ||
309 | /* horizontal flip enable */ | ||
310 | unsigned char horz_flip_enable; | ||
311 | /* | ||
312 | * enable to store the image in inverse order in memory | ||
313 | * (bottom to top) | ||
314 | */ | ||
315 | unsigned char image_invert_enable; | ||
316 | /* Configurable part of raw data */ | ||
317 | struct ccdc_config_params_raw config_params; | ||
318 | }; | ||
319 | |||
320 | #endif | ||
321 | #endif /* DM355_CCDC_H */ | ||