1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L 354f38fcaSMauro Carvalho Chehab 454f38fcaSMauro Carvalho Chehab.. _VIDIOC_DBG_G_CHIP_INFO: 554f38fcaSMauro Carvalho Chehab 654f38fcaSMauro Carvalho Chehab**************************** 754f38fcaSMauro Carvalho Chehabioctl VIDIOC_DBG_G_CHIP_INFO 854f38fcaSMauro Carvalho Chehab**************************** 954f38fcaSMauro Carvalho Chehab 1054f38fcaSMauro Carvalho ChehabName 1154f38fcaSMauro Carvalho Chehab==== 1254f38fcaSMauro Carvalho Chehab 1354f38fcaSMauro Carvalho ChehabVIDIOC_DBG_G_CHIP_INFO - Identify the chips on a TV card 1454f38fcaSMauro Carvalho Chehab 1554f38fcaSMauro Carvalho ChehabSynopsis 1654f38fcaSMauro Carvalho Chehab======== 1754f38fcaSMauro Carvalho Chehab 18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_DBG_G_CHIP_INFO 1954f38fcaSMauro Carvalho Chehab 20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_DBG_G_CHIP_INFO, struct v4l2_dbg_chip_info *argp)`` 2154f38fcaSMauro Carvalho Chehab 2254f38fcaSMauro Carvalho ChehabArguments 2354f38fcaSMauro Carvalho Chehab========= 2454f38fcaSMauro Carvalho Chehab 2554f38fcaSMauro Carvalho Chehab``fd`` 26407e84cdSMauro Carvalho Chehab File descriptor returned by :c:func:`open()`. 2754f38fcaSMauro Carvalho Chehab 2854f38fcaSMauro Carvalho Chehab``argp`` 2954f38fcaSMauro Carvalho Chehab Pointer to struct :c:type:`v4l2_dbg_chip_info`. 3054f38fcaSMauro Carvalho Chehab 3154f38fcaSMauro Carvalho ChehabDescription 3254f38fcaSMauro Carvalho Chehab=========== 3354f38fcaSMauro Carvalho Chehab 3454f38fcaSMauro Carvalho Chehab.. note:: 3554f38fcaSMauro Carvalho Chehab 3654f38fcaSMauro Carvalho Chehab This is an :ref:`experimental` interface and may 3754f38fcaSMauro Carvalho Chehab change in the future. 3854f38fcaSMauro Carvalho Chehab 3954f38fcaSMauro Carvalho ChehabFor driver debugging purposes this ioctl allows test applications to 4054f38fcaSMauro Carvalho Chehabquery the driver about the chips present on the TV card. Regular 4154f38fcaSMauro Carvalho Chehabapplications must not use it. When you found a chip specific bug, please 4254f38fcaSMauro Carvalho Chehabcontact the linux-media mailing list 4354f38fcaSMauro Carvalho Chehab(`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__) 4454f38fcaSMauro Carvalho Chehabso it can be fixed. 4554f38fcaSMauro Carvalho Chehab 4654f38fcaSMauro Carvalho ChehabAdditionally the Linux kernel must be compiled with the 4754f38fcaSMauro Carvalho Chehab``CONFIG_VIDEO_ADV_DEBUG`` option to enable this ioctl. 4854f38fcaSMauro Carvalho Chehab 4954f38fcaSMauro Carvalho ChehabTo query the driver applications must initialize the ``match.type`` and 5054f38fcaSMauro Carvalho Chehab``match.addr`` or ``match.name`` fields of a struct 5154f38fcaSMauro Carvalho Chehab:c:type:`v4l2_dbg_chip_info` and call 5254f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_DBG_G_CHIP_INFO` with a pointer to this structure. On success 5354f38fcaSMauro Carvalho Chehabthe driver stores information about the selected chip in the ``name`` 5454f38fcaSMauro Carvalho Chehaband ``flags`` fields. 5554f38fcaSMauro Carvalho Chehab 5654f38fcaSMauro Carvalho ChehabWhen ``match.type`` is ``V4L2_CHIP_MATCH_BRIDGE``, ``match.addr`` 5754f38fcaSMauro Carvalho Chehabselects the nth bridge 'chip' on the TV card. You can enumerate all 5854f38fcaSMauro Carvalho Chehabchips by starting at zero and incrementing ``match.addr`` by one until 5954f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_DBG_G_CHIP_INFO` fails with an ``EINVAL`` error code. The number 6054f38fcaSMauro Carvalho Chehabzero always selects the bridge chip itself, e. g. the chip connected to 6154f38fcaSMauro Carvalho Chehabthe PCI or USB bus. Non-zero numbers identify specific parts of the 6254f38fcaSMauro Carvalho Chehabbridge chip such as an AC97 register block. 6354f38fcaSMauro Carvalho Chehab 6454f38fcaSMauro Carvalho ChehabWhen ``match.type`` is ``V4L2_CHIP_MATCH_SUBDEV``, ``match.addr`` 6554f38fcaSMauro Carvalho Chehabselects the nth sub-device. This allows you to enumerate over all 6654f38fcaSMauro Carvalho Chehabsub-devices. 6754f38fcaSMauro Carvalho Chehab 6854f38fcaSMauro Carvalho ChehabOn success, the ``name`` field will contain a chip name and the 6954f38fcaSMauro Carvalho Chehab``flags`` field will contain ``V4L2_CHIP_FL_READABLE`` if the driver 7054f38fcaSMauro Carvalho Chehabsupports reading registers from the device or ``V4L2_CHIP_FL_WRITABLE`` 7154f38fcaSMauro Carvalho Chehabif the driver supports writing registers to the device. 7254f38fcaSMauro Carvalho Chehab 7354f38fcaSMauro Carvalho ChehabWe recommended the v4l2-dbg utility over calling this ioctl directly. It 7454f38fcaSMauro Carvalho Chehabis available from the LinuxTV v4l-dvb repository; see 7554f38fcaSMauro Carvalho Chehab`https://linuxtv.org/repo/ <https://linuxtv.org/repo/>`__ for access 7654f38fcaSMauro Carvalho Chehabinstructions. 7754f38fcaSMauro Carvalho Chehab 78*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{6.6cm}| 7954f38fcaSMauro Carvalho Chehab 8054f38fcaSMauro Carvalho Chehab.. _name-v4l2-dbg-match: 8154f38fcaSMauro Carvalho Chehab 8254f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_dbg_match 8354f38fcaSMauro Carvalho Chehab :header-rows: 0 8454f38fcaSMauro Carvalho Chehab :stub-columns: 0 8554f38fcaSMauro Carvalho Chehab :widths: 1 1 2 8654f38fcaSMauro Carvalho Chehab 8754f38fcaSMauro Carvalho Chehab * - __u32 8854f38fcaSMauro Carvalho Chehab - ``type`` 8954f38fcaSMauro Carvalho Chehab - See :ref:`name-chip-match-types` for a list of possible types. 9054f38fcaSMauro Carvalho Chehab * - union { 9154f38fcaSMauro Carvalho Chehab - (anonymous) 9254f38fcaSMauro Carvalho Chehab * - __u32 9354f38fcaSMauro Carvalho Chehab - ``addr`` 9454f38fcaSMauro Carvalho Chehab - Match a chip by this number, interpreted according to the ``type`` 9554f38fcaSMauro Carvalho Chehab field. 9654f38fcaSMauro Carvalho Chehab * - char 9754f38fcaSMauro Carvalho Chehab - ``name[32]`` 9854f38fcaSMauro Carvalho Chehab - Match a chip by this name, interpreted according to the ``type`` 9954f38fcaSMauro Carvalho Chehab field. Currently unused. 10054f38fcaSMauro Carvalho Chehab * - } 10154f38fcaSMauro Carvalho Chehab - 10254f38fcaSMauro Carvalho Chehab 10354f38fcaSMauro Carvalho Chehab 104*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}| 10554f38fcaSMauro Carvalho Chehab 10654f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_dbg_chip_info 10754f38fcaSMauro Carvalho Chehab 10854f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_dbg_chip_info 10954f38fcaSMauro Carvalho Chehab :header-rows: 0 11054f38fcaSMauro Carvalho Chehab :stub-columns: 0 11154f38fcaSMauro Carvalho Chehab :widths: 1 1 2 11254f38fcaSMauro Carvalho Chehab 11354f38fcaSMauro Carvalho Chehab * - struct v4l2_dbg_match 11454f38fcaSMauro Carvalho Chehab - ``match`` 11554f38fcaSMauro Carvalho Chehab - How to match the chip, see :ref:`name-v4l2-dbg-match`. 11654f38fcaSMauro Carvalho Chehab * - char 11754f38fcaSMauro Carvalho Chehab - ``name[32]`` 11854f38fcaSMauro Carvalho Chehab - The name of the chip. 11954f38fcaSMauro Carvalho Chehab * - __u32 12054f38fcaSMauro Carvalho Chehab - ``flags`` 12154f38fcaSMauro Carvalho Chehab - Set by the driver. If ``V4L2_CHIP_FL_READABLE`` is set, then the 12254f38fcaSMauro Carvalho Chehab driver supports reading registers from the device. If 12354f38fcaSMauro Carvalho Chehab ``V4L2_CHIP_FL_WRITABLE`` is set, then it supports writing 12454f38fcaSMauro Carvalho Chehab registers. 12554f38fcaSMauro Carvalho Chehab * - __u32 12654f38fcaSMauro Carvalho Chehab - ``reserved[8]`` 12754f38fcaSMauro Carvalho Chehab - Reserved fields, both application and driver must set these to 0. 12854f38fcaSMauro Carvalho Chehab 12954f38fcaSMauro Carvalho Chehab 130*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.5cm}| 13154f38fcaSMauro Carvalho Chehab 13254f38fcaSMauro Carvalho Chehab.. _name-chip-match-types: 13354f38fcaSMauro Carvalho Chehab 13454f38fcaSMauro Carvalho Chehab.. flat-table:: Chip Match Types 13554f38fcaSMauro Carvalho Chehab :header-rows: 0 13654f38fcaSMauro Carvalho Chehab :stub-columns: 0 13754f38fcaSMauro Carvalho Chehab :widths: 3 1 4 13854f38fcaSMauro Carvalho Chehab 13954f38fcaSMauro Carvalho Chehab * - ``V4L2_CHIP_MATCH_BRIDGE`` 14054f38fcaSMauro Carvalho Chehab - 0 14154f38fcaSMauro Carvalho Chehab - Match the nth chip on the card, zero for the bridge chip. Does not 14254f38fcaSMauro Carvalho Chehab match sub-devices. 14354f38fcaSMauro Carvalho Chehab * - ``V4L2_CHIP_MATCH_SUBDEV`` 14454f38fcaSMauro Carvalho Chehab - 4 14554f38fcaSMauro Carvalho Chehab - Match the nth sub-device. 14654f38fcaSMauro Carvalho Chehab 14754f38fcaSMauro Carvalho ChehabReturn Value 14854f38fcaSMauro Carvalho Chehab============ 14954f38fcaSMauro Carvalho Chehab 15054f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set 15154f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 15254f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 15354f38fcaSMauro Carvalho Chehab 15454f38fcaSMauro Carvalho ChehabEINVAL 15554f38fcaSMauro Carvalho Chehab The ``match_type`` is invalid or no device could be matched. 156