Blame view

include/media/v4l2-ioctl.h 12.6 KB
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  /*
   *
   *	V 4 L 2   D R I V E R   H E L P E R   A P I
   *
   * Moved from videodev2.h
   *
   *	Some commonly needed functions for drivers (v4l2-common.o module)
   */
  #ifndef _V4L2_IOCTL_H
  #define _V4L2_IOCTL_H
  
  #include <linux/poll.h>
  #include <linux/fs.h>
  #include <linux/device.h>
  #include <linux/mutex.h>
  #include <linux/compiler.h> /* need __user */
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
17
  #include <linux/videodev2.h>
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
18

d3d7c9635   Sakari Ailus   V4L/DVB: V4L: Eve...
19
  struct v4l2_fh;
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  struct v4l2_ioctl_ops {
  	/* ioctl callbacks */
  
  	/* VIDIOC_QUERYCAP handler */
  	int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
  
  	/* Priority handling */
  	int (*vidioc_g_priority)   (struct file *file, void *fh,
  				    enum v4l2_priority *p);
  	int (*vidioc_s_priority)   (struct file *file, void *fh,
  				    enum v4l2_priority p);
  
  	/* VIDIOC_ENUM_FMT handlers */
  	int (*vidioc_enum_fmt_vid_cap)     (struct file *file, void *fh,
  					    struct v4l2_fmtdesc *f);
  	int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh,
  					    struct v4l2_fmtdesc *f);
  	int (*vidioc_enum_fmt_vid_out)     (struct file *file, void *fh,
  					    struct v4l2_fmtdesc *f);
d14e6d76e   Pawel Osciak   [media] v4l: Add ...
39
40
41
42
  	int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh,
  					      struct v4l2_fmtdesc *f);
  	int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh,
  					      struct v4l2_fmtdesc *f);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  	int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
  					    struct v4l2_fmtdesc *f);
  
  	/* VIDIOC_G_FMT handlers */
  	int (*vidioc_g_fmt_vid_cap)    (struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_g_fmt_vid_out)    (struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_g_fmt_vbi_cap)    (struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_g_fmt_vbi_out)    (struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
  					struct v4l2_format *f);
d14e6d76e   Pawel Osciak   [media] v4l: Add ...
63
64
65
66
  	int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
  					   struct v4l2_format *f);
  	int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
  					   struct v4l2_format *f);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  	int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
  					struct v4l2_format *f);
  
  	/* VIDIOC_S_FMT handlers */
  	int (*vidioc_s_fmt_vid_cap)    (struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_s_fmt_vid_out)    (struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_s_fmt_vbi_cap)    (struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_s_fmt_vbi_out)    (struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
  					struct v4l2_format *f);
  	int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
  					struct v4l2_format *f);
d14e6d76e   Pawel Osciak   [media] v4l: Add ...
87
88
89
90
  	int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
  					   struct v4l2_format *f);
  	int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
  					   struct v4l2_format *f);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
  	int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
  					struct v4l2_format *f);
  
  	/* VIDIOC_TRY_FMT handlers */
  	int (*vidioc_try_fmt_vid_cap)    (struct file *file, void *fh,
  					  struct v4l2_format *f);
  	int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
  					  struct v4l2_format *f);
  	int (*vidioc_try_fmt_vid_out)    (struct file *file, void *fh,
  					  struct v4l2_format *f);
  	int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
  					  struct v4l2_format *f);
  	int (*vidioc_try_fmt_vbi_cap)    (struct file *file, void *fh,
  					  struct v4l2_format *f);
  	int (*vidioc_try_fmt_vbi_out)    (struct file *file, void *fh,
  					  struct v4l2_format *f);
  	int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
  					  struct v4l2_format *f);
  	int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
  					  struct v4l2_format *f);
d14e6d76e   Pawel Osciak   [media] v4l: Add ...
111
112
113
114
  	int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
  					     struct v4l2_format *f);
  	int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
  					     struct v4l2_format *f);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
