1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef _DAVINCI_VPFE_VIDEO_H
20#define _DAVINCI_VPFE_VIDEO_H
21
22#include <media/videobuf2-v4l2.h>
23#include <media/videobuf2-dma-contig.h>
24
25struct vpfe_device;
26
27
28
29
30
31
32struct vpfe_video_operations {
33 int (*queue)(struct vpfe_device *vpfe_dev, unsigned long addr);
34};
35
36enum vpfe_pipeline_stream_state {
37 VPFE_PIPELINE_STREAM_STOPPED = 0,
38 VPFE_PIPELINE_STREAM_CONTINUOUS = 1,
39 VPFE_PIPELINE_STREAM_SINGLESHOT = 2,
40};
41
42enum vpfe_video_state {
43
44 VPFE_VIDEO_BUFFER_NOT_QUEUED = 0,
45
46 VPFE_VIDEO_BUFFER_QUEUED = 1,
47};
48
49struct vpfe_pipeline {
50
51 struct media_pipeline *pipe;
52 struct media_graph graph;
53
54
55
56 enum vpfe_pipeline_stream_state state;
57
58 unsigned int input_num;
59
60 unsigned int output_num;
61
62 struct vpfe_video_device *inputs[10];
63
64 struct vpfe_video_device *outputs[10];
65};
66
67#define to_vpfe_pipeline(__e) \
68 container_of((__e)->pipe, struct vpfe_pipeline, pipe)
69
70#define to_vpfe_video(vdev) \
71 container_of(vdev, struct vpfe_video_device, video_dev)
72
73struct vpfe_cap_buffer {
74 struct vb2_v4l2_buffer vb;
75 struct list_head list;
76};
77
78struct vpfe_video_device {
79
80 struct vpfe_device *vpfe_dev;
81
82 struct video_device video_dev;
83
84 struct media_pad pad;
85
86 const struct vpfe_video_operations *ops;
87
88 enum v4l2_buf_type type;
89
90 u32 field_id;
91
92 struct vpfe_pipeline pipe;
93
94 u8 started;
95
96 unsigned int state;
97
98 int current_input;
99
100
101
102
103 enum v4l2_memory memory;
104
105 u32 usrs;
106
107 u8 initialized;
108
109 u8 skip_frame_count;
110
111 u8 skip_frame_count_init;
112
113 struct v4l2_fract timeperframe;
114
115 struct vpfe_ext_subdev_info *current_ext_subdev;
116
117 struct vpfe_cap_buffer *cur_frm;
118
119 struct vpfe_cap_buffer *next_frm;
120
121 struct v4l2_format fmt;
122 struct vb2_queue buffer_queue;
123
124 struct list_head dma_queue;
125 spinlock_t irqlock;
126
127 spinlock_t dma_queue_lock;
128
129 struct mutex lock;
130
131 u32 io_usrs;
132
133 v4l2_std_id stdid;
134
135
136
137
138 u32 field_off;
139};
140
141int vpfe_video_is_pipe_ready(struct vpfe_pipeline *pipe);
142void vpfe_video_unregister(struct vpfe_video_device *video);
143int vpfe_video_register(struct vpfe_video_device *video,
144 struct v4l2_device *vdev);
145int vpfe_video_init(struct vpfe_video_device *video, const char *name);
146void vpfe_video_process_buffer_complete(struct vpfe_video_device *video);
147void vpfe_video_schedule_bottom_field(struct vpfe_video_device *video);
148void vpfe_video_schedule_next_buffer(struct vpfe_video_device *video);
149
150#endif
151