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 CCDC configuration parameters for raw capture mode passed
109 struct ccdc_config_params_raw
{
110 /* data size value from 8 to 16 bits */
111 enum ccdc_data_size data_sz
;
112 /* Structure for Optional A-Law */
113 struct ccdc_a_law alaw
;
114 /* Structure for Optical Black Clamp */
115 struct ccdc_black_clamp blk_clamp
;
116 /* Structure for Black Compensation */
117 struct ccdc_black_compensation blk_comp
;
122 #include <linux/io.h>
123 /* Define to enable/disable video port */
124 #define FP_NUM_BYTES 4
125 /* Define for extra pixel/line and extra lines/frame */
126 #define NUM_EXTRAPIXELS 8
127 #define NUM_EXTRALINES 8
129 /* settings for commonly used video formats */
130 #define CCDC_WIN_PAL {0, 0, 720, 576}
131 /* ntsc square pixel */
132 #define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
134 /* Structure for CCDC configuration parameters for raw capture mode */
135 struct ccdc_params_raw
{
137 enum ccdc_pixfmt pix_fmt
;
138 /* progressive or interlaced frame */
139 enum ccdc_frmfmt frm_fmt
;
141 struct v4l2_rect win
;
142 /* field id polarity */
143 enum vpfe_pin_pol fid_pol
;
144 /* vertical sync polarity */
145 enum vpfe_pin_pol vd_pol
;
146 /* horizontal sync polarity */
147 enum vpfe_pin_pol hd_pol
;
148 /* interleaved or separated fields */
149 enum ccdc_buftype buf_type
;
151 * enable to store the image in inverse
152 * order in memory(bottom to top)
154 unsigned char image_invert_enable
;
155 /* configurable paramaters */
156 struct ccdc_config_params_raw config_params
;
159 struct ccdc_params_ycbcr
{
161 enum ccdc_pixfmt pix_fmt
;
162 /* progressive or interlaced frame */
163 enum ccdc_frmfmt frm_fmt
;
165 struct v4l2_rect win
;
166 /* field id polarity */
167 enum vpfe_pin_pol fid_pol
;
168 /* vertical sync polarity */
169 enum vpfe_pin_pol vd_pol
;
170 /* horizontal sync polarity */
171 enum vpfe_pin_pol hd_pol
;
172 /* enable BT.656 embedded sync mode */
174 /* cb:y:cr:y or y:cb:y:cr in memory */
175 enum ccdc_pixorder pix_order
;
176 /* interleaved or separated fields */
177 enum ccdc_buftype buf_type
;
180 #endif /* _DM644X_CCDC_H */