115
116
117
118
119
120
121
122
  	int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
  					  struct v4l2_format *f);
  
  	/* Buffer handlers */
  	int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
  	int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
  	int (*vidioc_qbuf)    (struct file *file, void *fh, struct v4l2_buffer *b);
  	int (*vidioc_dqbuf)   (struct file *file, void *fh, struct v4l2_buffer *b);
2150158b3   Guennadi Liakhovetski   [media] V4L: add ...
123
124
  	int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
  	int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
125
126
  
  	int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
  	int (*vidioc_g_fbuf)   (struct file *file, void *fh,
  				struct v4l2_framebuffer *a);
  	int (*vidioc_s_fbuf)   (struct file *file, void *fh,
  				struct v4l2_framebuffer *a);
  
  		/* Stream on/off */
  	int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
  	int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
  
  		/* Standard handling
  			ENUMSTD is handled by videodev.c
  		 */
  	int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm);
  	int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id *norm);
  	int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
  
  		/* Input handling */
  	int (*vidioc_enum_input)(struct file *file, void *fh,
  				 struct v4l2_input *inp);
  	int (*vidioc_g_input)   (struct file *file, void *fh, unsigned int *i);
  	int (*vidioc_s_input)   (struct file *file, void *fh, unsigned int i);
  
  		/* Output handling */
  	int (*vidioc_enum_output) (struct file *file, void *fh,
  				  struct v4l2_output *a);
  	int (*vidioc_g_output)   (struct file *file, void *fh, unsigned int *i);
  	int (*vidioc_s_output)   (struct file *file, void *fh, unsigned int i);
  
  		/* Control handling */
  	int (*vidioc_queryctrl)        (struct file *file, void *fh,
  					struct v4l2_queryctrl *a);
  	int (*vidioc_g_ctrl)           (struct file *file, void *fh,
  					struct v4l2_control *a);
  	int (*vidioc_s_ctrl)           (struct file *file, void *fh,
  					struct v4l2_control *a);
  	int (*vidioc_g_ext_ctrls)      (struct file *file, void *fh,
  					struct v4l2_ext_controls *a);
  	int (*vidioc_s_ext_ctrls)      (struct file *file, void *fh,
  					struct v4l2_ext_controls *a);
  	int (*vidioc_try_ext_ctrls)    (struct file *file, void *fh,
  					struct v4l2_ext_controls *a);
  	int (*vidioc_querymenu)        (struct file *file, void *fh,
  					struct v4l2_querymenu *a);
  
  	/* Audio ioctls */
  	int (*vidioc_enumaudio)        (struct file *file, void *fh,
  					struct v4l2_audio *a);
  	int (*vidioc_g_audio)          (struct file *file, void *fh,
  					struct v4l2_audio *a);
  	int (*vidioc_s_audio)          (struct file *file, void *fh,
  					struct v4l2_audio *a);
  
  	/* Audio out ioctls */
  	int (*vidioc_enumaudout)       (struct file *file, void *fh,
  					struct v4l2_audioout *a);
  	int (*vidioc_g_audout)         (struct file *file, void *fh,
  					struct v4l2_audioout *a);
  	int (*vidioc_s_audout)         (struct file *file, void *fh,
  					struct v4l2_audioout *a);
  	int (*vidioc_g_modulator)      (struct file *file, void *fh,
  					struct v4l2_modulator *a);
  	int (*vidioc_s_modulator)      (struct file *file, void *fh,
  					struct v4l2_modulator *a);
  	/* Crop ioctls */
  	int (*vidioc_cropcap)          (struct file *file, void *fh,
  					struct v4l2_cropcap *a);
  	int (*vidioc_g_crop)           (struct file *file, void *fh,
  					struct v4l2_crop *a);
  	int (*vidioc_s_crop)           (struct file *file, void *fh,
  					struct v4l2_crop *a);
