1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _DM644X_CCDC_H
19#define _DM644X_CCDC_H
20#include <media/davinci/ccdc_types.h>
21#include <media/davinci/vpfe_types.h>
22
23
24enum ccdc_sample_length {
25 CCDC_SAMPLE_1PIXELS,
26 CCDC_SAMPLE_2PIXELS,
27 CCDC_SAMPLE_4PIXELS,
28 CCDC_SAMPLE_8PIXELS,
29 CCDC_SAMPLE_16PIXELS
30};
31
32
33enum ccdc_sample_line {
34 CCDC_SAMPLE_1LINES,
35 CCDC_SAMPLE_2LINES,
36 CCDC_SAMPLE_4LINES,
37 CCDC_SAMPLE_8LINES,
38 CCDC_SAMPLE_16LINES
39};
40
41
42enum ccdc_gamma_width {
43 CCDC_GAMMA_BITS_15_6,
44 CCDC_GAMMA_BITS_14_5,
45 CCDC_GAMMA_BITS_13_4,
46 CCDC_GAMMA_BITS_12_3,
47 CCDC_GAMMA_BITS_11_2,
48 CCDC_GAMMA_BITS_10_1,
49 CCDC_GAMMA_BITS_09_0
50};
51
52
53static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width)
54{
55 return 15 - width;
56}
57
58enum ccdc_data_size {
59 CCDC_DATA_16BITS,
60 CCDC_DATA_15BITS,
61 CCDC_DATA_14BITS,
62 CCDC_DATA_13BITS,
63 CCDC_DATA_12BITS,
64 CCDC_DATA_11BITS,
65 CCDC_DATA_10BITS,
66 CCDC_DATA_8BITS
67};
68
69
70static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz)
71{
72 return sz == CCDC_DATA_8BITS ? 7 : 15 - sz;
73}
74
75
76struct ccdc_a_law {
77
78 unsigned char enable;
79
80 enum ccdc_gamma_width gamma_wd;
81};
82
83
84struct ccdc_black_clamp {
85 unsigned char enable;
86
87 enum ccdc_sample_length sample_pixel;
88
89 enum ccdc_sample_line sample_ln;
90
91 unsigned short start_pixel;
92
93 unsigned short sgain;
94
95 unsigned short dc_sub;
96};
97
98
99struct ccdc_black_compensation {
100
101 char r;
102
103 char gr;
104
105 char b;
106
107 char gb;
108};
109
110
111struct ccdc_fault_pixel {
112
113 unsigned char enable;
114
115 unsigned short fp_num;
116
117 unsigned int fpc_table_addr;
118};
119
120
121
122
123struct ccdc_config_params_raw {
124
125 enum ccdc_data_size data_sz;
126
127 struct ccdc_a_law alaw;
128
129 struct ccdc_black_clamp blk_clamp;
130
131 struct ccdc_black_compensation blk_comp;
132
133 struct ccdc_fault_pixel fault_pxl;
134};
135
136
137#ifdef __KERNEL__
138#include <linux/io.h>
139
140#define FP_NUM_BYTES 4
141
142#define NUM_EXTRAPIXELS 8
143#define NUM_EXTRALINES 8
144
145
146#define CCDC_WIN_PAL {0, 0, 720, 576}
147
148#define CCDC_WIN_VGA {0, 0, (640 + NUM_EXTRAPIXELS), (480 + NUM_EXTRALINES)}
149
150
151struct ccdc_params_raw {
152
153 enum ccdc_pixfmt pix_fmt;
154
155 enum ccdc_frmfmt frm_fmt;
156
157 struct v4l2_rect win;
158
159 enum vpfe_pin_pol fid_pol;
160
161 enum vpfe_pin_pol vd_pol;
162
163 enum vpfe_pin_pol hd_pol;
164
165 enum ccdc_buftype buf_type;
166
167
168
169
170 unsigned char image_invert_enable;
171
172 struct ccdc_config_params_raw config_params;
173};
174
175struct ccdc_params_ycbcr {
176
177 enum ccdc_pixfmt pix_fmt;
178
179 enum ccdc_frmfmt frm_fmt;
180
181 struct v4l2_rect win;
182
183 enum vpfe_pin_pol fid_pol;
184
185 enum vpfe_pin_pol vd_pol;
186
187 enum vpfe_pin_pol hd_pol;
188
189 int bt656_enable;
190
191 enum ccdc_pixorder pix_order;
192
193 enum ccdc_buftype buf_type;
194};
195#endif
196#endif
197