{"id":3605,"url":"https://patchwork.libcamera.org/api/patches/3605/?format=json","web_url":"https://patchwork.libcamera.org/patch/3605/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200428210609.6793-7-jacopo@jmondi.org>","date":"2020-04-28T21:06:09","name":"[libcamera-devel,v5,6/6] v4l: document VIDIOC_SUBDEV_QUERYCAP","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"9031096ae0ce90362cbc894da3c4547aebe9fffa","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3605/mbox/","series":[{"id":846,"url":"https://patchwork.libcamera.org/api/series/846/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=846","date":"2020-04-28T21:06:03","name":"media: Register read-only sub-dev devnode","version":5,"mbox":"https://patchwork.libcamera.org/series/846/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3605/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3605/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C250960AF4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 23:03:18 +0200 (CEST)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id B1148200002;\n\tTue, 28 Apr 2020 21:03:16 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"linux-media@vger.kernel.org,\n\tlibcamera-devel@lists.libcamera.org","Cc":"Jacopo Mondi <jacopo@jmondi.org>, mchehab@kernel.org,\n\thverkuil-cisco@xs4all.nl, sakari.ailus@linux.intel.com,\n\tandrey.konovalov@linaro.org, laurent.pinchart@ideasonboard.com,\n\tHans Verkuil <hans.verkuil@cisco.com>","Date":"Tue, 28 Apr 2020 23:06:09 +0200","Message-Id":"<20200428210609.6793-7-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.26.1","In-Reply-To":"<20200428210609.6793-1-jacopo@jmondi.org>","References":"<20200428210609.6793-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 6/6] v4l: document\n\tVIDIOC_SUBDEV_QUERYCAP","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 28 Apr 2020 21:03:18 -0000"},"content":"From: Hans Verkuil <hans.verkuil@cisco.com>\n\nAdd documentation for the new VIDIOC_SUBDEV_QUERYCAP ioctl.\n\nAcked-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nSigned-off-by: Hans Verkuil <hans.verkuil@cisco.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n .../userspace-api/media/v4l/user-func.rst     |   1 +\n .../media/v4l/vidioc-subdev-querycap.rst      | 114 ++++++++++++++++++\n 2 files changed, 115 insertions(+)\n create mode 100644 Documentation/userspace-api/media/v4l/vidioc-subdev-querycap.rst","diff":"diff --git a/Documentation/userspace-api/media/v4l/user-func.rst b/Documentation/userspace-api/media/v4l/user-func.rst\nindex f235f88efe89..bf77c842718e 100644\n--- a/Documentation/userspace-api/media/v4l/user-func.rst\n+++ b/Documentation/userspace-api/media/v4l/user-func.rst\n@@ -78,6 +78,7 @@ Function Reference\n     vidioc-subdev-g-fmt\n     vidioc-subdev-g-frame-interval\n     vidioc-subdev-g-selection\n+    vidioc-subdev-querycap\n     vidioc-subscribe-event\n     func-mmap\n     func-munmap\ndiff --git a/Documentation/userspace-api/media/v4l/vidioc-subdev-querycap.rst b/Documentation/userspace-api/media/v4l/vidioc-subdev-querycap.rst\nnew file mode 100644\nindex 000000000000..1ab5c808d9b4\n--- /dev/null\n+++ b/Documentation/userspace-api/media/v4l/vidioc-subdev-querycap.rst\n@@ -0,0 +1,114 @@\n+.. Permission is granted to copy, distribute and/or modify this\n+.. document under the terms of the GNU Free Documentation License,\n+.. Version 1.1 or any later version published by the Free Software\n+.. Foundation, with no Invariant Sections, no Front-Cover Texts\n+.. and no Back-Cover Texts. A copy of the license is included at\n+.. Documentation/userspace-api/media/fdl-appendix.rst.\n+..\n+.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections\n+\n+.. _VIDIOC_SUBDEV_QUERYCAP:\n+\n+****************************\n+ioctl VIDIOC_SUBDEV_QUERYCAP\n+****************************\n+\n+Name\n+====\n+\n+VIDIOC_SUBDEV_QUERYCAP - Query sub-device capabilities\n+\n+\n+Synopsis\n+========\n+\n+.. c:function:: int ioctl( int fd, VIDIOC_SUBDEV_QUERYCAP, struct v4l2_subdev_capability *argp )\n+    :name: VIDIOC_SUBDEV_QUERYCAP\n+\n+\n+Arguments\n+=========\n+\n+``fd``\n+    File descriptor returned by :ref:`open() <func-open>`.\n+\n+``argp``\n+    Pointer to struct :c:type:`v4l2_subdev_capability`.\n+\n+\n+Description\n+===========\n+\n+All V4L2 sub-devices support the ``VIDIOC_SUBDEV_QUERYCAP`` ioctl. It is used to\n+identify kernel devices compatible with this specification and to obtain\n+information about driver and hardware capabilities. The ioctl takes a pointer to\n+a struct :c:type:`v4l2_subdev_capability` which is filled by the driver. When\n+the driver is not compatible with this specification the ioctl returns\n+``ENOTTY`` error code.\n+\n+.. tabularcolumns:: |p{1.5cm}|p{2.5cm}|p{13cm}|\n+\n+.. c:type:: v4l2_subdev_capability\n+\n+.. flat-table:: struct v4l2_subdev_capability\n+    :header-rows:  0\n+    :stub-columns: 0\n+    :widths:       3 4 20\n+\n+    * - __u32\n+      - ``version``\n+      - Version number of the driver.\n+\n+\tThe version reported is provided by the V4L2 subsystem following the\n+\tkernel numbering scheme. However, it may not always return the same\n+\tversion as the kernel if, for example, a stable or\n+\tdistribution-modified kernel uses the V4L2 stack from a newer kernel.\n+\n+\tThe version number is formatted using the ``KERNEL_VERSION()``\n+\tmacro:\n+    * - :cspan:`2`\n+\n+\t``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``\n+\n+\t``__u32 version = KERNEL_VERSION(0, 8, 1);``\n+\n+\t``printf (\"Version: %u.%u.%u\\\\n\",``\n+\n+\t``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``\n+    * - __u32\n+      - ``subdev_caps``\n+      - Sub-device capabilities of the opened device, see\n+\t:ref:`subdevice-capabilities`.\n+\n+.. tabularcolumns:: |p{6cm}|p{2.2cm}|p{8.8cm}|\n+\n+.. _subdevice-capabilities:\n+\n+.. cssclass:: longtable\n+\n+.. flat-table:: Sub-Device Capabilities Flags\n+    :header-rows:  0\n+    :stub-columns: 0\n+    :widths:       3 1 4\n+\n+    * - V4L2_SUBDEV_CAP_RO_SUBDEV\n+      - 0x00000001\n+      - The sub-device device node is registered in read-only mode.\n+\tAccess to the sub-device ioctls that modify the device state is\n+\trestricted. Refer to each individual subdevice ioctl documentation\n+\tfor a description of which restrictions apply to a read-only sub-device.\n+\n+    * - V4L2_SUBDEV_CAP_RW_SUBDEV\n+      - 0x00000002\n+      - The sub-device device node is registered in read/write mode, all the\n+\tsubdevice ioctls are accessible from userspace.\n+\n+Return Value\n+============\n+\n+On success 0 is returned, on error -1 and the ``errno`` variable is set\n+appropriately. The generic error codes are described at the\n+:ref:`Generic Error Codes <gen-errors>` chapter.\n+\n+ENOTTY\n+    The device node is not a V4L2 sub-device.\n","prefixes":["libcamera-devel","v5","6/6"]}