0e8caacef   Tomasz Stanislawski   [media] v4l: add ...
197
198
199
200
  	int (*vidioc_g_selection)      (struct file *file, void *fh,
  					struct v4l2_selection *s);
  	int (*vidioc_s_selection)      (struct file *file, void *fh,
  					struct v4l2_selection *s);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
  	/* Compression ioctls */
  	int (*vidioc_g_jpegcomp)       (struct file *file, void *fh,
  					struct v4l2_jpegcompression *a);
  	int (*vidioc_s_jpegcomp)       (struct file *file, void *fh,
  					struct v4l2_jpegcompression *a);
  	int (*vidioc_g_enc_index)      (struct file *file, void *fh,
  					struct v4l2_enc_idx *a);
  	int (*vidioc_encoder_cmd)      (struct file *file, void *fh,
  					struct v4l2_encoder_cmd *a);
  	int (*vidioc_try_encoder_cmd)  (struct file *file, void *fh,
  					struct v4l2_encoder_cmd *a);
  
  	/* Stream type-dependent parameter ioctls */
  	int (*vidioc_g_parm)           (struct file *file, void *fh,
  					struct v4l2_streamparm *a);
  	int (*vidioc_s_parm)           (struct file *file, void *fh,
  					struct v4l2_streamparm *a);
  
  	/* Tuner ioctls */
  	int (*vidioc_g_tuner)          (struct file *file, void *fh,
  					struct v4l2_tuner *a);
  	int (*vidioc_s_tuner)          (struct file *file, void *fh,
  					struct v4l2_tuner *a);
  	int (*vidioc_g_frequency)      (struct file *file, void *fh,
  					struct v4l2_frequency *a);
  	int (*vidioc_s_frequency)      (struct file *file, void *fh,
  					struct v4l2_frequency *a);
  
  	/* Sliced VBI cap */
  	int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
  					struct v4l2_sliced_vbi_cap *a);
  
  	/* Log status ioctl */
  	int (*vidioc_log_status)       (struct file *file, void *fh);
  
  	int (*vidioc_s_hw_freq_seek)   (struct file *file, void *fh,
  					struct v4l2_hw_freq_seek *a);
  
  	/* Debugging ioctls */
  #ifdef CONFIG_VIDEO_ADV_DEBUG
  	int (*vidioc_g_register)       (struct file *file, void *fh,
aecde8b53   Hans Verkuil   V4L/DVB (10141): ...
242
  					struct v4l2_dbg_register *reg);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
243
  	int (*vidioc_s_register)       (struct file *file, void *fh,
aecde8b53   Hans Verkuil   V4L/DVB (10141): ...
244
  					struct v4l2_dbg_register *reg);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
245
246
  #endif
  	int (*vidioc_g_chip_ident)     (struct file *file, void *fh,
aecde8b53   Hans Verkuil   V4L/DVB (10141): ...
247
  					struct v4l2_dbg_chip_ident *chip);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
248

74d83fa02   Mauro Carvalho Chehab   V4L/DVB (9578): v...
249
250
251
252
253
  	int (*vidioc_enum_framesizes)   (struct file *file, void *fh,
  					 struct v4l2_frmsizeenum *fsize);
  
  	int (*vidioc_enum_frameintervals) (struct file *file, void *fh,
  					   struct v4l2_frmivalenum *fival);
b6456c0cf   Muralidharan Karicheri   V4L/DVB (13571): ...
254
255
256
257
258
259
260
261
262
263
264
265
266
267
  	/* DV Timings IOCTLs */
  	int (*vidioc_enum_dv_presets) (struct file *file, void *fh,
  				       struct v4l2_dv_enum_preset *preset);
  
  	int (*vidioc_s_dv_preset) (struct file *file, void *fh,
  				   struct v4l2_dv_preset *preset);
  	int (*vidioc_g_dv_preset) (struct file *file, void *fh,
  				   struct v4l2_dv_preset *preset);
  	int (*vidioc_query_dv_preset) (struct file *file, void *fh,
  					struct v4l2_dv_preset *qpreset);
  	int (*vidioc_s_dv_timings) (struct file *file, void *fh,
  				    struct v4l2_dv_timings *timings);
  	int (*vidioc_g_dv_timings) (struct file *file, void *fh,
  				    struct v4l2_dv_timings *timings);
