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