Merge tag 'drivers-5.10-2020-10-12' of git://git.kernel.dk/linux-block
[linux-2.6-block.git] / Documentation / userspace-api / media / v4l / vidioc-enuminput.rst
CommitLineData
059b1c5b 1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
82559ac0 2
af4a4d0d 3.. _VIDIOC_ENUMINPUT:
5377d91f
MH
4
5**********************
6ioctl VIDIOC_ENUMINPUT
7**********************
8
15e7d615 9Name
586027ce 10====
5377d91f 11
586027ce 12VIDIOC_ENUMINPUT - Enumerate video inputs
5377d91f 13
15e7d615
MCC
14
15Synopsis
5377d91f
MH
16========
17
41d80465
MCC
18.. c:function:: int ioctl( int fd, VIDIOC_ENUMINPUT, struct v4l2_input *argp )
19 :name: VIDIOC_ENUMINPUT
5377d91f 20
586027ce 21
15e7d615 22Arguments
5377d91f
MH
23=========
24
25``fd``
26 File descriptor returned by :ref:`open() <func-open>`.
27
5377d91f 28``argp``
1473c75e 29 Pointer to struct :c:type:`v4l2_input`.
5377d91f
MH
30
31
15e7d615 32Description
5377d91f
MH
33===========
34
35To query the attributes of a video input applications initialize the
e8be7e97 36``index`` field of struct :c:type:`v4l2_input` and call the
bff8ff65 37:ref:`VIDIOC_ENUMINPUT` with a pointer to this structure. Drivers
cdb4af0f 38fill the rest of the structure or return an ``EINVAL`` error code when the
5377d91f 39index is out of bounds. To enumerate all inputs applications shall begin
cdb4af0f 40at index zero, incrementing by one until the driver returns ``EINVAL``.
5377d91f
MH
41
42
5bd4bb78
MCC
43.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
44
e8be7e97 45.. c:type:: v4l2_input
fa92b04d 46
5377d91f
MH
47.. flat-table:: struct v4l2_input
48 :header-rows: 0
49 :stub-columns: 0
50 :widths: 1 1 2
51
c2b66caf
LP
52 * - __u32
53 - ``index``
54 - Identifies the input, set by the application.
55 * - __u8
56 - ``name``\ [32]
57 - Name of the video input, a NUL-terminated ASCII string, for
58 example: "Vin (Composite 2)". This information is intended for the
59 user, preferably the connector label on the device itself.
60 * - __u32
61 - ``type``
62 - Type of the input, see :ref:`input-type`.
63 * - __u32
64 - ``audioset``
65 - Drivers can enumerate up to 32 video and audio inputs. This field
66 shows which audio inputs were selectable as audio source if this
67 was the currently selected video input. It is a bit mask. The LSB
68 corresponds to audio input 0, the MSB to input 31. Any number of
69 bits can be set, or none.
70
71 When the driver does not enumerate audio inputs no bits must be
72 set. Applications shall not interpret this as lack of audio
73 support. Some drivers automatically select audio sources and do
74 not enumerate them since there is no choice anyway.
75
76 For details on audio inputs and how to select the current input
77 see :ref:`audio`.
78 * - __u32
79 - ``tuner``
80 - Capture devices can have zero or more tuners (RF demodulators).
81 When the ``type`` is set to ``V4L2_INPUT_TYPE_TUNER`` this is an
82 RF connector and this field identifies the tuner. It corresponds
83 to struct :c:type:`v4l2_tuner` field ``index``. For
84 details on tuners see :ref:`tuner`.
85 * - :ref:`v4l2_std_id <v4l2-std-id>`
86 - ``std``
87 - Every video input supports one or more different video standards.
88 This field is a set of all supported standards. For details on
89 video standards and how to switch see :ref:`standard`.
90 * - __u32
91 - ``status``
92 - This field provides status information about the input. See
93 :ref:`input-status` for flags. With the exception of the sensor
94 orientation bits ``status`` is only valid when this is the current
95 input.
96 * - __u32
97 - ``capabilities``
98 - This field provides capabilities for the input. See
99 :ref:`input-capabilities` for flags.
100 * - __u32
101 - ``reserved``\ [3]
102 - Reserved for future extensions. Drivers must set the array to
103 zero.
5377d91f
MH
104
105
106
5bd4bb78
MCC
107.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
108
fa92b04d
MCC
109.. _input-type:
110
5377d91f
MH
111.. flat-table:: Input Types
112 :header-rows: 0
113 :stub-columns: 0
114 :widths: 3 1 4
115
c2b66caf
LP
116 * - ``V4L2_INPUT_TYPE_TUNER``
117 - 1
118 - This input uses a tuner (RF demodulator).
119 * - ``V4L2_INPUT_TYPE_CAMERA``
120 - 2
bff8ff65
HV
121 - Any non-tuner video input, for example Composite Video,
122 S-Video, HDMI, camera sensor. The naming as ``_TYPE_CAMERA`` is historical,
123 today we would have called it ``_TYPE_VIDEO``.
c2b66caf
LP
124 * - ``V4L2_INPUT_TYPE_TOUCH``
125 - 3
126 - This input is a touch device for capturing raw touch data.
233b213a 127
5377d91f
MH
128
129
ef76c068
MCC
130.. tabularcolumns:: |p{4.8cm}|p{2.6cm}|p{10.1cm}|
131
fa92b04d
MCC
132.. _input-status:
133
5377d91f
MH
134.. flat-table:: Input Status Flags
135 :header-rows: 0
136 :stub-columns: 0
137
c2b66caf
LP
138 * - :cspan:`2` General
139 * - ``V4L2_IN_ST_NO_POWER``
140 - 0x00000001
141 - Attached device is off.
142 * - ``V4L2_IN_ST_NO_SIGNAL``
143 - 0x00000002
144 -
145 * - ``V4L2_IN_ST_NO_COLOR``
146 - 0x00000004
147 - The hardware supports color decoding, but does not detect color
148 modulation in the signal.
149 * - :cspan:`2` Sensor Orientation
150 * - ``V4L2_IN_ST_HFLIP``
151 - 0x00000010
152 - The input is connected to a device that produces a signal that is
153 flipped horizontally and does not correct this before passing the
154 signal to userspace.
155 * - ``V4L2_IN_ST_VFLIP``
156 - 0x00000020
157 - The input is connected to a device that produces a signal that is
158 flipped vertically and does not correct this before passing the
159 signal to userspace.
160 .. note:: A 180 degree rotation is the same as HFLIP | VFLIP
161 * - :cspan:`2` Analog Video
162 * - ``V4L2_IN_ST_NO_H_LOCK``
163 - 0x00000100
164 - No horizontal sync lock.
165 * - ``V4L2_IN_ST_COLOR_KILL``
166 - 0x00000200
167 - A color killer circuit automatically disables color decoding when
168 it detects no color modulation. When this flag is set the color
169 killer is enabled *and* has shut off color decoding.
170 * - ``V4L2_IN_ST_NO_V_LOCK``
171 - 0x00000400
172 - No vertical sync lock.
173 * - ``V4L2_IN_ST_NO_STD_LOCK``
174 - 0x00000800
175 - No standard format lock in case of auto-detection format
176 by the component.
177 * - :cspan:`2` Digital Video
178 * - ``V4L2_IN_ST_NO_SYNC``
179 - 0x00010000
180 - No synchronization lock.
181 * - ``V4L2_IN_ST_NO_EQU``
182 - 0x00020000
183 - No equalizer lock.
184 * - ``V4L2_IN_ST_NO_CARRIER``
185 - 0x00040000
186 - Carrier recovery failed.
187 * - :cspan:`2` VCR and Set-Top Box
188 * - ``V4L2_IN_ST_MACROVISION``
189 - 0x01000000
190 - Macrovision is an analog copy prevention system mangling the video
191 signal to confuse video recorders. When this flag is set
192 Macrovision has been detected.
193 * - ``V4L2_IN_ST_NO_ACCESS``
194 - 0x02000000
195 - Conditional access denied.
196 * - ``V4L2_IN_ST_VTR``
197 - 0x04000000
198 - VTR time constant. [?]
5377d91f
MH
199
200
201
5bd4bb78
MCC
202.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
203
fa92b04d
MCC
204.. _input-capabilities:
205
5377d91f
MH
206.. flat-table:: Input capabilities
207 :header-rows: 0
208 :stub-columns: 0
209 :widths: 3 1 4
210
c2b66caf
LP
211 * - ``V4L2_IN_CAP_DV_TIMINGS``
212 - 0x00000002
213 - This input supports setting video timings by using
bff8ff65 214 ``VIDIOC_S_DV_TIMINGS``.
c2b66caf
LP
215 * - ``V4L2_IN_CAP_STD``
216 - 0x00000004
217 - This input supports setting the TV standard by using
bff8ff65 218 ``VIDIOC_S_STD``.
c2b66caf
LP
219 * - ``V4L2_IN_CAP_NATIVE_SIZE``
220 - 0x00000008
221 - This input supports setting the native size using the
222 ``V4L2_SEL_TGT_NATIVE_SIZE`` selection target, see
223 :ref:`v4l2-selections-common`.
5377d91f
MH
224
225
15e7d615 226Return Value
5377d91f
MH
227============
228
229On success 0 is returned, on error -1 and the ``errno`` variable is set
230appropriately. The generic error codes are described at the
231:ref:`Generic Error Codes <gen-errors>` chapter.
232
233EINVAL
e8be7e97 234 The struct :c:type:`v4l2_input` ``index`` is out of
5377d91f 235 bounds.