18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_S_HW_FREQ_SEEK:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci***************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_S_HW_FREQ_SEEK
88c2ecf20Sopenharmony_ci***************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_S_HW_FREQ_SEEK - Perform a hardware frequency seek
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_S_HW_FREQ_SEEK
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_HW_FREQ_SEEK, struct v4l2_hw_freq_seek *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciArguments
238c2ecf20Sopenharmony_ci=========
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci``fd``
268c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``argp``
298c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`v4l2_hw_freq_seek`.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDescription
328c2ecf20Sopenharmony_ci===========
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciStart a hardware frequency seek from the current frequency. To do this
358c2ecf20Sopenharmony_ciapplications initialize the ``tuner``, ``type``, ``seek_upward``,
368c2ecf20Sopenharmony_ci``wrap_around``, ``spacing``, ``rangelow`` and ``rangehigh`` fields, and
378c2ecf20Sopenharmony_cizero out the ``reserved`` array of a struct
388c2ecf20Sopenharmony_ci:c:type:`v4l2_hw_freq_seek` and call the
398c2ecf20Sopenharmony_ci``VIDIOC_S_HW_FREQ_SEEK`` ioctl with a pointer to this structure.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciThe ``rangelow`` and ``rangehigh`` fields can be set to a non-zero value
428c2ecf20Sopenharmony_cito tell the driver to search a specific band. If the struct
438c2ecf20Sopenharmony_ci:c:type:`v4l2_tuner` ``capability`` field has the
448c2ecf20Sopenharmony_ci``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag set, these values must fall
458c2ecf20Sopenharmony_ciwithin one of the bands returned by
468c2ecf20Sopenharmony_ci:ref:`VIDIOC_ENUM_FREQ_BANDS`. If the
478c2ecf20Sopenharmony_ci``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag is not set, then these values
488c2ecf20Sopenharmony_cimust exactly match those of one of the bands returned by
498c2ecf20Sopenharmony_ci:ref:`VIDIOC_ENUM_FREQ_BANDS`. If the
508c2ecf20Sopenharmony_cicurrent frequency of the tuner does not fall within the selected band it
518c2ecf20Sopenharmony_ciwill be clamped to fit in the band before the seek is started.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciIf an error is returned, then the original frequency will be restored.
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciThis ioctl is supported if the ``V4L2_CAP_HW_FREQ_SEEK`` capability is
568c2ecf20Sopenharmony_ciset.
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciIf this ioctl is called from a non-blocking filehandle, then ``EAGAIN``
598c2ecf20Sopenharmony_cierror code is returned and no seek takes place.
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci.. c:type:: v4l2_hw_freq_seek
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_hw_freq_seek
668c2ecf20Sopenharmony_ci    :header-rows:  0
678c2ecf20Sopenharmony_ci    :stub-columns: 0
688c2ecf20Sopenharmony_ci    :widths:       1 1 2
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci    * - __u32
718c2ecf20Sopenharmony_ci      - ``tuner``
728c2ecf20Sopenharmony_ci      - The tuner index number. This is the same value as in the struct
738c2ecf20Sopenharmony_ci	:c:type:`v4l2_input` ``tuner`` field and the struct
748c2ecf20Sopenharmony_ci	:c:type:`v4l2_tuner` ``index`` field.
758c2ecf20Sopenharmony_ci    * - __u32
768c2ecf20Sopenharmony_ci      - ``type``
778c2ecf20Sopenharmony_ci      - The tuner type. This is the same value as in the struct
788c2ecf20Sopenharmony_ci	:c:type:`v4l2_tuner` ``type`` field. See
798c2ecf20Sopenharmony_ci	:c:type:`v4l2_tuner_type`
808c2ecf20Sopenharmony_ci    * - __u32
818c2ecf20Sopenharmony_ci      - ``seek_upward``
828c2ecf20Sopenharmony_ci      - If non-zero, seek upward from the current frequency, else seek
838c2ecf20Sopenharmony_ci	downward.
848c2ecf20Sopenharmony_ci    * - __u32
858c2ecf20Sopenharmony_ci      - ``wrap_around``
868c2ecf20Sopenharmony_ci      - If non-zero, wrap around when at the end of the frequency range,
878c2ecf20Sopenharmony_ci	else stop seeking. The struct :c:type:`v4l2_tuner`
888c2ecf20Sopenharmony_ci	``capability`` field will tell you what the hardware supports.
898c2ecf20Sopenharmony_ci    * - __u32
908c2ecf20Sopenharmony_ci      - ``spacing``
918c2ecf20Sopenharmony_ci      - If non-zero, defines the hardware seek resolution in Hz. The
928c2ecf20Sopenharmony_ci	driver selects the nearest value that is supported by the device.
938c2ecf20Sopenharmony_ci	If spacing is zero a reasonable default value is used.
948c2ecf20Sopenharmony_ci    * - __u32
958c2ecf20Sopenharmony_ci      - ``rangelow``
968c2ecf20Sopenharmony_ci      - If non-zero, the lowest tunable frequency of the band to search in
978c2ecf20Sopenharmony_ci	units of 62.5 kHz, or if the struct
988c2ecf20Sopenharmony_ci	:c:type:`v4l2_tuner` ``capability`` field has the
998c2ecf20Sopenharmony_ci	``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the
1008c2ecf20Sopenharmony_ci	struct :c:type:`v4l2_tuner` ``capability`` field has
1018c2ecf20Sopenharmony_ci	the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If
1028c2ecf20Sopenharmony_ci	``rangelow`` is zero a reasonable default value is used.
1038c2ecf20Sopenharmony_ci    * - __u32
1048c2ecf20Sopenharmony_ci      - ``rangehigh``
1058c2ecf20Sopenharmony_ci      - If non-zero, the highest tunable frequency of the band to search
1068c2ecf20Sopenharmony_ci	in units of 62.5 kHz, or if the struct
1078c2ecf20Sopenharmony_ci	:c:type:`v4l2_tuner` ``capability`` field has the
1088c2ecf20Sopenharmony_ci	``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the
1098c2ecf20Sopenharmony_ci	struct :c:type:`v4l2_tuner` ``capability`` field has
1108c2ecf20Sopenharmony_ci	the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If
1118c2ecf20Sopenharmony_ci	``rangehigh`` is zero a reasonable default value is used.
1128c2ecf20Sopenharmony_ci    * - __u32
1138c2ecf20Sopenharmony_ci      - ``reserved``\ [5]
1148c2ecf20Sopenharmony_ci      - Reserved for future extensions. Applications must set the array to
1158c2ecf20Sopenharmony_ci	zero.
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ciReturn Value
1188c2ecf20Sopenharmony_ci============
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
1218c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
1228c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ciEINVAL
1258c2ecf20Sopenharmony_ci    The ``tuner`` index is out of bounds, the ``wrap_around`` value is
1268c2ecf20Sopenharmony_ci    not supported or one of the values in the ``type``, ``rangelow`` or
1278c2ecf20Sopenharmony_ci    ``rangehigh`` fields is wrong.
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ciEAGAIN
1308c2ecf20Sopenharmony_ci    Attempted to call ``VIDIOC_S_HW_FREQ_SEEK`` with the filehandle in
1318c2ecf20Sopenharmony_ci    non-blocking mode.
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ciENODATA
1348c2ecf20Sopenharmony_ci    The hardware seek found no channels.
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ciEBUSY
1378c2ecf20Sopenharmony_ci    Another hardware seek is already in progress.
138