xref: /linux/Documentation/userspace-api/media/v4l/vidioc-subdev-g-client-cap.rst (revision fd4f587389e1202ab5737977c11f09ea56bbd1b2)
1f57fa295STomi Valkeinen.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2f57fa295STomi Valkeinen.. c:namespace:: V4L
3f57fa295STomi Valkeinen
4f57fa295STomi Valkeinen.. _VIDIOC_SUBDEV_G_CLIENT_CAP:
5f57fa295STomi Valkeinen
6f57fa295STomi Valkeinen************************************************************
7f57fa295STomi Valkeinenioctl VIDIOC_SUBDEV_G_CLIENT_CAP, VIDIOC_SUBDEV_S_CLIENT_CAP
8f57fa295STomi Valkeinen************************************************************
9f57fa295STomi Valkeinen
10f57fa295STomi ValkeinenName
11f57fa295STomi Valkeinen====
12f57fa295STomi Valkeinen
13f57fa295STomi ValkeinenVIDIOC_SUBDEV_G_CLIENT_CAP - VIDIOC_SUBDEV_S_CLIENT_CAP - Get or set client
14f57fa295STomi Valkeinencapabilities.
15f57fa295STomi Valkeinen
16f57fa295STomi ValkeinenSynopsis
17f57fa295STomi Valkeinen========
18f57fa295STomi Valkeinen
19f57fa295STomi Valkeinen.. c:macro:: VIDIOC_SUBDEV_G_CLIENT_CAP
20f57fa295STomi Valkeinen
21f57fa295STomi Valkeinen``int ioctl(int fd, VIDIOC_SUBDEV_G_CLIENT_CAP, struct v4l2_subdev_client_capability *argp)``
22f57fa295STomi Valkeinen
23f57fa295STomi Valkeinen.. c:macro:: VIDIOC_SUBDEV_S_CLIENT_CAP
24f57fa295STomi Valkeinen
25f57fa295STomi Valkeinen``int ioctl(int fd, VIDIOC_SUBDEV_S_CLIENT_CAP, struct v4l2_subdev_client_capability *argp)``
26f57fa295STomi Valkeinen
27f57fa295STomi ValkeinenArguments
28f57fa295STomi Valkeinen=========
29f57fa295STomi Valkeinen
30f57fa295STomi Valkeinen``fd``
31f57fa295STomi Valkeinen    File descriptor returned by :ref:`open() <func-open>`.
32f57fa295STomi Valkeinen
33f57fa295STomi Valkeinen``argp``
34f57fa295STomi Valkeinen    Pointer to struct :c:type:`v4l2_subdev_client_capability`.
35f57fa295STomi Valkeinen
36f57fa295STomi ValkeinenDescription
37f57fa295STomi Valkeinen===========
38f57fa295STomi Valkeinen
39f57fa295STomi ValkeinenThese ioctls are used to get and set the client (the application using the
40f57fa295STomi Valkeinensubdevice ioctls) capabilities. The client capabilities are stored in the file
41f57fa295STomi Valkeinenhandle of the opened subdev device node, and the client must set the
42f57fa295STomi Valkeinencapabilities for each opened subdev separately.
43f57fa295STomi Valkeinen
44f57fa295STomi ValkeinenBy default no client capabilities are set when a subdev device node is opened.
45f57fa295STomi Valkeinen
46f57fa295STomi ValkeinenThe purpose of the client capabilities are to inform the kernel of the behavior
47f57fa295STomi Valkeinenof the client, mainly related to maintaining compatibility with different
48f57fa295STomi Valkeinenkernel and userspace versions.
49f57fa295STomi Valkeinen
50f57fa295STomi ValkeinenThe ``VIDIOC_SUBDEV_G_CLIENT_CAP`` ioctl returns the current client capabilities
51f57fa295STomi Valkeinenassociated with the file handle ``fd``.
52f57fa295STomi Valkeinen
53f57fa295STomi ValkeinenThe ``VIDIOC_SUBDEV_S_CLIENT_CAP`` ioctl sets client capabilities for the file
54f57fa295STomi Valkeinenhandle ``fd``. The new capabilities fully replace the current capabilities, the
55f57fa295STomi Valkeinenioctl can therefore also be used to remove capabilities that have previously
56f57fa295STomi Valkeinenbeen set.
57f57fa295STomi Valkeinen
58f57fa295STomi Valkeinen``VIDIOC_SUBDEV_S_CLIENT_CAP`` modifies the struct
59f57fa295STomi Valkeinen:c:type:`v4l2_subdev_client_capability` to reflect the capabilities that have
60f57fa295STomi Valkeinenbeen accepted. A common case for the kernel not accepting a capability is that
61f57fa295STomi Valkeinenthe kernel is older than the headers the userspace uses, and thus the capability
62f57fa295STomi Valkeinenis unknown to the kernel.
63f57fa295STomi Valkeinen
64*fd4f5873SHans Verkuil.. tabularcolumns:: |p{1.5cm}|p{2.9cm}|p{12.9cm}|
65*fd4f5873SHans Verkuil
66*fd4f5873SHans Verkuil.. c:type:: v4l2_subdev_client_capability
67*fd4f5873SHans Verkuil
68*fd4f5873SHans Verkuil.. flat-table:: struct v4l2_subdev_client_capability
69*fd4f5873SHans Verkuil    :header-rows:  0
70*fd4f5873SHans Verkuil    :stub-columns: 0
71*fd4f5873SHans Verkuil    :widths:       3 4 20
72*fd4f5873SHans Verkuil
73*fd4f5873SHans Verkuil    * - __u64
74*fd4f5873SHans Verkuil      - ``capabilities``
75*fd4f5873SHans Verkuil      - Sub-device client capabilities of the opened device.
76*fd4f5873SHans Verkuil
77*fd4f5873SHans Verkuil.. tabularcolumns:: |p{6.8cm}|p{2.4cm}|p{8.1cm}|
78*fd4f5873SHans Verkuil
79f57fa295STomi Valkeinen.. flat-table:: Client Capabilities
80f57fa295STomi Valkeinen    :header-rows:  1
81f57fa295STomi Valkeinen
82f57fa295STomi Valkeinen    * - Capability
83f57fa295STomi Valkeinen      - Description
84f57fa295STomi Valkeinen    * - ``V4L2_SUBDEV_CLIENT_CAP_STREAMS``
85f57fa295STomi Valkeinen      - The client is aware of streams. Setting this flag enables the use
86f57fa295STomi Valkeinen        of 'stream' fields (referring to the stream number) with various
87f57fa295STomi Valkeinen        ioctls. If this is not set (which is the default), the 'stream' fields
88f57fa295STomi Valkeinen        will be forced to 0 by the kernel.
89805d4311SLaurent Pinchart    * - ``V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH``
90805d4311SLaurent Pinchart      - The client is aware of the :c:type:`v4l2_subdev_frame_interval`
91805d4311SLaurent Pinchart        ``which`` field. If this is not set (which is the default), the
92805d4311SLaurent Pinchart        ``which`` field is forced to ``V4L2_SUBDEV_FORMAT_ACTIVE`` by the
93805d4311SLaurent Pinchart        kernel.
94f57fa295STomi Valkeinen
95f57fa295STomi ValkeinenReturn Value
96f57fa295STomi Valkeinen============
97f57fa295STomi Valkeinen
98f57fa295STomi ValkeinenOn success 0 is returned, on error -1 and the ``errno`` variable is set
99f57fa295STomi Valkeinenappropriately. The generic error codes are described at the
100f57fa295STomi Valkeinen:ref:`Generic Error Codes <gen-errors>` chapter.
101f57fa295STomi Valkeinen
102f57fa295STomi ValkeinenENOIOCTLCMD
103f57fa295STomi Valkeinen   The kernel does not support this ioctl.
104