vidioc-subdev-enum-mbus-code.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _VIDIOC_SUBDEV_ENUM_MBUS_CODE:
  4. **********************************
  5. ioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE
  6. **********************************
  7. Name
  8. ====
  9. VIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats
  10. Synopsis
  11. ========
  12. .. c:macro:: VIDIOC_SUBDEV_ENUM_MBUS_CODE
  13. ``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_MBUS_CODE, struct v4l2_subdev_mbus_code_enum * argp)``
  14. Arguments
  15. =========
  16. ``fd``
  17. File descriptor returned by :c:func:`open()`.
  18. ``argp``
  19. Pointer to struct :c:type:`v4l2_subdev_mbus_code_enum`.
  20. Description
  21. ===========
  22. This call is used by the application to access the enumeration
  23. of media bus formats for the selected pad.
  24. The enumerations are defined by the driver, and indexed using the ``index`` field
  25. of struct :c:type:`v4l2_subdev_mbus_code_enum`.
  26. Each enumeration starts with the ``index`` of 0, and
  27. the lowest invalid index marks the end of enumeration.
  28. Therefore, to enumerate media bus formats available at a given sub-device pad,
  29. initialize the ``pad``, and ``which`` fields to desired values,
  30. and set ``index`` to 0.
  31. Then call the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl
  32. with a pointer to this structure.
  33. A successful call will return with the ``code`` field filled in
  34. with a mbus code value.
  35. Repeat with increasing ``index`` until ``EINVAL`` is received.
  36. ``EINVAL`` means that either ``pad`` is invalid,
  37. or that there are no more codes available at this pad.
  38. The driver must not return the same value of ``code`` for different indices
  39. at the same pad.
  40. Available media bus formats may depend on the current 'try' formats at
  41. other pads of the sub-device, as well as on the current active links.
  42. See :ref:`VIDIOC_SUBDEV_G_FMT` for more
  43. information about the try formats.
  44. .. c:type:: v4l2_subdev_mbus_code_enum
  45. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  46. .. flat-table:: struct v4l2_subdev_mbus_code_enum
  47. :header-rows: 0
  48. :stub-columns: 0
  49. :widths: 1 1 2
  50. * - __u32
  51. - ``pad``
  52. - Pad number as reported by the media controller API. Filled in by the
  53. application.
  54. * - __u32
  55. - ``index``
  56. - Index of the mbus code in the enumeration belonging to the given pad.
  57. Filled in by the application.
  58. * - __u32
  59. - ``code``
  60. - The media bus format code, as defined in
  61. :ref:`v4l2-mbus-format`. Filled in by the driver.
  62. * - __u32
  63. - ``which``
  64. - Media bus format codes to be enumerated, from enum
  65. :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
  66. * - __u32
  67. - ``flags``
  68. - See :ref:`v4l2-subdev-mbus-code-flags`
  69. * - __u32
  70. - ``stream``
  71. - Stream identifier.
  72. * - __u32
  73. - ``reserved``\ [6]
  74. - Reserved for future extensions. Applications and drivers must set
  75. the array to zero.
  76. .. raw:: latex
  77. \footnotesize
  78. .. tabularcolumns:: |p{8.8cm}|p{2.2cm}|p{6.3cm}|
  79. .. _v4l2-subdev-mbus-code-flags:
  80. .. flat-table:: Subdev Media Bus Code Enumerate Flags
  81. :header-rows: 0
  82. :stub-columns: 0
  83. :widths: 1 1 2
  84. * - V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE
  85. - 0x00000001
  86. - The driver allows the application to try to change the default colorspace
  87. encoding. The application can ask to configure the colorspace of the
  88. subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
  89. ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
  90. See :ref:`v4l2-mbus-format` on how to do this.
  91. * - V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC
  92. - 0x00000002
  93. - The driver allows the application to try to change the default transform function.
  94. The application can ask to configure the transform function of
  95. the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
  96. ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
  97. See :ref:`v4l2-mbus-format` on how to do this.
  98. * - V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
  99. - 0x00000004
  100. - The driver allows the application to try to change the default Y'CbCr
  101. encoding. The application can ask to configure the Y'CbCr encoding of the
  102. subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
  103. ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
  104. See :ref:`v4l2-mbus-format` on how to do this.
  105. * - V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC
  106. - 0x00000004
  107. - The driver allows the application to try to change the default HSV
  108. encoding. The application can ask to configure the HSV encoding of the
  109. subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
  110. ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
  111. See :ref:`v4l2-mbus-format` on how to do this.
  112. * - V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION
  113. - 0x00000008
  114. - The driver allows the application to try to change the default
  115. quantization. The application can ask to configure the quantization of
  116. the subdevice when calling the :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>`
  117. ioctl with :ref:`V4L2_MBUS_FRAMEFMT_SET_CSC <mbus-framefmt-set-csc>` set.
  118. See :ref:`v4l2-mbus-format` on how to do this.
  119. .. raw:: latex
  120. \normalsize
  121. Return Value
  122. ============
  123. On success 0 is returned, on error -1 and the ``errno`` variable is set
  124. appropriately. The generic error codes are described at the
  125. :ref:`Generic Error Codes <gen-errors>` chapter.
  126. EINVAL
  127. The struct :c:type:`v4l2_subdev_mbus_code_enum` ``pad`` references a
  128. non-existing pad, the ``which`` field has an unsupported value, or the
  129. ``index`` field is out of bounds.