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