blob: da8bd46288dc497da84d891716b3dfc3e61b245e [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
Mauro Carvalho Chehabaf4a4d02016-07-01 13:42:29 -03003.. _VIDIOC_DBG_G_CHIP_INFO:
Markus Heiser5377d912016-06-30 15:18:56 +02004
5****************************
6ioctl VIDIOC_DBG_G_CHIP_INFO
7****************************
8
9*man VIDIOC_DBG_G_CHIP_INFO(2)*
10
11Identify the chips on a TV card
12
13
14Synopsis
15========
16
Mauro Carvalho Chehabb7e67f62016-07-02 09:49:16 -030017.. cpp:function:: int ioctl( int fd, int request, struct v4l2_dbg_chip_info *argp )
Markus Heiser5377d912016-06-30 15:18:56 +020018
19Arguments
20=========
21
22``fd``
23 File descriptor returned by :ref:`open() <func-open>`.
24
25``request``
26 VIDIOC_DBG_G_CHIP_INFO
27
28``argp``
29
30
31Description
32===========
33
34 **Note**
35
Mauro Carvalho Chehab73470812016-07-01 13:58:44 -030036 This is an :ref:`experimental` interface and may
Markus Heiser5377d912016-06-30 15:18:56 +020037 change in the future.
38
39For driver debugging purposes this ioctl allows test applications to
40query the driver about the chips present on the TV card. Regular
41applications must not use it. When you found a chip specific bug, please
42contact the linux-media mailing list
43(`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__)
44so it can be fixed.
45
46Additionally the Linux kernel must be compiled with the
47``CONFIG_VIDEO_ADV_DEBUG`` option to enable this ioctl.
48
49To query the driver applications must initialize the ``match.type`` and
50``match.addr`` or ``match.name`` fields of a struct
51:ref:`v4l2_dbg_chip_info <v4l2-dbg-chip-info>` and call
Mauro Carvalho Chehab2212ff22016-07-01 14:33:56 -030052:ref:`VIDIOC_DBG_G_CHIP_INFO` with a pointer to this structure. On success
Markus Heiser5377d912016-06-30 15:18:56 +020053the driver stores information about the selected chip in the ``name``
54and ``flags`` fields.
55
56When ``match.type`` is ``V4L2_CHIP_MATCH_BRIDGE``, ``match.addr``
57selects the nth bridge 'chip' on the TV card. You can enumerate all
58chips by starting at zero and incrementing ``match.addr`` by one until
Mauro Carvalho Chehabcdb4af02016-07-03 11:53:09 -030059:ref:`VIDIOC_DBG_G_CHIP_INFO` fails with an ``EINVAL`` error code. The number
Markus Heiser5377d912016-06-30 15:18:56 +020060zero always selects the bridge chip itself, e. g. the chip connected to
61the PCI or USB bus. Non-zero numbers identify specific parts of the
62bridge chip such as an AC97 register block.
63
64When ``match.type`` is ``V4L2_CHIP_MATCH_SUBDEV``, ``match.addr``
65selects the nth sub-device. This allows you to enumerate over all
66sub-devices.
67
68On success, the ``name`` field will contain a chip name and the
69``flags`` field will contain ``V4L2_CHIP_FL_READABLE`` if the driver
70supports reading registers from the device or ``V4L2_CHIP_FL_WRITABLE``
71if the driver supports writing registers to the device.
72
73We recommended the v4l2-dbg utility over calling this ioctl directly. It
74is available from the LinuxTV v4l-dvb repository; see
75`https://linuxtv.org/repo/ <https://linuxtv.org/repo/>`__ for access
76instructions.
77
78
79.. _name-v4l2-dbg-match:
80
81.. flat-table:: struct v4l2_dbg_match
82 :header-rows: 0
83 :stub-columns: 0
84 :widths: 1 1 1 2
85
86
87 - .. row 1
88
89 - __u32
90
91 - ``type``
92
93 - See :ref:`name-chip-match-types` for a list of possible types.
94
95 - .. row 2
96
97 - union
98
99 - (anonymous)
100
101 - .. row 3
102
103 -
104 - __u32
105
106 - ``addr``
107
108 - Match a chip by this number, interpreted according to the ``type``
109 field.
110
111 - .. row 4
112
113 -
114 - char
115
116 - ``name[32]``
117
118 - Match a chip by this name, interpreted according to the ``type``
119 field. Currently unused.
120
121
122
123.. _v4l2-dbg-chip-info:
124
125.. flat-table:: struct v4l2_dbg_chip_info
126 :header-rows: 0
127 :stub-columns: 0
128 :widths: 1 1 2
129
130
131 - .. row 1
132
133 - struct v4l2_dbg_match
134
135 - ``match``
136
137 - How to match the chip, see :ref:`name-v4l2-dbg-match`.
138
139 - .. row 2
140
141 - char
142
143 - ``name[32]``
144
145 - The name of the chip.
146
147 - .. row 3
148
149 - __u32
150
151 - ``flags``
152
153 - Set by the driver. If ``V4L2_CHIP_FL_READABLE`` is set, then the
154 driver supports reading registers from the device. If
155 ``V4L2_CHIP_FL_WRITABLE`` is set, then it supports writing
156 registers.
157
158 - .. row 4
159
160 - __u32
161
162 - ``reserved[8]``
163
164 - Reserved fields, both application and driver must set these to 0.
165
166
167
168.. _name-chip-match-types:
169
170.. flat-table:: Chip Match Types
171 :header-rows: 0
172 :stub-columns: 0
173 :widths: 3 1 4
174
175
176 - .. row 1
177
178 - ``V4L2_CHIP_MATCH_BRIDGE``
179
180 - 0
181
182 - Match the nth chip on the card, zero for the bridge chip. Does not
183 match sub-devices.
184
185 - .. row 2
186
187 - ``V4L2_CHIP_MATCH_SUBDEV``
188
189 - 4
190
191 - Match the nth sub-device.
192
193
194
195Return Value
196============
197
198On success 0 is returned, on error -1 and the ``errno`` variable is set
199appropriately. The generic error codes are described at the
200:ref:`Generic Error Codes <gen-errors>` chapter.
201
202EINVAL
203 The ``match_type`` is invalid or no device could be matched.