blob: 8b1d19bc9b0ebccc4a7f1d1c8f812cc31d3d7297 [file] [log] [blame]
Hans Verkuil35ea11f2008-07-20 08:12:02 -03001/*
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>
Hans Verkuil35ea11f2008-07-20 08:12:02 -030014#include <linux/mutex.h>
15#include <linux/compiler.h> /* need __user */
Hans Verkuil35ea11f2008-07-20 08:12:02 -030016#include <linux/videodev2.h>
Hans Verkuil35ea11f2008-07-20 08:12:02 -030017
Sakari Ailusd3d7c962010-03-27 11:02:10 -030018struct v4l2_fh;
19
Mauro Carvalho Chehabc91661f2016-07-22 16:22:41 -030020/**
21 * struct v4l2_ioctl_ops - describe operations for each V4L2 ioctl
22 *
23 * @vidioc_querycap: pointer to the function that implements
24 * :ref:`VIDIOC_QUERYCAP <vidioc_querycap>` ioctl
25 * @vidioc_enum_fmt_vid_cap: pointer to the function that implements
26 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
27 * for video capture in single plane mode
28 * @vidioc_enum_fmt_vid_overlay: pointer to the function that implements
29 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
30 * for video overlay
31 * @vidioc_enum_fmt_vid_out: pointer to the function that implements
32 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
33 * for video output in single plane mode
34 * @vidioc_enum_fmt_vid_cap_mplane: pointer to the function that implements
35 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
36 * for video capture in multiplane mode
37 * @vidioc_enum_fmt_vid_out_mplane: pointer to the function that implements
38 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
39 * for video output in multiplane mode
40 * @vidioc_enum_fmt_sdr_cap: pointer to the function that implements
41 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
42 * for Software Defined Radio capture
43 * @vidioc_enum_fmt_sdr_out: pointer to the function that implements
44 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
45 * for Software Defined Radio output
46 * @vidioc_g_fmt_vid_cap: pointer to the function that implements
47 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
48 * in single plane mode
49 * @vidioc_g_fmt_vid_overlay: pointer to the function that implements
50 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay
51 * @vidioc_g_fmt_vid_out: pointer to the function that implements
52 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
53 * in single plane mode
54 * @vidioc_g_fmt_vid_out_overlay: pointer to the function that implements
55 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
56 * @vidioc_g_fmt_vbi_cap: pointer to the function that implements
57 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
58 * @vidioc_g_fmt_vbi_out: pointer to the function that implements
59 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
60 * @vidioc_g_fmt_sliced_vbi_cap: pointer to the function that implements
61 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
62 * @vidioc_g_fmt_sliced_vbi_out: pointer to the function that implements
63 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
64 * @vidioc_g_fmt_vid_cap_mplane: pointer to the function that implements
65 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
66 * in multiple plane mode
67 * @vidioc_g_fmt_vid_out_mplane: pointer to the function that implements
68 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
69 * in multiplane plane mode
70 * @vidioc_g_fmt_sdr_cap: pointer to the function that implements
71 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
72 * Radio capture
73 * @vidioc_g_fmt_sdr_out: pointer to the function that implements
74 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
75 * Radio output
76 * @vidioc_s_fmt_vid_cap: pointer to the function that implements
77 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video capture
78 * in single plane mode
79 * @vidioc_s_fmt_vid_overlay: pointer to the function that implements
80 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video overlay
81 * @vidioc_s_fmt_vid_out: pointer to the function that implements
82 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video out
83 * in single plane mode
84 * @vidioc_s_fmt_vid_out_overlay: pointer to the function that implements
85 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
86 * @vidioc_s_fmt_vbi_cap: pointer to the function that implements
87 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
88 * @vidioc_s_fmt_vbi_out: pointer to the function that implements
89 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
90 * @vidioc_s_fmt_sliced_vbi_cap: pointer to the function that implements
91 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
92 * @vidioc_s_fmt_sliced_vbi_out: pointer to the function that implements
93 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
94 * @vidioc_s_fmt_vid_cap_mplane: pointer to the function that implements
95 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video capture
96 * in multiple plane mode
97 * @vidioc_s_fmt_vid_out_mplane: pointer to the function that implements
98 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video out
99 * in multiplane plane mode
100 * @vidioc_s_fmt_sdr_cap: pointer to the function that implements
101 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
102 * Radio capture
103 * @vidioc_s_fmt_sdr_out: pointer to the function that implements
104 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
105 * Radio output
106 * @vidioc_try_fmt_vid_cap: pointer to the function that implements
107 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
108 * in single plane mode
109 * @vidioc_try_fmt_vid_overlay: pointer to the function that implements
110 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
111 * @vidioc_try_fmt_vid_out: pointer to the function that implements
112 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
113 * in single plane mode
114 * @vidioc_try_fmt_vid_out_overlay: pointer to the function that implements
115 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
116 * output
117 * @vidioc_try_fmt_vbi_cap: pointer to the function that implements
118 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
119 * @vidioc_try_fmt_vbi_out: pointer to the function that implements
120 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
121 * @vidioc_try_fmt_sliced_vbi_cap: pointer to the function that implements
122 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI
123 * capture
124 * @vidioc_try_fmt_sliced_vbi_out: pointer to the function that implements
125 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
126 * @vidioc_try_fmt_vid_cap_mplane: pointer to the function that implements
127 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
128 * in multiple plane mode
129 * @vidioc_try_fmt_vid_out_mplane: pointer to the function that implements
130 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
131 * in multiplane plane mode
132 * @vidioc_try_fmt_sdr_cap: pointer to the function that implements
133 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
134 * Radio capture
135 * @vidioc_try_fmt_sdr_out: pointer to the function that implements
136 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
137 * Radio output
138 * @vidioc_reqbufs: pointer to the function that implements
139 * :ref:`VIDIOC_REQBUFS <vidioc_reqbufs>` ioctl
140 * @vidioc_querybuf: pointer to the function that implements
141 * :ref:`VIDIOC_QUERYBUF <vidioc_querybuf>` ioctl
142 * @vidioc_qbuf: pointer to the function that implements
143 * :ref:`VIDIOC_QBUF <vidioc_qbuf>` ioctl
144 * @vidioc_expbuf: pointer to the function that implements
145 * :ref:`VIDIOC_EXPBUF <vidioc_expbuf>` ioctl
146 * @vidioc_dqbuf: pointer to the function that implements
147 * :ref:`VIDIOC_DQBUF <vidioc_qbuf>` ioctl
148 * @vidioc_create_bufs: pointer to the function that implements
149 * :ref:`VIDIOC_CREATE_BUFS <vidioc_create_bufs>` ioctl
150 * @vidioc_prepare_buf: pointer to the function that implements
151 * :ref:`VIDIOC_PREPARE_BUF <vidioc_prepare_buf>` ioctl
152 * @vidioc_overlay: pointer to the function that implements
153 * :ref:`VIDIOC_OVERLAY <vidioc_overlay>` ioctl
154 * @vidioc_g_fbuf: pointer to the function that implements
155 * :ref:`VIDIOC_G_FBUF <vidioc_g_fbuf>` ioctl
156 * @vidioc_s_fbuf: pointer to the function that implements
157 * :ref:`VIDIOC_S_FBUF <vidioc_g_fbuf>` ioctl
158 * @vidioc_streamon: pointer to the function that implements
159 * :ref:`VIDIOC_STREAMON <vidioc_streamon>` ioctl
160 * @vidioc_streamoff: pointer to the function that implements
161 * :ref:`VIDIOC_STREAMOFF <vidioc_streamon>` ioctl
162 * @vidioc_g_std: pointer to the function that implements
163 * :ref:`VIDIOC_G_STD <vidioc_g_std>` ioctl
164 * @vidioc_s_std: pointer to the function that implements
165 * :ref:`VIDIOC_S_STD <vidioc_g_std>` ioctl
166 * @vidioc_querystd: pointer to the function that implements
167 * :ref:`VIDIOC_QUERYSTD <vidioc_querystd>` ioctl
168 * @vidioc_enum_input: pointer to the function that implements
169 * :ref:`VIDIOC_ENUM_INPUT <vidioc_g_input>` ioctl
170 * @vidioc_g_input: pointer to the function that implements
171 * :ref:`VIDIOC_G_INPUT <vidioc_g_input>` ioctl
172 * @vidioc_s_input: pointer to the function that implements
173 * :ref:`VIDIOC_S_INPUT <vidioc_g_input>` ioctl
174 * @vidioc_enum_output: pointer to the function that implements
175 * :ref:`VIDIOC_ENUM_OUTPUT <vidioc_g_output>` ioctl
176 * @vidioc_g_output: pointer to the function that implements
177 * :ref:`VIDIOC_G_OUTPUT <vidioc_g_output>` ioctl
178 * @vidioc_s_output: pointer to the function that implements
179 * :ref:`VIDIOC_S_OUTPUT <vidioc_g_output>` ioctl
180 * @vidioc_queryctrl: pointer to the function that implements
181 * :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
182 * @vidioc_query_ext_ctrl: pointer to the function that implements
183 * :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
184 * @vidioc_g_ctrl: pointer to the function that implements
185 * :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
186 * @vidioc_s_ctrl: pointer to the function that implements
187 * :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
188 * @vidioc_g_ext_ctrls: pointer to the function that implements
189 * :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
190 * @vidioc_s_ext_ctrls: pointer to the function that implements
191 * :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
192 * @vidioc_try_ext_ctrls: pointer to the function that implements
193 * :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
194 * @vidioc_querymenu: pointer to the function that implements
195 * :ref:`VIDIOC_QUERYMENU <vidioc_queryctrl>` ioctl
196 * @vidioc_enumaudio: pointer to the function that implements
197 * :ref:`VIDIOC_ENUMAUDIO <vidioc_enumaudio>` ioctl
198 * @vidioc_g_audio: pointer to the function that implements
199 * :ref:`VIDIOC_G_AUDIO <vidioc_g_audio>` ioctl
200 * @vidioc_s_audio: pointer to the function that implements
201 * :ref:`VIDIOC_S_AUDIO <vidioc_g_audio>` ioctl
202 * @vidioc_enumaudout: pointer to the function that implements
203 * :ref:`VIDIOC_ENUMAUDOUT <vidioc_enumaudout>` ioctl
204 * @vidioc_g_audout: pointer to the function that implements
205 * :ref:`VIDIOC_G_AUDOUT <vidioc_g_audout>` ioctl
206 * @vidioc_s_audout: pointer to the function that implements
207 * :ref:`VIDIOC_S_AUDOUT <vidioc_g_audout>` ioctl
208 * @vidioc_g_modulator: pointer to the function that implements
209 * :ref:`VIDIOC_G_MODULATOR <vidioc_g_modulator>` ioctl
210 * @vidioc_s_modulator: pointer to the function that implements
211 * :ref:`VIDIOC_S_MODULATOR <vidioc_g_modulator>` ioctl
212 * @vidioc_cropcap: pointer to the function that implements
213 * :ref:`VIDIOC_CROPCAP <vidioc_cropcap>` ioctl
214 * @vidioc_g_crop: pointer to the function that implements
215 * :ref:`VIDIOC_G_CROP <vidioc_g_crop>` ioctl
216 * @vidioc_s_crop: pointer to the function that implements
217 * :ref:`VIDIOC_S_CROP <vidioc_g_crop>` ioctl
218 * @vidioc_g_selection: pointer to the function that implements
219 * :ref:`VIDIOC_G_SELECTION <vidioc_g_selection>` ioctl
220 * @vidioc_s_selection: pointer to the function that implements
221 * :ref:`VIDIOC_S_SELECTION <vidioc_g_selection>` ioctl
222 * @vidioc_g_jpegcomp: pointer to the function that implements
223 * :ref:`VIDIOC_G_JPEGCOMP <vidioc_g_jpegcomp>` ioctl
224 * @vidioc_s_jpegcomp: pointer to the function that implements
225 * :ref:`VIDIOC_S_JPEGCOMP <vidioc_g_jpegcomp>` ioctl
226 * @vidioc_g_enc_index: pointer to the function that implements
227 * :ref:`VIDIOC_G_ENC_INDEX <vidioc_g_enc_index>` ioctl
228 * @vidioc_encoder_cmd: pointer to the function that implements
229 * :ref:`VIDIOC_ENCODER_CMD <vidioc_encoder_cmd>` ioctl
230 * @vidioc_try_encoder_cmd: pointer to the function that implements
231 * :ref:`VIDIOC_TRY_ENCODER_CMD <vidioc_encoder_cmd>` ioctl
232 * @vidioc_decoder_cmd: pointer to the function that implements
233 * :ref:`VIDIOC_DECODER_CMD <vidioc_decoder_cmd>` ioctl
234 * @vidioc_try_decoder_cmd: pointer to the function that implements
235 * :ref:`VIDIOC_TRY_DECODER_CMD <vidioc_decoder_cmd>` ioctl
236 * @vidioc_g_parm: pointer to the function that implements
237 * :ref:`VIDIOC_G_PARM <vidioc_g_parm>` ioctl
238 * @vidioc_s_parm: pointer to the function that implements
239 * :ref:`VIDIOC_S_PARM <vidioc_g_parm>` ioctl
240 * @vidioc_g_tuner: pointer to the function that implements
241 * :ref:`VIDIOC_G_TUNER <vidioc_g_tuner>` ioctl
242 * @vidioc_s_tuner: pointer to the function that implements
243 * :ref:`VIDIOC_S_TUNER <vidioc_g_tuner>` ioctl
244 * @vidioc_g_frequency: pointer to the function that implements
245 * :ref:`VIDIOC_G_FREQUENCY <vidioc_g_frequency>` ioctl
246 * @vidioc_s_frequency: pointer to the function that implements
247 * :ref:`VIDIOC_S_FREQUENCY <vidioc_g_frequency>` ioctl
248 * @vidioc_enum_freq_bands: pointer to the function that implements
249 * :ref:`VIDIOC_ENUM_FREQ_BANDS <vidioc_enum_freq_bands>` ioctl
250 * @vidioc_g_sliced_vbi_cap: pointer to the function that implements
251 * :ref:`VIDIOC_G_SLICED_VBI_CAP <vidioc_g_sliced_vbi_cap>` ioctl
252 * @vidioc_log_status: pointer to the function that implements
253 * :ref:`VIDIOC_LOG_STATUS <vidioc_log_status>` ioctl
254 * @vidioc_s_hw_freq_seek: pointer to the function that implements
255 * :ref:`VIDIOC_S_HW_FREQ_SEEK <vidioc_s_hw_freq_seek>` ioctl
256 * @vidioc_g_register: pointer to the function that implements
257 * :ref:`VIDIOC_DBG_G_REGISTER <vidioc_dbg_g_register>` ioctl
258 * @vidioc_s_register: pointer to the function that implements
259 * :ref:`VIDIOC_DBG_S_REGISTER <vidioc_dbg_g_register>` ioctl
260 * @vidioc_g_chip_info: pointer to the function that implements
261 * :ref:`VIDIOC_DBG_G_CHIP_INFO <vidioc_dbg_g_chip_info>` ioctl
262 * @vidioc_enum_framesizes: pointer to the function that implements
263 * :ref:`VIDIOC_ENUM_FRAMESIZES <vidioc_enum_framesizes>` ioctl
264 * @vidioc_enum_frameintervals: pointer to the function that implements
265 * :ref:`VIDIOC_ENUM_FRAMEINTERVALS <vidioc_enum_frameintervals>` ioctl
266 * @vidioc_s_dv_timings: pointer to the function that implements
267 * :ref:`VIDIOC_S_DV_TIMINGS <vidioc_g_dv_timings>` ioctl
268 * @vidioc_g_dv_timings: pointer to the function that implements
269 * :ref:`VIDIOC_G_DV_TIMINGS <vidioc_g_dv_timings>` ioctl
270 * @vidioc_query_dv_timings: pointer to the function that implements
271 * :ref:`VIDIOC_QUERY_DV_TIMINGS <vidioc_query_dv_timings>` ioctl
272 * @vidioc_enum_dv_timings: pointer to the function that implements
273 * :ref:`VIDIOC_ENUM_DV_TIMINGS <vidioc_enum_dv_timings>` ioctl
274 * @vidioc_dv_timings_cap: pointer to the function that implements
275 * :ref:`VIDIOC_DV_TIMINGS_CAP <vidioc_dv_timings_cap>` ioctl
276 * @vidioc_g_edid: pointer to the function that implements
277 * :ref:`VIDIOC_G_EDID <vidioc_g_edid>` ioctl
278 * @vidioc_s_edid: pointer to the function that implements
279 * :ref:`VIDIOC_S_EDID <vidioc_g_edid>` ioctl
280 * @vidioc_subscribe_event: pointer to the function that implements
281 * :ref:`VIDIOC_SUBSCRIBE_EVENT <vidioc_subscribe_event>` ioctl
282 * @vidioc_unsubscribe_event: pointer to the function that implements
283 * :ref:`VIDIOC_UNSUBSCRIBE_EVENT <vidioc_unsubscribe_event>` ioctl
284 * @vidioc_default: pointed used to allow other ioctls
285 */
Hans Verkuila3998102008-07-21 02:57:38 -0300286struct v4l2_ioctl_ops {
287 /* ioctl callbacks */
288
289 /* VIDIOC_QUERYCAP handler */
290 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
291
Hans Verkuila3998102008-07-21 02:57:38 -0300292 /* VIDIOC_ENUM_FMT handlers */
293 int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh,
294 struct v4l2_fmtdesc *f);
295 int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh,
296 struct v4l2_fmtdesc *f);
297 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh,
298 struct v4l2_fmtdesc *f);
Pawel Osciakd14e6d72010-12-23 04:15:27 -0300299 int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh,
300 struct v4l2_fmtdesc *f);
301 int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh,
302 struct v4l2_fmtdesc *f);
Antti Palosaari855df1d2013-12-14 13:10:20 -0300303 int (*vidioc_enum_fmt_sdr_cap) (struct file *file, void *fh,
304 struct v4l2_fmtdesc *f);
Antti Palosaari9effc722015-10-10 13:51:00 -0300305 int (*vidioc_enum_fmt_sdr_out) (struct file *file, void *fh,
306 struct v4l2_fmtdesc *f);
Hans Verkuila3998102008-07-21 02:57:38 -0300307
308 /* VIDIOC_G_FMT handlers */
309 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh,
310 struct v4l2_format *f);
311 int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
312 struct v4l2_format *f);
313 int (*vidioc_g_fmt_vid_out) (struct file *file, void *fh,
314 struct v4l2_format *f);
315 int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
316 struct v4l2_format *f);
317 int (*vidioc_g_fmt_vbi_cap) (struct file *file, void *fh,
318 struct v4l2_format *f);
319 int (*vidioc_g_fmt_vbi_out) (struct file *file, void *fh,
320 struct v4l2_format *f);
321 int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
322 struct v4l2_format *f);
323 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
324 struct v4l2_format *f);
Pawel Osciakd14e6d72010-12-23 04:15:27 -0300325 int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
326 struct v4l2_format *f);
327 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
328 struct v4l2_format *f);
Antti Palosaari855df1d2013-12-14 13:10:20 -0300329 int (*vidioc_g_fmt_sdr_cap) (struct file *file, void *fh,
330 struct v4l2_format *f);
Antti Palosaari9effc722015-10-10 13:51:00 -0300331 int (*vidioc_g_fmt_sdr_out) (struct file *file, void *fh,
332 struct v4l2_format *f);
Hans Verkuila3998102008-07-21 02:57:38 -0300333
334 /* VIDIOC_S_FMT handlers */
335 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh,
336 struct v4l2_format *f);
337 int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
338 struct v4l2_format *f);
339 int (*vidioc_s_fmt_vid_out) (struct file *file, void *fh,
340 struct v4l2_format *f);
341 int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
342 struct v4l2_format *f);
343 int (*vidioc_s_fmt_vbi_cap) (struct file *file, void *fh,
344 struct v4l2_format *f);
345 int (*vidioc_s_fmt_vbi_out) (struct file *file, void *fh,
346 struct v4l2_format *f);
347 int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
348 struct v4l2_format *f);
349 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
350 struct v4l2_format *f);
Pawel Osciakd14e6d72010-12-23 04:15:27 -0300351 int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
352 struct v4l2_format *f);
353 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
354 struct v4l2_format *f);
Antti Palosaari855df1d2013-12-14 13:10:20 -0300355 int (*vidioc_s_fmt_sdr_cap) (struct file *file, void *fh,
356 struct v4l2_format *f);
Antti Palosaari9effc722015-10-10 13:51:00 -0300357 int (*vidioc_s_fmt_sdr_out) (struct file *file, void *fh,
358 struct v4l2_format *f);
Hans Verkuila3998102008-07-21 02:57:38 -0300359
360 /* VIDIOC_TRY_FMT handlers */
361 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh,
362 struct v4l2_format *f);
363 int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
364 struct v4l2_format *f);
365 int (*vidioc_try_fmt_vid_out) (struct file *file, void *fh,
366 struct v4l2_format *f);
367 int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
368 struct v4l2_format *f);
369 int (*vidioc_try_fmt_vbi_cap) (struct file *file, void *fh,
370 struct v4l2_format *f);
371 int (*vidioc_try_fmt_vbi_out) (struct file *file, void *fh,
372 struct v4l2_format *f);
373 int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
374 struct v4l2_format *f);
375 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
376 struct v4l2_format *f);
Pawel Osciakd14e6d72010-12-23 04:15:27 -0300377 int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
378 struct v4l2_format *f);
379 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
380 struct v4l2_format *f);
Antti Palosaari855df1d2013-12-14 13:10:20 -0300381 int (*vidioc_try_fmt_sdr_cap) (struct file *file, void *fh,
382 struct v4l2_format *f);
Antti Palosaari9effc722015-10-10 13:51:00 -0300383 int (*vidioc_try_fmt_sdr_out) (struct file *file, void *fh,
384 struct v4l2_format *f);
Hans Verkuila3998102008-07-21 02:57:38 -0300385
386 /* Buffer handlers */
387 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
388 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
389 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
Tomasz Stanislawskib799d092012-06-14 11:32:23 -0300390 int (*vidioc_expbuf) (struct file *file, void *fh,
391 struct v4l2_exportbuffer *e);
Hans Verkuila3998102008-07-21 02:57:38 -0300392 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
393
Guennadi Liakhovetski21501582011-09-28 11:34:06 -0300394 int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
395 int (*vidioc_prepare_buf)(struct file *file, void *fh, struct v4l2_buffer *b);
Hans Verkuila3998102008-07-21 02:57:38 -0300396
397 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
Hans Verkuila3998102008-07-21 02:57:38 -0300398 int (*vidioc_g_fbuf) (struct file *file, void *fh,
399 struct v4l2_framebuffer *a);
400 int (*vidioc_s_fbuf) (struct file *file, void *fh,
Hans Verkuile6eb28c2012-09-04 10:26:45 -0300401 const struct v4l2_framebuffer *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300402
403 /* Stream on/off */
404 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
405 int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
406
407 /* Standard handling
408 ENUMSTD is handled by videodev.c
409 */
410 int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm);
Hans Verkuil314527a2013-03-15 06:10:40 -0300411 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id norm);
Hans Verkuila3998102008-07-21 02:57:38 -0300412 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
413
414 /* Input handling */
415 int (*vidioc_enum_input)(struct file *file, void *fh,
416 struct v4l2_input *inp);
417 int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i);
418 int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i);
419
420 /* Output handling */
421 int (*vidioc_enum_output) (struct file *file, void *fh,
422 struct v4l2_output *a);
423 int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i);
424 int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i);
425
426 /* Control handling */
427 int (*vidioc_queryctrl) (struct file *file, void *fh,
428 struct v4l2_queryctrl *a);
Hans Verkuile6bee362014-06-10 04:22:06 -0300429 int (*vidioc_query_ext_ctrl) (struct file *file, void *fh,
430 struct v4l2_query_ext_ctrl *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300431 int (*vidioc_g_ctrl) (struct file *file, void *fh,
432 struct v4l2_control *a);
433 int (*vidioc_s_ctrl) (struct file *file, void *fh,
434 struct v4l2_control *a);
435 int (*vidioc_g_ext_ctrls) (struct file *file, void *fh,
436 struct v4l2_ext_controls *a);
437 int (*vidioc_s_ext_ctrls) (struct file *file, void *fh,
438 struct v4l2_ext_controls *a);
439 int (*vidioc_try_ext_ctrls) (struct file *file, void *fh,
440 struct v4l2_ext_controls *a);
441 int (*vidioc_querymenu) (struct file *file, void *fh,
442 struct v4l2_querymenu *a);
443
444 /* Audio ioctls */
445 int (*vidioc_enumaudio) (struct file *file, void *fh,
446 struct v4l2_audio *a);
447 int (*vidioc_g_audio) (struct file *file, void *fh,
448 struct v4l2_audio *a);
449 int (*vidioc_s_audio) (struct file *file, void *fh,
Hans Verkuil0e8025b92012-09-04 11:59:31 -0300450 const struct v4l2_audio *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300451
452 /* Audio out ioctls */
453 int (*vidioc_enumaudout) (struct file *file, void *fh,
454 struct v4l2_audioout *a);
455 int (*vidioc_g_audout) (struct file *file, void *fh,
456 struct v4l2_audioout *a);
457 int (*vidioc_s_audout) (struct file *file, void *fh,
Hans Verkuilba9425b2012-09-04 12:03:49 -0300458 const struct v4l2_audioout *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300459 int (*vidioc_g_modulator) (struct file *file, void *fh,
460 struct v4l2_modulator *a);
461 int (*vidioc_s_modulator) (struct file *file, void *fh,
Hans Verkuil3f70e1f2012-09-04 12:08:47 -0300462 const struct v4l2_modulator *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300463 /* Crop ioctls */
464 int (*vidioc_cropcap) (struct file *file, void *fh,
465 struct v4l2_cropcap *a);
466 int (*vidioc_g_crop) (struct file *file, void *fh,
467 struct v4l2_crop *a);
468 int (*vidioc_s_crop) (struct file *file, void *fh,
Hans Verkuil4f996592012-09-05 05:10:48 -0300469 const struct v4l2_crop *a);
Tomasz Stanislawski0e8caac2011-08-10 10:37:47 -0300470 int (*vidioc_g_selection) (struct file *file, void *fh,
471 struct v4l2_selection *s);
472 int (*vidioc_s_selection) (struct file *file, void *fh,
473 struct v4l2_selection *s);
Hans Verkuila3998102008-07-21 02:57:38 -0300474 /* Compression ioctls */
475 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
476 struct v4l2_jpegcompression *a);
477 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
Hans Verkuild88aab52012-09-17 05:05:25 -0300478 const struct v4l2_jpegcompression *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300479 int (*vidioc_g_enc_index) (struct file *file, void *fh,
480 struct v4l2_enc_idx *a);
481 int (*vidioc_encoder_cmd) (struct file *file, void *fh,
482 struct v4l2_encoder_cmd *a);
483 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
484 struct v4l2_encoder_cmd *a);
Hans Verkuila45c0ad2011-11-24 09:53:43 -0300485 int (*vidioc_decoder_cmd) (struct file *file, void *fh,
486 struct v4l2_decoder_cmd *a);
487 int (*vidioc_try_decoder_cmd) (struct file *file, void *fh,
488 struct v4l2_decoder_cmd *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300489
490 /* Stream type-dependent parameter ioctls */
491 int (*vidioc_g_parm) (struct file *file, void *fh,
492 struct v4l2_streamparm *a);
493 int (*vidioc_s_parm) (struct file *file, void *fh,
494 struct v4l2_streamparm *a);
495
496 /* Tuner ioctls */
497 int (*vidioc_g_tuner) (struct file *file, void *fh,
498 struct v4l2_tuner *a);
499 int (*vidioc_s_tuner) (struct file *file, void *fh,
Hans Verkuil2f73c7c2013-03-15 06:10:06 -0300500 const struct v4l2_tuner *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300501 int (*vidioc_g_frequency) (struct file *file, void *fh,
502 struct v4l2_frequency *a);
503 int (*vidioc_s_frequency) (struct file *file, void *fh,
Hans Verkuilb530a442013-03-19 04:09:26 -0300504 const struct v4l2_frequency *a);
Hans Verkuil82b655b2012-07-05 06:37:08 -0300505 int (*vidioc_enum_freq_bands) (struct file *file, void *fh,
506 struct v4l2_frequency_band *band);
Hans Verkuila3998102008-07-21 02:57:38 -0300507
508 /* Sliced VBI cap */
509 int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
510 struct v4l2_sliced_vbi_cap *a);
511
512 /* Log status ioctl */
513 int (*vidioc_log_status) (struct file *file, void *fh);
514
515 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh,
Hans Verkuilec6f4322012-09-14 07:41:18 -0300516 const struct v4l2_hw_freq_seek *a);
Hans Verkuila3998102008-07-21 02:57:38 -0300517
518 /* Debugging ioctls */
519#ifdef CONFIG_VIDEO_ADV_DEBUG
520 int (*vidioc_g_register) (struct file *file, void *fh,
Hans Verkuilaecde8b52008-12-30 07:14:19 -0300521 struct v4l2_dbg_register *reg);
Hans Verkuila3998102008-07-21 02:57:38 -0300522 int (*vidioc_s_register) (struct file *file, void *fh,
Hans Verkuil977ba3b2013-03-24 08:28:46 -0300523 const struct v4l2_dbg_register *reg);
Hans Verkuila3998102008-07-21 02:57:38 -0300524
Hans Verkuil96b03d22013-04-06 06:16:58 -0300525 int (*vidioc_g_chip_info) (struct file *file, void *fh,
526 struct v4l2_dbg_chip_info *chip);
Hans Verkuilcd634f12013-03-27 08:04:23 -0300527#endif
Hans Verkuil79b0c642013-03-18 12:16:34 -0300528
Mauro Carvalho Chehab74d83fa2008-11-11 21:13:47 -0300529 int (*vidioc_enum_framesizes) (struct file *file, void *fh,
530 struct v4l2_frmsizeenum *fsize);
531
532 int (*vidioc_enum_frameintervals) (struct file *file, void *fh,
533 struct v4l2_frmivalenum *fival);
534
Muralidharan Karicherib6456c02009-11-19 12:00:31 -0300535 /* DV Timings IOCTLs */
Muralidharan Karicherib6456c02009-11-19 12:00:31 -0300536 int (*vidioc_s_dv_timings) (struct file *file, void *fh,
537 struct v4l2_dv_timings *timings);
538 int (*vidioc_g_dv_timings) (struct file *file, void *fh,
539 struct v4l2_dv_timings *timings);
Hans Verkuil5d7758e2012-05-15 08:06:44 -0300540 int (*vidioc_query_dv_timings) (struct file *file, void *fh,
541 struct v4l2_dv_timings *timings);
542 int (*vidioc_enum_dv_timings) (struct file *file, void *fh,
543 struct v4l2_enum_dv_timings *timings);
544 int (*vidioc_dv_timings_cap) (struct file *file, void *fh,
545 struct v4l2_dv_timings_cap *cap);
Hans Verkuildd519bb2014-03-07 07:18:37 -0300546 int (*vidioc_g_edid) (struct file *file, void *fh, struct v4l2_edid *edid);
547 int (*vidioc_s_edid) (struct file *file, void *fh, struct v4l2_edid *edid);
Muralidharan Karicherib6456c02009-11-19 12:00:31 -0300548
Sakari Ailusd3d7c962010-03-27 11:02:10 -0300549 int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
Hans Verkuil85f5fe32012-09-04 11:46:09 -0300550 const struct v4l2_event_subscription *sub);
Sakari Ailusd3d7c962010-03-27 11:02:10 -0300551 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
Hans Verkuil85f5fe32012-09-04 11:46:09 -0300552 const struct v4l2_event_subscription *sub);
Sakari Ailusd3d7c962010-03-27 11:02:10 -0300553
Hans Verkuila3998102008-07-21 02:57:38 -0300554 /* For other private ioctls */
Hans Verkuil069b7472008-12-30 07:04:34 -0300555 long (*vidioc_default) (struct file *file, void *fh,
Mauro Carvalho Chehab6d43be72013-03-26 08:04:52 -0300556 bool valid_prio, unsigned int cmd, void *arg);
Hans Verkuila3998102008-07-21 02:57:38 -0300557};
558
559
Mauro Carvalho Chehab28644622008-07-20 20:26:54 -0300560/* v4l debugging and diagnostics */
561
Hans Verkuil17028cd2014-12-01 10:10:44 -0300562/* Device debug flags to be used with the video device debug attribute */
563
564/* Just log the ioctl name + error code */
565#define V4L2_DEV_DEBUG_IOCTL 0x01
566/* Log the ioctl name arguments + error code */
567#define V4L2_DEV_DEBUG_IOCTL_ARG 0x02
568/* Log the file operations open, release, mmap and get_unmapped_area */
569#define V4L2_DEV_DEBUG_FOP 0x04
570/* Log the read and write file operations and the VIDIOC_(D)QBUF ioctls */
571#define V4L2_DEV_DEBUG_STREAMING 0x08
572/* Log poll() */
573#define V4L2_DEV_DEBUG_POLL 0x10
Mauro Carvalho Chehab28644622008-07-20 20:26:54 -0300574
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300575/* Video standard functions */
576extern const char *v4l2_norm_to_name(v4l2_std_id id);
Trent Piepho51f0b8d52009-03-04 01:21:02 -0300577extern void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300578extern int v4l2_video_std_construct(struct v4l2_standard *vs,
579 int id, const char *name);
Hans Verkuil4a085162012-06-22 06:38:06 -0300580/* Prints the ioctl in a human-readable format. If prefix != NULL,
581 then do printk(KERN_DEBUG "%s: ", prefix) first. */
582extern void v4l_printk_ioctl(const char *prefix, unsigned int cmd);
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300583
Hans Verkuil5a5adf62012-06-22 07:29:35 -0300584/* Internal use only: get the mutex (if any) that we need to lock for the
585 given command. */
586struct video_device;
587extern struct mutex *v4l2_ioctl_get_lock(struct video_device *vdev, unsigned cmd);
588
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300589/* names for fancy debug output */
590extern const char *v4l2_field_names[];
591extern const char *v4l2_type_names[];
592
Hans Verkuilbec43662008-12-30 06:58:20 -0300593#ifdef CONFIG_COMPAT
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300594/* 32 Bits compatibility layer for 64 bits processors */
Hans Verkuil9bb7cde2008-12-30 06:42:40 -0300595extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300596 unsigned long arg);
Hans Verkuilbec43662008-12-30 06:58:20 -0300597#endif
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300598
Hans Verkuil08af2452010-12-24 10:33:19 -0300599typedef long (*v4l2_kioctl)(struct file *file,
600 unsigned int cmd, void *arg);
601
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300602/* Include support for obsoleted stuff */
Hans Verkuil069b7472008-12-30 07:04:34 -0300603extern long video_usercopy(struct file *file, unsigned int cmd,
Hans Verkuilf473bf72008-11-01 08:25:11 -0300604 unsigned long arg, v4l2_kioctl func);
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300605
Mauro Carvalho Chehab8a522c92008-10-21 11:58:39 -0300606/* Standard handlers for V4L ioctl's */
Hans Verkuil069b7472008-12-30 07:04:34 -0300607extern long video_ioctl2(struct file *file,
Mauro Carvalho Chehab8a522c92008-10-21 11:58:39 -0300608 unsigned int cmd, unsigned long arg);
609
Hans Verkuil35ea11f2008-07-20 08:12:02 -0300610#endif /* _V4L2_IOCTL_H */