1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2006-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 {
30 CCDC_GAMMA_BITS_15_6, /* use bits 15-6 for gamma */
36 CCDC_GAMMA_BITS_09_0 /* use bits 9-0 for gamma */
39 /* returns the highest bit used for the gamma */
40 static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
56 /* returns the highest bit used for this data size */
57 static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
59 return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
62 /* structure for ALaw */
64 /* Enable/disable A-Law */
66 /* Gamma Width Input */
67 enum ccdc_gamma_width gamma_wd;
70 /* structure for Black Clamping */
71 struct ccdc_black_clamp {
73 /* only if bClampEnable is TRUE */
74 enum ccdc_sample_length sample_pixel;
75 /* only if bClampEnable is TRUE */
76 enum ccdc_sample_line sample_ln;
77 /* only if bClampEnable is TRUE */
78 unsigned short start_pixel;
79 /* only if bClampEnable is TRUE */
81 /* only if bClampEnable is FALSE */
82 unsigned short dc_sub;
85 /* structure for Black Level Compensation */
86 struct ccdc_black_compensation {
87 /* Constant value to subtract from Red component */
89 /* Constant value to subtract from Gr component */
91 /* Constant value to subtract from Blue component */
93 /* Constant value to subtract from Gb component */
97 /* Structure for CCDC configuration parameters for raw capture mode passed
100 struct ccdc_config_params_raw {
101 /* data size value from 8 to 16 bits */
102 enum ccdc_data_size data_sz;
103 /* Structure for Optional A-Law */
104 struct ccdc_a_law alaw;
105 /* Structure for Optical Black Clamp */
106 struct ccdc_black_clamp blk_clamp;
107 /* Structure for Black Compensation */
108 struct ccdc_black_compensation blk_comp;
113 #include <linux/io.h>
114 /* Define to enable/disable video port */
115 #define FP_NUM_BYTES 4
116 /* Define for extra pixel/line and extra lines/frame */
117 #define NUM_EXTRAPIXELS 8
118 #define NUM_EXTRALINES 8
120 /* settings for commonly used video formats */
121 #define CCDC_WIN_PAL {0, 0, 720, 576}
122 /* ntsc square pixel */
123 #define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
125 /* Structure for CCDC configuration parameters for raw capture mode */
126 struct ccdc_params_raw {
128 enum ccdc_pixfmt pix_fmt;
129 /* progressive or interlaced frame */
130 enum ccdc_frmfmt frm_fmt;
132 struct v4l2_rect win;
133 /* field id polarity */
134 enum vpfe_pin_pol fid_pol;
135 /* vertical sync polarity */
136 enum vpfe_pin_pol vd_pol;
137 /* horizontal sync polarity */
138 enum vpfe_pin_pol hd_pol;
139 /* interleaved or separated fields */
140 enum ccdc_buftype buf_type;
142 * enable to store the image in inverse
143 * order in memory(bottom to top)
145 unsigned char image_invert_enable;
146 /* configurable parameters */
147 struct ccdc_config_params_raw config_params;
150 struct ccdc_params_ycbcr {
152 enum ccdc_pixfmt pix_fmt;
153 /* progressive or interlaced frame */
154 enum ccdc_frmfmt frm_fmt;
156 struct v4l2_rect win;
157 /* field id polarity */
158 enum vpfe_pin_pol fid_pol;
159 /* vertical sync polarity */
160 enum vpfe_pin_pol vd_pol;
161 /* horizontal sync polarity */
162 enum vpfe_pin_pol hd_pol;
163 /* enable BT.656 embedded sync mode */
165 /* cb:y:cr:y or y:cb:y:cr in memory */
166 enum ccdc_pixorder pix_order;
167 /* interleaved or separated fields */
168 enum ccdc_buftype buf_type;
171 #endif /* _DM644X_CCDC_H */