x86/amd-iommu: Add per IOMMU reference counting
[linux/fpc-iii.git] / include / media / v4l2-ioctl.h
blob7a4529defa8841ffa606d8af52d2dac289e5de29
1 /*
3 * V 4 L 2 D R I V E R H E L P E R A P I
5 * Moved from videodev2.h
7 * Some commonly needed functions for drivers (v4l2-common.o module)
8 */
9 #ifndef _V4L2_IOCTL_H
10 #define _V4L2_IOCTL_H
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
24 struct v4l2_ioctl_ops {
25 /* ioctl callbacks */
27 /* VIDIOC_QUERYCAP handler */
28 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
30 /* Priority handling */
31 int (*vidioc_g_priority) (struct file *file, void *fh,
32 enum v4l2_priority *p);
33 int (*vidioc_s_priority) (struct file *file, void *fh,
34 enum v4l2_priority p);
36 /* VIDIOC_ENUM_FMT handlers */
37 int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh,
38 struct v4l2_fmtdesc *f);
39 int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh,
40 struct v4l2_fmtdesc *f);
41 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh,
42 struct v4l2_fmtdesc *f);
43 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
44 struct v4l2_fmtdesc *f);
46 /* VIDIOC_G_FMT handlers */
47 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh,
48 struct v4l2_format *f);
49 int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
50 struct v4l2_format *f);
51 int (*vidioc_g_fmt_vid_out) (struct file *file, void *fh,
52 struct v4l2_format *f);
53 int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
54 struct v4l2_format *f);
55 int (*vidioc_g_fmt_vbi_cap) (struct file *file, void *fh,
56 struct v4l2_format *f);
57 int (*vidioc_g_fmt_vbi_out) (struct file *file, void *fh,
58 struct v4l2_format *f);
59 int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
60 struct v4l2_format *f);
61 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
62 struct v4l2_format *f);
63 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
64 struct v4l2_format *f);
66 /* VIDIOC_S_FMT handlers */
67 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh,
68 struct v4l2_format *f);
69 int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
70 struct v4l2_format *f);
71 int (*vidioc_s_fmt_vid_out) (struct file *file, void *fh,
72 struct v4l2_format *f);
73 int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
74 struct v4l2_format *f);
75 int (*vidioc_s_fmt_vbi_cap) (struct file *file, void *fh,
76 struct v4l2_format *f);
77 int (*vidioc_s_fmt_vbi_out) (struct file *file, void *fh,
78 struct v4l2_format *f);
79 int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
80 struct v4l2_format *f);
81 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
82 struct v4l2_format *f);
83 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
84 struct v4l2_format *f);
86 /* VIDIOC_TRY_FMT handlers */
87 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh,
88 struct v4l2_format *f);
89 int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
90 struct v4l2_format *f);
91 int (*vidioc_try_fmt_vid_out) (struct file *file, void *fh,
92 struct v4l2_format *f);
93 int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
94 struct v4l2_format *f);
95 int (*vidioc_try_fmt_vbi_cap) (struct file *file, void *fh,
96 struct v4l2_format *f);
97 int (*vidioc_try_fmt_vbi_out) (struct file *file, void *fh,
98 struct v4l2_format *f);
99 int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
100 struct v4l2_format *f);
101 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
102 struct v4l2_format *f);
103 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
104 struct v4l2_format *f);
106 /* Buffer handlers */
107 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
108 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
109 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
110 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
113 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
114 #ifdef CONFIG_VIDEO_V4L1_COMPAT
115 /* buffer type is struct vidio_mbuf * */
116 int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p);
117 #endif
118 int (*vidioc_g_fbuf) (struct file *file, void *fh,
119 struct v4l2_framebuffer *a);
120 int (*vidioc_s_fbuf) (struct file *file, void *fh,
121 struct v4l2_framebuffer *a);
123 /* Stream on/off */
124 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
125 int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
127 /* Standard handling
128 ENUMSTD is handled by videodev.c
130 int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm);
131 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id *norm);
132 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
134 /* Input handling */
135 int (*vidioc_enum_input)(struct file *file, void *fh,
136 struct v4l2_input *inp);
137 int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i);
138 int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i);
140 /* Output handling */
141 int (*vidioc_enum_output) (struct file *file, void *fh,
142 struct v4l2_output *a);
143 int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i);
144 int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i);
146 /* Control handling */
147 int (*vidioc_queryctrl) (struct file *file, void *fh,
148 struct v4l2_queryctrl *a);
149 int (*vidioc_g_ctrl) (struct file *file, void *fh,
150 struct v4l2_control *a);
151 int (*vidioc_s_ctrl) (struct file *file, void *fh,
152 struct v4l2_control *a);
153 int (*vidioc_g_ext_ctrls) (struct file *file, void *fh,
154 struct v4l2_ext_controls *a);
155 int (*vidioc_s_ext_ctrls) (struct file *file, void *fh,
156 struct v4l2_ext_controls *a);
157 int (*vidioc_try_ext_ctrls) (struct file *file, void *fh,
158 struct v4l2_ext_controls *a);
159 int (*vidioc_querymenu) (struct file *file, void *fh,
160 struct v4l2_querymenu *a);
162 /* Audio ioctls */
163 int (*vidioc_enumaudio) (struct file *file, void *fh,
164 struct v4l2_audio *a);
165 int (*vidioc_g_audio) (struct file *file, void *fh,
166 struct v4l2_audio *a);
167 int (*vidioc_s_audio) (struct file *file, void *fh,
168 struct v4l2_audio *a);
170 /* Audio out ioctls */
171 int (*vidioc_enumaudout) (struct file *file, void *fh,
172 struct v4l2_audioout *a);
173 int (*vidioc_g_audout) (struct file *file, void *fh,
174 struct v4l2_audioout *a);
175 int (*vidioc_s_audout) (struct file *file, void *fh,
176 struct v4l2_audioout *a);
177 int (*vidioc_g_modulator) (struct file *file, void *fh,
178 struct v4l2_modulator *a);
179 int (*vidioc_s_modulator) (struct file *file, void *fh,
180 struct v4l2_modulator *a);
181 /* Crop ioctls */
182 int (*vidioc_cropcap) (struct file *file, void *fh,
183 struct v4l2_cropcap *a);
184 int (*vidioc_g_crop) (struct file *file, void *fh,
185 struct v4l2_crop *a);
186 int (*vidioc_s_crop) (struct file *file, void *fh,
187 struct v4l2_crop *a);
188 /* Compression ioctls */
189 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
190 struct v4l2_jpegcompression *a);
191 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
192 struct v4l2_jpegcompression *a);
193 int (*vidioc_g_enc_index) (struct file *file, void *fh,
194 struct v4l2_enc_idx *a);
195 int (*vidioc_encoder_cmd) (struct file *file, void *fh,
196 struct v4l2_encoder_cmd *a);
197 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
198 struct v4l2_encoder_cmd *a);
200 /* Stream type-dependent parameter ioctls */
201 int (*vidioc_g_parm) (struct file *file, void *fh,
202 struct v4l2_streamparm *a);
203 int (*vidioc_s_parm) (struct file *file, void *fh,
204 struct v4l2_streamparm *a);
206 /* Tuner ioctls */
207 int (*vidioc_g_tuner) (struct file *file, void *fh,
208 struct v4l2_tuner *a);
209 int (*vidioc_s_tuner) (struct file *file, void *fh,
210 struct v4l2_tuner *a);
211 int (*vidioc_g_frequency) (struct file *file, void *fh,
212 struct v4l2_frequency *a);
213 int (*vidioc_s_frequency) (struct file *file, void *fh,
214 struct v4l2_frequency *a);
216 /* Sliced VBI cap */
217 int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
218 struct v4l2_sliced_vbi_cap *a);
220 /* Log status ioctl */
221 int (*vidioc_log_status) (struct file *file, void *fh);
223 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh,
224 struct v4l2_hw_freq_seek *a);
226 /* Debugging ioctls */
227 #ifdef CONFIG_VIDEO_ADV_DEBUG
228 int (*vidioc_g_register) (struct file *file, void *fh,
229 struct v4l2_dbg_register *reg);
230 int (*vidioc_s_register) (struct file *file, void *fh,
231 struct v4l2_dbg_register *reg);
232 #endif
233 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
234 struct v4l2_dbg_chip_ident *chip);
236 int (*vidioc_enum_framesizes) (struct file *file, void *fh,
237 struct v4l2_frmsizeenum *fsize);
239 int (*vidioc_enum_frameintervals) (struct file *file, void *fh,
240 struct v4l2_frmivalenum *fival);
242 /* For other private ioctls */
243 long (*vidioc_default) (struct file *file, void *fh,
244 int cmd, void *arg);
248 /* v4l debugging and diagnostics */
250 /* Debug bitmask flags to be used on V4L2 */
251 #define V4L2_DEBUG_IOCTL 0x01
252 #define V4L2_DEBUG_IOCTL_ARG 0x02
254 /* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
255 #define v4l_print_ioctl(name, cmd) \
256 do { \
257 printk(KERN_DEBUG "%s: ", name); \
258 v4l_printk_ioctl(cmd); \
259 } while (0)
261 /* Use this macro in I2C drivers where 'client' is the struct i2c_client
262 pointer */
263 #define v4l_i2c_print_ioctl(client, cmd) \
264 do { \
265 v4l_client_printk(KERN_DEBUG, client, ""); \
266 v4l_printk_ioctl(cmd); \
267 } while (0)
269 /* Video standard functions */
270 extern const char *v4l2_norm_to_name(v4l2_std_id id);
271 extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
272 extern int v4l2_video_std_construct(struct v4l2_standard *vs,
273 int id, const char *name);
274 /* Prints the ioctl in a human-readable format */
275 extern void v4l_printk_ioctl(unsigned int cmd);
277 /* names for fancy debug output */
278 extern const char *v4l2_field_names[];
279 extern const char *v4l2_type_names[];
281 /* Compatibility layer interface -- v4l1-compat module */
282 typedef long (*v4l2_kioctl)(struct file *file,
283 unsigned int cmd, void *arg);
284 #ifdef CONFIG_VIDEO_V4L1_COMPAT
285 long v4l_compat_translate_ioctl(struct file *file,
286 int cmd, void *arg, v4l2_kioctl driver_ioctl);
287 #else
288 #define v4l_compat_translate_ioctl(file, cmd, arg, ioctl) (-EINVAL)
289 #endif
291 #ifdef CONFIG_COMPAT
292 /* 32 Bits compatibility layer for 64 bits processors */
293 extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
294 unsigned long arg);
295 #endif
297 /* Include support for obsoleted stuff */
298 extern long video_usercopy(struct file *file, unsigned int cmd,
299 unsigned long arg, v4l2_kioctl func);
301 /* Standard handlers for V4L ioctl's */
302 extern long video_ioctl2(struct file *file,
303 unsigned int cmd, unsigned long arg);
305 #endif /* _V4L2_IOCTL_H */