vidioc-dbg-g-chip-info.rst 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. .. -*- coding: utf-8; mode: rst -*-
  2. .. _VIDIOC_DBG_G_CHIP_INFO:
  3. ****************************
  4. ioctl VIDIOC_DBG_G_CHIP_INFO
  5. ****************************
  6. Name
  7. ====
  8. VIDIOC_DBG_G_CHIP_INFO - Identify the chips on a TV card
  9. Synopsis
  10. ========
  11. .. c:function:: int ioctl( int fd, VIDIOC_DBG_G_CHIP_INFO, struct v4l2_dbg_chip_info *argp )
  12. :name: VIDIOC_DBG_G_CHIP_INFO
  13. Arguments
  14. =========
  15. ``fd``
  16. File descriptor returned by :ref:`open() <func-open>`.
  17. ``argp``
  18. Description
  19. ===========
  20. .. note::
  21. This is an :ref:`experimental` interface and may
  22. change in the future.
  23. For driver debugging purposes this ioctl allows test applications to
  24. query the driver about the chips present on the TV card. Regular
  25. applications must not use it. When you found a chip specific bug, please
  26. contact the linux-media mailing list
  27. (`https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__)
  28. so it can be fixed.
  29. Additionally the Linux kernel must be compiled with the
  30. ``CONFIG_VIDEO_ADV_DEBUG`` option to enable this ioctl.
  31. To query the driver applications must initialize the ``match.type`` and
  32. ``match.addr`` or ``match.name`` fields of a struct
  33. :c:type:`v4l2_dbg_chip_info` and call
  34. :ref:`VIDIOC_DBG_G_CHIP_INFO` with a pointer to this structure. On success
  35. the driver stores information about the selected chip in the ``name``
  36. and ``flags`` fields.
  37. When ``match.type`` is ``V4L2_CHIP_MATCH_BRIDGE``, ``match.addr``
  38. selects the nth bridge 'chip' on the TV card. You can enumerate all
  39. chips by starting at zero and incrementing ``match.addr`` by one until
  40. :ref:`VIDIOC_DBG_G_CHIP_INFO` fails with an ``EINVAL`` error code. The number
  41. zero always selects the bridge chip itself, e. g. the chip connected to
  42. the PCI or USB bus. Non-zero numbers identify specific parts of the
  43. bridge chip such as an AC97 register block.
  44. When ``match.type`` is ``V4L2_CHIP_MATCH_SUBDEV``, ``match.addr``
  45. selects the nth sub-device. This allows you to enumerate over all
  46. sub-devices.
  47. On success, the ``name`` field will contain a chip name and the
  48. ``flags`` field will contain ``V4L2_CHIP_FL_READABLE`` if the driver
  49. supports reading registers from the device or ``V4L2_CHIP_FL_WRITABLE``
  50. if the driver supports writing registers to the device.
  51. We recommended the v4l2-dbg utility over calling this ioctl directly. It
  52. is available from the LinuxTV v4l-dvb repository; see
  53. `https://linuxtv.org/repo/ <https://linuxtv.org/repo/>`__ for access
  54. instructions.
  55. .. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
  56. .. _name-v4l2-dbg-match:
  57. .. flat-table:: struct v4l2_dbg_match
  58. :header-rows: 0
  59. :stub-columns: 0
  60. :widths: 1 1 1 2
  61. * - __u32
  62. - ``type``
  63. - See :ref:`name-chip-match-types` for a list of possible types.
  64. * - union
  65. - (anonymous)
  66. * -
  67. - __u32
  68. - ``addr``
  69. - Match a chip by this number, interpreted according to the ``type``
  70. field.
  71. * -
  72. - char
  73. - ``name[32]``
  74. - Match a chip by this name, interpreted according to the ``type``
  75. field. Currently unused.
  76. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
  77. .. c:type:: v4l2_dbg_chip_info
  78. .. flat-table:: struct v4l2_dbg_chip_info
  79. :header-rows: 0
  80. :stub-columns: 0
  81. :widths: 1 1 2
  82. * - struct v4l2_dbg_match
  83. - ``match``
  84. - How to match the chip, see :ref:`name-v4l2-dbg-match`.
  85. * - char
  86. - ``name[32]``
  87. - The name of the chip.
  88. * - __u32
  89. - ``flags``
  90. - Set by the driver. If ``V4L2_CHIP_FL_READABLE`` is set, then the
  91. driver supports reading registers from the device. If
  92. ``V4L2_CHIP_FL_WRITABLE`` is set, then it supports writing
  93. registers.
  94. * - __u32
  95. - ``reserved[8]``
  96. - Reserved fields, both application and driver must set these to 0.
  97. .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
  98. .. _name-chip-match-types:
  99. .. flat-table:: Chip Match Types
  100. :header-rows: 0
  101. :stub-columns: 0
  102. :widths: 3 1 4
  103. * - ``V4L2_CHIP_MATCH_BRIDGE``
  104. - 0
  105. - Match the nth chip on the card, zero for the bridge chip. Does not
  106. match sub-devices.
  107. * - ``V4L2_CHIP_MATCH_SUBDEV``
  108. - 4
  109. - Match the nth sub-device.
  110. Return Value
  111. ============
  112. On success 0 is returned, on error -1 and the ``errno`` variable is set
  113. appropriately. The generic error codes are described at the
  114. :ref:`Generic Error Codes <gen-errors>` chapter.
  115. EINVAL
  116. The ``match_type`` is invalid or no device could be matched.