Show a patch.

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

{
    "id": 3718,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3718/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3718/",
    "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-8-jacopo@jmondi.org>",
    "date": "2020-05-08T10:01:52",
    "name": "[libcamera-devel,v10,07/13] media: v4l2-fwnode: Add helper to parse device properties",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9e5020299eeef1eddf9c08e63860f406675319b6",
    "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/3718/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/3718/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3718/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 2FD2C603E3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2020 11:59:21 +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 749F1FF804;\n\tFri,  8 May 2020 09:59:19 +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:52 +0200",
        "Message-Id": "<20200508100158.3437161-8-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 07/13] media: v4l2-fwnode: Add helper\n\tto parse 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>",
        "X-List-Received-Date": "Fri, 08 May 2020 09:59:21 -0000"
    },
    "content": "Add 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>\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 97f0f8b23b5dd..17b68cec8b083 100644\n--- a/drivers/media/v4l2-core/v4l2-fwnode.c\n+++ b/drivers/media/v4l2-core/v4l2-fwnode.c\n@@ -756,6 +756,48 @@ int v4l2_fwnode_connector_add_link(struct fwnode_handle *fwnode,\n }\n EXPORT_SYMBOL_GPL(v4l2_fwnode_connector_add_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 dd82d6d9764ef..68c415fdaac53 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@@ -354,6 +384,23 @@ int v4l2_fwnode_connector_parse(struct fwnode_handle *fwnode,\n int v4l2_fwnode_connector_add_link(struct fwnode_handle *fwnode,\n \t\t\t\t   struct v4l2_fwnode_connector *connector);\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",
        "v10",
        "07/13"
    ]
}