Patch Detail
Show a patch.
GET /api/1.1/patches/3418/?format=api
{ "id": 3418, "url": "https://patchwork.libcamera.org/api/1.1/patches/3418/?format=api", "web_url": "https://patchwork.libcamera.org/patch/3418/", "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": "<20200407163825.1766483-10-jacopo@jmondi.org>", "date": "2020-04-07T16:38:23", "name": "[libcamera-devel,v8,09/11] media: v4l2-ctrls: Add helper to register properties", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "dacd95dc3132f3baf292e1619fe3810d34a8cfd7", "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/3418/mbox/", "series": [ { "id": 801, "url": "https://patchwork.libcamera.org/api/1.1/series/801/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=801", "date": "2020-04-07T16:38:14", "name": "media: Report camera sensor properties", "version": 8, "mbox": "https://patchwork.libcamera.org/series/801/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/3418/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/3418/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net\n\t[217.70.183.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7037962DE4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 7 Apr 2020 18:35:47 +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 relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B4F8C4000A;\n\tTue, 7 Apr 2020 16:35:45 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "Mauro 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>, tfiga@google.com,\n\tpavel@ucw.cz", "Cc": "Jacopo Mondi <jacopo@jmondi.org>,\n\tlinux-media@vger.kernel.org (open list:MEDIA INPUT INFRASTRUCTURE\n\t(V4L/DVB)), libcamera-devel@lists.libcamera.org", "Date": "Tue, 7 Apr 2020 18:38:23 +0200", "Message-Id": "<20200407163825.1766483-10-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.26.0", "In-Reply-To": "<20200407163825.1766483-1-jacopo@jmondi.org>", "References": "<20200407163825.1766483-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v8 09/11] media: v4l2-ctrls: Add helper to\n\tregister 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": "Tue, 07 Apr 2020 16:35:47 -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 03029f92f8f3..539fa9e71c0e 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@@ -4601,3 +4602,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->location != V4L2_FWNODE_PROPERTY_UNSET) {\n+\t\tu32 location_ctrl;\n+\n+\t\tswitch (p->location) {\n+\t\tcase V4L2_FWNODE_LOCATION_FRONT:\n+\t\t\tlocation_ctrl = V4L2_LOCATION_FRONT;\n+\t\t\tbreak;\n+\t\tcase V4L2_FWNODE_LOCATION_BACK:\n+\t\t\tlocation_ctrl = V4L2_LOCATION_BACK;\n+\t\t\tbreak;\n+\t\tcase V4L2_FWNODE_LOCATION_EXTERNAL:\n+\t\t\tlocation_ctrl = V4L2_LOCATION_EXTERNAL;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tif (!v4l2_ctrl_new_std(hdl, ctrl_ops,\n+\t\t\t\t V4L2_CID_CAMERA_SENSOR_LOCATION,\n+\t\t\t\t location_ctrl, location_ctrl, 1,\n+\t\t\t\t location_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 cf59abafb0d9..409c800ab1f5 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@@ -1417,4 +1418,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_SENSOR_LOCATION;\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", "v8", "09/11" ] }