162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 262306a36Sopenharmony_ci.. c:namespace:: V4L 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci.. _VIDIOC_G_FREQUENCY: 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci******************************************** 762306a36Sopenharmony_ciioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY 862306a36Sopenharmony_ci******************************************** 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciName 1162306a36Sopenharmony_ci==== 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciVIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio frequency 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciSynopsis 1662306a36Sopenharmony_ci======== 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_G_FREQUENCY 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_FREQUENCY, struct v4l2_frequency *argp)`` 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci.. c:macro:: VIDIOC_S_FREQUENCY 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_FREQUENCY, const struct v4l2_frequency *argp)`` 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciArguments 2762306a36Sopenharmony_ci========= 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci``fd`` 3062306a36Sopenharmony_ci File descriptor returned by :c:func:`open()`. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci``argp`` 3362306a36Sopenharmony_ci Pointer to struct :c:type:`v4l2_frequency`. 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciDescription 3662306a36Sopenharmony_ci=========== 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciTo get the current tuner or modulator radio frequency applications set 3962306a36Sopenharmony_cithe ``tuner`` field of a struct 4062306a36Sopenharmony_ci:c:type:`v4l2_frequency` to the respective tuner or 4162306a36Sopenharmony_cimodulator number (only input devices have tuners, only output devices 4262306a36Sopenharmony_cihave modulators), zero out the ``reserved`` array and call the 4362306a36Sopenharmony_ci:ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this structure. The 4462306a36Sopenharmony_cidriver stores the current frequency in the ``frequency`` field. 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ciTo change the current tuner or modulator radio frequency applications 4762306a36Sopenharmony_ciinitialize the ``tuner``, ``type`` and ``frequency`` fields, and the 4862306a36Sopenharmony_ci``reserved`` array of a struct :c:type:`v4l2_frequency` 4962306a36Sopenharmony_ciand call the :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this 5062306a36Sopenharmony_cistructure. When the requested frequency is not possible the driver 5162306a36Sopenharmony_ciassumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` is a 5262306a36Sopenharmony_ciwrite-only ioctl, it does not return the actual new frequency. 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}| 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci.. c:type:: v4l2_frequency 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci.. flat-table:: struct v4l2_frequency 5962306a36Sopenharmony_ci :header-rows: 0 6062306a36Sopenharmony_ci :stub-columns: 0 6162306a36Sopenharmony_ci :widths: 1 1 2 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci * - __u32 6462306a36Sopenharmony_ci - ``tuner`` 6562306a36Sopenharmony_ci - The tuner or modulator index number. This is the same value as in 6662306a36Sopenharmony_ci the struct :c:type:`v4l2_input` ``tuner`` field and 6762306a36Sopenharmony_ci the struct :c:type:`v4l2_tuner` ``index`` field, or 6862306a36Sopenharmony_ci the struct :c:type:`v4l2_output` ``modulator`` field 6962306a36Sopenharmony_ci and the struct :c:type:`v4l2_modulator` ``index`` 7062306a36Sopenharmony_ci field. 7162306a36Sopenharmony_ci * - __u32 7262306a36Sopenharmony_ci - ``type`` 7362306a36Sopenharmony_ci - The tuner type. This is the same value as in the struct 7462306a36Sopenharmony_ci :c:type:`v4l2_tuner` ``type`` field. The type must be 7562306a36Sopenharmony_ci set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and 7662306a36Sopenharmony_ci to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to 7762306a36Sopenharmony_ci ``V4L2_TUNER_RADIO`` for modulators (currently only radio 7862306a36Sopenharmony_ci modulators are supported). See :c:type:`v4l2_tuner_type` 7962306a36Sopenharmony_ci * - __u32 8062306a36Sopenharmony_ci - ``frequency`` 8162306a36Sopenharmony_ci - Tuning frequency in units of 62.5 kHz, or if the struct 8262306a36Sopenharmony_ci :c:type:`v4l2_tuner` or struct 8362306a36Sopenharmony_ci :c:type:`v4l2_modulator` ``capability`` flag 8462306a36Sopenharmony_ci ``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is 8562306a36Sopenharmony_ci used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set. 8662306a36Sopenharmony_ci * - __u32 8762306a36Sopenharmony_ci - ``reserved``\ [8] 8862306a36Sopenharmony_ci - Reserved for future extensions. Drivers and applications must set 8962306a36Sopenharmony_ci the array to zero. 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ciReturn Value 9262306a36Sopenharmony_ci============ 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 9562306a36Sopenharmony_ciappropriately. The generic error codes are described at the 9662306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ciEINVAL 9962306a36Sopenharmony_ci The ``tuner`` index is out of bounds or the value in the ``type`` 10062306a36Sopenharmony_ci field is wrong. 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ciEBUSY 10362306a36Sopenharmony_ci A hardware seek is in progress. 104