162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: V4L
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _VIDIOC_S_HW_FREQ_SEEK:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci***************************
762306a36Sopenharmony_ciioctl VIDIOC_S_HW_FREQ_SEEK
862306a36Sopenharmony_ci***************************
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci====
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciVIDIOC_S_HW_FREQ_SEEK - Perform a hardware frequency seek
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci========
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_S_HW_FREQ_SEEK
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_HW_FREQ_SEEK, struct v4l2_hw_freq_seek *argp)``
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciArguments
2362306a36Sopenharmony_ci=========
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci``fd``
2662306a36Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci``argp``
2962306a36Sopenharmony_ci    Pointer to struct :c:type:`v4l2_hw_freq_seek`.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciDescription
3262306a36Sopenharmony_ci===========
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciStart a hardware frequency seek from the current frequency. To do this
3562306a36Sopenharmony_ciapplications initialize the ``tuner``, ``type``, ``seek_upward``,
3662306a36Sopenharmony_ci``wrap_around``, ``spacing``, ``rangelow`` and ``rangehigh`` fields, and
3762306a36Sopenharmony_cizero out the ``reserved`` array of a struct
3862306a36Sopenharmony_ci:c:type:`v4l2_hw_freq_seek` and call the
3962306a36Sopenharmony_ci``VIDIOC_S_HW_FREQ_SEEK`` ioctl with a pointer to this structure.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciThe ``rangelow`` and ``rangehigh`` fields can be set to a non-zero value
4262306a36Sopenharmony_cito tell the driver to search a specific band. If the struct
4362306a36Sopenharmony_ci:c:type:`v4l2_tuner` ``capability`` field has the
4462306a36Sopenharmony_ci``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag set, these values must fall
4562306a36Sopenharmony_ciwithin one of the bands returned by
4662306a36Sopenharmony_ci:ref:`VIDIOC_ENUM_FREQ_BANDS`. If the
4762306a36Sopenharmony_ci``V4L2_TUNER_CAP_HWSEEK_PROG_LIM`` flag is not set, then these values
4862306a36Sopenharmony_cimust exactly match those of one of the bands returned by
4962306a36Sopenharmony_ci:ref:`VIDIOC_ENUM_FREQ_BANDS`. If the
5062306a36Sopenharmony_cicurrent frequency of the tuner does not fall within the selected band it
5162306a36Sopenharmony_ciwill be clamped to fit in the band before the seek is started.
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciIf an error is returned, then the original frequency will be restored.
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciThis ioctl is supported if the ``V4L2_CAP_HW_FREQ_SEEK`` capability is
5662306a36Sopenharmony_ciset.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciIf this ioctl is called from a non-blocking filehandle, then ``EAGAIN``
5962306a36Sopenharmony_cierror code is returned and no seek takes place.
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci.. c:type:: v4l2_hw_freq_seek
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci.. flat-table:: struct v4l2_hw_freq_seek
6662306a36Sopenharmony_ci    :header-rows:  0
6762306a36Sopenharmony_ci    :stub-columns: 0
6862306a36Sopenharmony_ci    :widths:       1 1 2
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci    * - __u32
7162306a36Sopenharmony_ci      - ``tuner``
7262306a36Sopenharmony_ci      - The tuner index number. This is the same value as in the struct
7362306a36Sopenharmony_ci	:c:type:`v4l2_input` ``tuner`` field and the struct
7462306a36Sopenharmony_ci	:c:type:`v4l2_tuner` ``index`` field.
7562306a36Sopenharmony_ci    * - __u32
7662306a36Sopenharmony_ci      - ``type``
7762306a36Sopenharmony_ci      - The tuner type. This is the same value as in the struct
7862306a36Sopenharmony_ci	:c:type:`v4l2_tuner` ``type`` field. See
7962306a36Sopenharmony_ci	:c:type:`v4l2_tuner_type`
8062306a36Sopenharmony_ci    * - __u32
8162306a36Sopenharmony_ci      - ``seek_upward``
8262306a36Sopenharmony_ci      - If non-zero, seek upward from the current frequency, else seek
8362306a36Sopenharmony_ci	downward.
8462306a36Sopenharmony_ci    * - __u32
8562306a36Sopenharmony_ci      - ``wrap_around``
8662306a36Sopenharmony_ci      - If non-zero, wrap around when at the end of the frequency range,
8762306a36Sopenharmony_ci	else stop seeking. The struct :c:type:`v4l2_tuner`
8862306a36Sopenharmony_ci	``capability`` field will tell you what the hardware supports.
8962306a36Sopenharmony_ci    * - __u32
9062306a36Sopenharmony_ci      - ``spacing``
9162306a36Sopenharmony_ci      - If non-zero, defines the hardware seek resolution in Hz. The
9262306a36Sopenharmony_ci	driver selects the nearest value that is supported by the device.
9362306a36Sopenharmony_ci	If spacing is zero a reasonable default value is used.
9462306a36Sopenharmony_ci    * - __u32
9562306a36Sopenharmony_ci      - ``rangelow``
9662306a36Sopenharmony_ci      - If non-zero, the lowest tunable frequency of the band to search in
9762306a36Sopenharmony_ci	units of 62.5 kHz, or if the struct
9862306a36Sopenharmony_ci	:c:type:`v4l2_tuner` ``capability`` field has the
9962306a36Sopenharmony_ci	``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the
10062306a36Sopenharmony_ci	struct :c:type:`v4l2_tuner` ``capability`` field has
10162306a36Sopenharmony_ci	the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If
10262306a36Sopenharmony_ci	``rangelow`` is zero a reasonable default value is used.
10362306a36Sopenharmony_ci    * - __u32
10462306a36Sopenharmony_ci      - ``rangehigh``
10562306a36Sopenharmony_ci      - If non-zero, the highest tunable frequency of the band to search
10662306a36Sopenharmony_ci	in units of 62.5 kHz, or if the struct
10762306a36Sopenharmony_ci	:c:type:`v4l2_tuner` ``capability`` field has the
10862306a36Sopenharmony_ci	``V4L2_TUNER_CAP_LOW`` flag set, in units of 62.5 Hz or if the
10962306a36Sopenharmony_ci	struct :c:type:`v4l2_tuner` ``capability`` field has
11062306a36Sopenharmony_ci	the ``V4L2_TUNER_CAP_1HZ`` flag set, in units of 1 Hz. If
11162306a36Sopenharmony_ci	``rangehigh`` is zero a reasonable default value is used.
11262306a36Sopenharmony_ci    * - __u32
11362306a36Sopenharmony_ci      - ``reserved``\ [5]
11462306a36Sopenharmony_ci      - Reserved for future extensions. Applications must set the array to
11562306a36Sopenharmony_ci	zero.
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ciReturn Value
11862306a36Sopenharmony_ci============
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
12162306a36Sopenharmony_ciappropriately. The generic error codes are described at the
12262306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ciEINVAL
12562306a36Sopenharmony_ci    The ``tuner`` index is out of bounds, the ``wrap_around`` value is
12662306a36Sopenharmony_ci    not supported or one of the values in the ``type``, ``rangelow`` or
12762306a36Sopenharmony_ci    ``rangehigh`` fields is wrong.
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ciEAGAIN
13062306a36Sopenharmony_ci    Attempted to call ``VIDIOC_S_HW_FREQ_SEEK`` with the filehandle in
13162306a36Sopenharmony_ci    non-blocking mode.
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ciENODATA
13462306a36Sopenharmony_ci    The hardware seek found no channels.
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ciEBUSY
13762306a36Sopenharmony_ci    Another hardware seek is already in progress.
138