Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  *
0004  *  V 4 L 2   D R I V E R   H E L P E R   A P I
0005  *
0006  * Moved from videodev2.h
0007  *
0008  *  Some commonly needed functions for drivers (v4l2-common.o module)
0009  */
0010 #ifndef _V4L2_IOCTL_H
0011 #define _V4L2_IOCTL_H
0012 
0013 #include <linux/poll.h>
0014 #include <linux/fs.h>
0015 #include <linux/mutex.h>
0016 #include <linux/sched/signal.h>
0017 #include <linux/compiler.h> /* need __user */
0018 #include <linux/videodev2.h>
0019 
0020 struct v4l2_fh;
0021 
0022 /**
0023  * struct v4l2_ioctl_ops - describe operations for each V4L2 ioctl
0024  *
0025  * @vidioc_querycap: pointer to the function that implements
0026  *  :ref:`VIDIOC_QUERYCAP <vidioc_querycap>` ioctl
0027  * @vidioc_enum_fmt_vid_cap: pointer to the function that implements
0028  *  :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
0029  *  for video capture in single and multi plane mode
0030  * @vidioc_enum_fmt_vid_overlay: pointer to the function that implements
0031  *  :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
0032  *  for video overlay
0033  * @vidioc_enum_fmt_vid_out: pointer to the function that implements
0034  *  :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
0035  *  for video output in single and multi plane mode
0036  * @vidioc_enum_fmt_sdr_cap: pointer to the function that implements
0037  *  :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
0038  *  for Software Defined Radio capture
0039  * @vidioc_enum_fmt_sdr_out: pointer to the function that implements
0040  *  :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
0041  *  for Software Defined Radio output
0042  * @vidioc_enum_fmt_meta_cap: pointer to the function that implements
0043  *  :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
0044  *  for metadata capture
0045  * @vidioc_enum_fmt_meta_out: pointer to the function that implements
0046  *  :ref:`VIDIOC_ENUM_FMT <vidioc_enum_fmt>` ioctl logic
0047  *  for metadata output
0048  * @vidioc_g_fmt_vid_cap: pointer to the function that implements
0049  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
0050  *  in single plane mode
0051  * @vidioc_g_fmt_vid_overlay: pointer to the function that implements
0052  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay
0053  * @vidioc_g_fmt_vid_out: pointer to the function that implements
0054  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
0055  *  in single plane mode
0056  * @vidioc_g_fmt_vid_out_overlay: pointer to the function that implements
0057  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
0058  * @vidioc_g_fmt_vbi_cap: pointer to the function that implements
0059  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
0060  * @vidioc_g_fmt_vbi_out: pointer to the function that implements
0061  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
0062  * @vidioc_g_fmt_sliced_vbi_cap: pointer to the function that implements
0063  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
0064  * @vidioc_g_fmt_sliced_vbi_out: pointer to the function that implements
0065  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
0066  * @vidioc_g_fmt_vid_cap_mplane: pointer to the function that implements
0067  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video capture
0068  *  in multiple plane mode
0069  * @vidioc_g_fmt_vid_out_mplane: pointer to the function that implements
0070  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for video out
0071  *  in multiplane plane mode
0072  * @vidioc_g_fmt_sdr_cap: pointer to the function that implements
0073  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
0074  *  Radio capture
0075  * @vidioc_g_fmt_sdr_out: pointer to the function that implements
0076  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
0077  *  Radio output
0078  * @vidioc_g_fmt_meta_cap: pointer to the function that implements
0079  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
0080  * @vidioc_g_fmt_meta_out: pointer to the function that implements
0081  *  :ref:`VIDIOC_G_FMT <vidioc_g_fmt>` ioctl logic for metadata output
0082  * @vidioc_s_fmt_vid_cap: pointer to the function that implements
0083  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video capture
0084  *  in single plane mode
0085  * @vidioc_s_fmt_vid_overlay: pointer to the function that implements
0086  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video overlay
0087  * @vidioc_s_fmt_vid_out: pointer to the function that implements
0088  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video out
0089  *  in single plane mode
0090  * @vidioc_s_fmt_vid_out_overlay: pointer to the function that implements
0091  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video overlay output
0092  * @vidioc_s_fmt_vbi_cap: pointer to the function that implements
0093  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
0094  * @vidioc_s_fmt_vbi_out: pointer to the function that implements
0095  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
0096  * @vidioc_s_fmt_sliced_vbi_cap: pointer to the function that implements
0097  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI capture
0098  * @vidioc_s_fmt_sliced_vbi_out: pointer to the function that implements
0099  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
0100  * @vidioc_s_fmt_vid_cap_mplane: pointer to the function that implements
0101  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video capture
0102  *  in multiple plane mode
0103  * @vidioc_s_fmt_vid_out_mplane: pointer to the function that implements
0104  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for video out
0105  *  in multiplane plane mode
0106  * @vidioc_s_fmt_sdr_cap: pointer to the function that implements
0107  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
0108  *  Radio capture
0109  * @vidioc_s_fmt_sdr_out: pointer to the function that implements
0110  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
0111  *  Radio output
0112  * @vidioc_s_fmt_meta_cap: pointer to the function that implements
0113  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
0114  * @vidioc_s_fmt_meta_out: pointer to the function that implements
0115  *  :ref:`VIDIOC_S_FMT <vidioc_g_fmt>` ioctl logic for metadata output
0116  * @vidioc_try_fmt_vid_cap: pointer to the function that implements
0117  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
0118  *  in single plane mode
0119  * @vidioc_try_fmt_vid_overlay: pointer to the function that implements
0120  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
0121  * @vidioc_try_fmt_vid_out: pointer to the function that implements
0122  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
0123  *  in single plane mode
0124  * @vidioc_try_fmt_vid_out_overlay: pointer to the function that implements
0125  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video overlay
0126  *  output
0127  * @vidioc_try_fmt_vbi_cap: pointer to the function that implements
0128  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI capture
0129  * @vidioc_try_fmt_vbi_out: pointer to the function that implements
0130  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for raw VBI output
0131  * @vidioc_try_fmt_sliced_vbi_cap: pointer to the function that implements
0132  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI
0133  *  capture
0134  * @vidioc_try_fmt_sliced_vbi_out: pointer to the function that implements
0135  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for sliced VBI output
0136  * @vidioc_try_fmt_vid_cap_mplane: pointer to the function that implements
0137  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video capture
0138  *  in multiple plane mode
0139  * @vidioc_try_fmt_vid_out_mplane: pointer to the function that implements
0140  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for video out
0141  *  in multiplane plane mode
0142  * @vidioc_try_fmt_sdr_cap: pointer to the function that implements
0143  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
0144  *  Radio capture
0145  * @vidioc_try_fmt_sdr_out: pointer to the function that implements
0146  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for Software Defined
0147  *  Radio output
0148  * @vidioc_try_fmt_meta_cap: pointer to the function that implements
0149  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for metadata capture
0150  * @vidioc_try_fmt_meta_out: pointer to the function that implements
0151  *  :ref:`VIDIOC_TRY_FMT <vidioc_g_fmt>` ioctl logic for metadata output
0152  * @vidioc_reqbufs: pointer to the function that implements
0153  *  :ref:`VIDIOC_REQBUFS <vidioc_reqbufs>` ioctl
0154  * @vidioc_querybuf: pointer to the function that implements
0155  *  :ref:`VIDIOC_QUERYBUF <vidioc_querybuf>` ioctl
0156  * @vidioc_qbuf: pointer to the function that implements
0157  *  :ref:`VIDIOC_QBUF <vidioc_qbuf>` ioctl
0158  * @vidioc_expbuf: pointer to the function that implements
0159  *  :ref:`VIDIOC_EXPBUF <vidioc_expbuf>` ioctl
0160  * @vidioc_dqbuf: pointer to the function that implements
0161  *  :ref:`VIDIOC_DQBUF <vidioc_qbuf>` ioctl
0162  * @vidioc_create_bufs: pointer to the function that implements
0163  *  :ref:`VIDIOC_CREATE_BUFS <vidioc_create_bufs>` ioctl
0164  * @vidioc_prepare_buf: pointer to the function that implements
0165  *  :ref:`VIDIOC_PREPARE_BUF <vidioc_prepare_buf>` ioctl
0166  * @vidioc_overlay: pointer to the function that implements
0167  *  :ref:`VIDIOC_OVERLAY <vidioc_overlay>` ioctl
0168  * @vidioc_g_fbuf: pointer to the function that implements
0169  *  :ref:`VIDIOC_G_FBUF <vidioc_g_fbuf>` ioctl
0170  * @vidioc_s_fbuf: pointer to the function that implements
0171  *  :ref:`VIDIOC_S_FBUF <vidioc_g_fbuf>` ioctl
0172  * @vidioc_streamon: pointer to the function that implements
0173  *  :ref:`VIDIOC_STREAMON <vidioc_streamon>` ioctl
0174  * @vidioc_streamoff: pointer to the function that implements
0175  *  :ref:`VIDIOC_STREAMOFF <vidioc_streamon>` ioctl
0176  * @vidioc_g_std: pointer to the function that implements
0177  *  :ref:`VIDIOC_G_STD <vidioc_g_std>` ioctl
0178  * @vidioc_s_std: pointer to the function that implements
0179  *  :ref:`VIDIOC_S_STD <vidioc_g_std>` ioctl
0180  * @vidioc_querystd: pointer to the function that implements
0181  *  :ref:`VIDIOC_QUERYSTD <vidioc_querystd>` ioctl
0182  * @vidioc_enum_input: pointer to the function that implements
0183  *  :ref:`VIDIOC_ENUM_INPUT <vidioc_g_input>` ioctl
0184  * @vidioc_g_input: pointer to the function that implements
0185  *  :ref:`VIDIOC_G_INPUT <vidioc_g_input>` ioctl
0186  * @vidioc_s_input: pointer to the function that implements
0187  *  :ref:`VIDIOC_S_INPUT <vidioc_g_input>` ioctl
0188  * @vidioc_enum_output: pointer to the function that implements
0189  *  :ref:`VIDIOC_ENUM_OUTPUT <vidioc_g_output>` ioctl
0190  * @vidioc_g_output: pointer to the function that implements
0191  *  :ref:`VIDIOC_G_OUTPUT <vidioc_g_output>` ioctl
0192  * @vidioc_s_output: pointer to the function that implements
0193  *  :ref:`VIDIOC_S_OUTPUT <vidioc_g_output>` ioctl
0194  * @vidioc_queryctrl: pointer to the function that implements
0195  *  :ref:`VIDIOC_QUERYCTRL <vidioc_queryctrl>` ioctl
0196  * @vidioc_query_ext_ctrl: pointer to the function that implements
0197  *  :ref:`VIDIOC_QUERY_EXT_CTRL <vidioc_queryctrl>` ioctl
0198  * @vidioc_g_ctrl: pointer to the function that implements
0199  *  :ref:`VIDIOC_G_CTRL <vidioc_g_ctrl>` ioctl
0200  * @vidioc_s_ctrl: pointer to the function that implements
0201  *  :ref:`VIDIOC_S_CTRL <vidioc_g_ctrl>` ioctl
0202  * @vidioc_g_ext_ctrls: pointer to the function that implements
0203  *  :ref:`VIDIOC_G_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
0204  * @vidioc_s_ext_ctrls: pointer to the function that implements
0205  *  :ref:`VIDIOC_S_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
0206  * @vidioc_try_ext_ctrls: pointer to the function that implements
0207  *  :ref:`VIDIOC_TRY_EXT_CTRLS <vidioc_g_ext_ctrls>` ioctl
0208  * @vidioc_querymenu: pointer to the function that implements
0209  *  :ref:`VIDIOC_QUERYMENU <vidioc_queryctrl>` ioctl
0210  * @vidioc_enumaudio: pointer to the function that implements
0211  *  :ref:`VIDIOC_ENUMAUDIO <vidioc_enumaudio>` ioctl
0212  * @vidioc_g_audio: pointer to the function that implements
0213  *  :ref:`VIDIOC_G_AUDIO <vidioc_g_audio>` ioctl
0214  * @vidioc_s_audio: pointer to the function that implements
0215  *  :ref:`VIDIOC_S_AUDIO <vidioc_g_audio>` ioctl
0216  * @vidioc_enumaudout: pointer to the function that implements
0217  *  :ref:`VIDIOC_ENUMAUDOUT <vidioc_enumaudout>` ioctl
0218  * @vidioc_g_audout: pointer to the function that implements
0219  *  :ref:`VIDIOC_G_AUDOUT <vidioc_g_audout>` ioctl
0220  * @vidioc_s_audout: pointer to the function that implements
0221  *  :ref:`VIDIOC_S_AUDOUT <vidioc_g_audout>` ioctl
0222  * @vidioc_g_modulator: pointer to the function that implements
0223  *  :ref:`VIDIOC_G_MODULATOR <vidioc_g_modulator>` ioctl
0224  * @vidioc_s_modulator: pointer to the function that implements
0225  *  :ref:`VIDIOC_S_MODULATOR <vidioc_g_modulator>` ioctl
0226  * @vidioc_g_pixelaspect: pointer to the function that implements
0227  *  the pixelaspect part of the :ref:`VIDIOC_CROPCAP <vidioc_cropcap>` ioctl
0228  * @vidioc_g_selection: pointer to the function that implements
0229  *  :ref:`VIDIOC_G_SELECTION <vidioc_g_selection>` ioctl
0230  * @vidioc_s_selection: pointer to the function that implements
0231  *  :ref:`VIDIOC_S_SELECTION <vidioc_g_selection>` ioctl
0232  * @vidioc_g_jpegcomp: pointer to the function that implements
0233  *  :ref:`VIDIOC_G_JPEGCOMP <vidioc_g_jpegcomp>` ioctl
0234  * @vidioc_s_jpegcomp: pointer to the function that implements
0235  *  :ref:`VIDIOC_S_JPEGCOMP <vidioc_g_jpegcomp>` ioctl
0236  * @vidioc_g_enc_index: pointer to the function that implements
0237  *  :ref:`VIDIOC_G_ENC_INDEX <vidioc_g_enc_index>` ioctl
0238  * @vidioc_encoder_cmd: pointer to the function that implements
0239  *  :ref:`VIDIOC_ENCODER_CMD <vidioc_encoder_cmd>` ioctl
0240  * @vidioc_try_encoder_cmd: pointer to the function that implements
0241  *  :ref:`VIDIOC_TRY_ENCODER_CMD <vidioc_encoder_cmd>` ioctl
0242  * @vidioc_decoder_cmd: pointer to the function that implements
0243  *  :ref:`VIDIOC_DECODER_CMD <vidioc_decoder_cmd>` ioctl
0244  * @vidioc_try_decoder_cmd: pointer to the function that implements
0245  *  :ref:`VIDIOC_TRY_DECODER_CMD <vidioc_decoder_cmd>` ioctl
0246  * @vidioc_g_parm: pointer to the function that implements
0247  *  :ref:`VIDIOC_G_PARM <vidioc_g_parm>` ioctl
0248  * @vidioc_s_parm: pointer to the function that implements
0249  *  :ref:`VIDIOC_S_PARM <vidioc_g_parm>` ioctl
0250  * @vidioc_g_tuner: pointer to the function that implements
0251  *  :ref:`VIDIOC_G_TUNER <vidioc_g_tuner>` ioctl
0252  * @vidioc_s_tuner: pointer to the function that implements
0253  *  :ref:`VIDIOC_S_TUNER <vidioc_g_tuner>` ioctl
0254  * @vidioc_g_frequency: pointer to the function that implements
0255  *  :ref:`VIDIOC_G_FREQUENCY <vidioc_g_frequency>` ioctl
0256  * @vidioc_s_frequency: pointer to the function that implements
0257  *  :ref:`VIDIOC_S_FREQUENCY <vidioc_g_frequency>` ioctl
0258  * @vidioc_enum_freq_bands: pointer to the function that implements
0259  *  :ref:`VIDIOC_ENUM_FREQ_BANDS <vidioc_enum_freq_bands>` ioctl
0260  * @vidioc_g_sliced_vbi_cap: pointer to the function that implements
0261  *  :ref:`VIDIOC_G_SLICED_VBI_CAP <vidioc_g_sliced_vbi_cap>` ioctl
0262  * @vidioc_log_status: pointer to the function that implements
0263  *  :ref:`VIDIOC_LOG_STATUS <vidioc_log_status>` ioctl
0264  * @vidioc_s_hw_freq_seek: pointer to the function that implements
0265  *  :ref:`VIDIOC_S_HW_FREQ_SEEK <vidioc_s_hw_freq_seek>` ioctl
0266  * @vidioc_g_register: pointer to the function that implements
0267  *  :ref:`VIDIOC_DBG_G_REGISTER <vidioc_dbg_g_register>` ioctl
0268  * @vidioc_s_register: pointer to the function that implements
0269  *  :ref:`VIDIOC_DBG_S_REGISTER <vidioc_dbg_g_register>` ioctl
0270  * @vidioc_g_chip_info: pointer to the function that implements
0271  *  :ref:`VIDIOC_DBG_G_CHIP_INFO <vidioc_dbg_g_chip_info>` ioctl
0272  * @vidioc_enum_framesizes: pointer to the function that implements
0273  *  :ref:`VIDIOC_ENUM_FRAMESIZES <vidioc_enum_framesizes>` ioctl
0274  * @vidioc_enum_frameintervals: pointer to the function that implements
0275  *  :ref:`VIDIOC_ENUM_FRAMEINTERVALS <vidioc_enum_frameintervals>` ioctl
0276  * @vidioc_s_dv_timings: pointer to the function that implements
0277  *  :ref:`VIDIOC_S_DV_TIMINGS <vidioc_g_dv_timings>` ioctl
0278  * @vidioc_g_dv_timings: pointer to the function that implements
0279  *  :ref:`VIDIOC_G_DV_TIMINGS <vidioc_g_dv_timings>` ioctl
0280  * @vidioc_query_dv_timings: pointer to the function that implements
0281  *  :ref:`VIDIOC_QUERY_DV_TIMINGS <vidioc_query_dv_timings>` ioctl
0282  * @vidioc_enum_dv_timings: pointer to the function that implements
0283  *  :ref:`VIDIOC_ENUM_DV_TIMINGS <vidioc_enum_dv_timings>` ioctl
0284  * @vidioc_dv_timings_cap: pointer to the function that implements
0285  *  :ref:`VIDIOC_DV_TIMINGS_CAP <vidioc_dv_timings_cap>` ioctl
0286  * @vidioc_g_edid: pointer to the function that implements
0287  *  :ref:`VIDIOC_G_EDID <vidioc_g_edid>` ioctl
0288  * @vidioc_s_edid: pointer to the function that implements
0289  *  :ref:`VIDIOC_S_EDID <vidioc_g_edid>` ioctl
0290  * @vidioc_subscribe_event: pointer to the function that implements
0291  *  :ref:`VIDIOC_SUBSCRIBE_EVENT <vidioc_subscribe_event>` ioctl
0292  * @vidioc_unsubscribe_event: pointer to the function that implements
0293  *  :ref:`VIDIOC_UNSUBSCRIBE_EVENT <vidioc_unsubscribe_event>` ioctl
0294  * @vidioc_default: pointed used to allow other ioctls
0295  */
0296 struct v4l2_ioctl_ops {
0297     /* ioctl callbacks */
0298 
0299     /* VIDIOC_QUERYCAP handler */
0300     int (*vidioc_querycap)(struct file *file, void *fh,
0301                    struct v4l2_capability *cap);
0302 
0303     /* VIDIOC_ENUM_FMT handlers */
0304     int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh,
0305                        struct v4l2_fmtdesc *f);
0306     int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh,
0307                        struct v4l2_fmtdesc *f);
0308     int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh,
0309                        struct v4l2_fmtdesc *f);
0310     int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh,
0311                        struct v4l2_fmtdesc *f);
0312     int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh,
0313                        struct v4l2_fmtdesc *f);
0314     int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh,
0315                     struct v4l2_fmtdesc *f);
0316     int (*vidioc_enum_fmt_meta_out)(struct file *file, void *fh,
0317                     struct v4l2_fmtdesc *f);
0318 
0319     /* VIDIOC_G_FMT handlers */
0320     int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh,
0321                     struct v4l2_format *f);
0322     int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
0323                     struct v4l2_format *f);
0324     int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh,
0325                     struct v4l2_format *f);
0326     int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
0327                         struct v4l2_format *f);
0328     int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh,
0329                     struct v4l2_format *f);
0330     int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh,
0331                     struct v4l2_format *f);
0332     int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
0333                        struct v4l2_format *f);
0334     int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
0335                        struct v4l2_format *f);
0336     int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
0337                        struct v4l2_format *f);
0338     int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
0339                        struct v4l2_format *f);
0340     int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh,
0341                     struct v4l2_format *f);
0342     int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh,
0343                     struct v4l2_format *f);
0344     int (*vidioc_g_fmt_meta_cap)(struct file *file, void *fh,
0345                      struct v4l2_format *f);
0346     int (*vidioc_g_fmt_meta_out)(struct file *file, void *fh,
0347                      struct v4l2_format *f);
0348 
0349     /* VIDIOC_S_FMT handlers */
0350     int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh,
0351                     struct v4l2_format *f);
0352     int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
0353                     struct v4l2_format *f);
0354     int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh,
0355                     struct v4l2_format *f);
0356     int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
0357                         struct v4l2_format *f);
0358     int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh,
0359                     struct v4l2_format *f);
0360     int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh,
0361                     struct v4l2_format *f);
0362     int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
0363                        struct v4l2_format *f);
0364     int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
0365                        struct v4l2_format *f);
0366     int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
0367                        struct v4l2_format *f);
0368     int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
0369                        struct v4l2_format *f);
0370     int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh,
0371                     struct v4l2_format *f);
0372     int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh,
0373                     struct v4l2_format *f);
0374     int (*vidioc_s_fmt_meta_cap)(struct file *file, void *fh,
0375                      struct v4l2_format *f);
0376     int (*vidioc_s_fmt_meta_out)(struct file *file, void *fh,
0377                      struct v4l2_format *f);
0378 
0379     /* VIDIOC_TRY_FMT handlers */
0380     int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh,
0381                       struct v4l2_format *f);
0382     int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
0383                       struct v4l2_format *f);
0384     int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh,
0385                       struct v4l2_format *f);
0386     int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
0387                          struct v4l2_format *f);
0388     int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh,
0389                       struct v4l2_format *f);
0390     int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh,
0391                       struct v4l2_format *f);
0392     int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
0393                          struct v4l2_format *f);
0394     int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
0395                          struct v4l2_format *f);
0396     int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
0397                          struct v4l2_format *f);
0398     int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
0399                          struct v4l2_format *f);
0400     int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh,
0401                       struct v4l2_format *f);
0402     int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh,
0403                       struct v4l2_format *f);
0404     int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh,
0405                        struct v4l2_format *f);
0406     int (*vidioc_try_fmt_meta_out)(struct file *file, void *fh,
0407                        struct v4l2_format *f);
0408 
0409     /* Buffer handlers */
0410     int (*vidioc_reqbufs)(struct file *file, void *fh,
0411                   struct v4l2_requestbuffers *b);
0412     int (*vidioc_querybuf)(struct file *file, void *fh,
0413                    struct v4l2_buffer *b);
0414     int (*vidioc_qbuf)(struct file *file, void *fh,
0415                struct v4l2_buffer *b);
0416     int (*vidioc_expbuf)(struct file *file, void *fh,
0417                  struct v4l2_exportbuffer *e);
0418     int (*vidioc_dqbuf)(struct file *file, void *fh,
0419                 struct v4l2_buffer *b);
0420 
0421     int (*vidioc_create_bufs)(struct file *file, void *fh,
0422                   struct v4l2_create_buffers *b);
0423     int (*vidioc_prepare_buf)(struct file *file, void *fh,
0424                   struct v4l2_buffer *b);
0425 
0426     int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i);
0427     int (*vidioc_g_fbuf)(struct file *file, void *fh,
0428                  struct v4l2_framebuffer *a);
0429     int (*vidioc_s_fbuf)(struct file *file, void *fh,
0430                  const struct v4l2_framebuffer *a);
0431 
0432         /* Stream on/off */
0433     int (*vidioc_streamon)(struct file *file, void *fh,
0434                    enum v4l2_buf_type i);
0435     int (*vidioc_streamoff)(struct file *file, void *fh,
0436                 enum v4l2_buf_type i);
0437 
0438         /*
0439          * Standard handling
0440          *
0441          * Note: ENUMSTD is handled by videodev.c
0442          */
0443     int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm);
0444     int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm);
0445     int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a);
0446 
0447         /* Input handling */
0448     int (*vidioc_enum_input)(struct file *file, void *fh,
0449                  struct v4l2_input *inp);
0450     int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i);
0451     int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i);
0452 
0453         /* Output handling */
0454     int (*vidioc_enum_output)(struct file *file, void *fh,
0455                   struct v4l2_output *a);
0456     int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i);
0457     int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
0458 
0459         /* Control handling */
0460     int (*vidioc_queryctrl)(struct file *file, void *fh,
0461                 struct v4l2_queryctrl *a);
0462     int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
0463                      struct v4l2_query_ext_ctrl *a);
0464     int (*vidioc_g_ctrl)(struct file *file, void *fh,
0465                  struct v4l2_control *a);
0466     int (*vidioc_s_ctrl)(struct file *file, void *fh,
0467                  struct v4l2_control *a);
0468     int (*vidioc_g_ext_ctrls)(struct file *file, void *fh,
0469                   struct v4l2_ext_controls *a);
0470     int (*vidioc_s_ext_ctrls)(struct file *file, void *fh,
0471                   struct v4l2_ext_controls *a);
0472     int (*vidioc_try_ext_ctrls)(struct file *file, void *fh,
0473                     struct v4l2_ext_controls *a);
0474     int (*vidioc_querymenu)(struct file *file, void *fh,
0475                 struct v4l2_querymenu *a);
0476 
0477     /* Audio ioctls */
0478     int (*vidioc_enumaudio)(struct file *file, void *fh,
0479                 struct v4l2_audio *a);
0480     int (*vidioc_g_audio)(struct file *file, void *fh,
0481                   struct v4l2_audio *a);
0482     int (*vidioc_s_audio)(struct file *file, void *fh,
0483                   const struct v4l2_audio *a);
0484 
0485     /* Audio out ioctls */
0486     int (*vidioc_enumaudout)(struct file *file, void *fh,
0487                  struct v4l2_audioout *a);
0488     int (*vidioc_g_audout)(struct file *file, void *fh,
0489                    struct v4l2_audioout *a);
0490     int (*vidioc_s_audout)(struct file *file, void *fh,
0491                    const struct v4l2_audioout *a);
0492     int (*vidioc_g_modulator)(struct file *file, void *fh,
0493                   struct v4l2_modulator *a);
0494     int (*vidioc_s_modulator)(struct file *file, void *fh,
0495                   const struct v4l2_modulator *a);
0496     /* Crop ioctls */
0497     int (*vidioc_g_pixelaspect)(struct file *file, void *fh,
0498                     int buf_type, struct v4l2_fract *aspect);
0499     int (*vidioc_g_selection)(struct file *file, void *fh,
0500                   struct v4l2_selection *s);
0501     int (*vidioc_s_selection)(struct file *file, void *fh,
0502                   struct v4l2_selection *s);
0503     /* Compression ioctls */
0504     int (*vidioc_g_jpegcomp)(struct file *file, void *fh,
0505                  struct v4l2_jpegcompression *a);
0506     int (*vidioc_s_jpegcomp)(struct file *file, void *fh,
0507                  const struct v4l2_jpegcompression *a);
0508     int (*vidioc_g_enc_index)(struct file *file, void *fh,
0509                   struct v4l2_enc_idx *a);
0510     int (*vidioc_encoder_cmd)(struct file *file, void *fh,
0511                   struct v4l2_encoder_cmd *a);
0512     int (*vidioc_try_encoder_cmd)(struct file *file, void *fh,
0513                       struct v4l2_encoder_cmd *a);
0514     int (*vidioc_decoder_cmd)(struct file *file, void *fh,
0515                   struct v4l2_decoder_cmd *a);
0516     int (*vidioc_try_decoder_cmd)(struct file *file, void *fh,
0517                       struct v4l2_decoder_cmd *a);
0518 
0519     /* Stream type-dependent parameter ioctls */
0520     int (*vidioc_g_parm)(struct file *file, void *fh,
0521                  struct v4l2_streamparm *a);
0522     int (*vidioc_s_parm)(struct file *file, void *fh,
0523                  struct v4l2_streamparm *a);
0524 
0525     /* Tuner ioctls */
0526     int (*vidioc_g_tuner)(struct file *file, void *fh,
0527                   struct v4l2_tuner *a);
0528     int (*vidioc_s_tuner)(struct file *file, void *fh,
0529                   const struct v4l2_tuner *a);
0530     int (*vidioc_g_frequency)(struct file *file, void *fh,
0531                   struct v4l2_frequency *a);
0532     int (*vidioc_s_frequency)(struct file *file, void *fh,
0533                   const struct v4l2_frequency *a);
0534     int (*vidioc_enum_freq_bands)(struct file *file, void *fh,
0535                       struct v4l2_frequency_band *band);
0536 
0537     /* Sliced VBI cap */
0538     int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh,
0539                        struct v4l2_sliced_vbi_cap *a);
0540 
0541     /* Log status ioctl */
0542     int (*vidioc_log_status)(struct file *file, void *fh);
0543 
0544     int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh,
0545                      const struct v4l2_hw_freq_seek *a);
0546 
0547     /* Debugging ioctls */
0548 #ifdef CONFIG_VIDEO_ADV_DEBUG
0549     int (*vidioc_g_register)(struct file *file, void *fh,
0550                  struct v4l2_dbg_register *reg);
0551     int (*vidioc_s_register)(struct file *file, void *fh,
0552                  const struct v4l2_dbg_register *reg);
0553 
0554     int (*vidioc_g_chip_info)(struct file *file, void *fh,
0555                   struct v4l2_dbg_chip_info *chip);
0556 #endif
0557 
0558     int (*vidioc_enum_framesizes)(struct file *file, void *fh,
0559                       struct v4l2_frmsizeenum *fsize);
0560 
0561     int (*vidioc_enum_frameintervals)(struct file *file, void *fh,
0562                       struct v4l2_frmivalenum *fival);
0563 
0564     /* DV Timings IOCTLs */
0565     int (*vidioc_s_dv_timings)(struct file *file, void *fh,
0566                    struct v4l2_dv_timings *timings);
0567     int (*vidioc_g_dv_timings)(struct file *file, void *fh,
0568                    struct v4l2_dv_timings *timings);
0569     int (*vidioc_query_dv_timings)(struct file *file, void *fh,
0570                        struct v4l2_dv_timings *timings);
0571     int (*vidioc_enum_dv_timings)(struct file *file, void *fh,
0572                       struct v4l2_enum_dv_timings *timings);
0573     int (*vidioc_dv_timings_cap)(struct file *file, void *fh,
0574                      struct v4l2_dv_timings_cap *cap);
0575     int (*vidioc_g_edid)(struct file *file, void *fh,
0576                  struct v4l2_edid *edid);
0577     int (*vidioc_s_edid)(struct file *file, void *fh,
0578                  struct v4l2_edid *edid);
0579 
0580     int (*vidioc_subscribe_event)(struct v4l2_fh *fh,
0581                       const struct v4l2_event_subscription *sub);
0582     int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
0583                     const struct v4l2_event_subscription *sub);
0584 
0585     /* For other private ioctls */
0586     long (*vidioc_default)(struct file *file, void *fh,
0587                    bool valid_prio, unsigned int cmd, void *arg);
0588 };
0589 
0590 
0591 /* v4l debugging and diagnostics */
0592 
0593 /* Device debug flags to be used with the video device debug attribute */
0594 
0595 /* Just log the ioctl name + error code */
0596 #define V4L2_DEV_DEBUG_IOCTL        0x01
0597 /* Log the ioctl name arguments + error code */
0598 #define V4L2_DEV_DEBUG_IOCTL_ARG    0x02
0599 /* Log the file operations open, release, mmap and get_unmapped_area */
0600 #define V4L2_DEV_DEBUG_FOP      0x04
0601 /* Log the read and write file operations and the VIDIOC_(D)QBUF ioctls */
0602 #define V4L2_DEV_DEBUG_STREAMING    0x08
0603 /* Log poll() */
0604 #define V4L2_DEV_DEBUG_POLL     0x10
0605 /* Log controls */
0606 #define V4L2_DEV_DEBUG_CTRL     0x20
0607 
0608 /*  Video standard functions  */
0609 
0610 /**
0611  * v4l2_norm_to_name - Ancillary routine to analog TV standard name from its ID.
0612  *
0613  * @id: analog TV standard ID.
0614  *
0615  * Return: returns a string with the name of the analog TV standard.
0616  * If the standard is not found or if @id points to multiple standard,
0617  * it returns "Unknown".
0618  */
0619 const char *v4l2_norm_to_name(v4l2_std_id id);
0620 
0621 /**
0622  * v4l2_video_std_frame_period - Ancillary routine that fills a
0623  *  struct &v4l2_fract pointer with the default framerate fraction.
0624  *
0625  * @id: analog TV standard ID.
0626  * @frameperiod: struct &v4l2_fract pointer to be filled
0627  *
0628  */
0629 void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod);
0630 
0631 /**
0632  * v4l2_video_std_construct - Ancillary routine that fills in the fields of
0633  *  a &v4l2_standard structure according to the @id parameter.
0634  *
0635  * @vs: struct &v4l2_standard pointer to be filled
0636  * @id: analog TV standard ID.
0637  * @name: name of the standard to be used
0638  *
0639  * .. note::
0640  *
0641  *    This ancillary routine is obsolete. Shouldn't be used on newer drivers.
0642  */
0643 int v4l2_video_std_construct(struct v4l2_standard *vs,
0644                     int id, const char *name);
0645 
0646 /**
0647  * v4l_video_std_enumstd - Ancillary routine that fills in the fields of
0648  *  a &v4l2_standard structure according to the @id and @vs->index
0649  *  parameters.
0650  *
0651  * @vs: struct &v4l2_standard pointer to be filled.
0652  * @id: analog TV standard ID.
0653  *
0654  */
0655 int v4l_video_std_enumstd(struct v4l2_standard *vs, v4l2_std_id id);
0656 
0657 /**
0658  * v4l_printk_ioctl - Ancillary routine that prints the ioctl in a
0659  *  human-readable format.
0660  *
0661  * @prefix: prefix to be added at the ioctl prints.
0662  * @cmd: ioctl name
0663  *
0664  * .. note::
0665  *
0666  *    If prefix != %NULL, then it will issue a
0667  *    ``printk(KERN_DEBUG "%s: ", prefix)`` first.
0668  */
0669 void v4l_printk_ioctl(const char *prefix, unsigned int cmd);
0670 
0671 struct video_device;
0672 
0673 /* names for fancy debug output */
0674 extern const char *v4l2_field_names[];
0675 extern const char *v4l2_type_names[];
0676 
0677 #ifdef CONFIG_COMPAT
0678 /**
0679  * v4l2_compat_ioctl32 -32 Bits compatibility layer for 64 bits processors
0680  *
0681  * @file: Pointer to struct &file.
0682  * @cmd: Ioctl name.
0683  * @arg: Ioctl argument.
0684  */
0685 long int v4l2_compat_ioctl32(struct file *file, unsigned int cmd,
0686                  unsigned long arg);
0687 #endif
0688 
0689 unsigned int v4l2_compat_translate_cmd(unsigned int cmd);
0690 int v4l2_compat_get_user(void __user *arg, void *parg, unsigned int cmd);
0691 int v4l2_compat_put_user(void __user *arg, void *parg, unsigned int cmd);
0692 int v4l2_compat_get_array_args(struct file *file, void *mbuf,
0693                    void __user *user_ptr, size_t array_size,
0694                    unsigned int cmd, void *arg);
0695 int v4l2_compat_put_array_args(struct file *file, void __user *user_ptr,
0696                    void *mbuf, size_t array_size,
0697                    unsigned int cmd, void *arg);
0698 
0699 /**
0700  * typedef v4l2_kioctl - Typedef used to pass an ioctl handler.
0701  *
0702  * @file: Pointer to struct &file.
0703  * @cmd: Ioctl name.
0704  * @arg: Ioctl argument.
0705  */
0706 typedef long (*v4l2_kioctl)(struct file *file, unsigned int cmd, void *arg);
0707 
0708 /**
0709  * video_usercopy - copies data from/to userspace memory when an ioctl is
0710  *  issued.
0711  *
0712  * @file: Pointer to struct &file.
0713  * @cmd: Ioctl name.
0714  * @arg: Ioctl argument.
0715  * @func: function that will handle the ioctl
0716  *
0717  * .. note::
0718  *
0719  *    This routine should be used only inside the V4L2 core.
0720  */
0721 long int video_usercopy(struct file *file, unsigned int cmd,
0722             unsigned long int arg, v4l2_kioctl func);
0723 
0724 /**
0725  * video_ioctl2 - Handles a V4L2 ioctl.
0726  *
0727  * @file: Pointer to struct &file.
0728  * @cmd: Ioctl name.
0729  * @arg: Ioctl argument.
0730  *
0731  * Method used to hancle an ioctl. Should be used to fill the
0732  * &v4l2_ioctl_ops.unlocked_ioctl on all V4L2 drivers.
0733  */
0734 long int video_ioctl2(struct file *file,
0735               unsigned int cmd, unsigned long int arg);
0736 
0737 /*
0738  * The user space interpretation of the 'v4l2_event' differs
0739  * based on the 'time_t' definition on 32-bit architectures, so
0740  * the kernel has to handle both.
0741  * This is the old version for 32-bit architectures.
0742  */
0743 struct v4l2_event_time32 {
0744     __u32               type;
0745     union {
0746         struct v4l2_event_vsync     vsync;
0747         struct v4l2_event_ctrl      ctrl;
0748         struct v4l2_event_frame_sync    frame_sync;
0749         struct v4l2_event_src_change    src_change;
0750         struct v4l2_event_motion_det    motion_det;
0751         __u8                data[64];
0752     } u;
0753     __u32               pending;
0754     __u32               sequence;
0755     struct old_timespec32       timestamp;
0756     __u32               id;
0757     __u32               reserved[8];
0758 };
0759 
0760 #define VIDIOC_DQEVENT_TIME32    _IOR('V', 89, struct v4l2_event_time32)
0761 
0762 struct v4l2_buffer_time32 {
0763     __u32           index;
0764     __u32           type;
0765     __u32           bytesused;
0766     __u32           flags;
0767     __u32           field;
0768     struct old_timeval32    timestamp;
0769     struct v4l2_timecode    timecode;
0770     __u32           sequence;
0771 
0772     /* memory location */
0773     __u32           memory;
0774     union {
0775         __u32           offset;
0776         unsigned long   userptr;
0777         struct v4l2_plane *planes;
0778         __s32       fd;
0779     } m;
0780     __u32           length;
0781     __u32           reserved2;
0782     union {
0783         __s32       request_fd;
0784         __u32       reserved;
0785     };
0786 };
0787 #define VIDIOC_QUERYBUF_TIME32  _IOWR('V',  9, struct v4l2_buffer_time32)
0788 #define VIDIOC_QBUF_TIME32  _IOWR('V', 15, struct v4l2_buffer_time32)
0789 #define VIDIOC_DQBUF_TIME32 _IOWR('V', 17, struct v4l2_buffer_time32)
0790 #define VIDIOC_PREPARE_BUF_TIME32 _IOWR('V', 93, struct v4l2_buffer_time32)
0791 
0792 #endif /* _V4L2_IOCTL_H */