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