TTY: create drivers/tty/vt and move the vt code there
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / media / v4l2-ioctl.h
blob06daa6e8e051d6a24b196476d7d47707b1e375e6
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_fh;
26 struct v4l2_ioctl_ops {
27 /* ioctl callbacks */
29 /* VIDIOC_QUERYCAP handler */
30 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
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);
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);
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);
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);
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);
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);
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);
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);
129 /* Standard handling
130 ENUMSTD is handled by videodev.c
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);
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);
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);
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);
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);
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);
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);
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);
218 /* Sliced VBI cap */
219 int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
220 struct v4l2_sliced_vbi_cap *a);
222 /* Log status ioctl */
223 int (*vidioc_log_status) (struct file *file, void *fh);
225 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh,
226 struct v4l2_hw_freq_seek *a);
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);
238 int (*vidioc_enum_framesizes) (struct file *file, void *fh,
239 struct v4l2_frmsizeenum *fsize);
241 int (*vidioc_enum_frameintervals) (struct file *file, void *fh,
242 struct v4l2_frmivalenum *fival);
244 /* DV Timings IOCTLs */
245 int (*vidioc_enum_dv_presets) (struct file *file, void *fh,
246 struct v4l2_dv_enum_preset *preset);
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);
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);
264 /* For other private ioctls */
265 long (*vidioc_default) (struct file *file, void *fh,
266 int cmd, void *arg);
270 /* v4l debugging and diagnostics */
272 /* Debug bitmask flags to be used on V4L2 */
273 #define V4L2_DEBUG_IOCTL 0x01
274 #define V4L2_DEBUG_IOCTL_ARG 0x02
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)
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)
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);
299 /* names for fancy debug output */
300 extern const char *v4l2_field_names[];
301 extern const char *v4l2_type_names[];
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
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
319 /* Include support for obsoleted stuff */
320 extern long video_usercopy(struct file *file, unsigned int cmd,
321 unsigned long arg, v4l2_kioctl func);
323 /* Standard handlers for V4L ioctl's */
324 extern long video_ioctl2(struct file *file,
325 unsigned int cmd, unsigned long arg);
327 #endif /* _V4L2_IOCTL_H */