Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [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/userspace-api/media/fdl-appendix.rst. |
| 7 | .. |
| 8 | .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections |
| 9 | |
| 10 | .. _VIDIOC_SUBDEV_G_FRAME_INTERVAL: |
| 11 | |
| 12 | ******************************************************************** |
| 13 | ioctl VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL |
| 14 | ******************************************************************** |
| 15 | |
| 16 | Name |
| 17 | ==== |
| 18 | |
| 19 | VIDIOC_SUBDEV_G_FRAME_INTERVAL - VIDIOC_SUBDEV_S_FRAME_INTERVAL - Get or set the frame interval on a subdev pad |
| 20 | |
| 21 | |
| 22 | Synopsis |
| 23 | ======== |
| 24 | |
| 25 | .. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp ) |
| 26 | :name: VIDIOC_SUBDEV_G_FRAME_INTERVAL |
| 27 | |
| 28 | .. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, struct v4l2_subdev_frame_interval *argp ) |
| 29 | :name: VIDIOC_SUBDEV_S_FRAME_INTERVAL |
| 30 | |
| 31 | |
| 32 | Arguments |
| 33 | ========= |
| 34 | |
| 35 | ``fd`` |
| 36 | File descriptor returned by :ref:`open() <func-open>`. |
| 37 | |
| 38 | ``argp`` |
| 39 | Pointer to struct :c:type:`v4l2_subdev_frame_interval`. |
| 40 | |
| 41 | |
| 42 | Description |
| 43 | =========== |
| 44 | |
| 45 | These ioctls are used to get and set the frame interval at specific |
| 46 | subdev pads in the image pipeline. The frame interval only makes sense |
| 47 | for sub-devices that can control the frame period on their own. This |
| 48 | includes, for instance, image sensors and TV tuners. Sub-devices that |
| 49 | don't support frame intervals must not implement these ioctls. |
| 50 | |
| 51 | To retrieve the current frame interval applications set the ``pad`` |
| 52 | field of a struct |
| 53 | :c:type:`v4l2_subdev_frame_interval` to |
| 54 | the desired pad number as reported by the media controller API. When |
| 55 | they call the ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` ioctl with a pointer to |
| 56 | this structure the driver fills the members of the ``interval`` field. |
| 57 | |
| 58 | To change the current frame interval applications set both the ``pad`` |
| 59 | field and all members of the ``interval`` field. When they call the |
| 60 | ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl with a pointer to this |
| 61 | structure the driver verifies the requested interval, adjusts it based |
| 62 | on the hardware capabilities and configures the device. Upon return the |
| 63 | struct |
| 64 | :c:type:`v4l2_subdev_frame_interval` |
| 65 | contains the current frame interval as would be returned by a |
| 66 | ``VIDIOC_SUBDEV_G_FRAME_INTERVAL`` call. |
| 67 | |
Jacopo Mondi | 3fb0ee8 | 2020-05-07 17:12:49 +0200 | [diff] [blame^] | 68 | Calling ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` on a subdev device node that has been |
| 69 | registered in read-only mode is not allowed. An error is returned and the errno |
| 70 | variable is set to ``-EPERM``. |
| 71 | |
Mauro Carvalho Chehab | 54f38fc | 2020-03-04 10:21:39 +0100 | [diff] [blame] | 72 | Drivers must not return an error solely because the requested interval |
| 73 | doesn't match the device capabilities. They must instead modify the |
| 74 | interval to match what the hardware can provide. The modified interval |
| 75 | should be as close as possible to the original request. |
| 76 | |
| 77 | Changing the frame interval shall never change the format. Changing the |
| 78 | format, on the other hand, may change the frame interval. |
| 79 | |
| 80 | Sub-devices that support the frame interval ioctls should implement them |
| 81 | on a single pad only. Their behaviour when supported on multiple pads of |
| 82 | the same sub-device is not defined. |
| 83 | |
| 84 | |
| 85 | .. c:type:: v4l2_subdev_frame_interval |
| 86 | |
| 87 | .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| |
| 88 | |
| 89 | .. flat-table:: struct v4l2_subdev_frame_interval |
| 90 | :header-rows: 0 |
| 91 | :stub-columns: 0 |
| 92 | :widths: 1 1 2 |
| 93 | |
| 94 | * - __u32 |
| 95 | - ``pad`` |
| 96 | - Pad number as reported by the media controller API. |
| 97 | * - struct :c:type:`v4l2_fract` |
| 98 | - ``interval`` |
| 99 | - Period, in seconds, between consecutive video frames. |
| 100 | * - __u32 |
| 101 | - ``reserved``\ [9] |
| 102 | - Reserved for future extensions. Applications and drivers must set |
| 103 | the array to zero. |
| 104 | |
| 105 | |
| 106 | Return Value |
| 107 | ============ |
| 108 | |
| 109 | On success 0 is returned, on error -1 and the ``errno`` variable is set |
| 110 | appropriately. The generic error codes are described at the |
| 111 | :ref:`Generic Error Codes <gen-errors>` chapter. |
| 112 | |
| 113 | EBUSY |
| 114 | The frame interval can't be changed because the pad is currently |
| 115 | busy. This can be caused, for instance, by an active video stream on |
| 116 | the pad. The ioctl must not be retried without performing another |
| 117 | action to fix the problem first. Only returned by |
| 118 | ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` |
| 119 | |
| 120 | EINVAL |
| 121 | The struct |
| 122 | :c:type:`v4l2_subdev_frame_interval` |
| 123 | ``pad`` references a non-existing pad, or the pad doesn't support |
| 124 | frame intervals. |
Jacopo Mondi | 3fb0ee8 | 2020-05-07 17:12:49 +0200 | [diff] [blame^] | 125 | |
| 126 | EPERM |
| 127 | The ``VIDIOC_SUBDEV_S_FRAME_INTERVAL`` ioctl has been called on a read-only |
| 128 | subdevice. |