Merge tag 'for-5.1-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[linux-2.6-block.git] / include / media / v4l2-ioctl.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
35ea11ff
HV
2/*
3 *
4 * V 4 L 2 D R I V E R H E L P E R A P I
5 *
6 * Moved from videodev2.h
7 *
8 * Some commonly needed functions for drivers (v4l2-common.o module)
9 */
10#ifndef _V4L2_IOCTL_H
11#define _V4L2_IOCTL_H
12
13#include <linux/poll.h>
14#include <linux/fs.h>
35ea11ff 15#include <linux/mutex.h>
174cd4b1 16#include <linux/sched/signal.h>
35ea11ff 17#include <linux/compiler.h> /* need __user */
35ea11ff 18#include <linux/videodev2.h>
35ea11ff 19
d3d7c963
SA
20struct v4l2_fh;
21
c91661f1
MCC
22/**
23 * struct v4l2_ioctl_ops - describe operations for each V4L2 ioctl
24 *
25 * @vidioc_querycap: pointer to the function that implements
26 * :ref:`VIDIOC_QUERYCAP <vidioc_querycap>` ioctl
27 * @vidioc_enum_fmt_vid_cap: pointer to the function that implements
28 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
29 * for video capture in single plane mode
30 * @vidioc_enum_fmt_vid_overlay: pointer to the function that implements
31 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
32 * for video overlay
33 * @vidioc_enum_fmt_vid_out: pointer to the function that implements
34 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
35 * for video output in single plane mode
36 * @vidioc_enum_fmt_vid_cap_mplane: pointer to the function that implements
37 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
38 * for video capture in multiplane mode
39 * @vidioc_enum_fmt_vid_out_mplane: pointer to the function that implements
40 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
41 * for video output in multiplane mode
42 * @vidioc_enum_fmt_sdr_cap: pointer to the function that implements
43 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
44 * for Software Defined Radio capture
45 * @vidioc_enum_fmt_sdr_out: pointer to the function that implements
46 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
47 * for Software Defined Radio output
fb9ffa6a
LP
48 * @vidioc_enum_fmt_meta_cap: pointer to the function that implements
49 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
50 * for metadata capture
72148d1a
SA
51 * @vidioc_enum_fmt_meta_out: pointer to the function that implements
52 * :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
53 * for metadata output
c91661f1
MCC
54 * @vidioc_g_fmt_vid_cap: pointer to the function that implements
55 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
56 * in single plane mode
57 * @vidioc_g_fmt_vid_overlay: pointer to the function that implements
58 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay
59 * @vidioc_g_fmt_vid_out: pointer to the function that implements
60 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
61 * in single plane mode
62 * @vidioc_g_fmt_vid_out_overlay: pointer to the function that implements
63 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
64 * @vidioc_g_fmt_vbi_cap: pointer to the function that implements
65 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
66 * @vidioc_g_fmt_vbi_out: pointer to the function that implements
67 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
68 * @vidioc_g_fmt_sliced_vbi_cap: pointer to the function that implements
69 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
70 * @vidioc_g_fmt_sliced_vbi_out: pointer to the function that implements
71 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
72 * @vidioc_g_fmt_vid_cap_mplane: pointer to the function that implements
73 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
74 * in multiple plane mode
75 * @vidioc_g_fmt_vid_out_mplane: pointer to the function that implements
76 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
77 * in multiplane plane mode
78 * @vidioc_g_fmt_sdr_cap: pointer to the function that implements
79 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
80 * Radio capture
81 * @vidioc_g_fmt_sdr_out: pointer to the function that implements
82 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
83 * Radio output
fb9ffa6a
LP
84 * @vidioc_g_fmt_meta_cap: pointer to the function that implements
85 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
72148d1a
SA
86 * @vidioc_g_fmt_meta_out: pointer to the function that implements
87 * :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for metadata output
c91661f1
MCC
88 * @vidioc_s_fmt_vid_cap: pointer to the function that implements
89 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video capture
90 * in single plane mode
91 * @vidioc_s_fmt_vid_overlay: pointer to the function that implements
92 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video overlay
93 * @vidioc_s_fmt_vid_out: pointer to the function that implements
94 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video out
95 * in single plane mode
96 * @vidioc_s_fmt_vid_out_overlay: pointer to the function that implements
97 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
98 * @vidioc_s_fmt_vbi_cap: pointer to the function that implements
99 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
100 * @vidioc_s_fmt_vbi_out: pointer to the function that implements
101 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
102 * @vidioc_s_fmt_sliced_vbi_cap: pointer to the function that implements
103 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
104 * @vidioc_s_fmt_sliced_vbi_out: pointer to the function that implements
105 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
106 * @vidioc_s_fmt_vid_cap_mplane: pointer to the function that implements
107 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video capture
108 * in multiple plane mode
109 * @vidioc_s_fmt_vid_out_mplane: pointer to the function that implements
110 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video out
111 * in multiplane plane mode
112 * @vidioc_s_fmt_sdr_cap: pointer to the function that implements
113 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
114 * Radio capture
115 * @vidioc_s_fmt_sdr_out: pointer to the function that implements
116 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
117 * Radio output
fb9ffa6a
LP
118 * @vidioc_s_fmt_meta_cap: pointer to the function that implements
119 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
72148d1a
SA
120 * @vidioc_s_fmt_meta_out: pointer to the function that implements
121 * :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for metadata output
c91661f1
MCC
122 * @vidioc_try_fmt_vid_cap: pointer to the function that implements
123 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
124 * in single plane mode
125 * @vidioc_try_fmt_vid_overlay: pointer to the function that implements
126 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
127 * @vidioc_try_fmt_vid_out: pointer to the function that implements
128 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
129 * in single plane mode
130 * @vidioc_try_fmt_vid_out_overlay: pointer to the function that implements
131 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
132 * output
133 * @vidioc_try_fmt_vbi_cap: pointer to the function that implements
134 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
135 * @vidioc_try_fmt_vbi_out: pointer to the function that implements
136 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
137 * @vidioc_try_fmt_sliced_vbi_cap: pointer to the function that implements
138 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI
139 * capture
140 * @vidioc_try_fmt_sliced_vbi_out: pointer to the function that implements
141 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
142 * @vidioc_try_fmt_vid_cap_mplane: pointer to the function that implements
143 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
144 * in multiple plane mode
145 * @vidioc_try_fmt_vid_out_mplane: pointer to the function that implements
146 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
147 * in multiplane plane mode
148 * @vidioc_try_fmt_sdr_cap: pointer to the function that implements
149 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
150 * Radio capture
151 * @vidioc_try_fmt_sdr_out: pointer to the function that implements
152 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
153 * Radio output
fb9ffa6a
LP
154 * @vidioc_try_fmt_meta_cap: pointer to the function that implements
155 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
72148d1a
SA
156 * @vidioc_try_fmt_meta_out: pointer to the function that implements
157 * :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for metadata output
c91661f1
MCC
158 * @vidioc_reqbufs: pointer to the function that implements
159 * :ref:`VIDIOC_REQBUFS <vidioc_reqbufs>` ioctl
160 * @vidioc_querybuf: pointer to the function that implements
161 * :ref:`VIDIOC_QUERYBUF <vidioc_querybuf>` ioctl
162 * @vidioc_qbuf: pointer to the function that implements
163 * :ref:`VIDIOC_QBUF <vidioc_qbuf>` ioctl
164 * @vidioc_expbuf: pointer to the function that implements
165 * :ref:`VIDIOC_EXPBUF <vidioc_expbuf>` ioctl
166 * @vidioc_dqbuf: pointer to the function that implements
167 * :ref:`VIDIOC_DQBUF <vidioc_qbuf>` ioctl
168 * @vidioc_create_bufs: pointer to the function that implements
169 * :ref:`VIDIOC_CREATE_BUFS <vidioc_create_bufs>` ioctl
170 * @vidioc_prepare_buf: pointer to the function that implements
171 * :ref:`VIDIOC_PREPARE_BUF <vidioc_prepare_buf>` ioctl
172 * @vidioc_overlay: pointer to the function that implements
173 * :ref:`VIDIOC_OVERLAY <vidioc_overlay>` ioctl
174 * @vidioc_g_fbuf: pointer to the function that implements
175 * :ref:`VIDIOC_G_FBUF <vidioc_g_fbuf>` ioctl
176 * @vidioc_s_fbuf: pointer to the function that implements
177 * :ref:`VIDIOC_S_FBUF <vidioc_g_fbuf>` ioctl
178 * @vidioc_streamon: pointer to the function that implements
179 * :ref:`VIDIOC_STREAMON <vidioc_streamon>` ioctl
180 * @vidioc_streamoff: pointer to the function that implements
181 * :ref:`VIDIOC_STREAMOFF <vidioc_streamon>` ioctl
182 * @vidioc_g_std: pointer to the function that implements
183 * :ref:`VIDIOC_G_STD <vidioc_g_std>` ioctl
184 * @vidioc_s_std: pointer to the function that implements
185 * :ref:`VIDIOC_S_STD <vidioc_g_std>` ioctl
186 * @vidioc_querystd: pointer to the function that implements
187 * :ref:`VIDIOC_QUERYSTD <vidioc_querystd>` ioctl
188 * @vidioc_enum_input: pointer to the function that implements
189 * :ref:`VIDIOC_ENUM_INPUT <vidioc_g_input>` ioctl
190 * @vidioc_g_input: pointer to the function that implements
191 * :ref:`VIDIOC_G_INPUT <vidioc_g_input>` ioctl
192 * @vidioc_s_input: pointer to the function that implements
193 * :ref:`VIDIOC_S_INPUT <vidioc_g_input>` ioctl
194 * @vidioc_enum_output: pointer to the function that implements
195 * :ref:`VIDIOC_ENUM_OUTPUT <vidioc_g_output>` ioctl
196 * @vidioc_g_output: pointer to the function that implements
197 * :ref:`VIDIOC_G_OUTPUT <vidioc_g_output>` ioctl
198 * @vidioc_s_output: pointer to the function that implements
199 * :ref:`VIDIOC_S_OUTPUT <vidioc_g_output>` ioctl
200 * @vidioc_queryctrl: pointer to the function that implements
201 * :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
202 * @vidioc_query_ext_ctrl: pointer to the function that implements
203 * :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
204 * @vidioc_g_ctrl: pointer to the function that implements
205 * :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
206 * @vidioc_s_ctrl: pointer to the function that implements
207 * :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
208 * @vidioc_g_ext_ctrls: pointer to the function that implements
209 * :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
210 * @vidioc_s_ext_ctrls: pointer to the function that implements
211 * :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
212 * @vidioc_try_ext_ctrls: pointer to the function that implements
213 * :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
214 * @vidioc_querymenu: pointer to the function that implements
215 * :ref:`VIDIOC_QUERYMENU <vidioc_queryctrl>` ioctl
216 * @vidioc_enumaudio: pointer to the function that implements
217 * :ref:`VIDIOC_ENUMAUDIO <vidioc_enumaudio>` ioctl
218 * @vidioc_g_audio: pointer to the function that implements
219 * :ref:`VIDIOC_G_AUDIO <vidioc_g_audio>` ioctl
220 * @vidioc_s_audio: pointer to the function that implements
221 * :ref:`VIDIOC_S_AUDIO <vidioc_g_audio>` ioctl
222 * @vidioc_enumaudout: pointer to the function that implements
223 * :ref:`VIDIOC_ENUMAUDOUT <vidioc_enumaudout>` ioctl
224 * @vidioc_g_audout: pointer to the function that implements
225 * :ref:`VIDIOC_G_AUDOUT <vidioc_g_audout>` ioctl
226 * @vidioc_s_audout: pointer to the function that implements
227 * :ref:`VIDIOC_S_AUDOUT <vidioc_g_audout>` ioctl
228 * @vidioc_g_modulator: pointer to the function that implements
229 * :ref:`VIDIOC_G_MODULATOR <vidioc_g_modulator>` ioctl
230 * @vidioc_s_modulator: pointer to the function that implements
231 * :ref:`VIDIOC_S_MODULATOR <vidioc_g_modulator>` ioctl
5200ab6a
HV
232 * @vidioc_g_pixelaspect: pointer to the function that implements
233 * the pixelaspect part of the :ref:`VIDIOC_CROPCAP <vidioc_cropcap>` ioctl
c91661f1
MCC
234 * @vidioc_g_selection: pointer to the function that implements
235 * :ref:`VIDIOC_G_SELECTION <vidioc_g_selection>` ioctl
236 * @vidioc_s_selection: pointer to the function that implements
237 * :ref:`VIDIOC_S_SELECTION <vidioc_g_selection>` ioctl
238 * @vidioc_g_jpegcomp: pointer to the function that implements
239 * :ref:`VIDIOC_G_JPEGCOMP <vidioc_g_jpegcomp>` ioctl
240 * @vidioc_s_jpegcomp: pointer to the function that implements
241 * :ref:`VIDIOC_S_JPEGCOMP <vidioc_g_jpegcomp>` ioctl
242 * @vidioc_g_enc_index: pointer to the function that implements
243 * :ref:`VIDIOC_G_ENC_INDEX <vidioc_g_enc_index>` ioctl
244 * @vidioc_encoder_cmd: pointer to the function that implements
245 * :ref:`VIDIOC_ENCODER_CMD <vidioc_encoder_cmd>` ioctl
246 * @vidioc_try_encoder_cmd: pointer to the function that implements
247 * :ref:`VIDIOC_TRY_ENCODER_CMD <vidioc_encoder_cmd>` ioctl
248 * @vidioc_decoder_cmd: pointer to the function that implements
249 * :ref:`VIDIOC_DECODER_CMD <vidioc_decoder_cmd>` ioctl
250 * @vidioc_try_decoder_cmd: pointer to the function that implements
251 * :ref:`VIDIOC_TRY_DECODER_CMD <vidioc_decoder_cmd>` ioctl
252 * @vidioc_g_parm: pointer to the function that implements
253 * :ref:`VIDIOC_G_PARM <vidioc_g_parm>` ioctl
254 * @vidioc_s_parm: pointer to the function that implements
255 * :ref:`VIDIOC_S_PARM <vidioc_g_parm>` ioctl
256 * @vidioc_g_tuner: pointer to the function that implements
257 * :ref:`VIDIOC_G_TUNER <vidioc_g_tuner>` ioctl
258 * @vidioc_s_tuner: pointer to the function that implements
259 * :ref:`VIDIOC_S_TUNER <vidioc_g_tuner>` ioctl
260 * @vidioc_g_frequency: pointer to the function that implements
261 * :ref:`VIDIOC_G_FREQUENCY <vidioc_g_frequency>` ioctl
262 * @vidioc_s_frequency: pointer to the function that implements
263 * :ref:`VIDIOC_S_FREQUENCY <vidioc_g_frequency>` ioctl
264 * @vidioc_enum_freq_bands: pointer to the function that implements
265 * :ref:`VIDIOC_ENUM_FREQ_BANDS <vidioc_enum_freq_bands>` ioctl
266 * @vidioc_g_sliced_vbi_cap: pointer to the function that implements
267 * :ref:`VIDIOC_G_SLICED_VBI_CAP <vidioc_g_sliced_vbi_cap>` ioctl
268 * @vidioc_log_status: pointer to the function that implements
269 * :ref:`VIDIOC_LOG_STATUS <vidioc_log_status>` ioctl
270 * @vidioc_s_hw_freq_seek: pointer to the function that implements
271 * :ref:`VIDIOC_S_HW_FREQ_SEEK <vidioc_s_hw_freq_seek>` ioctl
272 * @vidioc_g_register: pointer to the function that implements
273 * :ref:`VIDIOC_DBG_G_REGISTER <vidioc_dbg_g_register>` ioctl
274 * @vidioc_s_register: pointer to the function that implements
275 * :ref:`VIDIOC_DBG_S_REGISTER <vidioc_dbg_g_register>` ioctl
276 * @vidioc_g_chip_info: pointer to the function that implements
277 * :ref:`VIDIOC_DBG_G_CHIP_INFO <vidioc_dbg_g_chip_info>` ioctl
278 * @vidioc_enum_framesizes: pointer to the function that implements
279 * :ref:`VIDIOC_ENUM_FRAMESIZES <vidioc_enum_framesizes>` ioctl
280 * @vidioc_enum_frameintervals: pointer to the function that implements
281 * :ref:`VIDIOC_ENUM_FRAMEINTERVALS <vidioc_enum_frameintervals>` ioctl
282 * @vidioc_s_dv_timings: pointer to the function that implements
283 * :ref:`VIDIOC_S_DV_TIMINGS <vidioc_g_dv_timings>` ioctl
284 * @vidioc_g_dv_timings: pointer to the function that implements
285 * :ref:`VIDIOC_G_DV_TIMINGS <vidioc_g_dv_timings>` ioctl
286 * @vidioc_query_dv_timings: pointer to the function that implements
287 * :ref:`VIDIOC_QUERY_DV_TIMINGS <vidioc_query_dv_timings>` ioctl
288 * @vidioc_enum_dv_timings: pointer to the function that implements
289 * :ref:`VIDIOC_ENUM_DV_TIMINGS <vidioc_enum_dv_timings>` ioctl
290 * @vidioc_dv_timings_cap: pointer to the function that implements
291 * :ref:`VIDIOC_DV_TIMINGS_CAP <vidioc_dv_timings_cap>` ioctl
292 * @vidioc_g_edid: pointer to the function that implements
293 * :ref:`VIDIOC_G_EDID <vidioc_g_edid>` ioctl
294 * @vidioc_s_edid: pointer to the function that implements
295 * :ref:`VIDIOC_S_EDID <vidioc_g_edid>` ioctl
296 * @vidioc_subscribe_event: pointer to the function that implements
297 * :ref:`VIDIOC_SUBSCRIBE_EVENT <vidioc_subscribe_event>` ioctl
298 * @vidioc_unsubscribe_event: pointer to the function that implements
299 * :ref:`VIDIOC_UNSUBSCRIBE_EVENT <vidioc_unsubscribe_event>` ioctl
300 * @vidioc_default: pointed used to allow other ioctls
301 */
a399810c
HV
302struct v4l2_ioctl_ops {
303 /* ioctl callbacks */
304
305 /* VIDIOC_QUERYCAP handler */
bba65c13
MCC
306 int (*vidioc_querycap)(struct file *file, void *fh,
307 struct v4l2_capability *cap);
a399810c 308
a399810c 309 /* VIDIOC_ENUM_FMT handlers */
bba65c13
MCC
310 int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh,
311 struct v4l2_fmtdesc *f);
312 int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh,
313 struct v4l2_fmtdesc *f);
314 int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh,
315 struct v4l2_fmtdesc *f);
d14e6d76
PO
316 int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh,
317 struct v4l2_fmtdesc *f);
318 int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh,
319 struct v4l2_fmtdesc *f);
bba65c13
MCC
320 int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh,
321 struct v4l2_fmtdesc *f);
322 int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh,
323 struct v4l2_fmtdesc *f);
fb9ffa6a
LP
324 int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh,
325 struct v4l2_fmtdesc *f);
72148d1a
SA
326 int (*vidioc_enum_fmt_meta_out)(struct file *file, void *fh,
327 struct v4l2_fmtdesc *f);
a399810c
HV
328
329 /* VIDIOC_G_FMT handlers */
bba65c13
MCC
330 int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh,
331 struct v4l2_format *f);
a399810c
HV
332 int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
333 struct v4l2_format *f);
bba65c13
MCC
334 int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh,
335 struct v4l2_format *f);
a399810c 336 int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
bba65c13
MCC
337 struct v4l2_format *f);
338 int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh,
339 struct v4l2_format *f);
340 int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh,
341 struct v4l2_format *f);
a399810c 342 int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
bba65c13 343 struct v4l2_format *f);
a399810c 344 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
bba65c13 345 struct v4l2_format *f);
d14e6d76
PO
346 int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
347 struct v4l2_format *f);
348 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
349 struct v4l2_format *f);
bba65c13
MCC
350 int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh,
351 struct v4l2_format *f);
352 int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh,
353 struct v4l2_format *f);
fb9ffa6a
LP
354 int (*vidioc_g_fmt_meta_cap)(struct file *file, void *fh,
355 struct v4l2_format *f);
72148d1a
SA
356 int (*vidioc_g_fmt_meta_out)(struct file *file, void *fh,
357 struct v4l2_format *f);
a399810c
HV
358
359 /* VIDIOC_S_FMT handlers */
bba65c13
MCC
360 int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh,
361 struct v4l2_format *f);
a399810c
HV
362 int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
363 struct v4l2_format *f);
bba65c13
MCC
364 int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh,
365 struct v4l2_format *f);
a399810c 366 int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
bba65c13
MCC
367 struct v4l2_format *f);
368 int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh,
369 struct v4l2_format *f);
370 int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh,
371 struct v4l2_format *f);
a399810c 372 int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
bba65c13 373 struct v4l2_format *f);
a399810c 374 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
bba65c13 375 struct v4l2_format *f);
d14e6d76
PO
376 int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
377 struct v4l2_format *f);
378 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
379 struct v4l2_format *f);
bba65c13
MCC
380 int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh,
381 struct v4l2_format *f);
382 int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh,
383 struct v4l2_format *f);
fb9ffa6a
LP
384 int (*vidioc_s_fmt_meta_cap)(struct file *file, void *fh,
385 struct v4l2_format *f);
72148d1a
SA
386 int (*vidioc_s_fmt_meta_out)(struct file *file, void *fh,
387 struct v4l2_format *f);
a399810c
HV
388
389 /* VIDIOC_TRY_FMT handlers */
bba65c13
MCC
390 int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh,
391 struct v4l2_format *f);
a399810c
HV
392 int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
393 struct v4l2_format *f);
bba65c13
MCC
394 int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh,
395 struct v4l2_format *f);
a399810c 396 int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
bba65c13
MCC
397 struct v4l2_format *f);
398 int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh,
399 struct v4l2_format *f);
400 int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh,
401 struct v4l2_format *f);
a399810c 402 int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
bba65c13 403 struct v4l2_format *f);
a399810c 404 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
bba65c13 405 struct v4l2_format *f);
d14e6d76
PO
406 int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
407 struct v4l2_format *f);
408 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
409 struct v4l2_format *f);
bba65c13
MCC
410 int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh,
411 struct v4l2_format *f);
412 int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh,
413 struct v4l2_format *f);
fb9ffa6a
LP
414 int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh,
415 struct v4l2_format *f);
72148d1a
SA
416 int (*vidioc_try_fmt_meta_out)(struct file *file, void *fh,
417 struct v4l2_format *f);
a399810c
HV
418
419 /* Buffer handlers */
bba65c13
MCC
420 int (*vidioc_reqbufs)(struct file *file, void *fh,
421 struct v4l2_requestbuffers *b);
422 int (*vidioc_querybuf)(struct file *file, void *fh,
423 struct v4l2_buffer *b);
424 int (*vidioc_qbuf)(struct file *file, void *fh,
425 struct v4l2_buffer *b);
426 int (*vidioc_expbuf)(struct file *file, void *fh,
427 struct v4l2_exportbuffer *e);
428 int (*vidioc_dqbuf)(struct file *file, void *fh,
429 struct v4l2_buffer *b);
430
431 int (*vidioc_create_bufs)(struct file *file, void *fh,
432 struct v4l2_create_buffers *b);
433 int (*vidioc_prepare_buf)(struct file *file, void *fh,
434 struct v4l2_buffer *b);
435
436 int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i);
437 int (*vidioc_g_fbuf)(struct file *file, void *fh,
438 struct v4l2_framebuffer *a);
439 int (*vidioc_s_fbuf)(struct file *file, void *fh,
440 const struct v4l2_framebuffer *a);
a399810c
HV
441
442 /* Stream on/off */
bba65c13
MCC
443 int (*vidioc_streamon)(struct file *file, void *fh,
444 enum v4l2_buf_type i);
445 int (*vidioc_streamoff)(struct file *file, void *fh,
446 enum v4l2_buf_type i);
447
448 /*
449 * Standard handling
450 *
451 * Note: ENUMSTD is handled by videodev.c
a399810c 452 */
bba65c13
MCC
453 int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm);
454 int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm);
455 int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a);
a399810c
HV
456
457 /* Input handling */
458 int (*vidioc_enum_input)(struct file *file, void *fh,
459 struct v4l2_input *inp);
bba65c13
MCC
460 int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i);
461 int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i);
a399810c
HV
462
463 /* Output handling */
bba65c13 464 int (*vidioc_enum_output)(struct file *file, void *fh,
a399810c 465 struct v4l2_output *a);
bba65c13
MCC
466 int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i);
467 int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
a399810c
HV
468
469 /* Control handling */
bba65c13
MCC
470 int (*vidioc_queryctrl)(struct file *file, void *fh,
471 struct v4l2_queryctrl *a);
472 int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
473 struct v4l2_query_ext_ctrl *a);
474 int (*vidioc_g_ctrl)(struct file *file, void *fh,
475 struct v4l2_control *a);
476 int (*vidioc_s_ctrl)(struct file *file, void *fh,
477 struct v4l2_control *a);
478 int (*vidioc_g_ext_ctrls)(struct file *file, void *fh,
479 struct v4l2_ext_controls *a);
480 int (*vidioc_s_ext_ctrls)(struct file *file, void *fh,
481 struct v4l2_ext_controls *a);
482 int (*vidioc_try_ext_ctrls)(struct file *file, void *fh,
483 struct v4l2_ext_controls *a);
484 int (*vidioc_querymenu)(struct file *file, void *fh,
485 struct v4l2_querymenu *a);
a399810c
HV
486
487 /* Audio ioctls */
bba65c13
MCC
488 int (*vidioc_enumaudio)(struct file *file, void *fh,
489 struct v4l2_audio *a);
490 int (*vidioc_g_audio)(struct file *file, void *fh,
491 struct v4l2_audio *a);
492 int (*vidioc_s_audio)(struct file *file, void *fh,
493 const struct v4l2_audio *a);
a399810c
HV
494
495 /* Audio out ioctls */
bba65c13
MCC
496 int (*vidioc_enumaudout)(struct file *file, void *fh,
497 struct v4l2_audioout *a);
498 int (*vidioc_g_audout)(struct file *file, void *fh,
499 struct v4l2_audioout *a);
500 int (*vidioc_s_audout)(struct file *file, void *fh,
501 const struct v4l2_audioout *a);
502 int (*vidioc_g_modulator)(struct file *file, void *fh,
503 struct v4l2_modulator *a);
504 int (*vidioc_s_modulator)(struct file *file, void *fh,
505 const struct v4l2_modulator *a);
a399810c 506 /* Crop ioctls */
5200ab6a
HV
507 int (*vidioc_g_pixelaspect)(struct file *file, void *fh,
508 int buf_type, struct v4l2_fract *aspect);
bba65c13
MCC
509 int (*vidioc_g_selection)(struct file *file, void *fh,
510 struct v4l2_selection *s);
511 int (*vidioc_s_selection)(struct file *file, void *fh,
512 struct v4l2_selection *s);
a399810c 513 /* Compression ioctls */
bba65c13
MCC
514 int (*vidioc_g_jpegcomp)(struct file *file, void *fh,
515 struct v4l2_jpegcompression *a);
516 int (*vidioc_s_jpegcomp)(struct file *file, void *fh,
517 const struct v4l2_jpegcompression *a);
518 int (*vidioc_g_enc_index)(struct file *file, void *fh,
519 struct v4l2_enc_idx *a);
520 int (*vidioc_encoder_cmd)(struct file *file, void *fh,
521 struct v4l2_encoder_cmd *a);
522 int (*vidioc_try_encoder_cmd)(struct file *file, void *fh,
523 struct v4l2_encoder_cmd *a);
524 int (*vidioc_decoder_cmd)(struct file *file, void *fh,
525 struct v4l2_decoder_cmd *a);
526 int (*vidioc_try_decoder_cmd)(struct file *file, void *fh,
527 struct v4l2_decoder_cmd *a);
a399810c
HV
528
529 /* Stream type-dependent parameter ioctls */
bba65c13
MCC
530 int (*vidioc_g_parm)(struct file *file, void *fh,
531 struct v4l2_streamparm *a);
532 int (*vidioc_s_parm)(struct file *file, void *fh,
533 struct v4l2_streamparm *a);
a399810c
HV
534
535 /* Tuner ioctls */
bba65c13
MCC
536 int (*vidioc_g_tuner)(struct file *file, void *fh,
537 struct v4l2_tuner *a);
538 int (*vidioc_s_tuner)(struct file *file, void *fh,
539 const struct v4l2_tuner *a);
540 int (*vidioc_g_frequency)(struct file *file, void *fh,
541 struct v4l2_frequency *a);
542 int (*vidioc_s_frequency)(struct file *file, void *fh,
543 const struct v4l2_frequency *a);
544 int (*vidioc_enum_freq_bands)(struct file *file, void *fh,
545 struct v4l2_frequency_band *band);
a399810c
HV
546
547 /* Sliced VBI cap */
bba65c13
MCC
548 int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh,
549 struct v4l2_sliced_vbi_cap *a);
a399810c
HV
550
551 /* Log status ioctl */
bba65c13 552 int (*vidioc_log_status)(struct file *file, void *fh);
a399810c 553
bba65c13
MCC
554 int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh,
555 const struct v4l2_hw_freq_seek *a);
a399810c
HV
556
557 /* Debugging ioctls */
558#ifdef CONFIG_VIDEO_ADV_DEBUG
bba65c13
MCC
559 int (*vidioc_g_register)(struct file *file, void *fh,
560 struct v4l2_dbg_register *reg);
561 int (*vidioc_s_register)(struct file *file, void *fh,
562 const struct v4l2_dbg_register *reg);
a399810c 563
bba65c13
MCC
564 int (*vidioc_g_chip_info)(struct file *file, void *fh,
565 struct v4l2_dbg_chip_info *chip);
cd634f1b 566#endif
79b0c640 567
bba65c13
MCC
568 int (*vidioc_enum_framesizes)(struct file *file, void *fh,
569 struct v4l2_frmsizeenum *fsize);
74d83fa0 570
bba65c13
MCC
571 int (*vidioc_enum_frameintervals)(struct file *file, void *fh,
572 struct v4l2_frmivalenum *fival);
74d83fa0 573
b6456c0c 574 /* DV Timings IOCTLs */
bba65c13
MCC
575 int (*vidioc_s_dv_timings)(struct file *file, void *fh,
576 struct v4l2_dv_timings *timings);
577 int (*vidioc_g_dv_timings)(struct file *file, void *fh,
578 struct v4l2_dv_timings *timings);
579 int (*vidioc_query_dv_timings)(struct file *file, void *fh,
580 struct v4l2_dv_timings *timings);
581 int (*vidioc_enum_dv_timings)(struct file *file, void *fh,
582 struct v4l2_enum_dv_timings *timings);
583 int (*vidioc_dv_timings_cap)(struct file *file, void *fh,
584 struct v4l2_dv_timings_cap *cap);
585 int (*vidioc_g_edid)(struct file *file, void *fh,
586 struct v4l2_edid *edid);
587 int (*vidioc_s_edid)(struct file *file, void *fh,
588 struct v4l2_edid *edid);
589
590 int (*vidioc_subscribe_event)(struct v4l2_fh *fh,
591 const struct v4l2_event_subscription *sub);
d3d7c963 592 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
85f5fe39 593 const struct v4l2_event_subscription *sub);
d3d7c963 594
a399810c 595 /* For other private ioctls */
bba65c13
MCC
596 long (*vidioc_default)(struct file *file, void *fh,
597 bool valid_prio, unsigned int cmd, void *arg);
a399810c
HV
598};
599
600
2864462e
MCC
601/* v4l debugging and diagnostics */
602
17028cdb
HV
603/* Device debug flags to be used with the video device debug attribute */
604
605/* Just log the ioctl name + error code */
606#define V4L2_DEV_DEBUG_IOCTL 0x01
607/* Log the ioctl name arguments + error code */
608#define V4L2_DEV_DEBUG_IOCTL_ARG 0x02
609/* Log the file operations open, release, mmap and get_unmapped_area */
610#define V4L2_DEV_DEBUG_FOP 0x04
611/* Log the read and write file operations and the VIDIOC_(D)QBUF ioctls */
612#define V4L2_DEV_DEBUG_STREAMING 0x08
613/* Log poll() */
614#define V4L2_DEV_DEBUG_POLL 0x10
2864462e 615
35ea11ff 616/* Video standard functions */
bba65c13
MCC
617
618/**
619 * v4l2_norm_to_name - Ancillary routine to analog TV standard name from its ID.
620 *
621 * @id: analog TV standard ID.
622 *
623 * Return: returns a string with the name of the analog TV standard.
624 * If the standard is not found or if @id points to multiple standard,
625 * it returns "Unknown".
626 */
627const char *v4l2_norm_to_name(v4l2_std_id id);
628
629/**
630 * v4l2_video_std_frame_period - Ancillary routine that fills a
631 * struct &v4l2_fract pointer with the default framerate fraction.
632 *
aa2f8871 633 * @id: analog TV standard ID.
bba65c13
MCC
634 * @frameperiod: struct &v4l2_fract pointer to be filled
635 *
636 */
637void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
638
639/**
640 * v4l2_video_std_construct - Ancillary routine that fills in the fields of
641 * a &v4l2_standard structure according to the @id parameter.
642 *
643 * @vs: struct &v4l2_standard pointer to be filled
aa2f8871 644 * @id: analog TV standard ID.
bba65c13
MCC
645 * @name: name of the standard to be used
646 *
647 * .. note::
648 *
649 * This ancillary routine is obsolete. Shouldn't be used on newer drivers.
650 */
651int v4l2_video_std_construct(struct v4l2_standard *vs,
35ea11ff 652 int id, const char *name);
35ea11ff 653
aa2f8871
NS
654/**
655 * v4l_video_std_enumstd - Ancillary routine that fills in the fields of
656 * a &v4l2_standard structure according to the @id and @vs->index
657 * parameters.
658 *
659 * @vs: struct &v4l2_standard pointer to be filled.
660 * @id: analog TV standard ID.
661 *
662 */
663int v4l_video_std_enumstd(struct v4l2_standard *vs, v4l2_std_id id);
664
bba65c13
MCC
665/**
666 * v4l_printk_ioctl - Ancillary routine that prints the ioctl in a
667 * human-readable format.
668 *
669 * @prefix: prefix to be added at the ioctl prints.
670 * @cmd: ioctl name
671 *
672 * .. note::
673 *
674 * If prefix != %NULL, then it will issue a
675 * ``printk(KERN_DEBUG "%s: ", prefix)`` first.
676 */
677void v4l_printk_ioctl(const char *prefix, unsigned int cmd);
678
5a5adf6b 679struct video_device;
bba65c13 680
35ea11ff
HV
681/* names for fancy debug output */
682extern const char *v4l2_field_names[];
683extern const char *v4l2_type_names[];
684
bec43661 685#ifdef CONFIG_COMPAT
bba65c13
MCC
686/**
687 * v4l2_compat_ioctl32 -32 Bits compatibility layer for 64 bits processors
688 *
689 * @file: Pointer to struct &file.
690 * @cmd: Ioctl name.
691 * @arg: Ioctl argument.
692 */
693long int v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
694 unsigned long arg);
bec43661 695#endif
35ea11ff 696
bba65c13
MCC
697/**
698 * typedef v4l2_kioctl - Typedef used to pass an ioctl handler.
699 *
700 * @file: Pointer to struct &file.
701 * @cmd: Ioctl name.
702 * @arg: Ioctl argument.
703 */
704typedef long (*v4l2_kioctl)(struct file *file, unsigned int cmd, void *arg);
08af245d 705
bba65c13
MCC
706/**
707 * video_usercopy - copies data from/to userspace memory when an ioctl is
708 * issued.
709 *
710 * @file: Pointer to struct &file.
711 * @cmd: Ioctl name.
712 * @arg: Ioctl argument.
713 * @func: function that will handle the ioctl
714 *
715 * .. note::
716 *
717 * This routine should be used only inside the V4L2 core.
718 */
719long int video_usercopy(struct file *file, unsigned int cmd,
720 unsigned long int arg, v4l2_kioctl func);
35ea11ff 721
bba65c13
MCC
722/**
723 * video_ioctl2 - Handles a V4L2 ioctl.
724 *
725 * @file: Pointer to struct &file.
726 * @cmd: Ioctl name.
727 * @arg: Ioctl argument.
728 *
729 * Method used to hancle an ioctl. Should be used to fill the
730 * &v4l2_ioctl_ops.unlocked_ioctl on all V4L2 drivers.
731 */
732long int video_ioctl2(struct file *file,
733 unsigned int cmd, unsigned long int arg);
8a522c91 734
35ea11ff 735#endif /* _V4L2_IOCTL_H */