Show a patch.

GET /api/1.1/patches/3604/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 3604,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3604/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3604/",
    "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": "<20200428210609.6793-6-jacopo@jmondi.org>",
    "date": "2020-04-28T21:06:08",
    "name": "[libcamera-devel,v5,5/6] v4l2-subdev: add VIDIOC_SUBDEV_QUERYCAP ioctl",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2294c3127fcd10cf7432308dbe290e03c6c0a5ea",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3604/mbox/",
    "series": [
        {
            "id": 846,
            "url": "https://patchwork.libcamera.org/api/1.1/series/846/?format=api",
            "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/3604/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3604/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 855F960AF4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 23:03:16 +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 54D0D20000D;\n\tTue, 28 Apr 2020 21:03:14 +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:08 +0200",
        "Message-Id": "<20200428210609.6793-6-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 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": "Tue, 28 Apr 2020 21:03:16 -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 f3fe515b8ccb..b8c0071aa4d0 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@@ -331,6 +332,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..89dc8f2ba6b3 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\tBIT(0)\n+/* The v4l2 sub-device video device node is registered in read/write mode. */\n+#define V4L2_SUBDEV_CAP_RW_SUBDEV\t\tBIT(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",
        "v5",
        "5/6"
    ]
}