This source file includes following definitions.
- ccdc_gamma_width_max_bit
- ccdc_data_size_max_bit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef AM437X_VPFE_H
22 #define AM437X_VPFE_H
23
24 #include <linux/am437x-vpfe.h>
25 #include <linux/clk.h>
26 #include <linux/device.h>
27 #include <linux/io.h>
28 #include <linux/i2c.h>
29 #include <linux/videodev2.h>
30
31 #include <media/v4l2-dev.h>
32 #include <media/v4l2-device.h>
33 #include <media/v4l2-ioctl.h>
34 #include <media/videobuf2-v4l2.h>
35 #include <media/videobuf2-dma-contig.h>
36
37 #include "am437x-vpfe_regs.h"
38
39 enum vpfe_pin_pol {
40 VPFE_PINPOL_POSITIVE = 0,
41 VPFE_PINPOL_NEGATIVE,
42 };
43
44 enum vpfe_hw_if_type {
45
46 VPFE_RAW_BAYER = 0,
47
48 VPFE_BT656,
49
50 VPFE_BT656_10BIT,
51
52 VPFE_YCBCR_SYNC_8,
53
54 VPFE_YCBCR_SYNC_16,
55 };
56
57
58 struct vpfe_hw_if_param {
59 enum vpfe_hw_if_type if_type;
60 enum vpfe_pin_pol hdpol;
61 enum vpfe_pin_pol vdpol;
62 unsigned int bus_width;
63 };
64
65 #define VPFE_MAX_SUBDEV 1
66 #define VPFE_MAX_INPUTS 1
67
68 struct vpfe_std_info {
69 int active_pixels;
70 int active_lines;
71
72 int frame_format;
73 };
74
75 struct vpfe_route {
76 u32 input;
77 u32 output;
78 };
79
80 struct vpfe_subdev_info {
81
82 int grp_id;
83
84 struct v4l2_input inputs[VPFE_MAX_INPUTS];
85
86 struct vpfe_route *routes;
87
88 int can_route;
89
90 struct vpfe_hw_if_param vpfe_param;
91 struct v4l2_subdev *sd;
92 };
93
94 struct vpfe_config {
95
96 struct vpfe_subdev_info sub_devs[VPFE_MAX_SUBDEV];
97
98 struct v4l2_async_subdev *asd[VPFE_MAX_SUBDEV];
99 };
100
101 struct vpfe_cap_buffer {
102 struct vb2_v4l2_buffer vb;
103 struct list_head list;
104 };
105
106 enum ccdc_pixfmt {
107 CCDC_PIXFMT_RAW = 0,
108 CCDC_PIXFMT_YCBCR_16BIT,
109 CCDC_PIXFMT_YCBCR_8BIT,
110 };
111
112 enum ccdc_frmfmt {
113 CCDC_FRMFMT_PROGRESSIVE = 0,
114 CCDC_FRMFMT_INTERLACED,
115 };
116
117
118
119 enum ccdc_pixorder {
120 CCDC_PIXORDER_YCBYCR,
121 CCDC_PIXORDER_CBYCRY,
122 };
123
124 enum ccdc_buftype {
125 CCDC_BUFTYPE_FLD_INTERLEAVED,
126 CCDC_BUFTYPE_FLD_SEPARATED
127 };
128
129
130
131 static inline u8 ccdc_gamma_width_max_bit(enum vpfe_ccdc_gamma_width width)
132 {
133 return 15 - width;
134 }
135
136
137 static inline u8 ccdc_data_size_max_bit(enum vpfe_ccdc_data_size sz)
138 {
139 return sz == VPFE_CCDC_DATA_8BITS ? 7 : 15 - sz;
140 }
141
142
143 struct ccdc_params_raw {
144
145 enum ccdc_pixfmt pix_fmt;
146
147 enum ccdc_frmfmt frm_fmt;
148 struct v4l2_rect win;
149
150 unsigned int bytesperpixel;
151
152
153
154 unsigned int bytesperline;
155
156 enum vpfe_pin_pol fid_pol;
157
158 enum vpfe_pin_pol vd_pol;
159
160 enum vpfe_pin_pol hd_pol;
161
162 enum ccdc_buftype buf_type;
163
164
165
166
167 unsigned char image_invert_enable;
168
169 struct vpfe_ccdc_config_params_raw config_params;
170 };
171
172 struct ccdc_params_ycbcr {
173
174 enum ccdc_pixfmt pix_fmt;
175
176 enum ccdc_frmfmt frm_fmt;
177 struct v4l2_rect win;
178
179 unsigned int bytesperpixel;
180
181
182
183 unsigned int bytesperline;
184
185 enum vpfe_pin_pol fid_pol;
186
187 enum vpfe_pin_pol vd_pol;
188
189 enum vpfe_pin_pol hd_pol;
190
191 int bt656_enable;
192
193 enum ccdc_pixorder pix_order;
194
195 enum ccdc_buftype buf_type;
196 };
197
198
199
200
201 struct ccdc_config {
202
203 enum vpfe_hw_if_type if_type;
204
205 struct ccdc_params_raw bayer;
206
207 struct ccdc_params_ycbcr ycbcr;
208
209 void __iomem *base_addr;
210 };
211
212 struct vpfe_ccdc {
213 struct ccdc_config ccdc_cfg;
214 u32 ccdc_ctx[VPFE_REG_END / sizeof(u32)];
215 };
216
217 struct vpfe_device {
218
219
220 struct video_device video_dev;
221
222 struct v4l2_subdev **sd;
223
224 struct vpfe_config *cfg;
225
226 struct v4l2_device v4l2_dev;
227
228 struct device *pdev;
229
230 struct v4l2_async_notifier notifier;
231
232 unsigned field;
233 unsigned sequence;
234
235 struct vpfe_hw_if_param vpfe_if_params;
236
237 struct vpfe_subdev_info *current_subdev;
238
239 int current_input;
240
241 struct vpfe_std_info std_info;
242
243 int std_index;
244
245 unsigned int irq;
246
247 struct vpfe_cap_buffer *cur_frm;
248
249 struct vpfe_cap_buffer *next_frm;
250
251 struct v4l2_format fmt;
252
253 unsigned int bpp;
254
255
256
257
258 struct v4l2_rect crop;
259
260 struct vb2_queue buffer_queue;
261
262 struct list_head dma_queue;
263
264 spinlock_t dma_queue_lock;
265
266 struct mutex lock;
267
268
269
270
271 u32 field_off;
272 struct vpfe_ccdc ccdc;
273 };
274
275 #endif