David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 1 | .. Permission is granted to copy, distribute and/or modify this |
| 2 | .. document under the terms of the GNU Free Documentation License, |
| 3 | .. Version 1.1 or any later version published by the Free Software |
| 4 | .. Foundation, with no Invariant Sections, no Front-Cover Texts |
| 5 | .. and no Back-Cover Texts. A copy of the license is included at |
| 6 | .. Documentation/media/uapi/fdl-appendix.rst. |
| 7 | .. |
| 8 | .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 9 | |
| 10 | .. _VIDIOC_SUBDEV_ENUM_MBUS_CODE: |
| 11 | |
| 12 | ********************************** |
| 13 | ioctl VIDIOC_SUBDEV_ENUM_MBUS_CODE |
| 14 | ********************************** |
| 15 | |
| 16 | Name |
| 17 | ==== |
| 18 | |
| 19 | VIDIOC_SUBDEV_ENUM_MBUS_CODE - Enumerate media bus formats |
| 20 | |
| 21 | |
| 22 | Synopsis |
| 23 | ======== |
| 24 | |
| 25 | .. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_ENUM_MBUS_CODE, struct v4l2_subdev_mbus_code_enum * argp ) |
| 26 | :name: VIDIOC_SUBDEV_ENUM_MBUS_CODE |
| 27 | |
| 28 | |
| 29 | Arguments |
| 30 | ========= |
| 31 | |
| 32 | ``fd`` |
| 33 | File descriptor returned by :ref:`open() <func-open>`. |
| 34 | |
| 35 | ``argp`` |
| 36 | Pointer to struct :c:type:`v4l2_subdev_mbus_code_enum`. |
| 37 | |
| 38 | |
| 39 | Description |
| 40 | =========== |
| 41 | |
| 42 | To enumerate media bus formats available at a given sub-device pad |
| 43 | applications initialize the ``pad``, ``which`` and ``index`` fields of |
| 44 | struct |
| 45 | :c:type:`v4l2_subdev_mbus_code_enum` and |
| 46 | call the :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` ioctl with a pointer to this |
| 47 | structure. Drivers fill the rest of the structure or return an ``EINVAL`` |
| 48 | error code if either the ``pad`` or ``index`` are invalid. All media bus |
| 49 | formats are enumerable by beginning at index zero and incrementing by |
| 50 | one until ``EINVAL`` is returned. |
| 51 | |
| 52 | Available media bus formats may depend on the current 'try' formats at |
| 53 | other pads of the sub-device, as well as on the current active links. |
| 54 | See :ref:`VIDIOC_SUBDEV_G_FMT` for more |
| 55 | information about the try formats. |
| 56 | |
| 57 | |
| 58 | .. c:type:: v4l2_subdev_mbus_code_enum |
| 59 | |
| 60 | .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| |
| 61 | |
| 62 | .. flat-table:: struct v4l2_subdev_mbus_code_enum |
| 63 | :header-rows: 0 |
| 64 | :stub-columns: 0 |
| 65 | :widths: 1 1 2 |
| 66 | |
| 67 | * - __u32 |
| 68 | - ``pad`` |
| 69 | - Pad number as reported by the media controller API. |
| 70 | * - __u32 |
| 71 | - ``index`` |
| 72 | - Number of the format in the enumeration, set by the application. |
| 73 | * - __u32 |
| 74 | - ``code`` |
| 75 | - The media bus format code, as defined in |
| 76 | :ref:`v4l2-mbus-format`. |
| 77 | * - __u32 |
| 78 | - ``which`` |
| 79 | - Media bus format codes to be enumerated, from enum |
| 80 | :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`. |
| 81 | * - __u32 |
| 82 | - ``reserved``\ [8] |
| 83 | - Reserved for future extensions. Applications and drivers must set |
| 84 | the array to zero. |
| 85 | |
| 86 | |
| 87 | Return Value |
| 88 | ============ |
| 89 | |
| 90 | On success 0 is returned, on error -1 and the ``errno`` variable is set |
| 91 | appropriately. The generic error codes are described at the |
| 92 | :ref:`Generic Error Codes <gen-errors>` chapter. |
| 93 | |
| 94 | EINVAL |
| 95 | The struct |
| 96 | :c:type:`v4l2_subdev_mbus_code_enum` |
| 97 | ``pad`` references a non-existing pad, or the ``index`` field is out |
| 98 | of bounds. |