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