Patch Detail
Show a patch.
GET /api/1.1/patches/3707/?format=api
{ "id": 3707, "url": "https://patchwork.libcamera.org/api/1.1/patches/3707/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3707/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20200507151253.2951492-6-jacopo@jmondi.org>", "date": "2020-05-07T15:12:52", "name": "[libcamera-devel,v7,5/6] v4l2-subdev: add VIDIOC_SUBDEV_QUERYCAP ioctl", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "4236863a6f65105e28e4e57461a46b3cc5438a8f", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/3707/mbox/", "series": [ { "id": 885, "url": "https://patchwork.libcamera.org/api/1.1/series/885/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=885", "date": "2020-05-07T15:12:47", "name": "media: Register read-only sub-dev devnode", "version": 7, "mbox": "https://patchwork.libcamera.org/series/885/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3707/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3707/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 155A4603EA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 7 May 2020 17:09:57 +0200 (CEST)", "from localhost.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 1B3DA20000A;\n\tThu, 7 May 2020 15:09:54 +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": "Thu, 7 May 2020 17:12:52 +0200", "Message-Id": "<20200507151253.2951492-6-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.26.1", "In-Reply-To": "<20200507151253.2951492-1-jacopo@jmondi.org>", "References": "<20200507151253.2951492-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v7 5/6] 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": "Thu, 07 May 2020 15:09:57 -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 capabilities of the\nsubdevice. Define a capability flag to report if the subdevice is\nregistered in read-only mode.\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 | 11 +++++++++++\n include/uapi/linux/v4l2-subdev.h | 16 ++++++++++++++++\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 174778f9c0bc4..665b0c0f74cf8 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@@ -344,6 +345,16 @@ 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->reserved, 0, sizeof(cap->reserved));\n+\t\tcap->version = LINUX_VERSION_CODE;\n+\t\tcap->capabilities = ro_subdev ? V4L2_SUBDEV_CAP_RO_SUBDEV : 0;\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 03970ce307419..5d2a1dab79112 100644\n--- a/include/uapi/linux/v4l2-subdev.h\n+++ b/include/uapi/linux/v4l2-subdev.h\n@@ -155,9 +155,25 @@ struct v4l2_subdev_selection {\n \t__u32 reserved[8];\n };\n \n+/**\n+ * struct v4l2_subdev_capability - subdev capabilities\n+ * @version: the driver versioning number\n+ * @capabilities: the subdev capabilities, see V4L2_SUBDEV_CAP_*\n+ * @reserved: for future use, set to zero for now\n+ */\n+struct v4l2_subdev_capability {\n+\t__u32 version;\n+\t__u32 capabilities;\n+\t__u32 reserved[14];\n+};\n+\n+/* The v4l2 sub-device video device node is registered in read-only mode. */\n+#define V4L2_SUBDEV_CAP_RO_SUBDEV\t\tBIT(0)\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", "v7", "5/6" ] }