Show a patch.

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

{
    "id": 8597,
    "url": "https://patchwork.libcamera.org/api/patches/8597/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/8597/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20200704004028.21153-7-laurent.pinchart@ideasonboard.com>",
    "date": "2020-07-04T00:40:22",
    "name": "[libcamera-devel,06/12] media: v4l2-fwnode: Add helper to parse device properties",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "343936f09a58a2fe4d590673c260bf68185eb646",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/8597/mbox/",
    "series": [
        {
            "id": 1080,
            "url": "https://patchwork.libcamera.org/api/series/1080/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1080",
            "date": "2020-07-04T00:40:16",
            "name": "raspberrypi: Report sensor orientation through DT",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1080/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/8597/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/8597/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 C35ACBFFE2\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  4 Jul 2020 00:40:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D54260DF5;\n\tSat,  4 Jul 2020 02:40:43 +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 431AF60CBA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jul 2020 02:40:39 +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 98AD1814;\n\tSat,  4 Jul 2020 02:40:38 +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=\"uBuPNVkt\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1593823238;\n\tbh=ZiH2wSMdUjcthIqx+ZRJqaBq6rp64VM9ralsJ4CY2Sw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=uBuPNVktWeYvEu0kWqSBvC0TZpe8mjz731ZF1iGPnkvYRB8OLJgMiQeHfJ1HhFmzZ\n\t9k7oYV092lxv/uHpVNnyEwjHSKSu2/4PwOidXTqBtNwXSgKAlibdIJ8hj7z/BPjDeu\n\tm16kK0n23ALLJB7pcksPb2bEHQZ9N0JVPProcfzM=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "Dave Stevenson <dave.stevenson@raspberrypi.com>",
        "Date": "Sat,  4 Jul 2020 03:40:22 +0300",
        "Message-Id": "<20200704004028.21153-7-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200704004028.21153-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200704004028.21153-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 06/12] media: v4l2-fwnode: Add helper to\n\tparse device 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 parse common device properties in the same\nway as v4l2_fwnode_endpoint_parse() parses common endpoint properties.\n\nParse the 'rotation' and 'orientation' properties from the firmware\ninterface.\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---\n drivers/media/v4l2-core/v4l2-fwnode.c | 42 ++++++++++++++++++++++++\n include/media/v4l2-fwnode.h           | 47 +++++++++++++++++++++++++++\n 2 files changed, 89 insertions(+)",
    "diff": "diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c\nindex 3bd1888787eb..856045356302 100644\n--- a/drivers/media/v4l2-core/v4l2-fwnode.c\n+++ b/drivers/media/v4l2-core/v4l2-fwnode.c\n@@ -595,6 +595,48 @@ void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link)\n }\n EXPORT_SYMBOL_GPL(v4l2_fwnode_put_link);\n \n+int v4l2_fwnode_device_parse(struct device *dev,\n+\t\t\t     struct v4l2_fwnode_device_properties *props)\n+{\n+\tstruct fwnode_handle *fwnode = dev_fwnode(dev);\n+\tu32 val;\n+\tint ret;\n+\n+\tmemset(props, 0, sizeof(*props));\n+\n+\tprops->orientation = V4L2_FWNODE_PROPERTY_UNSET;\n+\tret = fwnode_property_read_u32(fwnode, \"orientation\", &val);\n+\tif (!ret) {\n+\t\tswitch (val) {\n+\t\tcase V4L2_FWNODE_ORIENTATION_FRONT:\n+\t\tcase V4L2_FWNODE_ORIENTATION_BACK:\n+\t\tcase V4L2_FWNODE_ORIENTATION_EXTERNAL:\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tdev_warn(dev, \"Unsupported device orientation: %u\\n\", val);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tprops->orientation = val;\n+\t\tdev_dbg(dev, \"device orientation: %u\\n\", val);\n+\t}\n+\n+\tprops->rotation = V4L2_FWNODE_PROPERTY_UNSET;\n+\tret = fwnode_property_read_u32(fwnode, \"rotation\", &val);\n+\tif (!ret) {\n+\t\tif (val >= 360) {\n+\t\t\tdev_warn(dev, \"Unsupported device rotation: %u\\n\", val);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tprops->rotation = val;\n+\t\tdev_dbg(dev, \"device rotation: %u\\n\", val);\n+\t}\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(v4l2_fwnode_device_parse);\n+\n static int\n v4l2_async_notifier_fwnode_parse_endpoint(struct device *dev,\n \t\t\t\t\t  struct v4l2_async_notifier *notifier,\ndiff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h\nindex f6a7bcd13197..7bb8da2092f6 100644\n--- a/include/media/v4l2-fwnode.h\n+++ b/include/media/v4l2-fwnode.h\n@@ -109,6 +109,36 @@ struct v4l2_fwnode_endpoint {\n \tunsigned int nr_of_link_frequencies;\n };\n \n+/**\n+ * V4L2_FWNODE_PROPERTY_UNSET - identify a non initialized property\n+ *\n+ * All properties in &struct v4l2_fwnode_device_properties are initialized\n+ * to this value.\n+ */\n+#define V4L2_FWNODE_PROPERTY_UNSET   (-1U)\n+\n+/**\n+ * enum v4l2_fwnode_orientation - possible device orientation\n+ * @V4L2_FWNODE_ORIENTATION_FRONT: device installed on the front side\n+ * @V4L2_FWNODE_ORIENTATION_BACK: device installed on the back side\n+ * @V4L2_FWNODE_ORIENTATION_EXTERNAL: device externally located\n+ */\n+enum v4l2_fwnode_orientation {\n+\tV4L2_FWNODE_ORIENTATION_FRONT,\n+\tV4L2_FWNODE_ORIENTATION_BACK,\n+\tV4L2_FWNODE_ORIENTATION_EXTERNAL\n+};\n+\n+/**\n+ * struct v4l2_fwnode_device_properties - fwnode device properties\n+ * @orientation: device orientation. See &enum v4l2_fwnode_orientation\n+ * @rotation: device rotation\n+ */\n+struct v4l2_fwnode_device_properties {\n+\tenum v4l2_fwnode_orientation orientation;\n+\tunsigned int rotation;\n+};\n+\n /**\n  * struct v4l2_fwnode_link - a link between two endpoints\n  * @local_node: pointer to device_node of this endpoint\n@@ -233,6 +263,23 @@ int v4l2_fwnode_parse_link(struct fwnode_handle *fwnode,\n  */\n void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link);\n \n+/**\n+ * v4l2_fwnode_device_parse() - parse fwnode device properties\n+ * @dev: pointer to &struct device\n+ * @props: pointer to &struct v4l2_fwnode_device_properties where to store the\n+ *\t   parsed properties values\n+ *\n+ * This function parses and validates the V4L2 fwnode device properties from the\n+ * firmware interface, and fills the @struct v4l2_fwnode_device_properties\n+ * provided by the caller.\n+ *\n+ * Return:\n+ *\t% 0 on success\n+ *\t%-EINVAL if a parsed property value is not valid\n+ */\n+int v4l2_fwnode_device_parse(struct device *dev,\n+\t\t\t     struct v4l2_fwnode_device_properties *props);\n+\n /**\n  * typedef parse_endpoint_func - Driver's callback function to be called on\n  *\teach V4L2 fwnode endpoint.\n",
    "prefixes": [
        "libcamera-devel",
        "06/12"
    ]
}