162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
262306a36Sopenharmony_ci.. c:namespace:: V4L
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci.. _VIDIOC_ENUM_FREQ_BANDS:
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci****************************
762306a36Sopenharmony_ciioctl VIDIOC_ENUM_FREQ_BANDS
862306a36Sopenharmony_ci****************************
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciName
1162306a36Sopenharmony_ci====
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciVIDIOC_ENUM_FREQ_BANDS - Enumerate supported frequency bands
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciSynopsis
1662306a36Sopenharmony_ci========
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_ENUM_FREQ_BANDS
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_ENUM_FREQ_BANDS, struct v4l2_frequency_band *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_frequency_band`.
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ciDescription
3262306a36Sopenharmony_ci===========
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciEnumerates the frequency bands that a tuner or modulator supports. To do
3562306a36Sopenharmony_cithis applications initialize the ``tuner``, ``type`` and ``index``
3662306a36Sopenharmony_cifields, and zero out the ``reserved`` array of a struct
3762306a36Sopenharmony_ci:c:type:`v4l2_frequency_band` and call the
3862306a36Sopenharmony_ci:ref:`VIDIOC_ENUM_FREQ_BANDS` ioctl with a pointer to this structure.
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciThis ioctl is supported if the ``V4L2_TUNER_CAP_FREQ_BANDS`` capability
4162306a36Sopenharmony_ciof the corresponding tuner/modulator is set.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{2.4cm}|
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci.. c:type:: v4l2_frequency_band
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci.. flat-table:: struct v4l2_frequency_band
4862306a36Sopenharmony_ci    :header-rows:  0
4962306a36Sopenharmony_ci    :stub-columns: 0
5062306a36Sopenharmony_ci    :widths:       1 1 2 1 1
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci    * - __u32
5362306a36Sopenharmony_ci      - ``tuner``
5462306a36Sopenharmony_ci      - The tuner or modulator index number. This is the same value as in
5562306a36Sopenharmony_ci	the struct :c:type:`v4l2_input` ``tuner`` field and
5662306a36Sopenharmony_ci	the struct :c:type:`v4l2_tuner` ``index`` field, or
5762306a36Sopenharmony_ci	the struct :c:type:`v4l2_output` ``modulator`` field
5862306a36Sopenharmony_ci	and the struct :c:type:`v4l2_modulator` ``index``
5962306a36Sopenharmony_ci	field.
6062306a36Sopenharmony_ci    * - __u32
6162306a36Sopenharmony_ci      - ``type``
6262306a36Sopenharmony_ci      - The tuner type. This is the same value as in the struct
6362306a36Sopenharmony_ci	:c:type:`v4l2_tuner` ``type`` field. The type must be
6462306a36Sopenharmony_ci	set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and
6562306a36Sopenharmony_ci	to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to
6662306a36Sopenharmony_ci	``V4L2_TUNER_RADIO`` for modulators (currently only radio
6762306a36Sopenharmony_ci	modulators are supported). See :c:type:`v4l2_tuner_type`
6862306a36Sopenharmony_ci    * - __u32
6962306a36Sopenharmony_ci      - ``index``
7062306a36Sopenharmony_ci      - Identifies the frequency band, set by the application.
7162306a36Sopenharmony_ci    * - __u32
7262306a36Sopenharmony_ci      - ``capability``
7362306a36Sopenharmony_ci      - :cspan:`2` The tuner/modulator capability flags for this
7462306a36Sopenharmony_ci	frequency band, see :ref:`tuner-capability`. The
7562306a36Sopenharmony_ci	``V4L2_TUNER_CAP_LOW`` or ``V4L2_TUNER_CAP_1HZ`` capability must
7662306a36Sopenharmony_ci	be the same for all frequency bands of the selected
7762306a36Sopenharmony_ci	tuner/modulator. So either all bands have that capability set, or
7862306a36Sopenharmony_ci	none of them have that capability.
7962306a36Sopenharmony_ci    * - __u32
8062306a36Sopenharmony_ci      - ``rangelow``
8162306a36Sopenharmony_ci      - :cspan:`2` The lowest tunable frequency in units of 62.5 kHz, or
8262306a36Sopenharmony_ci	if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units
8362306a36Sopenharmony_ci	of 62.5 Hz, for this frequency band. A 1 Hz unit is used when the
8462306a36Sopenharmony_ci	``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
8562306a36Sopenharmony_ci    * - __u32
8662306a36Sopenharmony_ci      - ``rangehigh``
8762306a36Sopenharmony_ci      - :cspan:`2` The highest tunable frequency in units of 62.5 kHz,
8862306a36Sopenharmony_ci	or if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in
8962306a36Sopenharmony_ci	units of 62.5 Hz, for this frequency band. A 1 Hz unit is used
9062306a36Sopenharmony_ci	when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
9162306a36Sopenharmony_ci    * - __u32
9262306a36Sopenharmony_ci      - ``modulation``
9362306a36Sopenharmony_ci      - :cspan:`2` The supported modulation systems of this frequency
9462306a36Sopenharmony_ci	band. See :ref:`band-modulation`.
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci	.. note::
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci	   Currently only one modulation system per frequency band
9962306a36Sopenharmony_ci	   is supported. More work will need to be done if multiple
10062306a36Sopenharmony_ci	   modulation systems are possible. Contact the linux-media
10162306a36Sopenharmony_ci	   mailing list
10262306a36Sopenharmony_ci	   (`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__)
10362306a36Sopenharmony_ci	   if you need such functionality.
10462306a36Sopenharmony_ci    * - __u32
10562306a36Sopenharmony_ci      - ``reserved``\ [9]
10662306a36Sopenharmony_ci      - Reserved for future extensions.
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci	Applications and drivers must set the array to zero.
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}|
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci.. _band-modulation:
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci.. flat-table:: Band Modulation Systems
11662306a36Sopenharmony_ci    :header-rows:  0
11762306a36Sopenharmony_ci    :stub-columns: 0
11862306a36Sopenharmony_ci    :widths:       3 1 4
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci    * - ``V4L2_BAND_MODULATION_VSB``
12162306a36Sopenharmony_ci      - 0x02
12262306a36Sopenharmony_ci      - Vestigial Sideband modulation, used for analog TV.
12362306a36Sopenharmony_ci    * - ``V4L2_BAND_MODULATION_FM``
12462306a36Sopenharmony_ci      - 0x04
12562306a36Sopenharmony_ci      - Frequency Modulation, commonly used for analog radio.
12662306a36Sopenharmony_ci    * - ``V4L2_BAND_MODULATION_AM``
12762306a36Sopenharmony_ci      - 0x08
12862306a36Sopenharmony_ci      - Amplitude Modulation, commonly used for analog radio.
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ciReturn Value
13162306a36Sopenharmony_ci============
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
13462306a36Sopenharmony_ciappropriately. The generic error codes are described at the
13562306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ciEINVAL
13862306a36Sopenharmony_ci    The ``tuner`` or ``index`` is out of bounds or the ``type`` field is
13962306a36Sopenharmony_ci    wrong.
140