1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#ifndef V4L2_INT_DEVICE_H
26#define V4L2_INT_DEVICE_H
27
28#include <media/v4l2-common.h>
29
30#define V4L2NAMESIZE 32
31
32
33
34
35
36
37
38enum v4l2_int_type {
39 v4l2_int_type_master = 1,
40 v4l2_int_type_slave
41};
42
43struct module;
44
45struct v4l2_int_device;
46
47struct v4l2_int_master {
48 int (*attach)(struct v4l2_int_device *slave);
49 void (*detach)(struct v4l2_int_device *slave);
50};
51
52typedef int (v4l2_int_ioctl_func)(struct v4l2_int_device *);
53typedef int (v4l2_int_ioctl_func_0)(struct v4l2_int_device *);
54typedef int (v4l2_int_ioctl_func_1)(struct v4l2_int_device *, void *);
55
56struct v4l2_int_ioctl_desc {
57 int num;
58 v4l2_int_ioctl_func *func;
59};
60
61struct v4l2_int_slave {
62
63 struct v4l2_int_device *master;
64
65 char attach_to[V4L2NAMESIZE];
66
67 int num_ioctls;
68 struct v4l2_int_ioctl_desc *ioctls;
69};
70
71struct v4l2_int_device {
72
73 struct list_head head;
74
75 struct module *module;
76
77 char name[V4L2NAMESIZE];
78
79 enum v4l2_int_type type;
80 union {
81 struct v4l2_int_master *master;
82 struct v4l2_int_slave *slave;
83 } u;
84
85 void *priv;
86};
87
88void v4l2_int_device_try_attach_all(void);
89
90int v4l2_int_device_register(struct v4l2_int_device *d);
91void v4l2_int_device_unregister(struct v4l2_int_device *d);
92
93int v4l2_int_ioctl_0(struct v4l2_int_device *d, int cmd);
94int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg);
95
96
97
98
99
100
101
102enum v4l2_power {
103 V4L2_POWER_OFF = 0,
104 V4L2_POWER_ON,
105 V4L2_POWER_STANDBY,
106};
107
108
109enum v4l2_if_type {
110
111
112
113
114 V4L2_IF_TYPE_BT656,
115};
116
117enum v4l2_if_type_bt656_mode {
118
119
120
121
122 V4L2_IF_TYPE_BT656_MODE_NOBT_8BIT,
123 V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT,
124 V4L2_IF_TYPE_BT656_MODE_NOBT_12BIT,
125
126
127
128
129 V4L2_IF_TYPE_BT656_MODE_BT_8BIT,
130 V4L2_IF_TYPE_BT656_MODE_BT_10BIT,
131};
132
133struct v4l2_if_type_bt656 {
134
135
136
137
138 unsigned frame_start_on_rising_vs:1;
139
140 unsigned bt_sync_correct:1;
141
142 unsigned swap:1;
143
144 unsigned latch_clk_inv:1;
145
146 unsigned nobt_hs_inv:1;
147
148 unsigned nobt_vs_inv:1;
149 enum v4l2_if_type_bt656_mode mode;
150
151 u32 clock_min;
152
153 u32 clock_max;
154
155
156
157
158 u32 clock_curr;
159};
160
161struct v4l2_ifparm {
162 enum v4l2_if_type if_type;
163 union {
164 struct v4l2_if_type_bt656 bt656;
165 } u;
166};
167
168
169enum v4l2_int_ioctl_num {
170
171
172
173
174
175 vidioc_int_enum_fmt_cap_num = 1,
176 vidioc_int_g_fmt_cap_num,
177 vidioc_int_s_fmt_cap_num,
178 vidioc_int_try_fmt_cap_num,
179 vidioc_int_queryctrl_num,
180 vidioc_int_g_ctrl_num,
181 vidioc_int_s_ctrl_num,
182 vidioc_int_cropcap_num,
183 vidioc_int_g_crop_num,
184 vidioc_int_s_crop_num,
185 vidioc_int_g_parm_num,
186 vidioc_int_s_parm_num,
187 vidioc_int_querystd_num,
188 vidioc_int_s_std_num,
189 vidioc_int_s_video_routing_num,
190
191
192
193
194
195
196
197 vidioc_int_dev_init_num = 1000,
198
199 vidioc_int_dev_exit_num,
200
201 vidioc_int_s_power_num,
202
203
204
205
206 vidioc_int_g_priv_num,
207
208 vidioc_int_g_ifparm_num,
209
210 vidioc_int_g_needs_reset_num,
211 vidioc_int_enum_framesizes_num,
212 vidioc_int_enum_frameintervals_num,
213
214
215
216
217
218
219
220 vidioc_int_reset_num,
221
222 vidioc_int_init_num,
223
224
225
226
227
228
229 vidioc_int_priv_start_num = 2000,
230};
231
232
233
234
235
236
237
238#define V4L2_INT_WRAPPER_0(name) \
239 static inline int vidioc_int_##name(struct v4l2_int_device *d) \
240 { \
241 return v4l2_int_ioctl_0(d, vidioc_int_##name##_num); \
242 } \
243 \
244 static inline struct v4l2_int_ioctl_desc \
245 vidioc_int_##name##_cb(int (*func) \
246 (struct v4l2_int_device *)) \
247 { \
248 struct v4l2_int_ioctl_desc desc; \
249 \
250 desc.num = vidioc_int_##name##_num; \
251 desc.func = (v4l2_int_ioctl_func *)func; \
252 \
253 return desc; \
254 }
255
256#define V4L2_INT_WRAPPER_1(name, arg_type, asterisk) \
257 static inline int vidioc_int_##name(struct v4l2_int_device *d, \
258 arg_type asterisk arg) \
259 { \
260 return v4l2_int_ioctl_1(d, vidioc_int_##name##_num, \
261 (void *)(unsigned long)arg); \
262 } \
263 \
264 static inline struct v4l2_int_ioctl_desc \
265 vidioc_int_##name##_cb(int (*func) \
266 (struct v4l2_int_device *, \
267 arg_type asterisk)) \
268 { \
269 struct v4l2_int_ioctl_desc desc; \
270 \
271 desc.num = vidioc_int_##name##_num; \
272 desc.func = (v4l2_int_ioctl_func *)func; \
273 \
274 return desc; \
275 }
276
277V4L2_INT_WRAPPER_1(enum_fmt_cap, struct v4l2_fmtdesc, *);
278V4L2_INT_WRAPPER_1(g_fmt_cap, struct v4l2_format, *);
279V4L2_INT_WRAPPER_1(s_fmt_cap, struct v4l2_format, *);
280V4L2_INT_WRAPPER_1(try_fmt_cap, struct v4l2_format, *);
281V4L2_INT_WRAPPER_1(queryctrl, struct v4l2_queryctrl, *);
282V4L2_INT_WRAPPER_1(g_ctrl, struct v4l2_control, *);
283V4L2_INT_WRAPPER_1(s_ctrl, struct v4l2_control, *);
284V4L2_INT_WRAPPER_1(cropcap, struct v4l2_cropcap, *);
285V4L2_INT_WRAPPER_1(g_crop, struct v4l2_crop, *);
286V4L2_INT_WRAPPER_1(s_crop, struct v4l2_crop, *);
287V4L2_INT_WRAPPER_1(g_parm, struct v4l2_streamparm, *);
288V4L2_INT_WRAPPER_1(s_parm, struct v4l2_streamparm, *);
289V4L2_INT_WRAPPER_1(querystd, v4l2_std_id, *);
290V4L2_INT_WRAPPER_1(s_std, v4l2_std_id, *);
291V4L2_INT_WRAPPER_1(s_video_routing, struct v4l2_routing, *);
292
293V4L2_INT_WRAPPER_0(dev_init);
294V4L2_INT_WRAPPER_0(dev_exit);
295V4L2_INT_WRAPPER_1(s_power, enum v4l2_power, );
296V4L2_INT_WRAPPER_1(g_priv, void, *);
297V4L2_INT_WRAPPER_1(g_ifparm, struct v4l2_ifparm, *);
298V4L2_INT_WRAPPER_1(g_needs_reset, void, *);
299V4L2_INT_WRAPPER_1(enum_framesizes, struct v4l2_frmsizeenum, *);
300V4L2_INT_WRAPPER_1(enum_frameintervals, struct v4l2_frmivalenum, *);
301
302V4L2_INT_WRAPPER_0(reset);
303V4L2_INT_WRAPPER_0(init);
304
305#endif
306