1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L 354f38fcaSMauro Carvalho Chehab 454f38fcaSMauro Carvalho Chehab.. _VIDIOC_QUERY_DV_TIMINGS: 554f38fcaSMauro Carvalho Chehab 654f38fcaSMauro Carvalho Chehab***************************** 754f38fcaSMauro Carvalho Chehabioctl VIDIOC_QUERY_DV_TIMINGS 854f38fcaSMauro Carvalho Chehab***************************** 954f38fcaSMauro Carvalho Chehab 1054f38fcaSMauro Carvalho ChehabName 1154f38fcaSMauro Carvalho Chehab==== 1254f38fcaSMauro Carvalho Chehab 1354f38fcaSMauro Carvalho ChehabVIDIOC_QUERY_DV_TIMINGS - VIDIOC_SUBDEV_QUERY_DV_TIMINGS - Sense the DV preset received by the current input 1454f38fcaSMauro Carvalho Chehab 1554f38fcaSMauro Carvalho ChehabSynopsis 1654f38fcaSMauro Carvalho Chehab======== 1754f38fcaSMauro Carvalho Chehab 18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_QUERY_DV_TIMINGS 1954f38fcaSMauro Carvalho Chehab 20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_QUERY_DV_TIMINGS, struct v4l2_dv_timings *argp)`` 2154f38fcaSMauro Carvalho Chehab 22407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBDEV_QUERY_DV_TIMINGS 23407e84cdSMauro Carvalho Chehab 24407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_SUBDEV_QUERY_DV_TIMINGS, struct v4l2_dv_timings *argp)`` 2554f38fcaSMauro Carvalho Chehab 2654f38fcaSMauro Carvalho ChehabArguments 2754f38fcaSMauro Carvalho Chehab========= 2854f38fcaSMauro Carvalho Chehab 2954f38fcaSMauro Carvalho Chehab``fd`` 30407e84cdSMauro Carvalho Chehab File descriptor returned by :c:func:`open()`. 3154f38fcaSMauro Carvalho Chehab 3254f38fcaSMauro Carvalho Chehab``argp`` 3354f38fcaSMauro Carvalho Chehab Pointer to struct :c:type:`v4l2_dv_timings`. 3454f38fcaSMauro Carvalho Chehab 3554f38fcaSMauro Carvalho ChehabDescription 3654f38fcaSMauro Carvalho Chehab=========== 3754f38fcaSMauro Carvalho Chehab 3854f38fcaSMauro Carvalho ChehabThe hardware may be able to detect the current DV timings automatically, 3954f38fcaSMauro Carvalho Chehabsimilar to sensing the video standard. To do so, applications call 4054f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_QUERY_DV_TIMINGS` with a pointer to a struct 4154f38fcaSMauro Carvalho Chehab:c:type:`v4l2_dv_timings`. Once the hardware detects 4254f38fcaSMauro Carvalho Chehabthe timings, it will fill in the timings structure. 4354f38fcaSMauro Carvalho Chehab 4454f38fcaSMauro Carvalho Chehab.. note:: 4554f38fcaSMauro Carvalho Chehab 4654f38fcaSMauro Carvalho Chehab Drivers shall *not* switch timings automatically if new 4754f38fcaSMauro Carvalho Chehab timings are detected. Instead, drivers should send the 4854f38fcaSMauro Carvalho Chehab ``V4L2_EVENT_SOURCE_CHANGE`` event (if they support this) and expect 4954f38fcaSMauro Carvalho Chehab that userspace will take action by calling :ref:`VIDIOC_QUERY_DV_TIMINGS`. 5054f38fcaSMauro Carvalho Chehab The reason is that new timings usually mean different buffer sizes as 5154f38fcaSMauro Carvalho Chehab well, and you cannot change buffer sizes on the fly. In general, 5254f38fcaSMauro Carvalho Chehab applications that receive the Source Change event will have to call 5354f38fcaSMauro Carvalho Chehab :ref:`VIDIOC_QUERY_DV_TIMINGS`, and if the detected timings are valid they 5454f38fcaSMauro Carvalho Chehab will have to stop streaming, set the new timings, allocate new buffers 5554f38fcaSMauro Carvalho Chehab and start streaming again. 5654f38fcaSMauro Carvalho Chehab 5754f38fcaSMauro Carvalho ChehabIf the timings could not be detected because there was no signal, then 5854f38fcaSMauro Carvalho ChehabENOLINK is returned. If a signal was detected, but it was unstable and 5954f38fcaSMauro Carvalho Chehabthe receiver could not lock to the signal, then ``ENOLCK`` is returned. If 6054f38fcaSMauro Carvalho Chehabthe receiver could lock to the signal, but the format is unsupported 6154f38fcaSMauro Carvalho Chehab(e.g. because the pixelclock is out of range of the hardware 6254f38fcaSMauro Carvalho Chehabcapabilities), then the driver fills in whatever timings it could find 6354f38fcaSMauro Carvalho Chehaband returns ``ERANGE``. In that case the application can call 6454f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_DV_TIMINGS_CAP` to compare the 6554f38fcaSMauro Carvalho Chehabfound timings with the hardware's capabilities in order to give more 6654f38fcaSMauro Carvalho Chehabprecise feedback to the user. 6754f38fcaSMauro Carvalho Chehab 6854f38fcaSMauro Carvalho ChehabReturn Value 6954f38fcaSMauro Carvalho Chehab============ 7054f38fcaSMauro Carvalho Chehab 7154f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set 7254f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 7354f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 7454f38fcaSMauro Carvalho Chehab 7554f38fcaSMauro Carvalho ChehabENODATA 7654f38fcaSMauro Carvalho Chehab Digital video timings are not supported for this input or output. 7754f38fcaSMauro Carvalho Chehab 7854f38fcaSMauro Carvalho ChehabENOLINK 7954f38fcaSMauro Carvalho Chehab No timings could be detected because no signal was found. 8054f38fcaSMauro Carvalho Chehab 8154f38fcaSMauro Carvalho ChehabENOLCK 8254f38fcaSMauro Carvalho Chehab The signal was unstable and the hardware could not lock on to it. 8354f38fcaSMauro Carvalho Chehab 8454f38fcaSMauro Carvalho ChehabERANGE 8554f38fcaSMauro Carvalho Chehab Timings were found, but they are out of range of the hardware 8654f38fcaSMauro Carvalho Chehab capabilities. 87