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