2 * Copyright (C) 2006-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
18 #ifndef _DM644X_CCDC_H
19 #define _DM644X_CCDC_H
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 gamma width */
42 enum ccdc_gamma_width
{
43 CCDC_GAMMA_BITS_15_6
, /* use bits 15-6 for gamma */
49 CCDC_GAMMA_BITS_09_0
/* use bits 9-0 for gamma */
52 /* returns the highest bit used for the gamma */
53 static inline u8
ccdc_gamma_width_max_bit(enum ccdc_gamma_width width
)
69 /* returns the highest bit used for this data size */
70 static inline u8
ccdc_data_size_max_bit(enum ccdc_data_size sz
)
72 return sz
== CCDC_DATA_8BITS
? 7 : 15 - sz
;
75 /* structure for ALaw */
77 /* Enable/disable A-Law */
79 /* Gamma Width Input */
80 enum ccdc_gamma_width gamma_wd
;
83 /* structure for Black Clamping */
84 struct ccdc_black_clamp
{
86 /* only if bClampEnable is TRUE */
87 enum ccdc_sample_length sample_pixel
;
88 /* only if bClampEnable is TRUE */
89 enum ccdc_sample_line sample_ln
;
90 /* only if bClampEnable is TRUE */
91 unsigned short start_pixel
;
92 /* only if bClampEnable is TRUE */
94 /* only if bClampEnable is FALSE */
95 unsigned short dc_sub
;
98 /* structure for Black Level Compensation */
99 struct ccdc_black_compensation
{
100 /* Constant value to subtract from Red component */
102 /* Constant value to subtract from Gr component */
104 /* Constant value to subtract from Blue component */
106 /* Constant value to subtract from Gb component */
110 /* structure for fault pixel correction */
111 struct ccdc_fault_pixel
{
112 /* Enable or Disable fault pixel correction */
113 unsigned char enable
;
114 /* Number of fault pixel */
115 unsigned short fp_num
;
116 /* Address of fault pixel table */
117 unsigned long fpc_table_addr
;
120 /* Structure for CCDC configuration parameters for raw capture mode passed
123 struct ccdc_config_params_raw
{
124 /* data size value from 8 to 16 bits */
125 enum ccdc_data_size data_sz
;
126 /* Structure for Optional A-Law */
127 struct ccdc_a_law alaw
;
128 /* Structure for Optical Black Clamp */
129 struct ccdc_black_clamp blk_clamp
;
130 /* Structure for Black Compensation */
131 struct ccdc_black_compensation blk_comp
;
132 /* Structure for Fault Pixel Module Configuration */
133 struct ccdc_fault_pixel fault_pxl
;
138 #include <linux/io.h>
139 /* Define to enable/disable video port */
140 #define FP_NUM_BYTES 4
141 /* Define for extra pixel/line and extra lines/frame */
142 #define NUM_EXTRAPIXELS 8
143 #define NUM_EXTRALINES 8
145 /* settings for commonly used video formats */
146 #define CCDC_WIN_PAL {0, 0, 720, 576}
147 /* ntsc square pixel */
148 #define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
150 /* Structure for CCDC configuration parameters for raw capture mode */
151 struct ccdc_params_raw
{
153 enum ccdc_pixfmt pix_fmt
;
154 /* progressive or interlaced frame */
155 enum ccdc_frmfmt frm_fmt
;
157 struct v4l2_rect win
;
158 /* field id polarity */
159 enum vpfe_pin_pol fid_pol
;
160 /* vertical sync polarity */
161 enum vpfe_pin_pol vd_pol
;
162 /* horizontal sync polarity */
163 enum vpfe_pin_pol hd_pol
;
164 /* interleaved or separated fields */
165 enum ccdc_buftype buf_type
;
167 * enable to store the image in inverse
168 * order in memory(bottom to top)
170 unsigned char image_invert_enable
;
171 /* configurable paramaters */
172 struct ccdc_config_params_raw config_params
;
175 struct ccdc_params_ycbcr
{
177 enum ccdc_pixfmt pix_fmt
;
178 /* progressive or interlaced frame */
179 enum ccdc_frmfmt frm_fmt
;
181 struct v4l2_rect win
;
182 /* field id polarity */
183 enum vpfe_pin_pol fid_pol
;
184 /* vertical sync polarity */
185 enum vpfe_pin_pol vd_pol
;
186 /* horizontal sync polarity */
187 enum vpfe_pin_pol hd_pol
;
188 /* enable BT.656 embedded sync mode */
190 /* cb:y:cr:y or y:cb:y:cr in memory */
191 enum ccdc_pixorder pix_order
;
192 /* interleaved or separated fields */
193 enum ccdc_buftype buf_type
;
196 #endif /* _DM644X_CCDC_H */