xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/vidioc-enum-freq-bands.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: V4L
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _VIDIOC_ENUM_FREQ_BANDS:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun****************************
7*4882a593Smuzhiyunioctl VIDIOC_ENUM_FREQ_BANDS
8*4882a593Smuzhiyun****************************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunVIDIOC_ENUM_FREQ_BANDS - Enumerate supported frequency bands
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun========
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:macro:: VIDIOC_ENUM_FREQ_BANDS
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_ENUM_FREQ_BANDS, struct v4l2_frequency_band *argp)``
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunArguments
23*4882a593Smuzhiyun=========
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun``fd``
26*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun``argp``
29*4882a593Smuzhiyun    Pointer to struct :c:type:`v4l2_frequency_band`.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunDescription
32*4882a593Smuzhiyun===========
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunEnumerates the frequency bands that a tuner or modulator supports. To do
35*4882a593Smuzhiyunthis applications initialize the ``tuner``, ``type`` and ``index``
36*4882a593Smuzhiyunfields, and zero out the ``reserved`` array of a struct
37*4882a593Smuzhiyun:c:type:`v4l2_frequency_band` and call the
38*4882a593Smuzhiyun:ref:`VIDIOC_ENUM_FREQ_BANDS` ioctl with a pointer to this structure.
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunThis ioctl is supported if the ``V4L2_TUNER_CAP_FREQ_BANDS`` capability
41*4882a593Smuzhiyunof the corresponding tuner/modulator is set.
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{3.0cm}|
44*4882a593Smuzhiyun
45*4882a593Smuzhiyun.. c:type:: v4l2_frequency_band
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun.. flat-table:: struct v4l2_frequency_band
48*4882a593Smuzhiyun    :header-rows:  0
49*4882a593Smuzhiyun    :stub-columns: 0
50*4882a593Smuzhiyun    :widths:       1 1 2 1 1
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun    * - __u32
53*4882a593Smuzhiyun      - ``tuner``
54*4882a593Smuzhiyun      - The tuner or modulator index number. This is the same value as in
55*4882a593Smuzhiyun	the struct :c:type:`v4l2_input` ``tuner`` field and
56*4882a593Smuzhiyun	the struct :c:type:`v4l2_tuner` ``index`` field, or
57*4882a593Smuzhiyun	the struct :c:type:`v4l2_output` ``modulator`` field
58*4882a593Smuzhiyun	and the struct :c:type:`v4l2_modulator` ``index``
59*4882a593Smuzhiyun	field.
60*4882a593Smuzhiyun    * - __u32
61*4882a593Smuzhiyun      - ``type``
62*4882a593Smuzhiyun      - The tuner type. This is the same value as in the struct
63*4882a593Smuzhiyun	:c:type:`v4l2_tuner` ``type`` field. The type must be
64*4882a593Smuzhiyun	set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and
65*4882a593Smuzhiyun	to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to
66*4882a593Smuzhiyun	``V4L2_TUNER_RADIO`` for modulators (currently only radio
67*4882a593Smuzhiyun	modulators are supported). See :c:type:`v4l2_tuner_type`
68*4882a593Smuzhiyun    * - __u32
69*4882a593Smuzhiyun      - ``index``
70*4882a593Smuzhiyun      - Identifies the frequency band, set by the application.
71*4882a593Smuzhiyun    * - __u32
72*4882a593Smuzhiyun      - ``capability``
73*4882a593Smuzhiyun      - :cspan:`2` The tuner/modulator capability flags for this
74*4882a593Smuzhiyun	frequency band, see :ref:`tuner-capability`. The
75*4882a593Smuzhiyun	``V4L2_TUNER_CAP_LOW`` or ``V4L2_TUNER_CAP_1HZ`` capability must
76*4882a593Smuzhiyun	be the same for all frequency bands of the selected
77*4882a593Smuzhiyun	tuner/modulator. So either all bands have that capability set, or
78*4882a593Smuzhiyun	none of them have that capability.
79*4882a593Smuzhiyun    * - __u32
80*4882a593Smuzhiyun      - ``rangelow``
81*4882a593Smuzhiyun      - :cspan:`2` The lowest tunable frequency in units of 62.5 kHz, or
82*4882a593Smuzhiyun	if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units
83*4882a593Smuzhiyun	of 62.5 Hz, for this frequency band. A 1 Hz unit is used when the
84*4882a593Smuzhiyun	``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
85*4882a593Smuzhiyun    * - __u32
86*4882a593Smuzhiyun      - ``rangehigh``
87*4882a593Smuzhiyun      - :cspan:`2` The highest tunable frequency in units of 62.5 kHz,
88*4882a593Smuzhiyun	or if the ``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in
89*4882a593Smuzhiyun	units of 62.5 Hz, for this frequency band. A 1 Hz unit is used
90*4882a593Smuzhiyun	when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
91*4882a593Smuzhiyun    * - __u32
92*4882a593Smuzhiyun      - ``modulation``
93*4882a593Smuzhiyun      - :cspan:`2` The supported modulation systems of this frequency
94*4882a593Smuzhiyun	band. See :ref:`band-modulation`.
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun	.. note::
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun	   Currently only one modulation system per frequency band
99*4882a593Smuzhiyun	   is supported. More work will need to be done if multiple
100*4882a593Smuzhiyun	   modulation systems are possible. Contact the linux-media
101*4882a593Smuzhiyun	   mailing list
102*4882a593Smuzhiyun	   (`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__)
103*4882a593Smuzhiyun	   if you need such functionality.
104*4882a593Smuzhiyun    * - __u32
105*4882a593Smuzhiyun      - ``reserved``\ [9]
106*4882a593Smuzhiyun      - Reserved for future extensions.
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun	Applications and drivers must set the array to zero.
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun
111*4882a593Smuzhiyun.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
112*4882a593Smuzhiyun
113*4882a593Smuzhiyun.. _band-modulation:
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun.. flat-table:: Band Modulation Systems
116*4882a593Smuzhiyun    :header-rows:  0
117*4882a593Smuzhiyun    :stub-columns: 0
118*4882a593Smuzhiyun    :widths:       3 1 4
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun    * - ``V4L2_BAND_MODULATION_VSB``
121*4882a593Smuzhiyun      - 0x02
122*4882a593Smuzhiyun      - Vestigial Sideband modulation, used for analog TV.
123*4882a593Smuzhiyun    * - ``V4L2_BAND_MODULATION_FM``
124*4882a593Smuzhiyun      - 0x04
125*4882a593Smuzhiyun      - Frequency Modulation, commonly used for analog radio.
126*4882a593Smuzhiyun    * - ``V4L2_BAND_MODULATION_AM``
127*4882a593Smuzhiyun      - 0x08
128*4882a593Smuzhiyun      - Amplitude Modulation, commonly used for analog radio.
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunReturn Value
131*4882a593Smuzhiyun============
132*4882a593Smuzhiyun
133*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
134*4882a593Smuzhiyunappropriately. The generic error codes are described at the
135*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
136*4882a593Smuzhiyun
137*4882a593SmuzhiyunEINVAL
138*4882a593Smuzhiyun    The ``tuner`` or ``index`` is out of bounds or the ``type`` field is
139*4882a593Smuzhiyun    wrong.
140