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