Root/
1 | /* |
2 | * |
3 | * V 4 L 2 D R I V E R H E L P E R A P I |
4 | * |
5 | * Moved from videodev2.h |
6 | * |
7 | * Some commonly needed functions for drivers (v4l2-common.o module) |
8 | */ |
9 | #ifndef _V4L2_IOCTL_H |
10 | #define _V4L2_IOCTL_H |
11 | |
12 | #include <linux/poll.h> |
13 | #include <linux/fs.h> |
14 | #include <linux/device.h> |
15 | #include <linux/mutex.h> |
16 | #include <linux/compiler.h> /* need __user */ |
17 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
18 | #define __MIN_V4L1 |
19 | #include <linux/videodev.h> |
20 | #else |
21 | #include <linux/videodev2.h> |
22 | #endif |
23 | |
24 | struct v4l2_fh; |
25 | |
26 | struct v4l2_ioctl_ops { |
27 | /* ioctl callbacks */ |
28 | |
29 | /* VIDIOC_QUERYCAP handler */ |
30 | int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap); |
31 | |
32 | /* Priority handling */ |
33 | int (*vidioc_g_priority) (struct file *file, void *fh, |
34 | enum v4l2_priority *p); |
35 | int (*vidioc_s_priority) (struct file *file, void *fh, |
36 | enum v4l2_priority p); |
37 | |
38 | /* VIDIOC_ENUM_FMT handlers */ |
39 | int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh, |
40 | struct v4l2_fmtdesc *f); |
41 | int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh, |
42 | struct v4l2_fmtdesc *f); |
43 | int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh, |
44 | struct v4l2_fmtdesc *f); |
45 | int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, |
46 | struct v4l2_fmtdesc *f); |
47 | |
48 | /* VIDIOC_G_FMT handlers */ |
49 | int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh, |
50 | struct v4l2_format *f); |
51 | int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh, |
52 | struct v4l2_format *f); |
53 | int (*vidioc_g_fmt_vid_out) (struct file *file, void *fh, |
54 | struct v4l2_format *f); |
55 | int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh, |
56 | struct v4l2_format *f); |
57 | int (*vidioc_g_fmt_vbi_cap) (struct file *file, void *fh, |
58 | struct v4l2_format *f); |
59 | int (*vidioc_g_fmt_vbi_out) (struct file *file, void *fh, |
60 | struct v4l2_format *f); |
61 | int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh, |
62 | struct v4l2_format *f); |
63 | int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, |
64 | struct v4l2_format *f); |
65 | int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, |
66 | struct v4l2_format *f); |
67 | |
68 | /* VIDIOC_S_FMT handlers */ |
69 | int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh, |
70 | struct v4l2_format *f); |
71 | int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh, |
72 | struct v4l2_format *f); |
73 | int (*vidioc_s_fmt_vid_out) (struct file *file, void *fh, |
74 | struct v4l2_format *f); |
75 | int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh, |
76 | struct v4l2_format *f); |
77 | int (*vidioc_s_fmt_vbi_cap) (struct file *file, void *fh, |
78 | struct v4l2_format *f); |
79 | int (*vidioc_s_fmt_vbi_out) (struct file *file, void *fh, |
80 | struct v4l2_format *f); |
81 | int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh, |
82 | struct v4l2_format *f); |
83 | int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, |
84 | struct v4l2_format *f); |
85 | int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, |
86 | struct v4l2_format *f); |
87 | |
88 | /* VIDIOC_TRY_FMT handlers */ |
89 | int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh, |
90 | struct v4l2_format *f); |
91 | int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh, |
92 | struct v4l2_format *f); |
93 | int (*vidioc_try_fmt_vid_out) (struct file *file, void *fh, |
94 | struct v4l2_format *f); |
95 | int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh, |
96 | struct v4l2_format *f); |
97 | int (*vidioc_try_fmt_vbi_cap) (struct file *file, void *fh, |
98 | struct v4l2_format *f); |
99 | int (*vidioc_try_fmt_vbi_out) (struct file *file, void *fh, |
100 | struct v4l2_format *f); |
101 | int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh, |
102 | struct v4l2_format *f); |
103 | int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, |
104 | struct v4l2_format *f); |
105 | int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, |
106 | struct v4l2_format *f); |
107 | |
108 | /* Buffer handlers */ |
109 | int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); |
110 | int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b); |
111 | int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b); |
112 | int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); |
113 | |
114 | |
115 | int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i); |
116 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
117 | /* buffer type is struct vidio_mbuf * */ |
118 | int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p); |
119 | #endif |
120 | int (*vidioc_g_fbuf) (struct file *file, void *fh, |
121 | struct v4l2_framebuffer *a); |
122 | int (*vidioc_s_fbuf) (struct file *file, void *fh, |
123 | struct v4l2_framebuffer *a); |
124 | |
125 | /* Stream on/off */ |
126 | int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i); |
127 | int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i); |
128 | |
129 | /* Standard handling |
130 | ENUMSTD is handled by videodev.c |
131 | */ |
132 | int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm); |
133 | int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id *norm); |
134 | int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a); |
135 | |
136 | /* Input handling */ |
137 | int (*vidioc_enum_input)(struct file *file, void *fh, |
138 | struct v4l2_input *inp); |
139 | int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i); |
140 | int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i); |
141 | |
142 | /* Output handling */ |
143 | int (*vidioc_enum_output) (struct file *file, void *fh, |
144 | struct v4l2_output *a); |
145 | int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i); |
146 | int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i); |
147 | |
148 | /* Control handling */ |
149 | int (*vidioc_queryctrl) (struct file *file, void *fh, |
150 | struct v4l2_queryctrl *a); |
151 | int (*vidioc_g_ctrl) (struct file *file, void *fh, |
152 | struct v4l2_control *a); |
153 | int (*vidioc_s_ctrl) (struct file *file, void *fh, |
154 | struct v4l2_control *a); |
155 | int (*vidioc_g_ext_ctrls) (struct file *file, void *fh, |
156 | struct v4l2_ext_controls *a); |
157 | int (*vidioc_s_ext_ctrls) (struct file *file, void *fh, |
158 | struct v4l2_ext_controls *a); |
159 | int (*vidioc_try_ext_ctrls) (struct file *file, void *fh, |
160 | struct v4l2_ext_controls *a); |
161 | int (*vidioc_querymenu) (struct file *file, void *fh, |
162 | struct v4l2_querymenu *a); |
163 | |
164 | /* Audio ioctls */ |
165 | int (*vidioc_enumaudio) (struct file *file, void *fh, |
166 | struct v4l2_audio *a); |
167 | int (*vidioc_g_audio) (struct file *file, void *fh, |
168 | struct v4l2_audio *a); |
169 | int (*vidioc_s_audio) (struct file *file, void *fh, |
170 | struct v4l2_audio *a); |
171 | |
172 | /* Audio out ioctls */ |
173 | int (*vidioc_enumaudout) (struct file *file, void *fh, |
174 | struct v4l2_audioout *a); |
175 | int (*vidioc_g_audout) (struct file *file, void *fh, |
176 | struct v4l2_audioout *a); |
177 | int (*vidioc_s_audout) (struct file *file, void *fh, |
178 | struct v4l2_audioout *a); |
179 | int (*vidioc_g_modulator) (struct file *file, void *fh, |
180 | struct v4l2_modulator *a); |
181 | int (*vidioc_s_modulator) (struct file *file, void *fh, |
182 | struct v4l2_modulator *a); |
183 | /* Crop ioctls */ |
184 | int (*vidioc_cropcap) (struct file *file, void *fh, |
185 | struct v4l2_cropcap *a); |
186 | int (*vidioc_g_crop) (struct file *file, void *fh, |
187 | struct v4l2_crop *a); |
188 | int (*vidioc_s_crop) (struct file *file, void *fh, |
189 | struct v4l2_crop *a); |
190 | /* Compression ioctls */ |
191 | int (*vidioc_g_jpegcomp) (struct file *file, void *fh, |
192 | struct v4l2_jpegcompression *a); |
193 | int (*vidioc_s_jpegcomp) (struct file *file, void *fh, |
194 | struct v4l2_jpegcompression *a); |
195 | int (*vidioc_g_enc_index) (struct file *file, void *fh, |
196 | struct v4l2_enc_idx *a); |
197 | int (*vidioc_encoder_cmd) (struct file *file, void *fh, |
198 | struct v4l2_encoder_cmd *a); |
199 | int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, |
200 | struct v4l2_encoder_cmd *a); |
201 | |
202 | /* Stream type-dependent parameter ioctls */ |
203 | int (*vidioc_g_parm) (struct file *file, void *fh, |
204 | struct v4l2_streamparm *a); |
205 | int (*vidioc_s_parm) (struct file *file, void *fh, |
206 | struct v4l2_streamparm *a); |
207 | |
208 | /* Tuner ioctls */ |
209 | int (*vidioc_g_tuner) (struct file *file, void *fh, |
210 | struct v4l2_tuner *a); |
211 | int (*vidioc_s_tuner) (struct file *file, void *fh, |
212 | struct v4l2_tuner *a); |
213 | int (*vidioc_g_frequency) (struct file *file, void *fh, |
214 | struct v4l2_frequency *a); |
215 | int (*vidioc_s_frequency) (struct file *file, void *fh, |
216 | struct v4l2_frequency *a); |
217 | |
218 | /* Sliced VBI cap */ |
219 | int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh, |
220 | struct v4l2_sliced_vbi_cap *a); |
221 | |
222 | /* Log status ioctl */ |
223 | int (*vidioc_log_status) (struct file *file, void *fh); |
224 | |
225 | int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh, |
226 | struct v4l2_hw_freq_seek *a); |
227 | |
228 | /* Debugging ioctls */ |
229 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
230 | int (*vidioc_g_register) (struct file *file, void *fh, |
231 | struct v4l2_dbg_register *reg); |
232 | int (*vidioc_s_register) (struct file *file, void *fh, |
233 | struct v4l2_dbg_register *reg); |
234 | #endif |
235 | int (*vidioc_g_chip_ident) (struct file *file, void *fh, |
236 | struct v4l2_dbg_chip_ident *chip); |
237 | |
238 | int (*vidioc_enum_framesizes) (struct file *file, void *fh, |
239 | struct v4l2_frmsizeenum *fsize); |
240 | |
241 | int (*vidioc_enum_frameintervals) (struct file *file, void *fh, |
242 | struct v4l2_frmivalenum *fival); |
243 | |
244 | /* DV Timings IOCTLs */ |
245 | int (*vidioc_enum_dv_presets) (struct file *file, void *fh, |
246 | struct v4l2_dv_enum_preset *preset); |
247 | |
248 | int (*vidioc_s_dv_preset) (struct file *file, void *fh, |
249 | struct v4l2_dv_preset *preset); |
250 | int (*vidioc_g_dv_preset) (struct file *file, void *fh, |
251 | struct v4l2_dv_preset *preset); |
252 | int (*vidioc_query_dv_preset) (struct file *file, void *fh, |
253 | struct v4l2_dv_preset *qpreset); |
254 | int (*vidioc_s_dv_timings) (struct file *file, void *fh, |
255 | struct v4l2_dv_timings *timings); |
256 | int (*vidioc_g_dv_timings) (struct file *file, void *fh, |
257 | struct v4l2_dv_timings *timings); |
258 | |
259 | int (*vidioc_subscribe_event) (struct v4l2_fh *fh, |
260 | struct v4l2_event_subscription *sub); |
261 | int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, |
262 | struct v4l2_event_subscription *sub); |
263 | |
264 | /* For other private ioctls */ |
265 | long (*vidioc_default) (struct file *file, void *fh, |
266 | int cmd, void *arg); |
267 | }; |
268 | |
269 | |
270 | /* v4l debugging and diagnostics */ |
271 | |
272 | /* Debug bitmask flags to be used on V4L2 */ |
273 | #define V4L2_DEBUG_IOCTL 0x01 |
274 | #define V4L2_DEBUG_IOCTL_ARG 0x02 |
275 | |
276 | /* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ |
277 | #define v4l_print_ioctl(name, cmd) \ |
278 | do { \ |
279 | printk(KERN_DEBUG "%s: ", name); \ |
280 | v4l_printk_ioctl(cmd); \ |
281 | } while (0) |
282 | |
283 | /* Use this macro in I2C drivers where 'client' is the struct i2c_client |
284 | pointer */ |
285 | #define v4l_i2c_print_ioctl(client, cmd) \ |
286 | do { \ |
287 | v4l_client_printk(KERN_DEBUG, client, ""); \ |
288 | v4l_printk_ioctl(cmd); \ |
289 | } while (0) |
290 | |
291 | /* Video standard functions */ |
292 | extern const char *v4l2_norm_to_name(v4l2_std_id id); |
293 | extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod); |
294 | extern int v4l2_video_std_construct(struct v4l2_standard *vs, |
295 | int id, const char *name); |
296 | /* Prints the ioctl in a human-readable format */ |
297 | extern void v4l_printk_ioctl(unsigned int cmd); |
298 | |
299 | /* names for fancy debug output */ |
300 | extern const char *v4l2_field_names[]; |
301 | extern const char *v4l2_type_names[]; |
302 | |
303 | /* Compatibility layer interface -- v4l1-compat module */ |
304 | typedef long (*v4l2_kioctl)(struct file *file, |
305 | unsigned int cmd, void *arg); |
306 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
307 | long v4l_compat_translate_ioctl(struct file *file, |
308 | int cmd, void *arg, v4l2_kioctl driver_ioctl); |
309 | #else |
310 | #define v4l_compat_translate_ioctl(file, cmd, arg, ioctl) (-EINVAL) |
311 | #endif |
312 | |
313 | #ifdef CONFIG_COMPAT |
314 | /* 32 Bits compatibility layer for 64 bits processors */ |
315 | extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, |
316 | unsigned long arg); |
317 | #endif |
318 | |
319 | /* Include support for obsoleted stuff */ |
320 | extern long video_usercopy(struct file *file, unsigned int cmd, |
321 | unsigned long arg, v4l2_kioctl func); |
322 | |
323 | /* Standard handlers for V4L ioctl's */ |
324 | extern long video_ioctl2(struct file *file, |
325 | unsigned int cmd, unsigned long arg); |
326 | |
327 | #endif /* _V4L2_IOCTL_H */ |
328 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9