xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-subdev-querycap.rst (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L
30e06a071SHans Verkuil
40e06a071SHans Verkuil.. _VIDIOC_SUBDEV_QUERYCAP:
50e06a071SHans Verkuil
60e06a071SHans Verkuil****************************
70e06a071SHans Verkuilioctl VIDIOC_SUBDEV_QUERYCAP
80e06a071SHans Verkuil****************************
90e06a071SHans Verkuil
100e06a071SHans VerkuilName
110e06a071SHans Verkuil====
120e06a071SHans Verkuil
130e06a071SHans VerkuilVIDIOC_SUBDEV_QUERYCAP - Query sub-device capabilities
140e06a071SHans Verkuil
150e06a071SHans VerkuilSynopsis
160e06a071SHans Verkuil========
170e06a071SHans Verkuil
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBDEV_QUERYCAP
190e06a071SHans Verkuil
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_SUBDEV_QUERYCAP, struct v4l2_subdev_capability *argp)``
210e06a071SHans Verkuil
220e06a071SHans VerkuilArguments
230e06a071SHans Verkuil=========
240e06a071SHans Verkuil
250e06a071SHans Verkuil``fd``
26407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
270e06a071SHans Verkuil
280e06a071SHans Verkuil``argp``
290e06a071SHans Verkuil    Pointer to struct :c:type:`v4l2_subdev_capability`.
300e06a071SHans Verkuil
310e06a071SHans VerkuilDescription
320e06a071SHans Verkuil===========
330e06a071SHans Verkuil
340e06a071SHans VerkuilAll V4L2 sub-devices support the ``VIDIOC_SUBDEV_QUERYCAP`` ioctl. It is used to
350e06a071SHans Verkuilidentify kernel devices compatible with this specification and to obtain
360e06a071SHans Verkuilinformation about driver and hardware capabilities. The ioctl takes a pointer to
370e06a071SHans Verkuila struct :c:type:`v4l2_subdev_capability` which is filled by the driver. When
380e06a071SHans Verkuilthe driver is not compatible with this specification the ioctl returns
390e06a071SHans Verkuil``ENOTTY`` error code.
400e06a071SHans Verkuil
41*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{1.5cm}|p{2.9cm}|p{12.9cm}|
420e06a071SHans Verkuil
430e06a071SHans Verkuil.. c:type:: v4l2_subdev_capability
440e06a071SHans Verkuil
450e06a071SHans Verkuil.. flat-table:: struct v4l2_subdev_capability
460e06a071SHans Verkuil    :header-rows:  0
470e06a071SHans Verkuil    :stub-columns: 0
480e06a071SHans Verkuil    :widths:       3 4 20
490e06a071SHans Verkuil
500e06a071SHans Verkuil    * - __u32
510e06a071SHans Verkuil      - ``version``
520e06a071SHans Verkuil      - Version number of the driver.
530e06a071SHans Verkuil
540e06a071SHans Verkuil	The version reported is provided by the V4L2 subsystem following the
550e06a071SHans Verkuil	kernel numbering scheme. However, it may not always return the same
560e06a071SHans Verkuil	version as the kernel if, for example, a stable or
570e06a071SHans Verkuil	distribution-modified kernel uses the V4L2 stack from a newer kernel.
580e06a071SHans Verkuil
590e06a071SHans Verkuil	The version number is formatted using the ``KERNEL_VERSION()``
600e06a071SHans Verkuil	macro:
610e06a071SHans Verkuil    * - :cspan:`2`
620e06a071SHans Verkuil
630e06a071SHans Verkuil	``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
640e06a071SHans Verkuil
650e06a071SHans Verkuil	``__u32 version = KERNEL_VERSION(0, 8, 1);``
660e06a071SHans Verkuil
670e06a071SHans Verkuil	``printf ("Version: %u.%u.%u\\n",``
680e06a071SHans Verkuil
690e06a071SHans Verkuil	``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
700e06a071SHans Verkuil    * - __u32
710e06a071SHans Verkuil      - ``capabilities``
720e06a071SHans Verkuil      - Sub-device capabilities of the opened device, see
730e06a071SHans Verkuil	:ref:`subdevice-capabilities`.
740e06a071SHans Verkuil    * - __u32
750e06a071SHans Verkuil      - ``reserved``\ [14]
760e06a071SHans Verkuil      - Reserved for future extensions. Set to 0 by the V4L2 core.
770e06a071SHans Verkuil
78*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{6.8cm}|p{2.4cm}|p{8.1cm}|
790e06a071SHans Verkuil
800e06a071SHans Verkuil.. _subdevice-capabilities:
810e06a071SHans Verkuil
820e06a071SHans Verkuil.. cssclass:: longtable
830e06a071SHans Verkuil
840e06a071SHans Verkuil.. flat-table:: Sub-Device Capabilities Flags
850e06a071SHans Verkuil    :header-rows:  0
860e06a071SHans Verkuil    :stub-columns: 0
870e06a071SHans Verkuil    :widths:       3 1 4
880e06a071SHans Verkuil
890e06a071SHans Verkuil    * - V4L2_SUBDEV_CAP_RO_SUBDEV
900e06a071SHans Verkuil      - 0x00000001
910e06a071SHans Verkuil      - The sub-device device node is registered in read-only mode.
920e06a071SHans Verkuil	Access to the sub-device ioctls that modify the device state is
930e06a071SHans Verkuil	restricted. Refer to each individual subdevice ioctl documentation
940e06a071SHans Verkuil	for a description of which restrictions apply to a read-only sub-device.
950e06a071SHans Verkuil
960e06a071SHans VerkuilReturn Value
970e06a071SHans Verkuil============
980e06a071SHans Verkuil
990e06a071SHans VerkuilOn success 0 is returned, on error -1 and the ``errno`` variable is set
1000e06a071SHans Verkuilappropriately. The generic error codes are described at the
1010e06a071SHans Verkuil:ref:`Generic Error Codes <gen-errors>` chapter.
1020e06a071SHans Verkuil
1030e06a071SHans VerkuilENOTTY
1040e06a071SHans Verkuil    The device node is not a V4L2 sub-device.
105