1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*4882a593Smuzhiyun.. c:namespace:: V4L 3*4882a593Smuzhiyun 4*4882a593Smuzhiyun.. _VIDIOC_DBG_G_CHIP_INFO: 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun**************************** 7*4882a593Smuzhiyunioctl VIDIOC_DBG_G_CHIP_INFO 8*4882a593Smuzhiyun**************************** 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunName 11*4882a593Smuzhiyun==== 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunVIDIOC_DBG_G_CHIP_INFO - Identify the chips on a TV card 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunSynopsis 16*4882a593Smuzhiyun======== 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun.. c:macro:: VIDIOC_DBG_G_CHIP_INFO 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_DBG_G_CHIP_INFO, struct v4l2_dbg_chip_info *argp)`` 21*4882a593Smuzhiyun 22*4882a593SmuzhiyunArguments 23*4882a593Smuzhiyun========= 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun``fd`` 26*4882a593Smuzhiyun File descriptor returned by :c:func:`open()`. 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun``argp`` 29*4882a593Smuzhiyun Pointer to struct :c:type:`v4l2_dbg_chip_info`. 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunDescription 32*4882a593Smuzhiyun=========== 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun.. note:: 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun This is an :ref:`experimental` interface and may 37*4882a593Smuzhiyun change in the future. 38*4882a593Smuzhiyun 39*4882a593SmuzhiyunFor driver debugging purposes this ioctl allows test applications to 40*4882a593Smuzhiyunquery the driver about the chips present on the TV card. Regular 41*4882a593Smuzhiyunapplications must not use it. When you found a chip specific bug, please 42*4882a593Smuzhiyuncontact the linux-media mailing list 43*4882a593Smuzhiyun(`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__) 44*4882a593Smuzhiyunso it can be fixed. 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunAdditionally the Linux kernel must be compiled with the 47*4882a593Smuzhiyun``CONFIG_VIDEO_ADV_DEBUG`` option to enable this ioctl. 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunTo query the driver applications must initialize the ``match.type`` and 50*4882a593Smuzhiyun``match.addr`` or ``match.name`` fields of a struct 51*4882a593Smuzhiyun:c:type:`v4l2_dbg_chip_info` and call 52*4882a593Smuzhiyun:ref:`VIDIOC_DBG_G_CHIP_INFO` with a pointer to this structure. On success 53*4882a593Smuzhiyunthe driver stores information about the selected chip in the ``name`` 54*4882a593Smuzhiyunand ``flags`` fields. 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunWhen ``match.type`` is ``V4L2_CHIP_MATCH_BRIDGE``, ``match.addr`` 57*4882a593Smuzhiyunselects the nth bridge 'chip' on the TV card. You can enumerate all 58*4882a593Smuzhiyunchips by starting at zero and incrementing ``match.addr`` by one until 59*4882a593Smuzhiyun:ref:`VIDIOC_DBG_G_CHIP_INFO` fails with an ``EINVAL`` error code. The number 60*4882a593Smuzhiyunzero always selects the bridge chip itself, e. g. the chip connected to 61*4882a593Smuzhiyunthe PCI or USB bus. Non-zero numbers identify specific parts of the 62*4882a593Smuzhiyunbridge chip such as an AC97 register block. 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunWhen ``match.type`` is ``V4L2_CHIP_MATCH_SUBDEV``, ``match.addr`` 65*4882a593Smuzhiyunselects the nth sub-device. This allows you to enumerate over all 66*4882a593Smuzhiyunsub-devices. 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunOn success, the ``name`` field will contain a chip name and the 69*4882a593Smuzhiyun``flags`` field will contain ``V4L2_CHIP_FL_READABLE`` if the driver 70*4882a593Smuzhiyunsupports reading registers from the device or ``V4L2_CHIP_FL_WRITABLE`` 71*4882a593Smuzhiyunif the driver supports writing registers to the device. 72*4882a593Smuzhiyun 73*4882a593SmuzhiyunWe recommended the v4l2-dbg utility over calling this ioctl directly. It 74*4882a593Smuzhiyunis available from the LinuxTV v4l-dvb repository; see 75*4882a593Smuzhiyun`https://linuxtv.org/repo/ <https://linuxtv.org/repo/>`__ for access 76*4882a593Smuzhiyuninstructions. 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}| 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun.. _name-v4l2-dbg-match: 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun.. flat-table:: struct v4l2_dbg_match 83*4882a593Smuzhiyun :header-rows: 0 84*4882a593Smuzhiyun :stub-columns: 0 85*4882a593Smuzhiyun :widths: 1 1 2 86*4882a593Smuzhiyun 87*4882a593Smuzhiyun * - __u32 88*4882a593Smuzhiyun - ``type`` 89*4882a593Smuzhiyun - See :ref:`name-chip-match-types` for a list of possible types. 90*4882a593Smuzhiyun * - union { 91*4882a593Smuzhiyun - (anonymous) 92*4882a593Smuzhiyun * - __u32 93*4882a593Smuzhiyun - ``addr`` 94*4882a593Smuzhiyun - Match a chip by this number, interpreted according to the ``type`` 95*4882a593Smuzhiyun field. 96*4882a593Smuzhiyun * - char 97*4882a593Smuzhiyun - ``name[32]`` 98*4882a593Smuzhiyun - Match a chip by this name, interpreted according to the ``type`` 99*4882a593Smuzhiyun field. Currently unused. 100*4882a593Smuzhiyun * - } 101*4882a593Smuzhiyun - 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun 104*4882a593Smuzhiyun.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun.. c:type:: v4l2_dbg_chip_info 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun.. flat-table:: struct v4l2_dbg_chip_info 109*4882a593Smuzhiyun :header-rows: 0 110*4882a593Smuzhiyun :stub-columns: 0 111*4882a593Smuzhiyun :widths: 1 1 2 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun * - struct v4l2_dbg_match 114*4882a593Smuzhiyun - ``match`` 115*4882a593Smuzhiyun - How to match the chip, see :ref:`name-v4l2-dbg-match`. 116*4882a593Smuzhiyun * - char 117*4882a593Smuzhiyun - ``name[32]`` 118*4882a593Smuzhiyun - The name of the chip. 119*4882a593Smuzhiyun * - __u32 120*4882a593Smuzhiyun - ``flags`` 121*4882a593Smuzhiyun - Set by the driver. If ``V4L2_CHIP_FL_READABLE`` is set, then the 122*4882a593Smuzhiyun driver supports reading registers from the device. If 123*4882a593Smuzhiyun ``V4L2_CHIP_FL_WRITABLE`` is set, then it supports writing 124*4882a593Smuzhiyun registers. 125*4882a593Smuzhiyun * - __u32 126*4882a593Smuzhiyun - ``reserved[8]`` 127*4882a593Smuzhiyun - Reserved fields, both application and driver must set these to 0. 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun.. _name-chip-match-types: 133*4882a593Smuzhiyun 134*4882a593Smuzhiyun.. flat-table:: Chip Match Types 135*4882a593Smuzhiyun :header-rows: 0 136*4882a593Smuzhiyun :stub-columns: 0 137*4882a593Smuzhiyun :widths: 3 1 4 138*4882a593Smuzhiyun 139*4882a593Smuzhiyun * - ``V4L2_CHIP_MATCH_BRIDGE`` 140*4882a593Smuzhiyun - 0 141*4882a593Smuzhiyun - Match the nth chip on the card, zero for the bridge chip. Does not 142*4882a593Smuzhiyun match sub-devices. 143*4882a593Smuzhiyun * - ``V4L2_CHIP_MATCH_SUBDEV`` 144*4882a593Smuzhiyun - 4 145*4882a593Smuzhiyun - Match the nth sub-device. 146*4882a593Smuzhiyun 147*4882a593SmuzhiyunReturn Value 148*4882a593Smuzhiyun============ 149*4882a593Smuzhiyun 150*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set 151*4882a593Smuzhiyunappropriately. The generic error codes are described at the 152*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter. 153*4882a593Smuzhiyun 154*4882a593SmuzhiyunEINVAL 155*4882a593Smuzhiyun The ``match_type`` is invalid or no device could be matched. 156