Patch Detail
Show a patch.
GET /api/1.1/patches/8813/?format=api
{ "id": 8813, "url": "https://patchwork.libcamera.org/api/1.1/patches/8813/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8813/", "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": "<20200715011833.24600-8-laurent.pinchart@ideasonboard.com>", "date": "2020-07-15T01:18:27", "name": "[libcamera-devel,v2,07/13] media: v4l2-ctrls: Add helper to register properties", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "05e85097bcd44fb9c685e328bf8699b398f2ae22", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": { "id": 14, "url": "https://patchwork.libcamera.org/api/1.1/users/14/?format=api", "username": "pinchartl", "first_name": "Laurent", "last_name": "Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/8813/mbox/", "series": [ { "id": 1108, "url": "https://patchwork.libcamera.org/api/1.1/series/1108/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1108", "date": "2020-07-15T01:18:21", "name": "raspberrypi: Report sensor orientation through DT", "version": 2, "mbox": "https://patchwork.libcamera.org/series/1108/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8813/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8813/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 26703BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Jul 2020 01:18:55 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E75626093A;\n\tWed, 15 Jul 2020 03:18:54 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 227EE6093C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Jul 2020 03:18:48 +0200 (CEST)", "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A91C41230;\n\tWed, 15 Jul 2020 03:18:47 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"JF/B2ujD\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594775927;\n\tbh=f7AdZnKBNIjDjt7fmGM/Fqec34rm0Jb+Ab8G01CwXsg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=JF/B2ujDYRwbgfbJ1cPn+mBoIRLpVhfPS4RZOTGFZcUdJk9BjfUNF1x9w5jyVTzfv\n\tiA8OTE2EqOEFN73M456x2OhNuqIj9WQdyIBXvuXxtQYslH3QGv3JeajyP2EKz+1ysB\n\tVcQ3uKRcmbyr2fsaFg2ODkZmKco1Cgn9IxrnYzkY=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "Dave Stevenson <dave.stevenson@raspberrypi.com>", "Date": "Wed, 15 Jul 2020 04:18:27 +0300", "Message-Id": "<20200715011833.24600-8-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200715011833.24600-1-laurent.pinchart@ideasonboard.com>", "References": "<20200715011833.24600-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v2 07/13] 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>", "Cc": "libcamera-devel@lists.libcamera.org", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nAdd an helper function to v4l2-ctrls to register controls associated\nwith a device property.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>\n\nCommit e0a360630debdf12355d9ec9f1417172c3fa6756 upstream\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\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 6a8eb39eec81..e0cac7f3d960 100644\n--- a/drivers/media/v4l2-core/v4l2-ctrls.c\n+++ b/drivers/media/v4l2-core/v4l2-ctrls.c\n@@ -17,6 +17,7 @@\n #include <media/v4l2-ctrls.h>\n #include <media/v4l2-event.h>\n #include <media/v4l2-dev.h>\n+#include <media/v4l2-fwnode.h>\n \n #define dprintk(vdev, fmt, arg...) do {\t\t\t\t\t\\\n \tif (!WARN_ON(!(vdev)) && ((vdev)->dev_debug & V4L2_DEV_DEBUG_CTRL)) \\\n@@ -4577,3 +4578,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_CAMERA_ORIENTATION_FRONT;\n+\t\t\tbreak;\n+\t\tcase V4L2_FWNODE_ORIENTATION_BACK:\n+\t\t\torientation_ctrl = V4L2_CAMERA_ORIENTATION_BACK;\n+\t\t\tbreak;\n+\t\tcase V4L2_FWNODE_ORIENTATION_EXTERNAL:\n+\t\t\torientation_ctrl = V4L2_CAMERA_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_CAMERA_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 65575e9b5a2b..162859aa2138 100644\n--- a/include/media/v4l2-ctrls.h\n+++ b/include/media/v4l2-ctrls.h\n@@ -29,6 +29,7 @@ struct v4l2_ctrl_handler;\n struct v4l2_ctrl_helper;\n struct v4l2_ctrl;\n struct video_device;\n+struct v4l2_fwnode_device_properties;\n struct v4l2_subdev;\n struct v4l2_subscribed_event;\n struct v4l2_fh;\n@@ -1379,4 +1380,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", "v2", "07/13" ] }