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