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.
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
20 #include <media/davinci/ccdc_types.h>
21 #include <media/davinci/vpfe_types.h>
23 /* enum for No of pixel per line to be avg. in Black Clamping */
24 enum ccdc_sample_length
{
32 /* enum for No of lines in Black Clamping */
33 enum ccdc_sample_line
{
41 /* enum for Alaw gama width */
42 enum ccdc_gamma_width
{
58 enum ccdc_colpats olop
;
59 enum ccdc_colpats olep
;
60 enum ccdc_colpats elop
;
61 enum ccdc_colpats elep
;
85 CCDC_NO_MEDIAN_FILTER1
,
91 CCDC_NO_MEDIAN_FILTER2
,
96 /* structure for ALaw */
98 /* Enable/disable A-Law */
100 /* Gama Width Input */
101 enum ccdc_gamma_width gama_wd
;
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
;
119 /* structure for Black Level Compensation */
120 struct ccdc_black_compensation
{
121 /* Constant value to subtract from Red component */
123 /* Constant value to subtract from Gr component */
125 /* Constant value to subtract from Blue component */
127 /* Constant value to subtract from Gb component */
133 unsigned int decimal
;
136 #define CCDC_CSC_COEFF_TABLE_SIZE 16
137 /* structure for color space converter */
139 unsigned char enable
;
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
145 struct ccdc_float coeff
[CCDC_CSC_COEFF_TABLE_SIZE
];
148 /* Structures for Vertical Defect Correction*/
151 CCDC_VDF_HORZ_INTERPOL_SAT
,
152 CCDC_VDF_HORZ_INTERPOL
156 CCDC_VDF_WHOLE_LINE_CORRECT
,
157 CCDC_VDF_UPPER_DISABLE
161 CCDC_DFC_MWR_WRITE_COMPLETE
,
166 CCDC_DFC_READ_COMPLETE
,
170 enum ccdc_dfc_ma_rst
{
176 CCDC_DFC_CLEAR_COMPLETE
,
180 struct ccdc_dft_corr_ctl
{
181 enum ccdc_vdf_csl vdfcsl
;
182 enum ccdc_vdf_cuda vdfcuda
;
183 unsigned int vdflsft
;
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
;
193 #define CCDC_DFT_TABLE_SIZE 16
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
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
;
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
];
213 struct ccdc_data_offset
{
214 unsigned char horz_offset
;
215 unsigned char vert_offset
;
219 * Structure for CCDC configuration parameters for raw capture mode passed
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 */
235 * horz and vertical data offset. Appliable for defect correction
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 */
249 /* color patters for bayer capture */
250 struct ccdc_col_pat col_pat_field0
;
251 struct ccdc_col_pat col_pat_field1
;
255 #include <linux/io.h>
257 #define CCDC_WIN_PAL {0, 0, 720, 576}
258 #define CCDC_WIN_VGA {0, 0, 640, 480}
260 struct ccdc_params_ycbcr
{
262 enum ccdc_pixfmt pix_fmt
;
263 /* progressive or interlaced frame */
264 enum ccdc_frmfmt frm_fmt
;
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 */
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
;
281 /* Gain applied to Raw Bayer data */
284 unsigned short gr_cy
;
289 /* Structure for CCDC configuration parameters for raw capture mode */
290 struct ccdc_params_raw
{
292 enum ccdc_pixfmt pix_fmt
;
293 /* progressive or interlaced frame */
294 enum ccdc_frmfmt frm_fmt
;
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
;
306 struct ccdc_gain gain
;
308 unsigned int ccdc_offset
;
309 /* horizontal flip enable */
310 unsigned char horz_flip_enable
;
312 * enable to store the image in inverse order in memory
315 unsigned char image_invert_enable
;
316 /* Configurable part of raw data */
317 struct ccdc_config_params_raw config_params
;
321 #endif /* DM355_CCDC_H */