Show a patch.

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

{
    "id": 3721,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3721/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3721/",
    "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": "<20200508100158.3437161-11-jacopo@jmondi.org>",
    "date": "2020-05-08T10:01:55",
    "name": "[libcamera-devel,v10,10/13] media: v4l2-ctrls: Add helper to register properties",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "775a6fbc514057e2367be44d648271de785bff2f",
    "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/3721/mbox/",
    "series": [
        {
            "id": 888,
            "url": "https://patchwork.libcamera.org/api/1.1/series/888/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=888",
            "date": "2020-05-08T10:01:45",
            "name": "media: report camera properties",
            "version": 10,
            "mbox": "https://patchwork.libcamera.org/series/888/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3721/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3721/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net\n\t[217.70.183.199])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 124B461690\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2020 11:59:29 +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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 0EB70FF806;\n\tFri,  8 May 2020 09:59:24 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "linux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE\n\t(V4L/DVB)), libcamera-devel@lists.libcamera.org,\n\tMauro Carvalho Chehab <mchehab@kernel.org>,\n\tHans Verkuil <hverkuil-cisco@xs4all.nl>,\n\tSakari Ailus <sakari.ailus@linux.intel.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Cc": "Jacopo Mondi <jacopo@jmondi.org>,\n\ttfiga@google.com,\n\tpavel@ucw.cz",
        "Date": "Fri,  8 May 2020 12:01:55 +0200",
        "Message-Id": "<20200508100158.3437161-11-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.26.1",
        "In-Reply-To": "<20200508100158.3437161-1-jacopo@jmondi.org>",
        "References": "<20200508100158.3437161-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v10 10/13] media: v4l2-ctrls: Add helper\n\tto register properties",
        "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": "Fri, 08 May 2020 09:59:29 -0000"
    },
    "content": "Add an helper function to v4l2-ctrls to register controls associated\nwith a device property.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n drivers/media/v4l2-core/v4l2-ctrls.c | 40 ++++++++++++++++++++++++++++\n include/media/v4l2-ctrls.h           | 26 ++++++++++++++++++\n 2 files changed, 66 insertions(+)",
    "diff": "diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c\nindex 265452dae43bb..e4a679db55f09 100644\n--- a/drivers/media/v4l2-core/v4l2-ctrls.c\n+++ b/drivers/media/v4l2-core/v4l2-ctrls.c\n@@ -16,6 +16,7 @@\n #include <media/v4l2-dev.h>\n #include <media/v4l2-device.h>\n #include <media/v4l2-event.h>\n+#include <media/v4l2-fwnode.h>\n #include <media/v4l2-ioctl.h>\n \n #define dprintk(vdev, fmt, arg...) do {\t\t\t\t\t\\\n@@ -4623,3 +4624,42 @@ __poll_t v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait)\n \treturn 0;\n }\n EXPORT_SYMBOL(v4l2_ctrl_poll);\n+\n+int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl,\n+\t\t\t\t    const struct v4l2_ctrl_ops *ctrl_ops,\n+\t\t\t\t    const struct v4l2_fwnode_device_properties *p)\n+{\n+\tif (p->orientation != V4L2_FWNODE_PROPERTY_UNSET) {\n+\t\tu32 orientation_ctrl;\n+\n+\t\tswitch (p->orientation) {\n+\t\tcase V4L2_FWNODE_ORIENTATION_FRONT:\n+\t\t\torientation_ctrl = V4L2_ORIENTATION_FRONT;\n+\t\t\tbreak;\n+\t\tcase V4L2_FWNODE_ORIENTATION_BACK:\n+\t\t\torientation_ctrl = V4L2_ORIENTATION_BACK;\n+\t\t\tbreak;\n+\t\tcase V4L2_FWNODE_ORIENTATION_EXTERNAL:\n+\t\t\torientation_ctrl = V4L2_ORIENTATION_EXTERNAL;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tif (!v4l2_ctrl_new_std_menu(hdl, ctrl_ops,\n+\t\t\t\t\t    V4L2_CID_CAMERA_ORIENTATION,\n+\t\t\t\t\t    V4L2_ORIENTATION_EXTERNAL, 0,\n+\t\t\t\t\t    orientation_ctrl))\n+\t\t\treturn hdl->error;\n+\t}\n+\n+\tif (p->rotation != V4L2_FWNODE_PROPERTY_UNSET) {\n+\t\tif (!v4l2_ctrl_new_std(hdl, ctrl_ops,\n+\t\t\t\t       V4L2_CID_CAMERA_SENSOR_ROTATION,\n+\t\t\t\t       p->rotation, p->rotation, 1,\n+\t\t\t\t       p->rotation))\n+\t\t\treturn hdl->error;\n+\t}\n+\n+\treturn hdl->error;\n+}\n+EXPORT_SYMBOL(v4l2_ctrl_new_fwnode_properties);\ndiff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h\nindex 224c10823bbff..f40e2cbb21d34 100644\n--- a/include/media/v4l2-ctrls.h\n+++ b/include/media/v4l2-ctrls.h\n@@ -30,6 +30,7 @@ struct v4l2_ctrl;\n struct v4l2_ctrl_handler;\n struct v4l2_ctrl_helper;\n struct v4l2_fh;\n+struct v4l2_fwnode_device_properties;\n struct v4l2_subdev;\n struct v4l2_subscribed_event;\n struct video_device;\n@@ -1428,4 +1429,29 @@ int v4l2_ctrl_subdev_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,\n  */\n int v4l2_ctrl_subdev_log_status(struct v4l2_subdev *sd);\n \n+/**\n+ * v4l2_ctrl_new_fwnode_properties() - Register controls for the device\n+ *\t\t\t\t       properties\n+ *\n+ * @hdl: pointer to &struct v4l2_ctrl_handler to register controls on\n+ * @ctrl_ops: pointer to &struct v4l2_ctrl_ops to register controls with\n+ * @p: pointer to &struct v4l2_fwnode_device_properties\n+ *\n+ * This function registers controls associated to device properties, using the\n+ * property values contained in @p parameter, if the property has been set to\n+ * a value.\n+ *\n+ * Currently the following v4l2 controls are parsed and registered:\n+ * - V4L2_CID_CAMERA_ORIENTATION\n+ * - V4L2_CID_CAMERA_SENSOR_ROTATION;\n+ *\n+ * Controls already registered by the caller with the @hdl control handler are\n+ * not overwritten. Callers should register the controls they want to handle\n+ * themselves before calling this function.\n+ *\n+ * Return: 0 on success, a negative error code on failure.\n+ */\n+int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl,\n+\t\t\t\t    const struct v4l2_ctrl_ops *ctrl_ops,\n+\t\t\t\t    const struct v4l2_fwnode_device_properties *p);\n #endif\n",
    "prefixes": [
        "libcamera-devel",
        "v10",
        "10/13"
    ]
}