Patch Detail
Show a patch.
GET /api/patches/3490/?format=api
{ "id": 3490, "url": "https://patchwork.libcamera.org/api/patches/3490/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3490/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200418103216.140572-5-jacopo@jmondi.org>", "date": "2020-04-18T10:32:15", "name": "[libcamera-devel,v4,4/5] v4l2-subdev: add VIDIOC_SUBDEV_QUERYCAP ioctl", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "0921e827e904af07b18b99a91a8c9da1f4121f2f", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/3490/mbox/", "series": [ { "id": 816, "url": "https://patchwork.libcamera.org/api/series/816/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=816", "date": "2020-04-18T10:32:11", "name": "media: Register read-only sub-dev devnode", "version": 4, "mbox": "https://patchwork.libcamera.org/series/816/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3490/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3490/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1BCB560401\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 Apr 2020 12:29:58 +0200 (CEST)", "from uno.homenet.telecomitalia.it (unknown [87.13.136.104])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 4617060002;\n\tSat, 18 Apr 2020 10:29:44 +0000 (UTC)" ], "X-Originating-IP": "87.13.136.104", "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": "Sat, 18 Apr 2020 12:32:15 +0200", "Message-Id": "<20200418103216.140572-5-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.26.1", "In-Reply-To": "<20200418103216.140572-1-jacopo@jmondi.org>", "References": "<20200418103216.140572-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 4/5] v4l2-subdev: add\n\tVIDIOC_SUBDEV_QUERYCAP ioctl", "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": "Sat, 18 Apr 2020 10:29:58 -0000" }, "content": "From: Hans Verkuil <hans.verkuil@cisco.com>\n\nWhile normal video/radio/vbi/swradio nodes have a proper QUERYCAP ioctl\nthat apps can call to determine that it is indeed a V4L2 device, there\nis currently no equivalent for v4l-subdev nodes. Adding this ioctl will\nsolve that, and it will allow utilities like v4l2-compliance to be used\nwith these devices as well.\n\nSUBDEV_QUERYCAP currently returns the version and subdev_caps of the\nsubdevice. Define as the initial set of subdev_caps the read-only or\nread/write flags, to signal to userspace which set of IOCTLs are\navailable on the subdevice.\n\nSigned-off-by: Hans Verkuil <hans.verkuil@cisco.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n drivers/media/v4l2-core/v4l2-subdev.c | 12 ++++++++++++\n include/uapi/linux/v4l2-subdev.h | 15 +++++++++++++++\n 2 files changed, 27 insertions(+)", "diff": "diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c\nindex 1dc263c2ca0a..ca0aa54429c5 100644\n--- a/drivers/media/v4l2-core/v4l2-subdev.c\n+++ b/drivers/media/v4l2-core/v4l2-subdev.c\n@@ -15,6 +15,7 @@\n #include <linux/types.h>\n #include <linux/videodev2.h>\n #include <linux/export.h>\n+#include <linux/version.h>\n \n #include <media/v4l2-ctrls.h>\n #include <media/v4l2-device.h>\n@@ -336,6 +337,17 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)\n \tint rval;\n \n \tswitch (cmd) {\n+\tcase VIDIOC_SUBDEV_QUERYCAP: {\n+\t\tstruct v4l2_subdev_capability *cap = arg;\n+\n+\t\tmemset(cap, 0, sizeof(*cap));\n+\t\tcap->version = LINUX_VERSION_CODE;\n+\t\tcap->subdev_caps |= ro_subdev ? V4L2_SUBDEV_CAP_RO_SUBDEV\n+\t\t\t\t\t : V4L2_SUBDEV_CAP_RW_SUBDEV;\n+\n+\t\treturn 0;\n+\t}\n+\n \tcase VIDIOC_QUERYCTRL:\n \t\t/*\n \t\t * TODO: this really should be folded into v4l2_queryctrl (this\ndiff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h\nindex 03970ce30741..0886f88be193 100644\n--- a/include/uapi/linux/v4l2-subdev.h\n+++ b/include/uapi/linux/v4l2-subdev.h\n@@ -155,9 +155,24 @@ struct v4l2_subdev_selection {\n \t__u32 reserved[8];\n };\n \n+/**\n+ * struct v4l2_subdev_capability - subdev capabilities\n+ * @device_caps: the subdev capabilities, see V4L2_SUBDEV_CAP_*.\n+ */\n+struct v4l2_subdev_capability {\n+\t__u32 version;\n+\t__u32 subdev_caps;\n+};\n+\n+/* The v4l2 sub-device video device node is registered in read-only mode. */\n+#define V4L2_SUBDEV_CAP_RO_SUBDEV\t\t(1 << 0)\n+/* The v4l2 sub-device video device node is registered in read/write mode. */\n+#define V4L2_SUBDEV_CAP_RW_SUBDEV\t\t(1 << 1)\n+\n /* Backwards compatibility define --- to be removed */\n #define v4l2_subdev_edid v4l2_edid\n \n+#define VIDIOC_SUBDEV_QUERYCAP\t\t\t_IOR('V', 0, struct v4l2_subdev_capability)\n #define VIDIOC_SUBDEV_G_FMT\t\t\t_IOWR('V', 4, struct v4l2_subdev_format)\n #define VIDIOC_SUBDEV_S_FMT\t\t\t_IOWR('V', 5, struct v4l2_subdev_format)\n #define VIDIOC_SUBDEV_G_FRAME_INTERVAL\t\t_IOWR('V', 21, struct v4l2_subdev_frame_interval)\n", "prefixes": [ "libcamera-devel", "v4", "4/5" ] }