1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2005-2009 Texas Instruments Inc
7 #include <media/davinci/ccdc_types.h>
8 #include <media/davinci/vpfe_types.h>
10 /* enum for No of pixel per line to be avg. in Black Clamping */
11 enum ccdc_sample_length {
19 /* enum for No of lines in Black Clamping */
20 enum ccdc_sample_line {
28 /* enum for Alaw gamma width */
29 enum ccdc_gamma_width {
45 enum ccdc_colpats olop;
46 enum ccdc_colpats olep;
47 enum ccdc_colpats elop;
48 enum ccdc_colpats elep;
72 CCDC_NO_MEDIAN_FILTER1,
78 CCDC_NO_MEDIAN_FILTER2,
83 /* structure for ALaw */
85 /* Enable/disable A-Law */
87 /* Gamma Width Input */
88 enum ccdc_gamma_width gamma_wd;
91 /* structure for Black Clamping */
92 struct ccdc_black_clamp {
93 /* only if bClampEnable is TRUE */
94 unsigned char b_clamp_enable;
95 /* only if bClampEnable is TRUE */
96 enum ccdc_sample_length sample_pixel;
97 /* only if bClampEnable is TRUE */
98 enum ccdc_sample_line sample_ln;
99 /* only if bClampEnable is TRUE */
100 unsigned short start_pixel;
101 /* only if bClampEnable is FALSE */
102 unsigned short sgain;
103 unsigned short dc_sub;
106 /* structure for Black Level Compensation */
107 struct ccdc_black_compensation {
108 /* Constant value to subtract from Red component */
110 /* Constant value to subtract from Gr component */
112 /* Constant value to subtract from Blue component */
114 /* Constant value to subtract from Gb component */
120 unsigned int decimal;
123 #define CCDC_CSC_COEFF_TABLE_SIZE 16
124 /* structure for color space converter */
126 unsigned char enable;
128 * S8Q5. Use 2 decimal precision, user values range from -3.00 to 3.99.
129 * example - to use 1.03, set integer part as 1, and decimal part as 3
130 * to use -1.03, set integer part as -1 and decimal part as 3
132 struct ccdc_float coeff[CCDC_CSC_COEFF_TABLE_SIZE];
135 /* Structures for Vertical Defect Correction*/
138 CCDC_VDF_HORZ_INTERPOL_SAT,
139 CCDC_VDF_HORZ_INTERPOL
143 CCDC_VDF_WHOLE_LINE_CORRECT,
144 CCDC_VDF_UPPER_DISABLE
148 CCDC_DFC_MWR_WRITE_COMPLETE,
153 CCDC_DFC_READ_COMPLETE,
157 enum ccdc_dfc_ma_rst {
163 CCDC_DFC_CLEAR_COMPLETE,
167 struct ccdc_dft_corr_ctl {
168 enum ccdc_vdf_csl vdfcsl;
169 enum ccdc_vdf_cuda vdfcuda;
170 unsigned int vdflsft;
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;
180 #define CCDC_DFT_TABLE_SIZE 16
182 * Main Structure for vertical defect correction. Vertical defect
183 * correction can correct up to 16 defects if defects less than 16
184 * then pad the rest with 0
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;
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];
200 struct ccdc_data_offset {
201 unsigned char horz_offset;
202 unsigned char vert_offset;
206 * Structure for CCDC configuration parameters for raw capture mode passed
209 struct ccdc_config_params_raw {
210 /* data shift to be applied before storing */
211 enum ccdc_datasft datasft;
212 /* data size value from 8 to 16 bits */
213 enum ccdc_data_size data_sz;
214 /* median filter for sdram */
215 enum ccdc_mfilt1 mfilt1;
216 enum ccdc_mfilt2 mfilt2;
217 /* low pass filter enable/disable */
218 unsigned char lpf_enable;
219 /* Threshold of median filter */
222 * horz and vertical data offset. Applicable for defect correction
225 struct ccdc_data_offset data_offset;
226 /* Structure for Optional A-Law */
227 struct ccdc_a_law alaw;
228 /* Structure for Optical Black Clamp */
229 struct ccdc_black_clamp blk_clamp;
230 /* Structure for Black Compensation */
231 struct ccdc_black_compensation blk_comp;
232 /* structure for vertical Defect Correction Module Configuration */
233 struct ccdc_vertical_dft vertical_dft;
234 /* structure for color space converter Module Configuration */
236 /* color patters for bayer capture */
237 struct ccdc_col_pat col_pat_field0;
238 struct ccdc_col_pat col_pat_field1;
242 #include <linux/io.h>
244 #define CCDC_WIN_PAL {0, 0, 720, 576}
245 #define CCDC_WIN_VGA {0, 0, 640, 480}
247 struct ccdc_params_ycbcr {
249 enum ccdc_pixfmt pix_fmt;
250 /* progressive or interlaced frame */
251 enum ccdc_frmfmt frm_fmt;
253 struct v4l2_rect win;
254 /* field id polarity */
255 enum vpfe_pin_pol fid_pol;
256 /* vertical sync polarity */
257 enum vpfe_pin_pol vd_pol;
258 /* horizontal sync polarity */
259 enum vpfe_pin_pol hd_pol;
260 /* enable BT.656 embedded sync mode */
262 /* cb:y:cr:y or y:cb:y:cr in memory */
263 enum ccdc_pixorder pix_order;
264 /* interleaved or separated fields */
265 enum ccdc_buftype buf_type;
268 /* Gain applied to Raw Bayer data */
271 unsigned short gr_cy;
276 /* Structure for CCDC configuration parameters for raw capture mode */
277 struct ccdc_params_raw {
279 enum ccdc_pixfmt pix_fmt;
280 /* progressive or interlaced frame */
281 enum ccdc_frmfmt frm_fmt;
283 struct v4l2_rect win;
284 /* field id polarity */
285 enum vpfe_pin_pol fid_pol;
286 /* vertical sync polarity */
287 enum vpfe_pin_pol vd_pol;
288 /* horizontal sync polarity */
289 enum vpfe_pin_pol hd_pol;
290 /* interleaved or separated fields */
291 enum ccdc_buftype buf_type;
293 struct ccdc_gain gain;
295 unsigned int ccdc_offset;
296 /* horizontal flip enable */
297 unsigned char horz_flip_enable;
299 * enable to store the image in inverse order in memory
302 unsigned char image_invert_enable;
303 /* Configurable part of raw data */
304 struct ccdc_config_params_raw config_params;
308 #endif /* DM355_CCDC_H */