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