18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_G_FREQUENCY:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci********************************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
88c2ecf20Sopenharmony_ci********************************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio frequency
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_G_FREQUENCY
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_FREQUENCY, struct v4l2_frequency *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_S_FREQUENCY
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_FREQUENCY, const struct v4l2_frequency *argp)``
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciArguments
278c2ecf20Sopenharmony_ci=========
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci``fd``
308c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci``argp``
338c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`v4l2_frequency`.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciDescription
368c2ecf20Sopenharmony_ci===========
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciTo get the current tuner or modulator radio frequency applications set
398c2ecf20Sopenharmony_cithe ``tuner`` field of a struct
408c2ecf20Sopenharmony_ci:c:type:`v4l2_frequency` to the respective tuner or
418c2ecf20Sopenharmony_cimodulator number (only input devices have tuners, only output devices
428c2ecf20Sopenharmony_cihave modulators), zero out the ``reserved`` array and call the
438c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this structure. The
448c2ecf20Sopenharmony_cidriver stores the current frequency in the ``frequency`` field.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciTo change the current tuner or modulator radio frequency applications
478c2ecf20Sopenharmony_ciinitialize the ``tuner``, ``type`` and ``frequency`` fields, and the
488c2ecf20Sopenharmony_ci``reserved`` array of a struct :c:type:`v4l2_frequency`
498c2ecf20Sopenharmony_ciand call the :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this
508c2ecf20Sopenharmony_cistructure. When the requested frequency is not possible the driver
518c2ecf20Sopenharmony_ciassumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` is a
528c2ecf20Sopenharmony_ciwrite-only ioctl, it does not return the actual new frequency.
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci.. c:type:: v4l2_frequency
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_frequency
598c2ecf20Sopenharmony_ci    :header-rows:  0
608c2ecf20Sopenharmony_ci    :stub-columns: 0
618c2ecf20Sopenharmony_ci    :widths:       1 1 2
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci    * - __u32
648c2ecf20Sopenharmony_ci      - ``tuner``
658c2ecf20Sopenharmony_ci      - The tuner or modulator index number. This is the same value as in
668c2ecf20Sopenharmony_ci	the struct :c:type:`v4l2_input` ``tuner`` field and
678c2ecf20Sopenharmony_ci	the struct :c:type:`v4l2_tuner` ``index`` field, or
688c2ecf20Sopenharmony_ci	the struct :c:type:`v4l2_output` ``modulator`` field
698c2ecf20Sopenharmony_ci	and the struct :c:type:`v4l2_modulator` ``index``
708c2ecf20Sopenharmony_ci	field.
718c2ecf20Sopenharmony_ci    * - __u32
728c2ecf20Sopenharmony_ci      - ``type``
738c2ecf20Sopenharmony_ci      - The tuner type. This is the same value as in the struct
748c2ecf20Sopenharmony_ci	:c:type:`v4l2_tuner` ``type`` field. The type must be
758c2ecf20Sopenharmony_ci	set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and
768c2ecf20Sopenharmony_ci	to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to
778c2ecf20Sopenharmony_ci	``V4L2_TUNER_RADIO`` for modulators (currently only radio
788c2ecf20Sopenharmony_ci	modulators are supported). See :c:type:`v4l2_tuner_type`
798c2ecf20Sopenharmony_ci    * - __u32
808c2ecf20Sopenharmony_ci      - ``frequency``
818c2ecf20Sopenharmony_ci      - Tuning frequency in units of 62.5 kHz, or if the struct
828c2ecf20Sopenharmony_ci	:c:type:`v4l2_tuner` or struct
838c2ecf20Sopenharmony_ci	:c:type:`v4l2_modulator` ``capability`` flag
848c2ecf20Sopenharmony_ci	``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is
858c2ecf20Sopenharmony_ci	used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
868c2ecf20Sopenharmony_ci    * - __u32
878c2ecf20Sopenharmony_ci      - ``reserved``\ [8]
888c2ecf20Sopenharmony_ci      - Reserved for future extensions. Drivers and applications must set
898c2ecf20Sopenharmony_ci	the array to zero.
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ciReturn Value
928c2ecf20Sopenharmony_ci============
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
958c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
968c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ciEINVAL
998c2ecf20Sopenharmony_ci    The ``tuner`` index is out of bounds or the value in the ``type``
1008c2ecf20Sopenharmony_ci    field is wrong.
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ciEBUSY
1038c2ecf20Sopenharmony_ci    A hardware seek is in progress.
104