2 * Copyright (C) 2005-2009 Texas Instruments Inc
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.
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.
16 #include <media/davinci/ccdc_types.h>
17 #include <media/davinci/vpfe_types.h>
19 /* enum for No of pixel per line to be avg. in Black Clamping */
20 enum ccdc_sample_length
{
28 /* enum for No of lines in Black Clamping */
29 enum ccdc_sample_line
{
37 /* enum for Alaw gamma width */
38 enum ccdc_gamma_width
{
54 enum ccdc_colpats olop
;
55 enum ccdc_colpats olep
;
56 enum ccdc_colpats elop
;
57 enum ccdc_colpats elep
;
81 CCDC_NO_MEDIAN_FILTER1
,
87 CCDC_NO_MEDIAN_FILTER2
,
92 /* structure for ALaw */
94 /* Enable/disable A-Law */
96 /* Gamma Width Input */
97 enum ccdc_gamma_width gamma_wd
;
100 /* structure for Black Clamping */
101 struct ccdc_black_clamp
{
102 /* only if bClampEnable is TRUE */
103 unsigned char b_clamp_enable
;
104 /* only if bClampEnable is TRUE */
105 enum ccdc_sample_length sample_pixel
;
106 /* only if bClampEnable is TRUE */
107 enum ccdc_sample_line sample_ln
;
108 /* only if bClampEnable is TRUE */
109 unsigned short start_pixel
;
110 /* only if bClampEnable is FALSE */
111 unsigned short sgain
;
112 unsigned short dc_sub
;
115 /* structure for Black Level Compensation */
116 struct ccdc_black_compensation
{
117 /* Constant value to subtract from Red component */
119 /* Constant value to subtract from Gr component */
121 /* Constant value to subtract from Blue component */
123 /* Constant value to subtract from Gb component */
129 unsigned int decimal
;
132 #define CCDC_CSC_COEFF_TABLE_SIZE 16
133 /* structure for color space converter */
135 unsigned char enable
;
137 * S8Q5. Use 2 decimal precision, user values range from -3.00 to 3.99.
138 * example - to use 1.03, set integer part as 1, and decimal part as 3
139 * to use -1.03, set integer part as -1 and decimal part as 3
141 struct ccdc_float coeff
[CCDC_CSC_COEFF_TABLE_SIZE
];
144 /* Structures for Vertical Defect Correction*/
147 CCDC_VDF_HORZ_INTERPOL_SAT
,
148 CCDC_VDF_HORZ_INTERPOL
152 CCDC_VDF_WHOLE_LINE_CORRECT
,
153 CCDC_VDF_UPPER_DISABLE
157 CCDC_DFC_MWR_WRITE_COMPLETE
,
162 CCDC_DFC_READ_COMPLETE
,
166 enum ccdc_dfc_ma_rst
{
172 CCDC_DFC_CLEAR_COMPLETE
,
176 struct ccdc_dft_corr_ctl
{
177 enum ccdc_vdf_csl vdfcsl
;
178 enum ccdc_vdf_cuda vdfcuda
;
179 unsigned int vdflsft
;
182 struct ccdc_dft_corr_mem_ctl
{
183 enum ccdc_dfc_mwr dfcmwr
;
184 enum ccdc_dfc_mrd dfcmrd
;
185 enum ccdc_dfc_ma_rst dfcmarst
;
186 enum ccdc_dfc_mclr dfcmclr
;
189 #define CCDC_DFT_TABLE_SIZE 16
191 * Main Structure for vertical defect correction. Vertical defect
192 * correction can correct up to 16 defects if defects less than 16
193 * then pad the rest with 0
195 struct ccdc_vertical_dft
{
196 unsigned char ver_dft_en
;
197 unsigned char gen_dft_en
;
198 unsigned int saturation_ctl
;
199 struct ccdc_dft_corr_ctl dft_corr_ctl
;
200 struct ccdc_dft_corr_mem_ctl dft_corr_mem_ctl
;
202 unsigned int dft_corr_horz
[CCDC_DFT_TABLE_SIZE
];
203 unsigned int dft_corr_vert
[CCDC_DFT_TABLE_SIZE
];
204 unsigned int dft_corr_sub1
[CCDC_DFT_TABLE_SIZE
];
205 unsigned int dft_corr_sub2
[CCDC_DFT_TABLE_SIZE
];
206 unsigned int dft_corr_sub3
[CCDC_DFT_TABLE_SIZE
];
209 struct ccdc_data_offset
{
210 unsigned char horz_offset
;
211 unsigned char vert_offset
;
215 * Structure for CCDC configuration parameters for raw capture mode passed
218 struct ccdc_config_params_raw
{
219 /* data shift to be applied before storing */
220 enum ccdc_datasft datasft
;
221 /* data size value from 8 to 16 bits */
222 enum ccdc_data_size data_sz
;
223 /* median filter for sdram */
224 enum ccdc_mfilt1 mfilt1
;
225 enum ccdc_mfilt2 mfilt2
;
226 /* low pass filter enable/disable */
227 unsigned char lpf_enable
;
228 /* Threshold of median filter */
231 * horz and vertical data offset. Appliable for defect correction
234 struct ccdc_data_offset data_offset
;
235 /* Structure for Optional A-Law */
236 struct ccdc_a_law alaw
;
237 /* Structure for Optical Black Clamp */
238 struct ccdc_black_clamp blk_clamp
;
239 /* Structure for Black Compensation */
240 struct ccdc_black_compensation blk_comp
;
241 /* struture for vertical Defect Correction Module Configuration */
242 struct ccdc_vertical_dft vertical_dft
;
243 /* structure for color space converter Module Configuration */
245 /* color patters for bayer capture */
246 struct ccdc_col_pat col_pat_field0
;
247 struct ccdc_col_pat col_pat_field1
;
251 #include <linux/io.h>
253 #define CCDC_WIN_PAL {0, 0, 720, 576}
254 #define CCDC_WIN_VGA {0, 0, 640, 480}
256 struct ccdc_params_ycbcr
{
258 enum ccdc_pixfmt pix_fmt
;
259 /* progressive or interlaced frame */
260 enum ccdc_frmfmt frm_fmt
;
262 struct v4l2_rect win
;
263 /* field id polarity */
264 enum vpfe_pin_pol fid_pol
;
265 /* vertical sync polarity */
266 enum vpfe_pin_pol vd_pol
;
267 /* horizontal sync polarity */
268 enum vpfe_pin_pol hd_pol
;
269 /* enable BT.656 embedded sync mode */
271 /* cb:y:cr:y or y:cb:y:cr in memory */
272 enum ccdc_pixorder pix_order
;
273 /* interleaved or separated fields */
274 enum ccdc_buftype buf_type
;
277 /* Gain applied to Raw Bayer data */
280 unsigned short gr_cy
;
285 /* Structure for CCDC configuration parameters for raw capture mode */
286 struct ccdc_params_raw
{
288 enum ccdc_pixfmt pix_fmt
;
289 /* progressive or interlaced frame */
290 enum ccdc_frmfmt frm_fmt
;
292 struct v4l2_rect win
;
293 /* field id polarity */
294 enum vpfe_pin_pol fid_pol
;
295 /* vertical sync polarity */
296 enum vpfe_pin_pol vd_pol
;
297 /* horizontal sync polarity */
298 enum vpfe_pin_pol hd_pol
;
299 /* interleaved or separated fields */
300 enum ccdc_buftype buf_type
;
302 struct ccdc_gain gain
;
304 unsigned int ccdc_offset
;
305 /* horizontal flip enable */
306 unsigned char horz_flip_enable
;
308 * enable to store the image in inverse order in memory
311 unsigned char image_invert_enable
;
312 /* Configurable part of raw data */
313 struct ccdc_config_params_raw config_params
;
317 #endif /* DM355_CCDC_H */