1
2
3
4
5
6 #ifndef VPIF_CAPTURE_H
7 #define VPIF_CAPTURE_H
8
9
10 #include <media/videobuf2-dma-contig.h>
11 #include <media/v4l2-device.h>
12
13 #include "vpif.h"
14
15
16 #define VPIF_CAPTURE_VERSION "0.0.2"
17
18 #define VPIF_VALID_FIELD(field) (((V4L2_FIELD_ANY == field) || \
19 (V4L2_FIELD_NONE == field)) || \
20 (((V4L2_FIELD_INTERLACED == field) || \
21 (V4L2_FIELD_SEQ_TB == field)) || \
22 (V4L2_FIELD_SEQ_BT == field)))
23
24 #define VPIF_CAPTURE_MAX_DEVICES 2
25 #define VPIF_VIDEO_INDEX 0
26 #define VPIF_NUMBER_OF_OBJECTS 1
27
28
29 enum vpif_channel_id {
30 VPIF_CHANNEL0_VIDEO = 0,
31 VPIF_CHANNEL1_VIDEO,
32 };
33
34 struct video_obj {
35 enum v4l2_field buf_field;
36
37 v4l2_std_id stdid;
38 struct v4l2_dv_timings dv_timings;
39 };
40
41 struct vpif_cap_buffer {
42 struct vb2_v4l2_buffer vb;
43 struct list_head list;
44 };
45
46 struct common_obj {
47
48 struct vpif_cap_buffer *cur_frm;
49
50 struct vpif_cap_buffer *next_frm;
51
52 struct v4l2_format fmt;
53
54 struct vb2_queue buffer_queue;
55
56 struct list_head dma_queue;
57
58 spinlock_t irqlock;
59
60 struct mutex lock;
61
62 void (*set_addr) (unsigned long, unsigned long, unsigned long,
63 unsigned long);
64
65 u32 ytop_off;
66
67 u32 ybtm_off;
68
69 u32 ctop_off;
70
71 u32 cbtm_off;
72
73 u32 width;
74
75 u32 height;
76 };
77
78 struct channel_obj {
79
80 struct video_device video_dev;
81
82 u32 field_id;
83
84 u8 initialized;
85
86 enum vpif_channel_id channel_id;
87
88 u32 input_idx;
89
90 struct v4l2_subdev *sd;
91
92 struct vpif_params vpifparams;
93
94 struct common_obj common[VPIF_NUMBER_OF_OBJECTS];
95
96 struct video_obj video;
97 };
98
99 struct vpif_device {
100 struct v4l2_device v4l2_dev;
101 struct channel_obj *dev[VPIF_CAPTURE_NUM_CHANNELS];
102 struct v4l2_subdev **sd;
103 struct v4l2_async_notifier notifier;
104 struct vpif_capture_config *config;
105 };
106
107 #endif