{"id":15866,"url":"https://patchwork.libcamera.org/api/patches/15866/?format=json","web_url":"https://patchwork.libcamera.org/patch/15866/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220510115147.19360-27-laurent.pinchart@ideasonboard.com>","date":"2022-05-10T11:51:23","name":"[libcamera-devel,26/50] staging: media: imx: imx7-media-csi: Fold imx_media_dev into imx7_csi","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"3ce762cbcc31ec8e24281fb578ec7e980c311df1","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15866/mbox/","series":[{"id":3106,"url":"https://patchwork.libcamera.org/api/series/3106/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3106","date":"2022-05-10T11:50:57","name":"staging: media: imx: Prepare destaging of imx7-media-csi","version":1,"mbox":"https://patchwork.libcamera.org/series/3106/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15866/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15866/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 9597DC326E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 May 2022 11:52:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 44B4E65699;\n\tTue, 10 May 2022 13:52:28 +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 4E9A165685\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 May 2022 13:52:19 +0200 (CEST)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 70FBFB60;\n\tTue, 10 May 2022 13:52:18 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652183548;\n\tbh=HbKz4y1G2znjiWeWjvthgfOCUuheE0gfBZq5dYC849s=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=CUeDBr4Q7Hkmg/130QevGGl0EGG2owl9FfhWNhWde0MhdMYGB6Kh3YccbMUffIONS\n\teezQhhmKO+4ZSKp+iDa7x3Uxyc9uD1zLl2VCownQ3pLtqB+g0VXr3USbdUxATKvx29\n\t6XHBUwmORx778QDJ+74akOIKnINHEbrCzeaFZ920s6jDt0QKhuf3IoUzsTCZtaNnfz\n\tntsNaG7S4b8RvgQvKbfuJkCmNTSjpBJFy9jmegxqMyul1YKzkT00ydj29kwNsrFq9L\n\tteoFc0WeQp1m6EoRJJRnp0FHk9JPydKMho6wYfU/Juhen2qFlSF9ldSUbaFC7q/nC2\n\t3WhCJ9HzRAQKQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652183539;\n\tbh=HbKz4y1G2znjiWeWjvthgfOCUuheE0gfBZq5dYC849s=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Bkbt9/eY+VsGZl5AkUCIcvFUJS5KoGs4y+nWr95YKvbBbu5Z3OvuI4dDN5C/nM6iF\n\terQVQCcb+3zVIa4ziqXAxvYEv4WHp6OtS8TcvOBf1t2OjYCOWcymN+fvvBsx447D4T\n\tZsDAKJ7VU2ZhkPyg0TBuGwbJA7V0YBIOoHs+TGBg="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Bkbt9/eY\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 10 May 2022 14:51:23 +0300","Message-Id":"<20220510115147.19360-27-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","In-Reply-To":"<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>","References":"<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 26/50] staging: media: imx:\n\timx7-media-csi: Fold imx_media_dev into imx7_csi","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Martin Kepplinger <martin.kepplinger@puri.sm>, kernel@pengutronix.de,\n\tDorota Czaplejewicz <dorota.czaplejewicz@puri.sm>,\n\tAlexander Stein <alexander.stein@ew.tq-group.com>,\n\tRui Miguel Silva <rmfrfs@gmail.com>,\n\tPhilipp Zabel <p.zabel@pengutronix.de>, \n\tSteve Longerbeam <slongerbeam@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Now that the driver doesn't use any helper that relies on the\nimx_media_dev structure anymore, merge the three fields of the\nimx_media_dev structure directly in the imx7_csi structure. Update all\nthe users accordingly.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n drivers/staging/media/imx/imx7-media-csi.c | 61 +++++++++++-----------\n 1 file changed, 30 insertions(+), 31 deletions(-)","diff":"diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c\nindex 44c19c73da97..b116f6ab96f0 100644\n--- a/drivers/staging/media/imx/imx7-media-csi.c\n+++ b/drivers/staging/media/imx/imx7-media-csi.c\n@@ -183,8 +183,10 @@ struct imx7_csi {\n \tspinlock_t irqlock; /* Protects last_eof */\n \n \t/* Media and V4L2 device */\n-\tstruct imx_media_dev imxmd;\n+\tstruct media_device mdev;\n+\tstruct v4l2_device v4l2_dev;\n \tstruct v4l2_async_notifier notifier;\n+\tstruct media_pipeline pipe;\n \n \tstruct v4l2_subdev *src_sd;\n \tbool is_csi2;\n@@ -1081,9 +1083,9 @@ static int imx7_csi_video_start_streaming(struct vb2_queue *vq,\n \t\tgoto err_buffers;\n \t}\n \n-\tmutex_lock(&csi->imxmd.md.graph_mutex);\n+\tmutex_lock(&csi->mdev.graph_mutex);\n \n-\tret = __media_pipeline_start(&csi->sd.entity, &csi->imxmd.pipe);\n+\tret = __media_pipeline_start(&csi->sd.entity, &csi->pipe);\n \tif (ret)\n \t\tgoto err_unlock;\n \n@@ -1091,14 +1093,14 @@ static int imx7_csi_video_start_streaming(struct vb2_queue *vq,\n \tif (ret)\n \t\tgoto err_stop;\n \n-\tmutex_unlock(&csi->imxmd.md.graph_mutex);\n+\tmutex_unlock(&csi->mdev.graph_mutex);\n \n \treturn 0;\n \n err_stop:\n \t__media_pipeline_stop(&csi->sd.entity);\n err_unlock:\n-\tmutex_unlock(&csi->imxmd.md.graph_mutex);\n+\tmutex_unlock(&csi->mdev.graph_mutex);\n \tdev_err(csi->dev, \"pipeline start failed with %d\\n\", ret);\n err_buffers:\n \tspin_lock_irqsave(&csi->q_lock, flags);\n@@ -1117,10 +1119,10 @@ static void imx7_csi_video_stop_streaming(struct vb2_queue *vq)\n \tstruct imx_media_buffer *tmp;\n \tunsigned long flags;\n \n-\tmutex_lock(&csi->imxmd.md.graph_mutex);\n+\tmutex_lock(&csi->mdev.graph_mutex);\n \tv4l2_subdev_call(&csi->sd, video, s_stream, 0);\n \t__media_pipeline_stop(&csi->sd.entity);\n-\tmutex_unlock(&csi->imxmd.md.graph_mutex);\n+\tmutex_unlock(&csi->mdev.graph_mutex);\n \n \t/* release all active buffers */\n \tspin_lock_irqsave(&csi->q_lock, flags);\n@@ -1704,11 +1706,11 @@ static int imx7_csi_registered(struct v4l2_subdev *sd)\n \tif (ret)\n \t\treturn ret;\n \n-\tret = v4l2_device_register_subdev_nodes(&csi->imxmd.v4l2_dev);\n+\tret = v4l2_device_register_subdev_nodes(&csi->v4l2_dev);\n \tif (ret)\n \t\tgoto err_unreg;\n \n-\tret = media_device_register(&csi->imxmd.md);\n+\tret = media_device_register(&csi->mdev);\n \tif (ret)\n \t\tgoto err_unreg;\n \n@@ -1778,7 +1780,7 @@ static int imx7_csi_notify_complete(struct v4l2_async_notifier *notifier)\n {\n \tstruct imx7_csi *csi = imx7_csi_notifier_to_dev(notifier);\n \n-\treturn v4l2_device_register_subdev_nodes(&csi->imxmd.v4l2_dev);\n+\treturn v4l2_device_register_subdev_nodes(&csi->v4l2_dev);\n }\n \n static const struct v4l2_async_notifier_operations imx7_csi_notify_ops = {\n@@ -1812,7 +1814,7 @@ static int imx7_csi_async_register(struct imx7_csi *csi)\n \n \tcsi->notifier.ops = &imx7_csi_notify_ops;\n \n-\tret = v4l2_async_nf_register(&csi->imxmd.v4l2_dev, &csi->notifier);\n+\tret = v4l2_async_nf_register(&csi->v4l2_dev, &csi->notifier);\n \tif (ret)\n \t\treturn ret;\n \n@@ -1821,11 +1823,9 @@ static int imx7_csi_async_register(struct imx7_csi *csi)\n \n static void imx7_csi_media_cleanup(struct imx7_csi *csi)\n {\n-\tstruct imx_media_dev *imxmd = &csi->imxmd;\n-\n-\tv4l2_device_unregister(&imxmd->v4l2_dev);\n-\tmedia_device_unregister(&imxmd->md);\n-\tmedia_device_cleanup(&imxmd->md);\n+\tv4l2_device_unregister(&csi->v4l2_dev);\n+\tmedia_device_unregister(&csi->mdev);\n+\tmedia_device_cleanup(&csi->mdev);\n }\n \n static const struct media_device_ops imx7_csi_media_ops = {\n@@ -1834,26 +1834,25 @@ static const struct media_device_ops imx7_csi_media_ops = {\n \n static int imx7_csi_media_dev_init(struct imx7_csi *csi)\n {\n-\tstruct imx_media_dev *imxmd = &csi->imxmd;\n \tint ret;\n \n-\tdev_set_drvdata(csi->dev, imxmd);\n+\tdev_set_drvdata(csi->dev, csi);\n \n-\tstrscpy(imxmd->md.model, \"imx-media\", sizeof(imxmd->md.model));\n-\timxmd->md.ops = &imx7_csi_media_ops;\n-\timxmd->md.dev = csi->dev;\n+\tstrscpy(csi->mdev.model, \"imx-media\", sizeof(csi->mdev.model));\n+\tcsi->mdev.ops = &imx7_csi_media_ops;\n+\tcsi->mdev.dev = csi->dev;\n \n-\timxmd->v4l2_dev.mdev = &imxmd->md;\n-\tstrscpy(imxmd->v4l2_dev.name, \"imx-media\",\n-\t\tsizeof(imxmd->v4l2_dev.name));\n-\tsnprintf(imxmd->md.bus_info, sizeof(imxmd->md.bus_info),\n-\t\t \"platform:%s\", dev_name(imxmd->md.dev));\n+\tcsi->v4l2_dev.mdev = &csi->mdev;\n+\tstrscpy(csi->v4l2_dev.name, \"imx-media\",\n+\t\tsizeof(csi->v4l2_dev.name));\n+\tsnprintf(csi->mdev.bus_info, sizeof(csi->mdev.bus_info),\n+\t\t \"platform:%s\", dev_name(csi->mdev.dev));\n \n-\tmedia_device_init(&imxmd->md);\n+\tmedia_device_init(&csi->mdev);\n \n-\tret = v4l2_device_register(csi->dev, &imxmd->v4l2_dev);\n+\tret = v4l2_device_register(csi->dev, &csi->v4l2_dev);\n \tif (ret < 0) {\n-\t\tv4l2_err(&imxmd->v4l2_dev,\n+\t\tv4l2_err(&csi->v4l2_dev,\n \t\t\t \"Failed to register v4l2_device: %d\\n\", ret);\n \t\tgoto cleanup;\n \t}\n@@ -1861,7 +1860,7 @@ static int imx7_csi_media_dev_init(struct imx7_csi *csi)\n \treturn 0;\n \n cleanup:\n-\tmedia_device_cleanup(&imxmd->md);\n+\tmedia_device_cleanup(&csi->mdev);\n \n \treturn ret;\n }\n@@ -1894,7 +1893,7 @@ static int imx7_csi_media_init(struct imx7_csi *csi)\n \tif (ret < 0)\n \t\treturn ret;\n \n-\treturn v4l2_device_register_subdev(&csi->imxmd.v4l2_dev, &csi->sd);\n+\treturn v4l2_device_register_subdev(&csi->v4l2_dev, &csi->sd);\n }\n \n static int imx7_csi_probe(struct platform_device *pdev)\n","prefixes":["libcamera-devel","26/50"]}