1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2 3.. _VIDIOC_G_DV_TIMINGS: 4 5********************************************** 6ioctl VIDIOC_G_DV_TIMINGS, VIDIOC_S_DV_TIMINGS 7********************************************** 8 9Name 10==== 11 12VIDIOC_G_DV_TIMINGS - VIDIOC_S_DV_TIMINGS - VIDIOC_SUBDEV_G_DV_TIMINGS - VIDIOC_SUBDEV_S_DV_TIMINGS - Get or set DV timings for input or output 13 14 15Synopsis 16======== 17 18.. c:function:: int ioctl( int fd, VIDIOC_G_DV_TIMINGS, struct v4l2_dv_timings *argp ) 19 :name: VIDIOC_G_DV_TIMINGS 20 21.. c:function:: int ioctl( int fd, VIDIOC_S_DV_TIMINGS, struct v4l2_dv_timings *argp ) 22 :name: VIDIOC_S_DV_TIMINGS 23 24.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_DV_TIMINGS, struct v4l2_dv_timings *argp ) 25 :name: VIDIOC_SUBDEV_G_DV_TIMINGS 26 27.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_DV_TIMINGS, struct v4l2_dv_timings *argp ) 28 :name: VIDIOC_SUBDEV_S_DV_TIMINGS 29 30 31Arguments 32========= 33 34``fd`` 35 File descriptor returned by :ref:`open() <func-open>`. 36 37``argp`` 38 Pointer to struct :c:type:`v4l2_dv_timings`. 39 40 41Description 42=========== 43 44To set DV timings for the input or output, applications use the 45:ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl and to get the current timings, 46applications use the :ref:`VIDIOC_G_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` ioctl. The detailed timing 47information is filled in using the structure struct 48:c:type:`v4l2_dv_timings`. These ioctls take a 49pointer to the struct :c:type:`v4l2_dv_timings` 50structure as argument. If the ioctl is not supported or the timing 51values are not correct, the driver returns ``EINVAL`` error code. 52 53Calling ``VIDIOC_SUBDEV_S_DV_TIMINGS`` on a subdev device node that has been 54registered in read-only mode is not allowed. An error is returned and the errno 55variable is set to ``-EPERM``. 56 57The ``linux/v4l2-dv-timings.h`` header can be used to get the timings of 58the formats in the :ref:`cea861` and :ref:`vesadmt` standards. If 59the current input or output does not support DV timings (e.g. if 60:ref:`VIDIOC_ENUMINPUT` does not set the 61``V4L2_IN_CAP_DV_TIMINGS`` flag), then ``ENODATA`` error code is returned. 62 63 64Return Value 65============ 66 67On success 0 is returned, on error -1 and the ``errno`` variable is set 68appropriately. The generic error codes are described at the 69:ref:`Generic Error Codes <gen-errors>` chapter. 70 71EINVAL 72 This ioctl is not supported, or the :ref:`VIDIOC_S_DV_TIMINGS <VIDIOC_G_DV_TIMINGS>` 73 parameter was unsuitable. 74 75ENODATA 76 Digital video timings are not supported for this input or output. 77 78EBUSY 79 The device is busy and therefore can not change the timings. 80 81EPERM 82 ``VIDIOC_SUBDEV_S_DV_TIMINGS`` has been called on a read-only subdevice. 83 84.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 85 86.. c:type:: v4l2_bt_timings 87 88.. flat-table:: struct v4l2_bt_timings 89 :header-rows: 0 90 :stub-columns: 0 91 :widths: 1 1 2 92 93 * - __u32 94 - ``width`` 95 - Width of the active video in pixels. 96 * - __u32 97 - ``height`` 98 - Height of the active video frame in lines. So for interlaced 99 formats the height of the active video in each field is 100 ``height``/2. 101 * - __u32 102 - ``interlaced`` 103 - Progressive (``V4L2_DV_PROGRESSIVE``) or interlaced (``V4L2_DV_INTERLACED``). 104 * - __u32 105 - ``polarities`` 106 - This is a bit mask that defines polarities of sync signals. bit 0 107 (``V4L2_DV_VSYNC_POS_POL``) is for vertical sync polarity and bit 108 1 (``V4L2_DV_HSYNC_POS_POL``) is for horizontal sync polarity. If 109 the bit is set (1) it is positive polarity and if is cleared (0), 110 it is negative polarity. 111 * - __u64 112 - ``pixelclock`` 113 - Pixel clock in Hz. Ex. 74.25MHz->74250000 114 * - __u32 115 - ``hfrontporch`` 116 - Horizontal front porch in pixels 117 * - __u32 118 - ``hsync`` 119 - Horizontal sync length in pixels 120 * - __u32 121 - ``hbackporch`` 122 - Horizontal back porch in pixels 123 * - __u32 124 - ``vfrontporch`` 125 - Vertical front porch in lines. For interlaced formats this refers 126 to the odd field (aka field 1). 127 * - __u32 128 - ``vsync`` 129 - Vertical sync length in lines. For interlaced formats this refers 130 to the odd field (aka field 1). 131 * - __u32 132 - ``vbackporch`` 133 - Vertical back porch in lines. For interlaced formats this refers 134 to the odd field (aka field 1). 135 * - __u32 136 - ``il_vfrontporch`` 137 - Vertical front porch in lines for the even field (aka field 2) of 138 interlaced field formats. Must be 0 for progressive formats. 139 * - __u32 140 - ``il_vsync`` 141 - Vertical sync length in lines for the even field (aka field 2) of 142 interlaced field formats. Must be 0 for progressive formats. 143 * - __u32 144 - ``il_vbackporch`` 145 - Vertical back porch in lines for the even field (aka field 2) of 146 interlaced field formats. Must be 0 for progressive formats. 147 * - __u32 148 - ``standards`` 149 - The video standard(s) this format belongs to. This will be filled 150 in by the driver. Applications must set this to 0. See 151 :ref:`dv-bt-standards` for a list of standards. 152 * - __u32 153 - ``flags`` 154 - Several flags giving more information about the format. See 155 :ref:`dv-bt-flags` for a description of the flags. 156 * - struct :c:type:`v4l2_fract` 157 - ``picture_aspect`` 158 - The picture aspect if the pixels are not square. Only valid if the 159 ``V4L2_DV_FL_HAS_PICTURE_ASPECT`` flag is set. 160 * - __u8 161 - ``cea861_vic`` 162 - The Video Identification Code according to the CEA-861 standard. 163 Only valid if the ``V4L2_DV_FL_HAS_CEA861_VIC`` flag is set. 164 * - __u8 165 - ``hdmi_vic`` 166 - The Video Identification Code according to the HDMI standard. 167 Only valid if the ``V4L2_DV_FL_HAS_HDMI_VIC`` flag is set. 168 * - __u8 169 - ``reserved[46]`` 170 - Reserved for future extensions. Drivers and applications must set 171 the array to zero. 172 173 174.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{7.0cm}|p{3.5cm}| 175 176.. c:type:: v4l2_dv_timings 177 178.. flat-table:: struct v4l2_dv_timings 179 :header-rows: 0 180 :stub-columns: 0 181 :widths: 1 1 2 182 183 * - __u32 184 - ``type`` 185 - Type of DV timings as listed in :ref:`dv-timing-types`. 186 * - union { 187 - (anonymous) 188 * - struct :c:type:`v4l2_bt_timings` 189 - ``bt`` 190 - Timings defined by BT.656/1120 specifications 191 * - __u32 192 - ``reserved``\ [32] 193 - 194 * - } 195 - 196 197.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 198 199.. _dv-timing-types: 200 201.. flat-table:: DV Timing types 202 :header-rows: 0 203 :stub-columns: 0 204 :widths: 1 1 2 205 206 * - Timing type 207 - value 208 - Description 209 * - 210 - 211 - 212 * - ``V4L2_DV_BT_656_1120`` 213 - 0 214 - BT.656/1120 timings 215 216.. tabularcolumns:: |p{4.5cm}|p{12.8cm}| 217 218.. _dv-bt-standards: 219 220.. flat-table:: DV BT Timing standards 221 :header-rows: 0 222 :stub-columns: 0 223 224 * - Timing standard 225 - Description 226 * - ``V4L2_DV_BT_STD_CEA861`` 227 - The timings follow the CEA-861 Digital TV Profile standard 228 * - ``V4L2_DV_BT_STD_DMT`` 229 - The timings follow the VESA Discrete Monitor Timings standard 230 * - ``V4L2_DV_BT_STD_CVT`` 231 - The timings follow the VESA Coordinated Video Timings standard 232 * - ``V4L2_DV_BT_STD_GTF`` 233 - The timings follow the VESA Generalized Timings Formula standard 234 * - ``V4L2_DV_BT_STD_SDI`` 235 - The timings follow the SDI Timings standard. 236 There are no horizontal syncs/porches at all in this format. 237 Total blanking timings must be set in hsync or vsync fields only. 238 239.. tabularcolumns:: |p{7.0cm}|p{10.5cm}| 240 241.. _dv-bt-flags: 242 243.. flat-table:: DV BT Timing flags 244 :header-rows: 0 245 :stub-columns: 0 246 247 * - Flag 248 - Description 249 * - ``V4L2_DV_FL_REDUCED_BLANKING`` 250 - CVT/GTF specific: the timings use reduced blanking (CVT) or the 251 'Secondary GTF' curve (GTF). In both cases the horizontal and/or 252 vertical blanking intervals are reduced, allowing a higher 253 resolution over the same bandwidth. This is a read-only flag, 254 applications must not set this. 255 * - ``V4L2_DV_FL_CAN_REDUCE_FPS`` 256 - CEA-861 specific: set for CEA-861 formats with a framerate that is 257 a multiple of six. These formats can be optionally played at 1 / 258 1.001 speed to be compatible with 60 Hz based standards such as 259 NTSC and PAL-M that use a framerate of 29.97 frames per second. If 260 the transmitter can't generate such frequencies, then the flag 261 will also be cleared. This is a read-only flag, applications must 262 not set this. 263 * - ``V4L2_DV_FL_REDUCED_FPS`` 264 - CEA-861 specific: only valid for video transmitters or video 265 receivers that have the ``V4L2_DV_FL_CAN_DETECT_REDUCED_FPS`` 266 set. This flag is cleared otherwise. It is also only valid for 267 formats with the ``V4L2_DV_FL_CAN_REDUCE_FPS`` flag set, for other 268 formats the flag will be cleared by the driver. 269 270 If the application sets this flag for a transmitter, then the 271 pixelclock used to set up the transmitter is divided by 1.001 to 272 make it compatible with NTSC framerates. If the transmitter can't 273 generate such frequencies, then the flag will be cleared. 274 275 If a video receiver detects that the format uses a reduced framerate, 276 then it will set this flag to signal this to the application. 277 * - ``V4L2_DV_FL_HALF_LINE`` 278 - Specific to interlaced formats: if set, then the vertical 279 frontporch of field 1 (aka the odd field) is really one half-line 280 longer and the vertical backporch of field 2 (aka the even field) 281 is really one half-line shorter, so each field has exactly the 282 same number of half-lines. Whether half-lines can be detected or 283 used depends on the hardware. 284 * - ``V4L2_DV_FL_IS_CE_VIDEO`` 285 - If set, then this is a Consumer Electronics (CE) video format. 286 Such formats differ from other formats (commonly called IT 287 formats) in that if R'G'B' encoding is used then by default the 288 R'G'B' values use limited range (i.e. 16-235) as opposed to full 289 range (i.e. 0-255). All formats defined in CEA-861 except for the 290 640x480p59.94 format are CE formats. 291 * - ``V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE`` 292 - Some formats like SMPTE-125M have an interlaced signal with a odd 293 total height. For these formats, if this flag is set, the first 294 field has the extra line. Else, it is the second field. 295 * - ``V4L2_DV_FL_HAS_PICTURE_ASPECT`` 296 - If set, then the picture_aspect field is valid. Otherwise assume that 297 the pixels are square, so the picture aspect ratio is the same as the 298 width to height ratio. 299 * - ``V4L2_DV_FL_HAS_CEA861_VIC`` 300 - If set, then the cea861_vic field is valid and contains the Video 301 Identification Code as per the CEA-861 standard. 302 * - ``V4L2_DV_FL_HAS_HDMI_VIC`` 303 - If set, then the hdmi_vic field is valid and contains the Video 304 Identification Code as per the HDMI standard (HDMI Vendor Specific 305 InfoFrame). 306 * - ``V4L2_DV_FL_CAN_DETECT_REDUCED_FPS`` 307 - CEA-861 specific: only valid for video receivers, the flag is 308 cleared by transmitters. 309 If set, then the hardware can detect the difference between 310 regular framerates and framerates reduced by 1000/1001. E.g.: 311 60 vs 59.94 Hz, 30 vs 29.97 Hz or 24 vs 23.976 Hz. 312