d3d7c9635   Sakari Ailus   V4L/DVB: V4L: Eve...
268
269
270
271
  	int (*vidioc_subscribe_event)  (struct v4l2_fh *fh,
  					struct v4l2_event_subscription *sub);
  	int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
  					struct v4l2_event_subscription *sub);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
272
  	/* For other private ioctls */
069b74793   Hans Verkuil   V4L/DVB (10138): ...
273
  	long (*vidioc_default)	       (struct file *file, void *fh,
99cd47bc7   Hans Verkuil   [media] v4l2-ioct...
274
  					bool valid_prio, int cmd, void *arg);
a399810ca   Hans Verkuil   V4L/DVB (8482): v...
275
  };
2864462ea   Mauro Carvalho Chehab   V4L/DVB (8434): F...
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
  /* v4l debugging and diagnostics */
  
  /* Debug bitmask flags to be used on V4L2 */
  #define V4L2_DEBUG_IOCTL     0x01
  #define V4L2_DEBUG_IOCTL_ARG 0x02
  
  /* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
  #define v4l_print_ioctl(name, cmd)  		 \
  	do {  					 \
  		printk(KERN_DEBUG "%s: ", name); \
  		v4l_printk_ioctl(cmd);		 \
  	} while (0)
  
  /* Use this macro in I2C drivers where 'client' is the struct i2c_client
     pointer */
  #define v4l_i2c_print_ioctl(client, cmd) 		   \
  	do {      					   \
  		v4l_client_printk(KERN_DEBUG, client, ""); \
  		v4l_printk_ioctl(cmd);			   \
  	} while (0)
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
296
297
  /*  Video standard functions  */
  extern const char *v4l2_norm_to_name(v4l2_std_id id);
51f0b8d57   Trent Piepho   V4L/DVB (10813): ...
298
  extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
299
300
301
302
303
304
305
306
  extern int v4l2_video_std_construct(struct v4l2_standard *vs,
  				    int id, const char *name);
  /* Prints the ioctl in a human-readable format */
  extern void v4l_printk_ioctl(unsigned int cmd);
  
  /* names for fancy debug output */
  extern const char *v4l2_field_names[];
  extern const char *v4l2_type_names[];
bec43661b   Hans Verkuil   V4L/DVB (10135): ...
307
  #ifdef CONFIG_COMPAT
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
308
  /* 32 Bits compatibility layer for 64 bits processors */
9bb7cde79   Hans Verkuil   V4L/DVB (10139): ...
309
  extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
310
  				unsigned long arg);
bec43661b   Hans Verkuil   V4L/DVB (10135): ...
311
  #endif
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
312

08af245de   Hans Verkuil   [media] V4L: remo...
313
314
  typedef long (*v4l2_kioctl)(struct file *file,
  		unsigned int cmd, void *arg);
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
315
  /* Include support for obsoleted stuff */
069b74793   Hans Verkuil   V4L/DVB (10138): ...
316
  extern long video_usercopy(struct file *file, unsigned int cmd,
f473bf76c   Hans Verkuil   V4L/DVB (9503): v...
317
  				unsigned long arg, v4l2_kioctl func);
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
318

8a522c916   Mauro Carvalho Chehab   V4L/DVB (9331): R...
319
  /* Standard handlers for V4L ioctl's */
069b74793   Hans Verkuil   V4L/DVB (10138): ...
320
  extern long video_ioctl2(struct file *file,
8a522c916   Mauro Carvalho Chehab   V4L/DVB (9331): R...
321
  			unsigned int cmd, unsigned long arg);
35ea11ff8   Hans Verkuil   V4L/DVB (8430): v...
322
  #endif /* _V4L2_IOCTL_H */