18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci.. c:namespace:: V4L 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci.. _VIDIOC_DBG_G_CHIP_INFO: 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci**************************** 78c2ecf20Sopenharmony_ciioctl VIDIOC_DBG_G_CHIP_INFO 88c2ecf20Sopenharmony_ci**************************** 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciName 118c2ecf20Sopenharmony_ci==== 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciVIDIOC_DBG_G_CHIP_INFO - Identify the chips on a TV card 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciSynopsis 168c2ecf20Sopenharmony_ci======== 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_DBG_G_CHIP_INFO 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_DBG_G_CHIP_INFO, struct v4l2_dbg_chip_info *argp)`` 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciArguments 238c2ecf20Sopenharmony_ci========= 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci``fd`` 268c2ecf20Sopenharmony_ci File descriptor returned by :c:func:`open()`. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci``argp`` 298c2ecf20Sopenharmony_ci Pointer to struct :c:type:`v4l2_dbg_chip_info`. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciDescription 328c2ecf20Sopenharmony_ci=========== 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci.. note:: 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci This is an :ref:`experimental` interface and may 378c2ecf20Sopenharmony_ci change in the future. 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ciFor driver debugging purposes this ioctl allows test applications to 408c2ecf20Sopenharmony_ciquery the driver about the chips present on the TV card. Regular 418c2ecf20Sopenharmony_ciapplications must not use it. When you found a chip specific bug, please 428c2ecf20Sopenharmony_cicontact the linux-media mailing list 438c2ecf20Sopenharmony_ci(`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__) 448c2ecf20Sopenharmony_ciso it can be fixed. 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ciAdditionally the Linux kernel must be compiled with the 478c2ecf20Sopenharmony_ci``CONFIG_VIDEO_ADV_DEBUG`` option to enable this ioctl. 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciTo query the driver applications must initialize the ``match.type`` and 508c2ecf20Sopenharmony_ci``match.addr`` or ``match.name`` fields of a struct 518c2ecf20Sopenharmony_ci:c:type:`v4l2_dbg_chip_info` and call 528c2ecf20Sopenharmony_ci:ref:`VIDIOC_DBG_G_CHIP_INFO` with a pointer to this structure. On success 538c2ecf20Sopenharmony_cithe driver stores information about the selected chip in the ``name`` 548c2ecf20Sopenharmony_ciand ``flags`` fields. 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ciWhen ``match.type`` is ``V4L2_CHIP_MATCH_BRIDGE``, ``match.addr`` 578c2ecf20Sopenharmony_ciselects the nth bridge 'chip' on the TV card. You can enumerate all 588c2ecf20Sopenharmony_cichips by starting at zero and incrementing ``match.addr`` by one until 598c2ecf20Sopenharmony_ci:ref:`VIDIOC_DBG_G_CHIP_INFO` fails with an ``EINVAL`` error code. The number 608c2ecf20Sopenharmony_cizero always selects the bridge chip itself, e. g. the chip connected to 618c2ecf20Sopenharmony_cithe PCI or USB bus. Non-zero numbers identify specific parts of the 628c2ecf20Sopenharmony_cibridge chip such as an AC97 register block. 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ciWhen ``match.type`` is ``V4L2_CHIP_MATCH_SUBDEV``, ``match.addr`` 658c2ecf20Sopenharmony_ciselects the nth sub-device. This allows you to enumerate over all 668c2ecf20Sopenharmony_cisub-devices. 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciOn success, the ``name`` field will contain a chip name and the 698c2ecf20Sopenharmony_ci``flags`` field will contain ``V4L2_CHIP_FL_READABLE`` if the driver 708c2ecf20Sopenharmony_cisupports reading registers from the device or ``V4L2_CHIP_FL_WRITABLE`` 718c2ecf20Sopenharmony_ciif the driver supports writing registers to the device. 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciWe recommended the v4l2-dbg utility over calling this ioctl directly. It 748c2ecf20Sopenharmony_ciis available from the LinuxTV v4l-dvb repository; see 758c2ecf20Sopenharmony_ci`https://linuxtv.org/repo/ <https://linuxtv.org/repo/>`__ for access 768c2ecf20Sopenharmony_ciinstructions. 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci.. _name-v4l2-dbg-match: 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_dbg_match 838c2ecf20Sopenharmony_ci :header-rows: 0 848c2ecf20Sopenharmony_ci :stub-columns: 0 858c2ecf20Sopenharmony_ci :widths: 1 1 2 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci * - __u32 888c2ecf20Sopenharmony_ci - ``type`` 898c2ecf20Sopenharmony_ci - See :ref:`name-chip-match-types` for a list of possible types. 908c2ecf20Sopenharmony_ci * - union { 918c2ecf20Sopenharmony_ci - (anonymous) 928c2ecf20Sopenharmony_ci * - __u32 938c2ecf20Sopenharmony_ci - ``addr`` 948c2ecf20Sopenharmony_ci - Match a chip by this number, interpreted according to the ``type`` 958c2ecf20Sopenharmony_ci field. 968c2ecf20Sopenharmony_ci * - char 978c2ecf20Sopenharmony_ci - ``name[32]`` 988c2ecf20Sopenharmony_ci - Match a chip by this name, interpreted according to the ``type`` 998c2ecf20Sopenharmony_ci field. Currently unused. 1008c2ecf20Sopenharmony_ci * - } 1018c2ecf20Sopenharmony_ci - 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci.. c:type:: v4l2_dbg_chip_info 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_dbg_chip_info 1098c2ecf20Sopenharmony_ci :header-rows: 0 1108c2ecf20Sopenharmony_ci :stub-columns: 0 1118c2ecf20Sopenharmony_ci :widths: 1 1 2 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci * - struct v4l2_dbg_match 1148c2ecf20Sopenharmony_ci - ``match`` 1158c2ecf20Sopenharmony_ci - How to match the chip, see :ref:`name-v4l2-dbg-match`. 1168c2ecf20Sopenharmony_ci * - char 1178c2ecf20Sopenharmony_ci - ``name[32]`` 1188c2ecf20Sopenharmony_ci - The name of the chip. 1198c2ecf20Sopenharmony_ci * - __u32 1208c2ecf20Sopenharmony_ci - ``flags`` 1218c2ecf20Sopenharmony_ci - Set by the driver. If ``V4L2_CHIP_FL_READABLE`` is set, then the 1228c2ecf20Sopenharmony_ci driver supports reading registers from the device. If 1238c2ecf20Sopenharmony_ci ``V4L2_CHIP_FL_WRITABLE`` is set, then it supports writing 1248c2ecf20Sopenharmony_ci registers. 1258c2ecf20Sopenharmony_ci * - __u32 1268c2ecf20Sopenharmony_ci - ``reserved[8]`` 1278c2ecf20Sopenharmony_ci - Reserved fields, both application and driver must set these to 0. 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci.. _name-chip-match-types: 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci.. flat-table:: Chip Match Types 1358c2ecf20Sopenharmony_ci :header-rows: 0 1368c2ecf20Sopenharmony_ci :stub-columns: 0 1378c2ecf20Sopenharmony_ci :widths: 3 1 4 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci * - ``V4L2_CHIP_MATCH_BRIDGE`` 1408c2ecf20Sopenharmony_ci - 0 1418c2ecf20Sopenharmony_ci - Match the nth chip on the card, zero for the bridge chip. Does not 1428c2ecf20Sopenharmony_ci match sub-devices. 1438c2ecf20Sopenharmony_ci * - ``V4L2_CHIP_MATCH_SUBDEV`` 1448c2ecf20Sopenharmony_ci - 4 1458c2ecf20Sopenharmony_ci - Match the nth sub-device. 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ciReturn Value 1488c2ecf20Sopenharmony_ci============ 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 1518c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the 1528c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ciEINVAL 1558c2ecf20Sopenharmony_ci The ``match_type`` is invalid or no device could be matched. 156