From patchwork Tue Feb 14 07:51:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93921 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447268qgi; Mon, 13 Feb 2017 23:52:26 -0800 (PST) X-Received: by 10.98.102.196 with SMTP id s65mr30158231pfj.137.1487058746744; Mon, 13 Feb 2017 23:52:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.26; Mon, 13 Feb 2017 23:52:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752587AbdBNHwY (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:24 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:39761 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930AbdBNHwU (ORCPT ); Tue, 14 Feb 2017 02:52:20 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC003K6TV4BA20@mailout3.w1.samsung.com>; Tue, 14 Feb 2017 07:52:16 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075215eucas1p1bba8b7298a1b3bb70255a4816874ed04~jGAqlf9aS2143621436eucas1p1x; Tue, 14 Feb 2017 07:52:15 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id E3.84.09557.F27B2A85; Tue, 14 Feb 2017 07:52:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075215eucas1p1e77dbae8e0be9f7f5bf66765c5d57f5f~jGApz9PY32143621436eucas1p1w; Tue, 14 Feb 2017 07:52:15 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-b0-58a2b72fa432 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EB.5E.06687.E77B2A85; Tue, 14 Feb 2017 07:53:34 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:15 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 02/15] media: s5p-mfc: Use generic of_device_get_match_data helper Date: Tue, 14 Feb 2017 08:51:55 +0100 Message-id: <1487058728-16501-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djPc7r62xdFGLy9rGVxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK+Pl9l9MBbvFKp429bI3MPYJdzFyckgImEjcXbKADcIWk7hwbz2QzcUhJLCU UeL48R4mCOczo0TPy2nsMB1bGnawQySWMUo8P7KfGcJpYJK4cGAu2Cw2AUOJrrddYLaIgJPE wll/wTqYBb4zSnzbfZoVJCEsECIx414vmM0ioCqx4dNaFhCbV8BDYvXOxcwQ6+QkTh6bDFbD KeApsenzFEaQQRICz9kk9va8BHI4gBxZiU0HoOpdJL62HmOCsIUlXh3fAnW2jERnx0GoeD+j RFOrNoQ9g1Hi3FteCNta4vDxi2C7mAX4JCZtm84MMZ5XoqNNCKLEQ2L/rGvQ8HKUOL3pDdha IYE5jBJr7ylOYJRZwMiwilEktbQ4Nz212FivODG3uDQvXS85P3cTIzBuT/87/mkH49cTVocY BTgYlXh4JxxYGCHEmlhWXJl7iFGCg1lJhJehd1GEEG9KYmVValF+fFFpTmrxIUZpDhYlcd49 C66ECwmkJ5akZqemFqQWwWSZODilGhhPTZT8ZXcr8eMeU6atun7amyUCVzqpKGpxWG5QnxrP oyrKf2vf6Yw5b1mWtJoJPhIzzncObt9avy9vCv/mkxF9Mpv3FRpGGe24+YFXRL3PJ2xS7qGQ rxtZT6x75zPhaUX5spnal89uzN3jGvbnxK2WNLf+D5feulnPaTt7KGdG0YloYaXymPtKLMUZ iYZazEXFiQDLvHt/1wIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xK7p12xdFGGxbzmlxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhkvt/9iKtgtVvG0qZe9gbFPuIuRk0NCwERiS8MOdghbTOLCvfVsXYxcHEICSxglvjX/ZoFw mpgkZt+ZyAhSxSZgKNH1tosNxBYRcJJYOOsvWDezwHdGiWU300BsYYEQiRn3ellBbBYBVYkN n9aygNi8Ah4Sq3cuZobYJidx8thksBpOAU+JTZ+ngM0XAqo5u2YH+wRG3gWMDKsYRVJLi3PT c4sN9YoTc4tL89L1kvNzNzECQ3jbsZ+bdzBe2hh8iFGAg1GJh3fCgYURQqyJZcWVuYcYJTiY lUR4GXoXRQjxpiRWVqUW5ccXleakFh9iNAU6aiKzlGhyPjC+8kriDU0MzS0NjYwtLMyNjJTE eUs+XAkXEkhPLEnNTk0tSC2C6WPi4JRqYJycxyXlUWr6esL2mzmBiiEaxYlZN3amt0rcM3qz 7GOl2btIq66+C1zyKx1uGnS90/ng//7tgrN3zlqfqZC8mvlo+6lknbiamYfXX6tPLX6Y227Y 2bHhoOTNsJu37sZuubpuHTC4jz60Pd9eJC4V7Dcrfb2FRRRf+g2PcItCx4PpuX+e7Xy4TIml OCPRUIu5qDgRALMv4+J3AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075215eucas1p1e77dbae8e0be9f7f5bf66765c5d57f5f X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075215eucas1p1e77dbae8e0be9f7f5bf66765c5d57f5f X-RootMTR: 20170214075215eucas1p1e77dbae8e0be9f7f5bf66765c5d57f5f References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Replace custom code with generic helper to retrieve driver data. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 17 ++--------------- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 4 ++-- 2 files changed, 4 insertions(+), 17 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 3e1f22eb4339..ad3d7377f40d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "s5p_mfc_common.h" @@ -1157,8 +1158,6 @@ static void s5p_mfc_unconfigure_dma_memory(struct s5p_mfc_dev *mfc_dev) device_unregister(mfc_dev->mem_dev_r); } -static void *mfc_get_drv_data(struct platform_device *pdev); - /* MFC probe function */ static int s5p_mfc_probe(struct platform_device *pdev) { @@ -1182,7 +1181,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) return -ENODEV; } - dev->variant = mfc_get_drv_data(pdev); + dev->variant = of_device_get_match_data(&pdev->dev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); dev->regs_base = devm_ioremap_resource(&pdev->dev, res); @@ -1541,18 +1540,6 @@ static int s5p_mfc_resume(struct device *dev) }; MODULE_DEVICE_TABLE(of, exynos_mfc_match); -static void *mfc_get_drv_data(struct platform_device *pdev) -{ - struct s5p_mfc_variant *driver_data = NULL; - const struct of_device_id *match; - - match = of_match_node(exynos_mfc_match, pdev->dev.of_node); - if (match) - driver_data = (struct s5p_mfc_variant *)match->data; - - return driver_data; -} - static struct platform_driver s5p_mfc_driver = { .probe = s5p_mfc_probe, .remove = s5p_mfc_remove, diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 3e0e8eaf8bfe..2f1387a4c386 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -192,7 +192,7 @@ struct s5p_mfc_buf { */ struct s5p_mfc_pm { struct clk *clock_gate; - const char **clk_names; + const char * const *clk_names; struct clk *clocks[MFC_MAX_CLOCKS]; int num_clocks; bool use_clock_gating; @@ -304,7 +304,7 @@ struct s5p_mfc_dev { struct v4l2_ctrl_handler dec_ctrl_handler; struct v4l2_ctrl_handler enc_ctrl_handler; struct s5p_mfc_pm pm; - struct s5p_mfc_variant *variant; + const struct s5p_mfc_variant *variant; int num_inst; spinlock_t irqlock; /* lock when operating on context */ spinlock_t condlock; /* lock when changing/checking if a context is From patchwork Tue Feb 14 07:51:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93933 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447403qgi; Mon, 13 Feb 2017 23:52:54 -0800 (PST) X-Received: by 10.84.229.1 with SMTP id b1mr12590680plk.148.1487058774238; Mon, 13 Feb 2017 23:52:54 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.53; Mon, 13 Feb 2017 23:52:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752654AbdBNHwx (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:53 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:39235 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbdBNHwV (ORCPT ); Tue, 14 Feb 2017 02:52:21 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC003KZTV52920@mailout1.w1.samsung.com>; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075216eucas1p2507fa50b57c239f330bd709009b13e6f~jGArNSXsl1348213482eucas1p2V; Tue, 14 Feb 2017 07:52:16 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id A3.51.16908.337B2A85; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075215eucas1p2c3c06daf02ca5b3d29bce024fc9898e1~jGAqiGTuJ1393113931eucas1p2e; Tue, 14 Feb 2017 07:52:15 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-fb-58a2b733e223 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 5E.FF.10233.337B2A85; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:15 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 03/15] media: s5p-mfc: Replace mem_dev_* entries with an array Date: Tue, 14 Feb 2017 08:51:56 +0100 Message-id: <1487058728-16501-4-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsWy7djP87rG2xdFGJy4ympxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK2Px+nlsBdubGCv+H+tgaWDsy+ti5OSQEDCR2L5qNguELSZx4d56ti5GLg4h gWWMEgvaLjBBOJ8ZJW5P2sME0/Fiy0d2uKq/b6dDtTQwSVw4MJcNpIpNwFCi620XmC0i4CSx cNZfsA5mge+MEt92n2YFSQgLBEi8b13GCGKzCKhKtE68zAxi8wp4SBy9eRhqnZzEyWOTweo5 BTwlNn2ewggySELgNZvEua33gTZwADmyEpsOMEPUu0is2nWZFcIWlnh1fAs7hC0jcXlyN9Sj /YwSTa3aEPYMRolzb3khbGuJw8cvgvUyC/BJTNo2nRliPK9ER5sQRImHxOz7k6HGOErM/PiT BeL5OYwSj/ftY5rAKLOAkWEVo0hqaXFuemqxoV5xYm5xaV66XnJ+7iZGYOye/nf8/Q7Gp80h hxgFOBiVeHgnHFgYIcSaWFZcmXuIUYKDWUmEl6F3UYQQb0piZVVqUX58UWlOavEhRmkOFiVx 3r0LroQLCaQnlqRmp6YWpBbBZJk4OKUaGGc+MPv7b6HRJs1i8Ud3E7ZKXHx/dhLnnfwfu+LW eqns3datGKLsZB+1TmjVRnm3o8fu2dflHnQ6qblE/9qUSs74LSl6rs/nqhe8+Lpn+WJlt4PS 9xM23my4VKXtEXjJyke2RNPxguRc/nuvulIuh72KX2meczhp2YOQSQZvJ9YZxVpWZ1X2tiux FGckGmoxFxUnAgD8SOTt2QIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKLMWRmVeSWpSXmKPExsVy+t/xK7rG2xdFGPxsFrG4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzlZpOR mpiSWqSQmpecn5KZl26rFBripmuhpJCXmJtqqxSh6xsSpKRQlphTCuQZGaABB+cA92AlfbsE t4zF6+exFWxvYqz4f6yDpYGxL6+LkZNDQsBE4sWWj+wQtpjEhXvr2boYuTiEBJYwSmw5eoEJ wmlikph9ZyIjSBWbgKFE19suNhBbRMBJYuGsv2DdzALfGSWW3UwDsYUF/CQ6Z09jBrFZBFQl WideBrN5BTwkjt48zASxTU7i5LHJrCA2p4CnxKbPU8DmCwHVnF2zg30CI+8CRoZVjCKppcW5 6bnFRnrFibnFpXnpesn5uZsYgUG87djPLTsYu94FH2IU4GBU4uG12LcwQog1say4MvcQowQH s5IIL0Pvoggh3pTEyqrUovz4otKc1OJDjKZAR01klhJNzgdGWF5JvKGJobmloZGxhYW5kZGS OO/UD1fChQTSE0tSs1NTC1KLYPqYODilGhh5nrV8cw9fs5HLW477YoiAB6vs31bxhJJdy7at ZmaVXDCN4V/cMSa+I8dlwt6zpnqkpjx8/vVmQ3rD3pb/9xNiX1rGzutQTRR/vPTrrndH2y83 vvH99PtOVaSqtqm8dcG2UP6KEzOuvtVaqRF47XrEn2Vb9pxvF9SYEbSbOYNjkZu7kfsugxdK LMUZiYZazEXFiQAvfOq2eAIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075215eucas1p2c3c06daf02ca5b3d29bce024fc9898e1 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075215eucas1p2c3c06daf02ca5b3d29bce024fc9898e1 X-RootMTR: 20170214075215eucas1p2c3c06daf02ca5b3d29bce024fc9898e1 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Internal MFC driver device structure contains two pointers to devices used for DMA memory allocation: mem_dev_l and mem_dev_r. Replace them with the mem_dev[] array and use defines for accessing particular banks. This will help to simplify code in the next patches. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 31 +++++++++++++----------- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 11 ++++----- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 23 +++++++++--------- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 8 +++---- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 10 ++++---- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | 32 ++++++++++++++----------- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 15 ++++++------ 7 files changed, 69 insertions(+), 61 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index ad3d7377f40d..f7664910f12c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1123,7 +1123,8 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) int ret = exynos_configure_iommu(dev, S5P_MFC_IOMMU_DMA_BASE, S5P_MFC_IOMMU_DMA_SIZE); if (ret == 0) - mfc_dev->mem_dev_l = mfc_dev->mem_dev_r = dev; + mfc_dev->mem_dev[BANK1_CTX] = + mfc_dev->mem_dev[BANK2_CTX] = dev; return ret; } @@ -1131,14 +1132,14 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) * Create and initialize virtual devices for accessing * reserved memory regions. */ - mfc_dev->mem_dev_l = s5p_mfc_alloc_memdev(dev, "left", - MFC_BANK1_ALLOC_CTX); - if (!mfc_dev->mem_dev_l) + mfc_dev->mem_dev[BANK1_CTX] = s5p_mfc_alloc_memdev(dev, "left", + BANK1_CTX); + if (!mfc_dev->mem_dev[BANK1_CTX]) return -ENODEV; - mfc_dev->mem_dev_r = s5p_mfc_alloc_memdev(dev, "right", - MFC_BANK2_ALLOC_CTX); - if (!mfc_dev->mem_dev_r) { - device_unregister(mfc_dev->mem_dev_l); + mfc_dev->mem_dev[BANK2_CTX] = s5p_mfc_alloc_memdev(dev, "right", + BANK2_CTX); + if (!mfc_dev->mem_dev[BANK2_CTX]) { + device_unregister(mfc_dev->mem_dev[BANK1_CTX]); return -ENODEV; } @@ -1154,8 +1155,8 @@ static void s5p_mfc_unconfigure_dma_memory(struct s5p_mfc_dev *mfc_dev) return; } - device_unregister(mfc_dev->mem_dev_l); - device_unregister(mfc_dev->mem_dev_r); + device_unregister(mfc_dev->mem_dev[BANK1_CTX]); + device_unregister(mfc_dev->mem_dev[BANK2_CTX]); } /* MFC probe function */ @@ -1213,8 +1214,10 @@ static int s5p_mfc_probe(struct platform_device *pdev) goto err_dma; } - vb2_dma_contig_set_max_seg_size(dev->mem_dev_l, DMA_BIT_MASK(32)); - vb2_dma_contig_set_max_seg_size(dev->mem_dev_r, DMA_BIT_MASK(32)); + vb2_dma_contig_set_max_seg_size(dev->mem_dev[BANK1_CTX], + DMA_BIT_MASK(32)); + vb2_dma_contig_set_max_seg_size(dev->mem_dev[BANK2_CTX], + DMA_BIT_MASK(32)); mutex_init(&dev->mfc_mutex); init_waitqueue_head(&dev->queue); @@ -1348,8 +1351,8 @@ static int s5p_mfc_remove(struct platform_device *pdev) v4l2_device_unregister(&dev->v4l2_dev); s5p_mfc_release_firmware(dev); s5p_mfc_unconfigure_dma_memory(dev); - vb2_dma_contig_clear_max_seg_size(dev->mem_dev_l); - vb2_dma_contig_clear_max_seg_size(dev->mem_dev_r); + vb2_dma_contig_clear_max_seg_size(dev->mem_dev[BANK1_CTX]); + vb2_dma_contig_clear_max_seg_size(dev->mem_dev[BANK2_CTX]); s5p_mfc_final_pm(dev); return 0; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 2f1387a4c386..27d4c864e06e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -33,8 +33,9 @@ * while mmaping */ #define DST_QUEUE_OFF_BASE (1 << 30) -#define MFC_BANK1_ALLOC_CTX 0 -#define MFC_BANK2_ALLOC_CTX 1 +#define BANK1_CTX 0 +#define BANK2_CTX 1 +#define BANK_CTX_NUM 2 #define MFC_BANK1_ALIGN_ORDER 13 #define MFC_BANK2_ALIGN_ORDER 13 @@ -254,8 +255,7 @@ struct s5p_mfc_priv_buf { * @vfd_dec: video device for decoding * @vfd_enc: video device for encoding * @plat_dev: platform device - * @mem_dev_l: child device of the left memory bank (0) - * @mem_dev_r: child device of the right memory bank (1) + * @mem_dev[]: child devices of the memory banks * @regs_base: base address of the MFC hw registers * @irq: irq resource * @dec_ctrl_handler: control framework handler for decoding @@ -297,8 +297,7 @@ struct s5p_mfc_dev { struct video_device *vfd_dec; struct video_device *vfd_enc; struct platform_device *plat_dev; - struct device *mem_dev_l; - struct device *mem_dev_r; + struct device *mem_dev[BANK_CTX_NUM]; void __iomem *regs_base; int irq; struct v4l2_ctrl_handler dec_ctrl_handler; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index cc888713b3b6..cd1406c75d9a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -28,6 +28,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) { void *bank2_virt; dma_addr_t bank2_dma_addr; + unsigned int align_size = 1 << MFC_BASE_ALIGN_ORDER; dev->fw_size = dev->variant->buf_size->fw; @@ -36,8 +37,8 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) return -ENOMEM; } - dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev_l, dev->fw_size, - &dev->bank1, GFP_KERNEL); + dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], + dev->fw_size, &dev->bank1, GFP_KERNEL); if (!dev->fw_virt_addr) { mfc_err("Allocating bitprocessor buffer failed\n"); @@ -45,13 +46,13 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) } if (HAS_PORTNUM(dev) && IS_TWOPORT(dev)) { - bank2_virt = dma_alloc_coherent(dev->mem_dev_r, 1 << MFC_BASE_ALIGN_ORDER, - &bank2_dma_addr, GFP_KERNEL); + bank2_virt = dma_alloc_coherent(dev->mem_dev[BANK2_CTX], + align_size, &bank2_dma_addr, GFP_KERNEL); if (!bank2_virt) { mfc_err("Allocating bank2 base failed\n"); - dma_free_coherent(dev->mem_dev_l, dev->fw_size, - dev->fw_virt_addr, dev->bank1); + dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_size, + dev->fw_virt_addr, dev->bank1); dev->fw_virt_addr = NULL; return -ENOMEM; } @@ -60,10 +61,10 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) * should not have address of bank2 - MFC will treat it as a null frame. * To avoid such situation we set bank2 address below the pool address. */ - dev->bank2 = bank2_dma_addr - (1 << MFC_BASE_ALIGN_ORDER); + dev->bank2 = bank2_dma_addr - align_size; - dma_free_coherent(dev->mem_dev_r, 1 << MFC_BASE_ALIGN_ORDER, - bank2_virt, bank2_dma_addr); + dma_free_coherent(dev->mem_dev[BANK2_CTX], align_size, + bank2_virt, bank2_dma_addr); } else { /* In this case bank2 can point to the same address as bank1. @@ -123,8 +124,8 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) * that MFC is no longer processing */ if (!dev->fw_virt_addr) return -EINVAL; - dma_free_coherent(dev->mem_dev_l, dev->fw_size, dev->fw_virt_addr, - dev->bank1); + dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_size, + dev->fw_virt_addr, dev->bank1); dev->fw_virt_addr = NULL; return 0; } diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 367ef8e8dbf0..f17062f9070b 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -931,14 +931,14 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, psize[1] = ctx->chroma_size; if (IS_MFCV6_PLUS(dev)) - alloc_devs[0] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK1_CTX]; else - alloc_devs[0] = ctx->dev->mem_dev_r; - alloc_devs[1] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK2_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK1_CTX]; } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && ctx->state == MFCINST_INIT) { psize[0] = ctx->dec_src_buf_size; - alloc_devs[0] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK1_CTX]; } else { mfc_err("This video node is dedicated to decoding. Decoding not initialized\n"); return -EINVAL; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index e39d9e06e299..2eea21f06d7e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1832,7 +1832,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, if (*buf_count > MFC_MAX_BUFFERS) *buf_count = MFC_MAX_BUFFERS; psize[0] = ctx->enc_dst_buf_size; - alloc_devs[0] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK1_CTX]; } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (ctx->src_fmt) *plane_count = ctx->src_fmt->num_planes; @@ -1848,11 +1848,11 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, psize[1] = ctx->chroma_size; if (IS_MFCV6_PLUS(dev)) { - alloc_devs[0] = ctx->dev->mem_dev_l; - alloc_devs[1] = ctx->dev->mem_dev_l; + alloc_devs[0] = ctx->dev->mem_dev[BANK1_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK1_CTX]; } else { - alloc_devs[0] = ctx->dev->mem_dev_r; - alloc_devs[1] = ctx->dev->mem_dev_r; + alloc_devs[0] = ctx->dev->mem_dev[BANK2_CTX]; + alloc_devs[1] = ctx->dev->mem_dev[BANK2_CTX]; } } else { mfc_err("invalid queue type: %d\n", vq->type); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c index f4301d5bbd32..65dd3e64b4db 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c @@ -41,7 +41,8 @@ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) int ret; ctx->dsc.size = buf_size->dsc; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, &ctx->dsc); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, + &ctx->dsc); if (ret) { mfc_err("Failed to allocate temporary buffer\n"); return ret; @@ -57,7 +58,7 @@ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) /* Release temporary buffers for decoding */ static void s5p_mfc_release_dec_desc_buffer_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->dsc); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->dsc); } /* Allocate codec buffers */ @@ -172,8 +173,8 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) /* Allocate only if memory from bank 1 is necessary */ if (ctx->bank1.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, - &ctx->bank1); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->bank1, &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 temporary buffer\n"); return ret; @@ -182,11 +183,12 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) } /* Allocate only if memory from bank 2 is necessary */ if (ctx->bank2.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_r, dev->bank2, - &ctx->bank2); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK2_CTX], + dev->bank2, &ctx->bank2); if (ret) { mfc_err("Failed to allocate Bank2 temporary buffer\n"); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], + &ctx->bank1); return ret; } BUG_ON(ctx->bank2.dma & ((1 << MFC_BANK2_ALIGN_ORDER) - 1)); @@ -197,8 +199,8 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) /* Release buffers allocated for codec */ static void s5p_mfc_release_codec_buffers_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_r, &ctx->bank2); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK2_CTX], &ctx->bank2); } /* Allocate memory for instance data buffer */ @@ -214,7 +216,8 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) else ctx->ctx.size = buf_size->non_h264_ctx; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, + &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -227,10 +230,11 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) /* Initialize shared memory */ ctx->shm.size = buf_size->shm; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, &ctx->shm); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, + &ctx->shm); if (ret) { mfc_err("Failed to allocate shared memory buffer\n"); - s5p_mfc_release_priv_buf(dev->mem_dev_l, &ctx->ctx); + s5p_mfc_release_priv_buf(dev->mem_dev[BANK1_CTX], &ctx->ctx); return ret; } @@ -246,8 +250,8 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) /* Release instance buffer */ static void s5p_mfc_release_instance_buffer_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->ctx); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->shm); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->ctx); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->shm); } static int s5p_mfc_alloc_dev_context_buffer_v5(struct s5p_mfc_dev *dev) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index d6f207e859ab..d2bc938253bc 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -239,8 +239,8 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) /* Allocate only if memory from bank 1 is necessary */ if (ctx->bank1.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, - &ctx->bank1); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->bank1, &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 memory\n"); return ret; @@ -253,7 +253,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) /* Release buffers allocated for codec */ static void s5p_mfc_release_codec_buffers_v6(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->bank1); } /* Allocate memory for instance data buffer */ @@ -292,7 +292,8 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) break; } - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, + &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -309,7 +310,7 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) /* Release instance buffer */ static void s5p_mfc_release_instance_buffer_v6(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev_l, &ctx->ctx); + s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->ctx); } /* Allocate context buffers for SYS_INIT */ @@ -321,7 +322,7 @@ static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev) mfc_debug_enter(); dev->ctx_buf.size = buf_size->dev_ctx; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, dev->bank1, + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, &dev->ctx_buf); if (ret) { mfc_err("Failed to allocate device context buffer\n"); @@ -339,7 +340,7 @@ static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev) /* Release context buffers for SYS_INIT */ static void s5p_mfc_release_dev_context_buffer_v6(struct s5p_mfc_dev *dev) { - s5p_mfc_release_priv_buf(dev->mem_dev_l, &dev->ctx_buf); + s5p_mfc_release_priv_buf(dev->mem_dev[BANK1_CTX], &dev->ctx_buf); } static int calc_plane(int width, int height) From patchwork Tue Feb 14 07:51:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93931 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447390qgi; Mon, 13 Feb 2017 23:52:52 -0800 (PST) X-Received: by 10.84.210.232 with SMTP id a95mr35117144pli.31.1487058772090; Mon, 13 Feb 2017 23:52:52 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.51; Mon, 13 Feb 2017 23:52:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752633AbdBNHwt (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:49 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:39761 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752223AbdBNHwW (ORCPT ); Tue, 14 Feb 2017 02:52:22 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC003IQTV5LK20@mailout3.w1.samsung.com>; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075217eucas1p29246938a67d57981f87fe2d0ed8a67e3~jGArruIWA1393113931eucas1p2f; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 74.84.09557.037B2A85; Tue, 14 Feb 2017 07:52:16 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075216eucas1p24d953cf4977047973c5f030f4cb331f1~jGAq6n1qD1875418754eucas1p28; Tue, 14 Feb 2017 07:52:16 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-b2-58a2b730c195 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4F.FF.10233.337B2A85; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:16 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 04/15] media: s5p-mfc: Replace bank1/bank2 entries with an array Date: Tue, 14 Feb 2017 08:51:57 +0100 Message-id: <1487058728-16501-5-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7djPc7oG2xdFGLQ8M7W4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzFZZOS mpNZllqkb5fAlTFr8nrGgplhFT+bDjE3MK5372Lk5JAQMJHofNPPDGGLSVy4t56ti5GLQ0hg KaPE3C2LWCCcz4wSTXcWssN0rLy6nR0isYxR4uj2X8wQTgOTxP7eVSwgVWwChhJdb7vYQGwR ASeJhbP+gnUwC3xnlPi2+zQrSEJYIEji4bpPQDYHB4uAqsT1vXkgYV4BD4kXMx8zQWyTkzh5 bDJYOaeAp8Smz1MYQeZICLxmk3h2aDkzSK+EgKzEpgNQpovEzr8sEK3CEq+Ob4E6Wkbi8uRu qHg/0Det2hD2DEaJc295IWxricPHL4KtYhbgk5i0bTrUSF6JjjYhCNND4v1uVohqR4knq88z QXw+h1GiY+p29gmMMgsYGVYxiqSWFuempxYb6xUn5haX5qXrJefnbmIExuzpf8c/7WD8esLq EKMAB6MSD++EAwsjhFgTy4orcw8xSnAwK4nwMvQuihDiTUmsrEotyo8vKs1JLT7EKM3BoiTO u2fBlXAhgfTEktTs1NSC1CKYLBMHp1QD46YLuWf/ijAyTUy4ZidwcupXhtQu7+SlIulq/7ke vDmSE6tvlPNO+unrXN9/feKvL6xquK8yR3/2Ku2d/7kXRe1MMZq60NBavHrC9jtSyy40fvx0 Y2PRujpmCXH3eX9yJEuKbn5MktN/ztChVLnp6aLAJxuS+o2Nj+/8XLfv+6Xfa/ayMS6vd1Zi Kc5INNRiLipOBABntnY21QIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRmVeSWpSXmKPExsVy+t/xK7rG2xdFGKw4pGtxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhmzJq9nLJgZVvGz6RBzA+N69y5GTg4JAROJlVe3s0PYYhIX7q1n62Lk4hASWMIoceLEVyin iUni2c85zCBVbAKGEl1vu9hAbBEBJ4mFs/6CdTMLfGeUWHYzDcQWFgiQeNzYxdTFyMHBIqAq cX1vHkiYV8BD4sXMx0wQy+QkTh6bzApicwp4Smz6PIURxBYCqjm7Zgf7BEbeBYwMqxhFUkuL c9Nzi430ihNzi0vz0vWS83M3MQIDeNuxn1t2MHa9Cz7EKMDBqMTDa7FvYYQQa2JZcWXuIUYJ DmYlEV6G3kURQrwpiZVVqUX58UWlOanFhxhNgW6ayCwlmpwPjK68knhDE0NzS0MjYwsLcyMj JXHeqR+uhAsJpCeWpGanphakFsH0MXFwSjUwyrAf9voSb6vxK9E62LJhWb/tmhuFv14cC7/x TVVv2VvhIM1soT2MsRLdabYnIubeWxqmxHucaeKpCNmuwKjA4x1z26ZlL/bxiM76ytDExCvs 0qayxODuQbkjlpoTBFfPZYtW+cPjmvP/AruC7KwkbmnLreyhrKuUC495Vp25+Uz3qZuDkLAS S3FGoqEWc1FxIgANZKNrdgIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075216eucas1p24d953cf4977047973c5f030f4cb331f1 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075216eucas1p24d953cf4977047973c5f030f4cb331f1 X-RootMTR: 20170214075216eucas1p24d953cf4977047973c5f030f4cb331f1 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Internal MFC driver device structure contains two entries for keeping addresses of the DMA memory banks. Replace them with the dma_base[] array and use defines for accessing particular banks. This will help to simplify code in the next patches. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 6 ++-- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 27 +++++++++++------- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | 38 +++++++++++++------------ drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 10 +++---- 4 files changed, 43 insertions(+), 38 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 27d4c864e06e..da601a2dba2f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -273,8 +273,7 @@ struct s5p_mfc_priv_buf { * @queue: waitqueue for waiting for completion of device commands * @fw_size: size of firmware * @fw_virt_addr: virtual firmware address - * @bank1: address of the beginning of bank 1 memory - * @bank2: address of the beginning of bank 2 memory + * @dma_base[]: address of the beginning of memory banks * @hw_lock: used for hardware locking * @ctx: array of driver contexts * @curr_ctx: number of the currently running context @@ -315,8 +314,7 @@ struct s5p_mfc_dev { wait_queue_head_t queue; size_t fw_size; void *fw_virt_addr; - dma_addr_t bank1; - dma_addr_t bank2; + dma_addr_t dma_base[BANK_CTX_NUM]; unsigned long hw_lock; struct s5p_mfc_ctx *ctx[MFC_NUM_CONTEXTS]; int curr_ctx; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index cd1406c75d9a..c9bff3d0655f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -38,8 +38,8 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) } dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], - dev->fw_size, &dev->bank1, GFP_KERNEL); - + dev->fw_size, &dev->dma_base[BANK1_CTX], + GFP_KERNEL); if (!dev->fw_virt_addr) { mfc_err("Allocating bitprocessor buffer failed\n"); return -ENOMEM; @@ -52,7 +52,8 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) if (!bank2_virt) { mfc_err("Allocating bank2 base failed\n"); dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_size, - dev->fw_virt_addr, dev->bank1); + dev->fw_virt_addr, + dev->dma_base[BANK1_CTX]); dev->fw_virt_addr = NULL; return -ENOMEM; } @@ -61,7 +62,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) * should not have address of bank2 - MFC will treat it as a null frame. * To avoid such situation we set bank2 address below the pool address. */ - dev->bank2 = bank2_dma_addr - align_size; + dev->dma_base[BANK2_CTX] = bank2_dma_addr - align_size; dma_free_coherent(dev->mem_dev[BANK2_CTX], align_size, bank2_virt, bank2_dma_addr); @@ -70,7 +71,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) /* In this case bank2 can point to the same address as bank1. * Firmware will always occupy the beginning of this area so it is * impossible having a video frame buffer with zero address. */ - dev->bank2 = dev->bank1; + dev->dma_base[BANK2_CTX] = dev->dma_base[BANK1_CTX]; } return 0; } @@ -125,7 +126,7 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) if (!dev->fw_virt_addr) return -EINVAL; dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_size, - dev->fw_virt_addr, dev->bank1); + dev->fw_virt_addr, dev->dma_base[BANK1_CTX]); dev->fw_virt_addr = NULL; return 0; } @@ -211,13 +212,17 @@ int s5p_mfc_reset(struct s5p_mfc_dev *dev) static inline void s5p_mfc_init_memctrl(struct s5p_mfc_dev *dev) { if (IS_MFCV6_PLUS(dev)) { - mfc_write(dev, dev->bank1, S5P_FIMV_RISC_BASE_ADDRESS_V6); - mfc_debug(2, "Base Address : %pad\n", &dev->bank1); + mfc_write(dev, dev->dma_base[BANK1_CTX], + S5P_FIMV_RISC_BASE_ADDRESS_V6); + mfc_debug(2, "Base Address : %pad\n", + &dev->dma_base[BANK1_CTX]); } else { - mfc_write(dev, dev->bank1, S5P_FIMV_MC_DRAMBASE_ADR_A); - mfc_write(dev, dev->bank2, S5P_FIMV_MC_DRAMBASE_ADR_B); + mfc_write(dev, dev->dma_base[BANK1_CTX], + S5P_FIMV_MC_DRAMBASE_ADR_A); + mfc_write(dev, dev->dma_base[BANK2_CTX], + S5P_FIMV_MC_DRAMBASE_ADR_B); mfc_debug(2, "Bank1: %pad, Bank2: %pad\n", - &dev->bank1, &dev->bank2); + &dev->dma_base[BANK1_CTX], &dev->dma_base[BANK2_CTX]); } } diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c index 65dd3e64b4db..32ce9ade2edb 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c @@ -30,8 +30,8 @@ #include #include -#define OFFSETA(x) (((x) - dev->bank1) >> MFC_OFFSET_SHIFT) -#define OFFSETB(x) (((x) - dev->bank2) >> MFC_OFFSET_SHIFT) +#define OFFSETA(x) (((x) - dev->dma_base[BANK1_CTX]) >> MFC_OFFSET_SHIFT) +#define OFFSETB(x) (((x) - dev->dma_base[BANK2_CTX]) >> MFC_OFFSET_SHIFT) /* Allocate temporary buffers for decoding */ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) @@ -41,8 +41,8 @@ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) int ret; ctx->dsc.size = buf_size->dsc; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, - &ctx->dsc); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->dma_base[BANK1_CTX], &ctx->dsc); if (ret) { mfc_err("Failed to allocate temporary buffer\n"); return ret; @@ -174,7 +174,7 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) if (ctx->bank1.size > 0) { ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->bank1, &ctx->bank1); + dev->dma_base[BANK1_CTX], &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 temporary buffer\n"); return ret; @@ -184,7 +184,7 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) /* Allocate only if memory from bank 2 is necessary */ if (ctx->bank2.size > 0) { ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK2_CTX], - dev->bank2, &ctx->bank2); + dev->dma_base[BANK2_CTX], &ctx->bank2); if (ret) { mfc_err("Failed to allocate Bank2 temporary buffer\n"); s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], @@ -216,8 +216,8 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) else ctx->ctx.size = buf_size->non_h264_ctx; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, - &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->dma_base[BANK1_CTX], &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -230,8 +230,8 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) /* Initialize shared memory */ ctx->shm.size = buf_size->shm; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, - &ctx->shm); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->dma_base[BANK1_CTX], &ctx->shm); if (ret) { mfc_err("Failed to allocate shared memory buffer\n"); s5p_mfc_release_priv_buf(dev->mem_dev[BANK1_CTX], &ctx->ctx); @@ -239,7 +239,7 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) } /* shared memory offset only keeps the offset from base (port a) */ - ctx->shm.ofs = ctx->shm.dma - dev->bank1; + ctx->shm.ofs = ctx->shm.dma - dev->dma_base[BANK1_CTX]; BUG_ON(ctx->shm.ofs & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); memset(ctx->shm.virt, 0, buf_size->shm); @@ -538,10 +538,10 @@ static void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx, { struct s5p_mfc_dev *dev = ctx->dev; - *y_addr = dev->bank2 + (mfc_read(dev, S5P_FIMV_ENCODED_Y_ADDR) - << MFC_OFFSET_SHIFT); - *c_addr = dev->bank2 + (mfc_read(dev, S5P_FIMV_ENCODED_C_ADDR) - << MFC_OFFSET_SHIFT); + *y_addr = dev->dma_base[BANK2_CTX] + + (mfc_read(dev, S5P_FIMV_ENCODED_Y_ADDR) << MFC_OFFSET_SHIFT); + *c_addr = dev->dma_base[BANK2_CTX] + + (mfc_read(dev, S5P_FIMV_ENCODED_C_ADDR) << MFC_OFFSET_SHIFT); } /* Set encoding ref & codec buffer */ @@ -1218,7 +1218,8 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) } if (list_empty(&ctx->src_queue)) { /* send null frame */ - s5p_mfc_set_enc_frame_buffer_v5(ctx, dev->bank2, dev->bank2); + s5p_mfc_set_enc_frame_buffer_v5(ctx, dev->dma_base[BANK2_CTX], + dev->dma_base[BANK2_CTX]); src_mb = NULL; } else { src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, @@ -1226,8 +1227,9 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) src_mb->flags |= MFC_BUF_FLAG_USED; if (src_mb->b->vb2_buf.planes[0].bytesused == 0) { /* send null frame */ - s5p_mfc_set_enc_frame_buffer_v5(ctx, dev->bank2, - dev->bank2); + s5p_mfc_set_enc_frame_buffer_v5(ctx, + dev->dma_base[BANK2_CTX], + dev->dma_base[BANK2_CTX]); ctx->state = MFCINST_FINISHING; } else { src_y_addr = vb2_dma_contig_plane_dma_addr( diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index d2bc938253bc..51053ed68741 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -240,7 +240,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) /* Allocate only if memory from bank 1 is necessary */ if (ctx->bank1.size > 0) { ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->bank1, &ctx->bank1); + dev->dma_base[BANK1_CTX], &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 memory\n"); return ret; @@ -292,8 +292,8 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) break; } - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, - &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->dma_base[BANK1_CTX], &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -322,8 +322,8 @@ static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev) mfc_debug_enter(); dev->ctx_buf.size = buf_size->dev_ctx; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], dev->bank1, - &dev->ctx_buf); + ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], + dev->dma_base[BANK1_CTX], &dev->ctx_buf); if (ret) { mfc_err("Failed to allocate device context buffer\n"); return ret; From patchwork Tue Feb 14 07:51:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93920 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447257qgi; Mon, 13 Feb 2017 23:52:24 -0800 (PST) X-Received: by 10.84.217.199 with SMTP id d7mr3052692plj.80.1487058744799; Mon, 13 Feb 2017 23:52:24 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.24; Mon, 13 Feb 2017 23:52:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752499AbdBNHwX (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:23 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:39708 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635AbdBNHwU (ORCPT ); Tue, 14 Feb 2017 02:52:20 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC002O5TV6XD20@mailout4.w1.samsung.com>; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eusmges4.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075217eucas1p1d371e4b85ff4ff1f380677e5cc5acb09~jGAr9N-tV2457524575eucas1p1a; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges4.samsung.com (EUCPMTA) with SMTP id D0.3B.28517.137B2A85; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075216eucas1p1e3ee119a7e6bbdcda45db5ec0502b6c3~jGArIN0n71806018060eucas1p1c; Tue, 14 Feb 2017 07:52:16 +0000 (GMT) X-AuditID: cbfec7f4-f79716d000006f65-fa-58a2b7317ffe Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EC.5E.06687.F77B2A85; Tue, 14 Feb 2017 07:53:35 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:16 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 05/15] media: s5p-mfc: Simplify alloc/release private buffer functions Date: Tue, 14 Feb 2017 08:51:58 +0100 Message-id: <1487058728-16501-6-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djPc7qG2xdFGDQ94bK4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzFZZOS mpNZllqkb5fAlXHo1U+2gikhFb+fHmFpYFzk3sXIwSEhYCKx/J9hFyMnkCkmceHeerYuRi4O IYGljBJLNn5khnA+M0pM/bqRBaLKROLf7MnsEIlljBJPF26Famlgktjfuwqsik3AUKLrbRcb iC0i4CSxcNZfsA5mge+MEt92n2YFSQgLREgsOLuQGcRmEVCVmLcTpIiTg1fAQ+J92zR2iHVy EiePTQar5xTwlNj0eQojyCAJgedsEu9WLGKEeEJWYtMBZoh6F4nXrzuhbGGJV8e3QM2Rkejs OMgEYfczSjS1akPYMxglzr3lhbCtJQ4fvwi2i1mAT2LStunMEON5JTrahCBKPCSWH53ECmE7 SvQcnscC8fwcRokvv+YwTmCUWcDIsIpRJLW0ODc9tdhErzgxt7g0L10vOT93EyMwbk//O/5l B+PiY1aHGAU4GJV4eC32LYwQYk0sK67MPcQowcGsJMLL0LsoQog3JbGyKrUoP76oNCe1+BCj NAeLkjjvngVXwoUE0hNLUrNTUwtSi2CyTBycUg2MK/MMcmbY6LkVBmUEHj+RtEx/c49FkuM5 Cd9zj9PSfs78udDrp6jwn53ZTBtPf9hw/M5/24yAW9wH2hv2lK3V1ZO8o2Y35/WVRcfvbTDY FPavVl3T/P3yna9PHWovvCd0yOffwvnvT3v3mjwzDBMKU53BYM/xXaFS//Wto4Jp/89uEJu5 LSX1ixJLcUaioRZzUXEiAGbXZBHXAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xK7r12xdFGDSuVrK4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzlZpOR mpiSWqSQmpecn5KZl26rFBripmuhpJCXmJtqqxSh6xsSpKRQlphTCuQZGaABB+cA92AlfbsE t4xDr36yFUwJqfj99AhLA+Mi9y5GTg4JAROJf7Mns0PYYhIX7q1n62Lk4hASWMIoMXnTHFYI p4lJ4tnPOcwgVWwChhJdb7vYQGwRASeJhbP+gnUzC3xnlFh2Mw3EFhaIkFhwdiFYPYuAqsS8 nRA1vAIeEu/bpkFtk5M4eWwyK4jNKeApsenzFEYQWwio5uyaHewTGHkXMDKsYhRJLS3OTc8t NtQrTswtLs1L10vOz93ECAzhbcd+bt7BeGlj8CFGAQ5GJR7eCQcWRgixJpYVV+YeYpTgYFYS 4WXoXRQhxJuSWFmVWpQfX1Sak1p8iNEU6KiJzFKiyfnA+MoriTc0MTS3NDQytrAwNzJSEuct +XAlXEggPbEkNTs1tSC1CKaPiYNTqoGxW6p72Zf3b06t3ri39OV010DW5jN5736fKZ9SWDdv t6lyI/MRM0YlseI5qu/PsR4zf+ovsbhW885k5qsnj6x/wHLydHt25aMrmfvOf+pX5Dp7aPqh Wd2cHRI3Jla4v5v7q71lWzPLdFnzDdncp3ptzGzCBKq23kzfkXenvt3tsuU8l6YFBmuMlFiK MxINtZiLihMBEK63MncCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075216eucas1p1e3ee119a7e6bbdcda45db5ec0502b6c3 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075216eucas1p1e3ee119a7e6bbdcda45db5ec0502b6c3 X-RootMTR: 20170214075216eucas1p1e3ee119a7e6bbdcda45db5ec0502b6c3 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Change parameters for s5p_mfc_alloc_priv_buf() and s5p_mfc_release_priv_buf() functions. Instead of DMA device pointer and a base, provide common MFC device structure and memory bank context identifier. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++ drivers/media/platform/s5p-mfc/s5p_mfc_opr.c | 20 +++++++++++------ drivers/media/platform/s5p-mfc/s5p_mfc_opr.h | 8 +++---- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | 30 ++++++++++--------------- drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 15 +++++-------- 5 files changed, 37 insertions(+), 38 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index da601a2dba2f..9cf860f34c71 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -240,12 +240,14 @@ struct s5p_mfc_variant { * buffer accessed by driver * @dma: DMA address, only valid when kernel DMA API used * @size: size of the buffer + * @ctx: memory context (bank) used for this allocation */ struct s5p_mfc_priv_buf { unsigned long ofs; void *virt; dma_addr_t dma; size_t size; + unsigned int ctx; }; /** diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.c index 99f65a92a6be..9294ee124661 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.c @@ -37,12 +37,16 @@ void s5p_mfc_init_regs(struct s5p_mfc_dev *dev) dev->mfc_regs = s5p_mfc_init_regs_v6_plus(dev); } -int s5p_mfc_alloc_priv_buf(struct device *dev, dma_addr_t base, - struct s5p_mfc_priv_buf *b) +int s5p_mfc_alloc_priv_buf(struct s5p_mfc_dev *dev, unsigned int mem_ctx, + struct s5p_mfc_priv_buf *b) { + struct device *mem_dev = dev->mem_dev[mem_ctx]; + dma_addr_t base = dev->dma_base[mem_ctx]; + mfc_debug(3, "Allocating priv: %zu\n", b->size); - b->virt = dma_alloc_coherent(dev, b->size, &b->dma, GFP_KERNEL); + b->ctx = mem_ctx; + b->virt = dma_alloc_coherent(mem_dev, b->size, &b->dma, GFP_KERNEL); if (!b->virt) { mfc_err("Allocating private buffer of size %zu failed\n", @@ -53,7 +57,7 @@ int s5p_mfc_alloc_priv_buf(struct device *dev, dma_addr_t base, if (b->dma < base) { mfc_err("Invalid memory configuration - buffer (%pad) is below base memory address(%pad)\n", &b->dma, &base); - dma_free_coherent(dev, b->size, b->virt, b->dma); + dma_free_coherent(mem_dev, b->size, b->virt, b->dma); return -ENOMEM; } @@ -61,11 +65,13 @@ int s5p_mfc_alloc_priv_buf(struct device *dev, dma_addr_t base, return 0; } -void s5p_mfc_release_priv_buf(struct device *dev, - struct s5p_mfc_priv_buf *b) +void s5p_mfc_release_priv_buf(struct s5p_mfc_dev *dev, + struct s5p_mfc_priv_buf *b) { + struct device *mem_dev = dev->mem_dev[b->ctx]; + if (b->virt) { - dma_free_coherent(dev, b->size, b->virt, b->dma); + dma_free_coherent(mem_dev, b->size, b->virt, b->dma); b->virt = NULL; b->dma = 0; b->size = 0; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h index b6ac417ab63e..108e59382e0c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h @@ -315,10 +315,10 @@ struct s5p_mfc_hw_ops { void s5p_mfc_init_hw_ops(struct s5p_mfc_dev *dev); void s5p_mfc_init_regs(struct s5p_mfc_dev *dev); -int s5p_mfc_alloc_priv_buf(struct device *dev, dma_addr_t base, - struct s5p_mfc_priv_buf *b); -void s5p_mfc_release_priv_buf(struct device *dev, - struct s5p_mfc_priv_buf *b); +int s5p_mfc_alloc_priv_buf(struct s5p_mfc_dev *dev, unsigned int mem_ctx, + struct s5p_mfc_priv_buf *b); +void s5p_mfc_release_priv_buf(struct s5p_mfc_dev *dev, + struct s5p_mfc_priv_buf *b); #endif /* S5P_MFC_OPR_H_ */ diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c index 32ce9ade2edb..20e8a1bdc984 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c @@ -41,8 +41,7 @@ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) int ret; ctx->dsc.size = buf_size->dsc; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->dma_base[BANK1_CTX], &ctx->dsc); + ret = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &ctx->dsc); if (ret) { mfc_err("Failed to allocate temporary buffer\n"); return ret; @@ -58,7 +57,7 @@ static int s5p_mfc_alloc_dec_temp_buffers_v5(struct s5p_mfc_ctx *ctx) /* Release temporary buffers for decoding */ static void s5p_mfc_release_dec_desc_buffer_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->dsc); + s5p_mfc_release_priv_buf(ctx->dev, &ctx->dsc); } /* Allocate codec buffers */ @@ -173,8 +172,7 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) /* Allocate only if memory from bank 1 is necessary */ if (ctx->bank1.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->dma_base[BANK1_CTX], &ctx->bank1); + ret = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 temporary buffer\n"); return ret; @@ -183,12 +181,10 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) } /* Allocate only if memory from bank 2 is necessary */ if (ctx->bank2.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK2_CTX], - dev->dma_base[BANK2_CTX], &ctx->bank2); + ret = s5p_mfc_alloc_priv_buf(dev, BANK2_CTX, &ctx->bank2); if (ret) { mfc_err("Failed to allocate Bank2 temporary buffer\n"); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], - &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev, &ctx->bank1); return ret; } BUG_ON(ctx->bank2.dma & ((1 << MFC_BANK2_ALIGN_ORDER) - 1)); @@ -199,8 +195,8 @@ static int s5p_mfc_alloc_codec_buffers_v5(struct s5p_mfc_ctx *ctx) /* Release buffers allocated for codec */ static void s5p_mfc_release_codec_buffers_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->bank1); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK2_CTX], &ctx->bank2); + s5p_mfc_release_priv_buf(ctx->dev, &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev, &ctx->bank2); } /* Allocate memory for instance data buffer */ @@ -216,8 +212,7 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) else ctx->ctx.size = buf_size->non_h264_ctx; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->dma_base[BANK1_CTX], &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -230,11 +225,10 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) /* Initialize shared memory */ ctx->shm.size = buf_size->shm; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->dma_base[BANK1_CTX], &ctx->shm); + ret = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &ctx->shm); if (ret) { mfc_err("Failed to allocate shared memory buffer\n"); - s5p_mfc_release_priv_buf(dev->mem_dev[BANK1_CTX], &ctx->ctx); + s5p_mfc_release_priv_buf(dev, &ctx->ctx); return ret; } @@ -250,8 +244,8 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx) /* Release instance buffer */ static void s5p_mfc_release_instance_buffer_v5(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->ctx); - s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->shm); + s5p_mfc_release_priv_buf(ctx->dev, &ctx->ctx); + s5p_mfc_release_priv_buf(ctx->dev, &ctx->shm); } static int s5p_mfc_alloc_dev_context_buffer_v5(struct s5p_mfc_dev *dev) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index 51053ed68741..4e5ead236455 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c @@ -239,8 +239,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) /* Allocate only if memory from bank 1 is necessary */ if (ctx->bank1.size > 0) { - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->dma_base[BANK1_CTX], &ctx->bank1); + ret = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &ctx->bank1); if (ret) { mfc_err("Failed to allocate Bank1 memory\n"); return ret; @@ -253,7 +252,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) /* Release buffers allocated for codec */ static void s5p_mfc_release_codec_buffers_v6(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->bank1); + s5p_mfc_release_priv_buf(ctx->dev, &ctx->bank1); } /* Allocate memory for instance data buffer */ @@ -292,8 +291,7 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) break; } - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->dma_base[BANK1_CTX], &ctx->ctx); + ret = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &ctx->ctx); if (ret) { mfc_err("Failed to allocate instance buffer\n"); return ret; @@ -310,7 +308,7 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct s5p_mfc_ctx *ctx) /* Release instance buffer */ static void s5p_mfc_release_instance_buffer_v6(struct s5p_mfc_ctx *ctx) { - s5p_mfc_release_priv_buf(ctx->dev->mem_dev[BANK1_CTX], &ctx->ctx); + s5p_mfc_release_priv_buf(ctx->dev, &ctx->ctx); } /* Allocate context buffers for SYS_INIT */ @@ -322,8 +320,7 @@ static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev) mfc_debug_enter(); dev->ctx_buf.size = buf_size->dev_ctx; - ret = s5p_mfc_alloc_priv_buf(dev->mem_dev[BANK1_CTX], - dev->dma_base[BANK1_CTX], &dev->ctx_buf); + ret = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &dev->ctx_buf); if (ret) { mfc_err("Failed to allocate device context buffer\n"); return ret; @@ -340,7 +337,7 @@ static int s5p_mfc_alloc_dev_context_buffer_v6(struct s5p_mfc_dev *dev) /* Release context buffers for SYS_INIT */ static void s5p_mfc_release_dev_context_buffer_v6(struct s5p_mfc_dev *dev) { - s5p_mfc_release_priv_buf(dev->mem_dev[BANK1_CTX], &dev->ctx_buf); + s5p_mfc_release_priv_buf(dev, &dev->ctx_buf); } static int calc_plane(int width, int height) From patchwork Tue Feb 14 07:51:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93934 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447423qgi; Mon, 13 Feb 2017 23:52:59 -0800 (PST) X-Received: by 10.99.94.71 with SMTP id s68mr30742070pgb.181.1487058779060; Mon, 13 Feb 2017 23:52:59 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.58; Mon, 13 Feb 2017 23:52:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752515AbdBNHw6 (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:58 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:39229 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751932AbdBNHwV (ORCPT ); Tue, 14 Feb 2017 02:52:21 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC002L4TV6TB20@mailout1.w1.samsung.com>; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075218eucas1p15edf801c0b0dbc46735a0ebd57fa532b~jGAsx81Uu2459424594eucas1p1p; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 00.70.17477.237B2A85; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075217eucas1p26836eab5b19b43498b4a5186fb8f71db~jGAryitF21384513845eucas1p2b; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d000004445-77-58a2b7323e9a Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 70.00.10233.437B2A85; Tue, 14 Feb 2017 07:52:20 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:16 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 06/15] media: s5p-mfc: Move setting DMA max segmetn size to DMA configure function Date: Tue, 14 Feb 2017 08:51:59 +0100 Message-id: <1487058728-16501-7-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsWy7djP87pG2xdFGKzZwmxxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK2NyxxvWgg0iFY1NX9kaGJcKdjFyckgImEhcn7yfFcIWk7hwbz1bFyMXh5DA UkaJ3cc6oZzPjBKPp71ig+mYPe0hI0RiGaPE6eldTBBOA5PE/t5VLCBVbAKGEl1vu8A6RASc JBbO+ssOUsQs8J1R4tvu02ALhQVSJJY1N7KD2CwCqhL3lr8Ga+AV8JCY/qUT6ig5iZPHJoPZ nAKeEps+TwFbLSHwnE1iY+deoNUcQI6sxKYDzBD1LhK933qgThWWeHV8CzuELSNxeXI3C4Td zyjR1KoNYc9glDj3lhfCtpY4fPwi2C5mAT6JSdumM0OM55XoaBOCKPGQ6H1/CWqko8TCeVuZ IZ6fwyhx6tIStgmMMgsYGVYxiqSWFuempxab6hUn5haX5qXrJefnbmIERu7pf8e/7mBceszq EKMAB6MSD++EAwsjhFgTy4orcw8xSnAwK4nwMvQuihDiTUmsrEotyo8vKs1JLT7EKM3BoiTO u2fBlXAhgfTEktTs1NSC1CKYLBMHp1QDo6dSy7y+pU802xc+WX703ONf2ktV4td8qOEx0m1Z MmFH21JVaSEGwx7VTwydiQceWojskmqaFrdK8uSKuM1pj99P7XGYrcX6apHXi7zNh+e0HF/s HfevSbNLaYlhU0PMJ9dtx7enZM2UuvBovYL/VYs57kaiQTqn1cV3eFt+cK1TUuZMr5RfocRS nJFoqMVcVJwIAHb05jzYAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xK7om2xdFGHz4oGlxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhmTO96wFmwQqWhs+srWwLhUsIuRk0NCwERi9rSHjBC2mMSFe+vZuhi5OIQEljBKHL+4mgnC aWKSePZzDjNIFZuAoUTX2y42EFtEwEli4ay/7CA2s8B3RollN9NAbGGBFIkfy98wgdgsAqoS 95a/BqvnFfCQmP6lkxVim5zEyWOTwWxOAU+JTZ+ngF0hBFRzds0O9gmMvAsYGVYxiqSWFuem 5xYb6RUn5haX5qXrJefnbmIEhvC2Yz+37GDsehd8iFGAg1GJh9di38IIIdbEsuLK3EOMEhzM SiK8DL2LIoR4UxIrq1KL8uOLSnNSiw8xmgIdNZFZSjQ5HxhfeSXxhiaG5paGRsYWFuZGRkri vFM/XAkXEkhPLEnNTk0tSC2C6WPi4JRqYOTP5OgpV5OSjvFxbQ0MLrLfWSK2jPFCedR++22m Rk2G/d/V0grnKAh/r2/+N8e4V9LoCkvbEYtvF3v1vPc+e6k7f0X3w40B+4q+XX/4WPZ7EVc6 X7Z6cAdvhmkRV/vZD6+e5C2/HnWgsm2Z/LdH54TidjyYtZbr2UTlbLvMLfuXdesz8CycqcRS nJFoqMVcVJwIAGOUWm93AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075217eucas1p26836eab5b19b43498b4a5186fb8f71db X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075217eucas1p26836eab5b19b43498b4a5186fb8f71db X-RootMTR: 20170214075217eucas1p26836eab5b19b43498b4a5186fb8f71db References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Setting DMA max segment size to 32 bit mask is a part of DMA memory configuration, so move those calls to s5p_mfc_configure_dma_memory() function. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index f7664910f12c..bc1aeb25ebeb 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1122,9 +1122,13 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) if (exynos_is_iommu_available(dev)) { int ret = exynos_configure_iommu(dev, S5P_MFC_IOMMU_DMA_BASE, S5P_MFC_IOMMU_DMA_SIZE); - if (ret == 0) + if (ret == 0) { mfc_dev->mem_dev[BANK1_CTX] = mfc_dev->mem_dev[BANK2_CTX] = dev; + vb2_dma_contig_set_max_seg_size(dev, + DMA_BIT_MASK(32)); + } + return ret; } @@ -1143,6 +1147,11 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) return -ENODEV; } + vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK1_CTX], + DMA_BIT_MASK(32)); + vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK2_CTX], + DMA_BIT_MASK(32)); + return 0; } @@ -1152,11 +1161,14 @@ static void s5p_mfc_unconfigure_dma_memory(struct s5p_mfc_dev *mfc_dev) if (exynos_is_iommu_available(dev)) { exynos_unconfigure_iommu(dev); + vb2_dma_contig_clear_max_seg_size(dev); return; } device_unregister(mfc_dev->mem_dev[BANK1_CTX]); device_unregister(mfc_dev->mem_dev[BANK2_CTX]); + vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK1_CTX]); + vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK2_CTX]); } /* MFC probe function */ @@ -1214,11 +1226,6 @@ static int s5p_mfc_probe(struct platform_device *pdev) goto err_dma; } - vb2_dma_contig_set_max_seg_size(dev->mem_dev[BANK1_CTX], - DMA_BIT_MASK(32)); - vb2_dma_contig_set_max_seg_size(dev->mem_dev[BANK2_CTX], - DMA_BIT_MASK(32)); - mutex_init(&dev->mfc_mutex); init_waitqueue_head(&dev->queue); dev->hw_lock = 0; @@ -1351,8 +1358,6 @@ static int s5p_mfc_remove(struct platform_device *pdev) v4l2_device_unregister(&dev->v4l2_dev); s5p_mfc_release_firmware(dev); s5p_mfc_unconfigure_dma_memory(dev); - vb2_dma_contig_clear_max_seg_size(dev->mem_dev[BANK1_CTX]); - vb2_dma_contig_clear_max_seg_size(dev->mem_dev[BANK2_CTX]); s5p_mfc_final_pm(dev); return 0; From patchwork Tue Feb 14 07:52:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93930 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447352qgi; Mon, 13 Feb 2017 23:52:44 -0800 (PST) X-Received: by 10.99.56.29 with SMTP id f29mr31105050pga.167.1487058763962; Mon, 13 Feb 2017 23:52:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.43; Mon, 13 Feb 2017 23:52:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752627AbdBNHwm (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:42 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:39229 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751490AbdBNHwW (ORCPT ); Tue, 14 Feb 2017 02:52:22 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC003KSTV72B20@mailout1.w1.samsung.com>; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075218eucas1p2e4cac9a471138d9fee97176c76d02468~jGAtEPiI_1548815488eucas1p2y; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 45.84.09557.237B2A85; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075217eucas1p2957a45afd938beab333a21b9bec56480~jGAsOwSCo1400814008eucas1p2p; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-b6-58a2b73285a5 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AD.5E.06687.087B2A85; Tue, 14 Feb 2017 07:53:36 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 07/15] media: s5p-mfc: Put firmware to private buffer structure Date: Tue, 14 Feb 2017 08:52:00 +0100 Message-id: <1487058728-16501-8-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djP87pG2xdFGCzaLWZxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK+Pw2vlMBYvUKhbtPMzYwDhXoYuRk0NCwETi5sEONghbTOLCvfVANheHkMBS RonNW79COZ8ZJdbMXMkG0/H35FZmiMQyRol1cxYygiSEBBqYJBo+8IDYbAKGEl1vu8AaRASc JBbO+ssO0sAs8J1R4tvu06wgCWGBQIl7Xy6ANbMIqEq077/JAmLzCnhIrJ90kQlim5zEyWOT weo5BTwlNn2ewggySELgNZtEw57JQGdwADmyEpsOMEPUu0hs/XmREcIWlnh1fAs7hC0j0dlx EGpmP6NEU6s2hD2DUeLcW14I21ri8PGLYLuYBfgkJm2bDjWeV6KjTQiixEOiY/p0FgjbUeLY h3NMkICYwyjR+n41+wRGmQWMDKsYRVJLi3PTU4uN9YoTc4tL89L1kvNzNzEC4/b0v+OfdjB+ PWF1iFGAg1GJh3fCgYURQqyJZcWVuYcYJTiYlUR4GXoXRQjxpiRWVqUW5ccXleakFh9ilOZg URLn3bPgSriQQHpiSWp2ampBahFMlomDU6qB8TTT/7CUsNqVS3eV/zhS+lTVZ0qJn6fW94O6 HXYrs1Uba2/ocf5ZeUFVQOfDsYvfnvcq/Nd6e/t+1DKtM58P3Jnwk9v9SoGtX71It+ZEk3up kQbhn3v/vGFcVOXdXm9/crZ83ILPNQv+7per7HE/LZq646M2y+OgAvcj74W/ur1LO56Rpnr8 khJLcUaioRZzUXEiABzTSPLXAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xK7oN2xdFGHxbI29xa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhmH185nKlikVrFo52HGBsa5Cl2MnBwSAiYSf09uZYawxSQu3FvP1sXIxSEksIRRomnxVGYI p4lJ4u7ceywgVWwChhJdb7vYQGwRASeJhbP+soPYzALfGSWW3UwDsYUF/CXWfljCCmKzCKhK tO+/CdbLK+AhsX7SRSaIbXISJ49NBqvhFPCU2PR5CiOILQRUc3bNDvYJjLwLGBlWMYqklhbn pucWG+oVJ+YWl+al6yXn525iBIbwtmM/N+9gvLQx+BCjAAejEg/vhAMLI4RYE8uKK3MPMUpw MCuJ8DL0LooQ4k1JrKxKLcqPLyrNSS0+xGgKdNREZinR5HxgfOWVxBuaGJpbGhoZW1iYGxkp ifOWfLgSLiSQnliSmp2aWpBaBNPHxMEp1cA4Q/DC+x1MUwP2Za5b7dH9e/mNe0+/LpdJzd2/ f075hb9aXxtYndLnF/RE/3iYWyqvu1qR7W9U9QUv3ZapAhx/U38JJ+6Lf2nQ0rDhR7y48d/a hpTpdT9u7F/Yv77b3OvY1u3PpKe2nljwx6FuTsDaaUHLzCcUOZe82uV34b6RfpBm1EOTE9ra SizFGYmGWsxFxYkA4FKVjncCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075217eucas1p2957a45afd938beab333a21b9bec56480 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075217eucas1p2957a45afd938beab333a21b9bec56480 X-RootMTR: 20170214075217eucas1p2957a45afd938beab333a21b9bec56480 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Use s5p_mfc_priv_buf structure for keeping the firmware image. This will help handling of firmware buffer allocation in the next patches. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c | 2 +- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 3 +-- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 36 ++++++++++++------------- 3 files changed, 20 insertions(+), 21 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c index 8c4739ca16d6..4c80bb4243be 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v5.c @@ -47,7 +47,7 @@ static int s5p_mfc_sys_init_cmd_v5(struct s5p_mfc_dev *dev) struct s5p_mfc_cmd_args h2r_args; memset(&h2r_args, 0, sizeof(struct s5p_mfc_cmd_args)); - h2r_args.arg[0] = dev->fw_size; + h2r_args.arg[0] = dev->fw_buf.size; return s5p_mfc_cmd_host2risc_v5(dev, S5P_FIMV_H2R_CMD_SYS_INIT, &h2r_args); } diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 9cf860f34c71..cea17a737ef7 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -314,8 +314,7 @@ struct s5p_mfc_dev { int int_type; unsigned int int_err; wait_queue_head_t queue; - size_t fw_size; - void *fw_virt_addr; + struct s5p_mfc_priv_buf fw_buf; dma_addr_t dma_base[BANK_CTX_NUM]; unsigned long hw_lock; struct s5p_mfc_ctx *ctx[MFC_NUM_CONTEXTS]; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index c9bff3d0655f..50d698968049 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -29,21 +29,22 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) void *bank2_virt; dma_addr_t bank2_dma_addr; unsigned int align_size = 1 << MFC_BASE_ALIGN_ORDER; + struct s5p_mfc_priv_buf *fw_buf = &dev->fw_buf; - dev->fw_size = dev->variant->buf_size->fw; + fw_buf->size = dev->variant->buf_size->fw; - if (dev->fw_virt_addr) { + if (fw_buf->virt) { mfc_err("Attempting to allocate firmware when it seems that it is already loaded\n"); return -ENOMEM; } - dev->fw_virt_addr = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], - dev->fw_size, &dev->dma_base[BANK1_CTX], - GFP_KERNEL); - if (!dev->fw_virt_addr) { + fw_buf->virt = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], fw_buf->size, + &fw_buf->dma, GFP_KERNEL); + if (!fw_buf->virt) { mfc_err("Allocating bitprocessor buffer failed\n"); return -ENOMEM; } + dev->dma_base[BANK1_CTX] = fw_buf->dma; if (HAS_PORTNUM(dev) && IS_TWOPORT(dev)) { bank2_virt = dma_alloc_coherent(dev->mem_dev[BANK2_CTX], @@ -51,10 +52,9 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) if (!bank2_virt) { mfc_err("Allocating bank2 base failed\n"); - dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_size, - dev->fw_virt_addr, - dev->dma_base[BANK1_CTX]); - dev->fw_virt_addr = NULL; + dma_free_coherent(dev->mem_dev[BANK1_CTX], fw_buf->size, + fw_buf->virt, fw_buf->dma); + fw_buf->virt = NULL; return -ENOMEM; } @@ -101,17 +101,17 @@ int s5p_mfc_load_firmware(struct s5p_mfc_dev *dev) mfc_err("Firmware is not present in the /lib/firmware directory nor compiled in kernel\n"); return -EINVAL; } - if (fw_blob->size > dev->fw_size) { + if (fw_blob->size > dev->fw_buf.size) { mfc_err("MFC firmware is too big to be loaded\n"); release_firmware(fw_blob); return -ENOMEM; } - if (!dev->fw_virt_addr) { + if (!dev->fw_buf.virt) { mfc_err("MFC firmware is not allocated\n"); release_firmware(fw_blob); return -EINVAL; } - memcpy(dev->fw_virt_addr, fw_blob->data, fw_blob->size); + memcpy(dev->fw_buf.virt, fw_blob->data, fw_blob->size); wmb(); release_firmware(fw_blob); mfc_debug_leave(); @@ -123,11 +123,11 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) { /* Before calling this function one has to make sure * that MFC is no longer processing */ - if (!dev->fw_virt_addr) + if (!dev->fw_buf.virt) return -EINVAL; - dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_size, - dev->fw_virt_addr, dev->dma_base[BANK1_CTX]); - dev->fw_virt_addr = NULL; + dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_buf.size, + dev->fw_buf.virt, dev->fw_buf.dma); + dev->fw_buf.virt = NULL; return 0; } @@ -246,7 +246,7 @@ int s5p_mfc_init_hw(struct s5p_mfc_dev *dev) int ret; mfc_debug_enter(); - if (!dev->fw_virt_addr) { + if (!dev->fw_buf.virt) { mfc_err("Firmware memory is not allocated.\n"); return -EINVAL; } From patchwork Tue Feb 14 07:52:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93932 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447398qgi; Mon, 13 Feb 2017 23:52:53 -0800 (PST) X-Received: by 10.99.5.15 with SMTP id 15mr30835134pgf.109.1487058773518; Mon, 13 Feb 2017 23:52:53 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.53; Mon, 13 Feb 2017 23:52:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752223AbdBNHwv (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:51 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:39708 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752127AbdBNHwV (ORCPT ); Tue, 14 Feb 2017 02:52:21 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC004KXTV72J20@mailout4.w1.samsung.com>; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075218eucas1p133abf327c32ff52647316c9c028da802~jGAtVYOSA2459524595eucas1p1o; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id E4.51.16908.537B2A85; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075218eucas1p2918abf0dc5cb970183f5a18561050720~jGAssdLTV1338813388eucas1p2b; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-02-58a2b73579ed Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E2.00.10233.537B2A85; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:17 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 08/15] media: s5p-mfc: Move firmware allocation to DMA configure function Date: Tue, 14 Feb 2017 08:52:01 +0100 Message-id: <1487058728-16501-9-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djPc7qm2xdFGEztE7e4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzFZZOS mpNZllqkb5fAlfFhzRzGghMmFU8u3mdpYPyv3cXIySEhYCKxvLGRFcIWk7hwbz1bFyMXh5DA MkaJJzv3MUE4nxkllt1dxgjTcXdDPytc1fb7bWAJIYEGJomGDzwgNpuAoUTX2y42EFtEwEli 4ay/7CANzALfGSW+7T4Ntk9YIFpi1t8f7CA2i4CqxMuHM8AG8Qp4SEx9uooZYpucxMljk8Hq OQU8JTZ9nsIIMkhC4DmbxKW1m4A2cAA5shKbDkDVu0g8O3oXyhaWeHV8CzuELSNxeXI3C4Td zyjR1Ar1/wxGiXNveSFsa4nDxy+C7WIW4JOYtG06M8R4XomONiGIEg+Jb29+s0HYjhKPn/2G BtccRoln2w8zTWCUWcDIsIpRJLW0ODc9tdhQrzgxt7g0L10vOT93EyMwbk//O/5+B+PT5pBD jAIcjEo8vBMOLIwQYk0sK67MPcQowcGsJMLL0LsoQog3JbGyKrUoP76oNCe1+BCjNAeLkjjv 3gVXwoUE0hNLUrNTUwtSi2CyTBycUg2MizaIX6xZVnTjHAML296TM78lTJmRsXVWgI++nejk 5HdPDpRvsW4yLsxfx2V40/nV1ETXHTH/05e471N9E1HDr50lLW0fJDTr8wWl/W0KfOmsd87p Lfec/PIT048wPdFTs1nqTXZ9lmu7PL/My+ZY4iGjy3Ny/Rrq6iVUF83gdphw61eegweXEktx RqKhFnNRcSIAR0/IONcCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xK7qm2xdFGBxs17C4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzlZpOR mpiSWqSQmpecn5KZl26rFBripmuhpJCXmJtqqxSh6xsSpKRQlphTCuQZGaABB+cA92AlfbsE t4wPa+YwFpwwqXhy8T5LA+N/7S5GTg4JAROJuxv6WSFsMYkL99azdTFycQgJLGGUOPvlMjuE 08QkcXfuPRaQKjYBQ4mut11sILaIgJPEwll/2UFsZoHvjBLLbqaB2MIC0RKz/v4Ai7MIqEq8 fDiDEcTmFfCQmPp0FTPENjmJk8cmg23mFPCU2PR5CliNEFDN2TU72Ccw8i5gZFjFKJJaWpyb nltspFecmFtcmpeul5yfu4kRGMLbjv3csoOx613wIUYBDkYlHl6LfQsjhFgTy4orcw8xSnAw K4nwMvQuihDiTUmsrEotyo8vKs1JLT7EaAp01ERmKdHkfGB85ZXEG5oYmlsaGhlbWJgbGSmJ 8079cCVcSCA9sSQ1OzW1ILUIpo+Jg1OqgZHZ+JNIjkDUsS3zT+UVtyctWpXL/aqgr1uumafF 5NmWtzldIdLFdVX37Ut0Qjp9K6afVvSoibTeVhins0L6tvcsr/1Hpu/MlfNfc9dQdy6DsmjZ xrlbQ+b+Dgq0CNtWcTjIfVN98nSm8MCPQQ/cyttE1fm77m46zHxN06rbLSpOndWC91mXEktx RqKhFnNRcSIAbFnEOXcCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075218eucas1p2918abf0dc5cb970183f5a18561050720 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075218eucas1p2918abf0dc5cb970183f5a18561050720 X-RootMTR: 20170214075218eucas1p2918abf0dc5cb970183f5a18561050720 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org To complete DMA memory configuration for MFC device, allocation of the firmware buffer is needed, because some parameters are dependant on its base address. Till now, this has been handled in the s5p_mfc_alloc_firmware() function. This patch moves that logic to s5p_mfc_configure_dma_memory() to keep DMA memory related operations in a single place. This way s5p_mfc_alloc_firmware() is simplified and does what it name says. The other consequence of this change is moving s5p_mfc_alloc_firmware() call from the s5p_mfc_probe() function to the s5p_mfc_configure_dma_memory(). Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 58 +++++++++++++++++++++------ drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 31 -------------- 2 files changed, 45 insertions(+), 44 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index bc1aeb25ebeb..92a88c20b26d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1110,6 +1110,10 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) { struct device *dev = &mfc_dev->plat_dev->dev; + void *bank2_virt; + dma_addr_t bank2_dma_addr; + unsigned long align_size = 1 << MFC_BASE_ALIGN_ORDER; + struct s5p_mfc_priv_buf *fw_buf = &mfc_dev->fw_buf; /* * When IOMMU is available, we cannot use the default configuration, @@ -1122,14 +1126,21 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) if (exynos_is_iommu_available(dev)) { int ret = exynos_configure_iommu(dev, S5P_MFC_IOMMU_DMA_BASE, S5P_MFC_IOMMU_DMA_SIZE); - if (ret == 0) { - mfc_dev->mem_dev[BANK1_CTX] = - mfc_dev->mem_dev[BANK2_CTX] = dev; - vb2_dma_contig_set_max_seg_size(dev, - DMA_BIT_MASK(32)); + if (ret) + return ret; + + mfc_dev->mem_dev[BANK1_CTX] = mfc_dev->mem_dev[BANK2_CTX] = dev; + ret = s5p_mfc_alloc_firmware(mfc_dev); + if (ret) { + exynos_unconfigure_iommu(dev); + return ret; } - return ret; + mfc_dev->dma_base[BANK1_CTX] = mfc_dev->fw_buf.dma; + mfc_dev->dma_base[BANK2_CTX] = mfc_dev->fw_buf.dma; + vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); + + return 0; } /* @@ -1147,6 +1158,32 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) return -ENODEV; } + /* Allocate memory for firmware and initialize both banks addresses */ + ret = s5p_mfc_alloc_firmware(mfc_dev); + if (ret) + return ret; + + mfc_dev->dma_base[BANK1_CTX] = mfc_dev->fw_buf.dma; + + bank2_virt = dma_alloc_coherent(mfc_dev->mem_dev[BANK2_CTX], align_size, + &bank2_dma_addr, GFP_KERNEL); + if (!bank2_virt) { + mfc_err("Allocating bank2 base failed\n"); + s5p_mfc_release_firmware(mfc_dev); + device_unregister(mfc_dev->mem_dev[BANK2_CTX]); + device_unregister(mfc_dev->mem_dev[BANK1_CTX]); + return -ENOMEM; + } + + /* Valid buffers passed to MFC encoder with LAST_FRAME command + * should not have address of bank2 - MFC will treat it as a null frame. + * To avoid such situation we set bank2 address below the pool address. + */ + mfc_dev->dma_base[BANK2_CTX] = bank2_dma_addr - align_size; + + dma_free_coherent(mfc_dev->mem_dev[BANK2_CTX], align_size, bank2_virt, + bank2_dma_addr); + vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK1_CTX], DMA_BIT_MASK(32)); vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK2_CTX], @@ -1159,6 +1196,8 @@ static void s5p_mfc_unconfigure_dma_memory(struct s5p_mfc_dev *mfc_dev) { struct device *dev = &mfc_dev->plat_dev->dev; + s5p_mfc_release_firmware(mfc_dev); + if (exynos_is_iommu_available(dev)) { exynos_unconfigure_iommu(dev); vb2_dma_contig_clear_max_seg_size(dev); @@ -1235,10 +1274,6 @@ static int s5p_mfc_probe(struct platform_device *pdev) dev->watchdog_timer.data = (unsigned long)dev; dev->watchdog_timer.function = s5p_mfc_watchdog; - ret = s5p_mfc_alloc_firmware(dev); - if (ret) - goto err_res; - ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) goto err_v4l2_dev_reg; @@ -1313,8 +1348,6 @@ static int s5p_mfc_probe(struct platform_device *pdev) err_dec_alloc: v4l2_device_unregister(&dev->v4l2_dev); err_v4l2_dev_reg: - s5p_mfc_release_firmware(dev); -err_res: s5p_mfc_final_pm(dev); err_dma: s5p_mfc_unconfigure_dma_memory(dev); @@ -1356,7 +1389,6 @@ static int s5p_mfc_remove(struct platform_device *pdev) video_device_release(dev->vfd_enc); video_device_release(dev->vfd_dec); v4l2_device_unregister(&dev->v4l2_dev); - s5p_mfc_release_firmware(dev); s5p_mfc_unconfigure_dma_memory(dev); s5p_mfc_final_pm(dev); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index 50d698968049..b0cf3970117a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -26,9 +26,6 @@ /* Allocate memory for firmware */ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) { - void *bank2_virt; - dma_addr_t bank2_dma_addr; - unsigned int align_size = 1 << MFC_BASE_ALIGN_ORDER; struct s5p_mfc_priv_buf *fw_buf = &dev->fw_buf; fw_buf->size = dev->variant->buf_size->fw; @@ -44,35 +41,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) mfc_err("Allocating bitprocessor buffer failed\n"); return -ENOMEM; } - dev->dma_base[BANK1_CTX] = fw_buf->dma; - - if (HAS_PORTNUM(dev) && IS_TWOPORT(dev)) { - bank2_virt = dma_alloc_coherent(dev->mem_dev[BANK2_CTX], - align_size, &bank2_dma_addr, GFP_KERNEL); - - if (!bank2_virt) { - mfc_err("Allocating bank2 base failed\n"); - dma_free_coherent(dev->mem_dev[BANK1_CTX], fw_buf->size, - fw_buf->virt, fw_buf->dma); - fw_buf->virt = NULL; - return -ENOMEM; - } - - /* Valid buffers passed to MFC encoder with LAST_FRAME command - * should not have address of bank2 - MFC will treat it as a null frame. - * To avoid such situation we set bank2 address below the pool address. - */ - dev->dma_base[BANK2_CTX] = bank2_dma_addr - align_size; - dma_free_coherent(dev->mem_dev[BANK2_CTX], align_size, - bank2_virt, bank2_dma_addr); - - } else { - /* In this case bank2 can point to the same address as bank1. - * Firmware will always occupy the beginning of this area so it is - * impossible having a video frame buffer with zero address. */ - dev->dma_base[BANK2_CTX] = dev->dma_base[BANK1_CTX]; - } return 0; } From patchwork Tue Feb 14 07:52:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93923 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447279qgi; Mon, 13 Feb 2017 23:52:29 -0800 (PST) X-Received: by 10.98.93.152 with SMTP id n24mr30421149pfj.107.1487058749603; Mon, 13 Feb 2017 23:52:29 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.29; Mon, 13 Feb 2017 23:52:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750930AbdBNHw1 (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:27 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:39761 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbdBNHwX (ORCPT ); Tue, 14 Feb 2017 02:52:23 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC002MPTV7KW20@mailout3.w1.samsung.com>; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075219eucas1p234b5f62e6c91c5c9256186508032bc98~jGAtn9Iwa1548415484eucas1p2E; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 1D.15.30614.237B2A85; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075218eucas1p188d8d26aa2a6c9157587e1c979008817~jGAs82BGq2457524575eucas1p1e; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) X-AuditID: cbfec7f1-f793f6d000007796-8f-58a2b732968a Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2F.5E.06687.187B2A85; Tue, 14 Feb 2017 07:53:37 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 09/15] media: s5p-mfc: Allocate firmware with internal private buffer alloc function Date: Tue, 14 Feb 2017 08:52:02 +0100 Message-id: <1487058728-16501-10-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7djP87pG2xdFGDxot7a4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzFZZOS mpNZllqkb5fAlTF1w1O2gj28FZfWqjQwLuDuYuTkkBAwkdi5eAIzhC0mceHeerYuRi4OIYGl jBInjnczQTifGSWWzv3MDNMx48NyqKpljBKLNz5ih3AamCSaN7xjB6liEzCU6HrbxQZiiwg4 SSyc9ResiFngO6PEt92nWUESwgJpEp+2vWcBsVkEVCU29G0DW8Er4Clx6ONEVoh1chInj00G szmB4ps+T2EEGSQh8JhNYu/xA0AHcgA5shKbDkCd5yLRcWAmI4QtLPHq+BZ2CFtGorPjIBOE 3c8o0dSqDWHPYJQ495YXwraWOHz8ItguZgE+iUnbpjNDjOeV6GgTgijxkJj/YxYbhO0ocf35 PLByIYE5jBJ3NlVOYJRZwMiwilEktbQ4Nz212EivODG3uDQvXS85P3cTIzBqT/87/nEH4/sT VocYBTgYlXh4LfYtjBBiTSwrrsw9xCjBwawkwsvQuyhCiDclsbIqtSg/vqg0J7X4EKM0B4uS OO+eBVfChQTSE0tSs1NTC1KLYLJMHJxSDYwKeQWTuXIrJk8S9C+WuhDnXsMYm5Eu2LjImeHR jq0iZy4LFqX3be++qifLWPzxjJDn584KnY/zm4vz5/3kZ/iw8a1w5h3zK3uMFbalCHb5acx5 Oct0ZyjXbJN594TfXnhhyLR/hU2euU+PqU/gvEqTk65Ri1WW5k6czHd4tqtr8xWN3i1Mu5RY ijMSDbWYi4oTAXXFFLfWAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRmVeSWpSXmKPExsVy+t/xK7qN2xdFGOz9JG9xa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhlTNzxlK9jDW3FprUoD4wLuLkZODgkBE4kZH5azQdhiEhfurQeyuTiEBJYwStzrPcMO4TQx SdxY9Y4VpIpNwFCi620XWIeIgJPEwll/2UFsZoHvjBLLbqaB2MICaRJvZzwGi7MIqEps6NvG DGLzCnhKHPo4kRVim5zEyWOTwWxOoPimz1MYQWwhAQ+Js2t2sE9g5F3AyLCKUSS1tDg3PbfY UK84Mbe4NC9dLzk/dxMjMIC3Hfu5eQfjpY3BhxgFOBiVeHgnHFgYIcSaWFZcmXuIUYKDWUmE l6F3UYQQb0piZVVqUX58UWlOavEhRlOgoyYyS4km5wOjK68k3tDE0NzS0MjYwsLcyEhJnLfk w5VwIYH0xJLU7NTUgtQimD4mDk6pBsaW5nNS6myK7/Srbyxhm168WPKzhvqzjmQjNpHLW2dL 1vbfW7bceFHF+h+lu39kPLpjViVmrbYivYTdsHD6m1vvAriuhpQ0uc72kwq8xNnoo8W+e6YO 06JXq3SemLyevD2mwWH1PtbMUq/tVjb1rKIOeVqhe/tUO7ynJp42Yc4SNRHrOn2sVYmlOCPR UIu5qDgRAJT1aVt2AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075218eucas1p188d8d26aa2a6c9157587e1c979008817 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075218eucas1p188d8d26aa2a6c9157587e1c979008817 X-RootMTR: 20170214075218eucas1p188d8d26aa2a6c9157587e1c979008817 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Once firmware buffer has been converted to use s5p_mfc_priv_buf structure, it is possible to allocate it with existing s5p_mfc_alloc_priv_buf() function. This change will help to reduce code variants in the next patches. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index b0cf3970117a..a1811ee538bd 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -27,6 +27,7 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) { struct s5p_mfc_priv_buf *fw_buf = &dev->fw_buf; + int err; fw_buf->size = dev->variant->buf_size->fw; @@ -35,11 +36,10 @@ int s5p_mfc_alloc_firmware(struct s5p_mfc_dev *dev) return -ENOMEM; } - fw_buf->virt = dma_alloc_coherent(dev->mem_dev[BANK1_CTX], fw_buf->size, - &fw_buf->dma, GFP_KERNEL); - if (!fw_buf->virt) { + err = s5p_mfc_alloc_priv_buf(dev, BANK1_CTX, &dev->fw_buf); + if (err) { mfc_err("Allocating bitprocessor buffer failed\n"); - return -ENOMEM; + return err; } return 0; @@ -92,11 +92,7 @@ int s5p_mfc_release_firmware(struct s5p_mfc_dev *dev) { /* Before calling this function one has to make sure * that MFC is no longer processing */ - if (!dev->fw_buf.virt) - return -EINVAL; - dma_free_coherent(dev->mem_dev[BANK1_CTX], dev->fw_buf.size, - dev->fw_buf.virt, dev->fw_buf.dma); - dev->fw_buf.virt = NULL; + s5p_mfc_release_priv_buf(dev, &dev->fw_buf); return 0; } From patchwork Tue Feb 14 07:52:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93928 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447343qgi; Mon, 13 Feb 2017 23:52:42 -0800 (PST) X-Received: by 10.98.102.21 with SMTP id a21mr30224671pfc.29.1487058762596; Mon, 13 Feb 2017 23:52:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.42; Mon, 13 Feb 2017 23:52:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751635AbdBNHwk (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:40 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:39708 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752302AbdBNHwX (ORCPT ); Tue, 14 Feb 2017 02:52:23 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC004J0TV8JX20@mailout4.w1.samsung.com>; Tue, 14 Feb 2017 07:52:20 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075219eucas1p12016176ecacdc267a19bbbf9584ea784~jGAuEkOMg2457024570eucas1p1h; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges5.samsung.com (EUCPMTA) with SMTP id 21.70.17477.337B2A85; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075218eucas1p157d3da30dab72acd2bea1ea99795a274~jGAtZHoyp2459424594eucas1p1r; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) X-AuditID: cbfec7f5-f79d06d000004445-7b-58a2b733cb71 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 10.6E.06687.187B2A85; Tue, 14 Feb 2017 07:53:37 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:18 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 10/15] media: s5p-mfc: Reduce firmware buffer size for MFC v6+ variants Date: Tue, 14 Feb 2017 08:52:03 +0100 Message-id: <1487058728-16501-11-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsWy7djPc7rG2xdFGBxcLG1xa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK2PK8ussBQ2CFe/vPWZvYNzG18XIySEhYCIx99w7ZghbTOLCvfVsILaQwFJG iTu9hhD2Z0aJw7+DYernrelj6mLkAoovY5TYvmcPI4TTwCTRvOEdO0gVm4ChRNfbLrBJIgJO Egtn/WUHKWIW+M4o8W33aVaQhLBApETfzP9MIDaLgKrEi0O7wOK8Ap4SvRtXMUKsk5M4eWwy WJwTKL7p8xSwbRICr9kk5rf/ALqbA8iRldh0AOoFF4ntcyZB2cISr45vYYewZSQ6Ow4yQdj9 jBJNrdoQ9gxGiXNveSFsa4nDxy+C7WIW4JOYtG061HheiY42IYgSD4lr85+zQtiOEh+vbGKF eH4Oo8SSXWdZJjDKLGBkWMUoklpanJueWmyqV5yYW1yal66XnJ+7iREYtaf/Hf+6g3HpMatD jAIcjEo8vBMOLIwQYk0sK67MPcQowcGsJMLL0LsoQog3JbGyKrUoP76oNCe1+BCjNAeLkjjv ngVXwoUE0hNLUrNTUwtSi2CyTBycUg2My68HMq7e/Io5ZtJRh69TDqttvXPwod2dKTFKLdFb DQ74/GSSOmpwhqf6QLjzt9DXAiYH+mof7Z2b77314oV7bU9d7skdmLfzho6m6IJrqekT/r4R j12TOrlabDKDw+V93Ka6jKHlazM3NraKCTjEy7x4abCS11f3yw3byA0b7p59mtJyctsGWSWW 4oxEQy3mouJEALIDK4XWAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsVy+t/xK7qN2xdFGDw4a2Nxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhlTll9nKWgQrHh/7zF7A+M2vi5GTg4JAROJeWv6mCBsMYkL99azdTFycQgJLGGUeLZtIwuE 08QkcWPVO1aQKjYBQ4mut11sILaIgJPEwll/2UFsZoHvjBLLbqaB2MICkRKTTi5nAbFZBFQl XhzaBdbLK+Ap0btxFSPENjmJk8cmg8U5geKbPk8BiwsJeEicXbODfQIj7wJGhlWMIqmlxbnp ucWGesWJucWleel6yfm5mxiBIbzt2M/NOxgvbQw+xCjAwajEwzvhwMIIIdbEsuLK3EOMEhzM SiK8DL2LIoR4UxIrq1KL8uOLSnNSiw8xmgIdNZFZSjQ5HxhfeSXxhiaG5paGRsYWFuZGRkri vCUfroQLCaQnlqRmp6YWpBbB9DFxcEo1MJq/Zd1kcD7qqmiGY+nH9EXZCyQSczxmHr4f8TB4 f8XSm3k5K1w3Som4RXgE/Aw4NO+G8ZtYIV9/n1O3Von+/5wcZsK56oLDEZbdHeWeDtUXgy5E iEzw3sHvfTQlbcbtf8lmZQecDx3WEeCaeF7xzOTFfwtsspZeeLj966Jp9qZPJ6yfarb1kK8S S3FGoqEWc1FxIgAbjHySdwIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075218eucas1p157d3da30dab72acd2bea1ea99795a274 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075218eucas1p157d3da30dab72acd2bea1ea99795a274 X-RootMTR: 20170214075218eucas1p157d3da30dab72acd2bea1ea99795a274 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Firmware for MFC v6+ variants is not larger than 400 KiB, so there is no need to allocate a full 1 MiB buffer for it. Reduce it to 512 KiB to keep proper alignment of allocated buffer. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/regs-mfc-v6.h | 2 +- drivers/media/platform/s5p-mfc/regs-mfc-v7.h | 2 +- drivers/media/platform/s5p-mfc/regs-mfc-v8.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h index d2cd35916dc5..c0166ee9a455 100644 --- a/drivers/media/platform/s5p-mfc/regs-mfc-v6.h +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v6.h @@ -403,7 +403,7 @@ #define MFC_OTHER_ENC_CTX_BUF_SIZE_V6 (12 * SZ_1K) /* 12KB */ /* MFCv6 variant defines */ -#define MAX_FW_SIZE_V6 (SZ_1M) /* 1MB */ +#define MAX_FW_SIZE_V6 (SZ_512K) /* 512KB */ #define MAX_CPB_SIZE_V6 (3 * SZ_1M) /* 3MB */ #define MFC_VERSION_V6 0x61 #define MFC_NUM_PORTS_V6 1 diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h index 1a5c6fdf7846..9f220769d970 100644 --- a/drivers/media/platform/s5p-mfc/regs-mfc-v7.h +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v7.h @@ -34,7 +34,7 @@ #define S5P_FIMV_E_VP8_NUM_T_LAYER_V7 0xfdc4 /* MFCv7 variant defines */ -#define MAX_FW_SIZE_V7 (SZ_1M) /* 1MB */ +#define MAX_FW_SIZE_V7 (SZ_512K) /* 512KB */ #define MAX_CPB_SIZE_V7 (3 * SZ_1M) /* 3MB */ #define MFC_VERSION_V7 0x72 #define MFC_NUM_PORTS_V7 1 diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v8.h b/drivers/media/platform/s5p-mfc/regs-mfc-v8.h index 4d1c3750eb5e..75f5f7511d72 100644 --- a/drivers/media/platform/s5p-mfc/regs-mfc-v8.h +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v8.h @@ -116,7 +116,7 @@ #define S5P_FIMV_D_ALIGN_PLANE_SIZE_V8 64 /* MFCv8 variant defines */ -#define MAX_FW_SIZE_V8 (SZ_1M) /* 1MB */ +#define MAX_FW_SIZE_V8 (SZ_512K) /* 512KB */ #define MAX_CPB_SIZE_V8 (3 * SZ_1M) /* 3MB */ #define MFC_VERSION_V8 0x80 #define MFC_NUM_PORTS_V8 1 From patchwork Tue Feb 14 07:52:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93927 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447337qgi; Mon, 13 Feb 2017 23:52:41 -0800 (PST) X-Received: by 10.99.234.83 with SMTP id l19mr31595987pgk.114.1487058761182; Mon, 13 Feb 2017 23:52:41 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.40; Mon, 13 Feb 2017 23:52:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752612AbdBNHwj (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:39 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:39062 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752585AbdBNHwZ (ORCPT ); Tue, 14 Feb 2017 02:52:25 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC003ILTV9O120@mailout2.w1.samsung.com>; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075220eucas1p1aaee34493f4221eea6eadb04db450553~jGAvH_ZGa2142821428eucas1p1I; Tue, 14 Feb 2017 07:52:20 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1.samsung.com (EUCPMTA) with SMTP id C5.51.16908.737B2A85; Tue, 14 Feb 2017 07:52:23 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170214075220eucas1p21d7f82fa19a9f058bb6fbe0a994478cc~jGAugTXZL1704117041eucas1p2T; Tue, 14 Feb 2017 07:52:20 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-07-58a2b737808a Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D4.00.10233.737B2A85; Tue, 14 Feb 2017 07:52:23 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:19 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 12/15] media: s5p-mfc: Add support for probe-time preallocated block based allocator Date: Tue, 14 Feb 2017 08:52:05 +0100 Message-id: <1487058728-16501-13-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djP87rm2xdFGOxaJ2Rxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK2PpqnPsBbdsK87eqW5gXGncxcjJISFgIvH61QlGCFtM4sK99WxdjFwcQgLL GCVetf9hgnA+M0pMfNDFCtPRv2EHC1zVzGfT2CGcBiaJxwuvsoBUsQkYSnS97WIDsUUEnCQW zvoLVsQs8J1R4tvu02CjhAXSJPZ92MAOYrMIqEpcaTzCBGLzCnhKLD5zCWqdnMTJY5PBbE6g +KbPUxhBBkkIPGeTWHFgH9AGDiBHVmLTAWaIeheJN1d+MUHYwhKvjm9hh7BlJC5P7maBsPsZ JZpatSHsGYwS597yQtjWEoePXwTbxSzAJzFp23RmiPG8Eh1tQhAlHhInNn6FhpejxOyJt6BB NIdR4uz3j+wTGGUWMDKsYhRJLS3OTU8tNtQrTswtLs1L10vOz93ECIzb0/+Ov9/B+LQ55BCj AAejEg/vhAMLI4RYE8uKK3MPMUpwMCuJ8DL0LooQ4k1JrKxKLcqPLyrNSS0+xCjNwaIkzrt3 wZVwIYH0xJLU7NTUgtQimCwTB6dUA6NA5T6lSaGH1io1fT15562u4R2FlI1dz5/xL/9dUORv XX4yRu/1V4lrr/aGmc4Sq41NTHTbf6qF9e3ba32r2ir2flcrW71NPo9fbuF3p1dcj5YzP/nl 1Lvmi8YSx+bQyRJFL5ae3VVhEMl6MDLAVPLYy7Bv/2+EhGYnrbyy/T1X2Bvuf5OW22YqsRRn JBpqMRcVJwIA7yXfu9cCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRmVeSWpSXmKPExsVy+t/xK7rm2xdFGKzaomJxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhlLV51jL7hlW3H2TnUD40rjLkZODgkBE4n+DTtYIGwxiQv31rN1MXJxCAksYZTY3TCLEcJp YpLYd283M0gVm4ChRNfbLjYQW0TASWLhrL/sIDazwHdGiWU300BsYYE0ifP9r8DiLAKqElca jzCB2LwCnhKLz1xihdgmJ3Hy2GQwmxMovunzFEYQW0jAQ+Lsmh3sExh5FzAyrGIUSS0tzk3P LTbSK07MLS7NS9dLzs/dxAgM4G3Hfm7Zwdj1LvgQowAHoxIPr8W+hRFCrIllxZW5hxglOJiV RHgZehdFCPGmJFZWpRblxxeV5qQWH2I0BTpqIrOUaHI+MLrySuINTQzNLQ2NjC0szI2MlMR5 p364Ei4kkJ5YkpqdmlqQWgTTx8TBKdXAGF+nXx2meHVjR9+SmnsT5b/sOW3fknb14bOZuj3F ZVdm+xnPlbD2fGUyuXRW7ZcFHsl3dBdu8k+Zff66rVjqbYuiixO/TTeTXWpygDNoDrv+s6/l HX4LvnvaMmkrrVgs0BFqoqDGbzGZlffeB62NJR+ye5n75q39w6R5eg/H3xl28RYnut/YK7EU ZyQaajEXFScCAJwLSCd2AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075220eucas1p21d7f82fa19a9f058bb6fbe0a994478cc X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075220eucas1p21d7f82fa19a9f058bb6fbe0a994478cc X-RootMTR: 20170214075220eucas1p21d7f82fa19a9f058bb6fbe0a994478cc References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Current MFC driver depends on the fact that when IOMMU is available, the DMA-mapping framework and its IOMMU glue will use first-fit allocator. This was true for ARM architecture, but its not for ARM64 arch. However, in case of MFC v6+ hardware and latest firmware, it turned out that there is no strict requirement for ALL buffers to be allocated on higher addresses than the firmware base. This requirement is true only for the device and per-context buffers. All video data buffers can be allocated anywhere for all MFC v6+ versions. Such relaxed requirements for the memory buffers can be easily fulfilled by allocating firmware, device and per-context buffers from the probe-time preallocated larger buffer. This patch adds support for it. This way the driver finally works fine on ARM64 architecture. The size of the preallocated buffer is 8 MiB, what is enough for three instances H264 decoders or encoders (other codecs have smaller memory requirements). If one needs more for particular use case, one can use "mem" module parameter to force larger (or smaller) buffer (for example by adding "s5p_mfc.mem=16M" to kernel command line). Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 43 ++++++++++++++++--- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 4 ++ drivers/media/platform/s5p-mfc/s5p_mfc_opr.c | 57 ++++++++++++++++--------- 3 files changed, 79 insertions(+), 25 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index a18740c81c55..7492e81fde6d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -43,6 +43,10 @@ module_param_named(debug, mfc_debug_level, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug level - higher value produces more verbose messages"); +static char *mfc_mem_size = NULL; +module_param_named(mem, mfc_mem_size, charp, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(mem, "Preallocated memory size for the firmware and context buffers"); + /* Helper functions for interrupt processing */ /* Remove from hw execution round robin */ @@ -1174,6 +1178,8 @@ static void s5p_mfc_unconfigure_2port_memory(struct s5p_mfc_dev *mfc_dev) static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) { struct device *dev = &mfc_dev->plat_dev->dev; + unsigned long mem_size = SZ_8M; + unsigned int bitmap_size; /* * When IOMMU is available, we cannot use the default configuration, * because of MFC firmware requirements: address space limited to @@ -1187,17 +1193,39 @@ static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) if (ret) return ret; - mfc_dev->mem_dev[BANK1_CTX] = mfc_dev->mem_dev[BANK2_CTX] = dev; - ret = s5p_mfc_alloc_firmware(mfc_dev); - if (ret) { + if (mfc_mem_size) + mem_size = memparse(mfc_mem_size, NULL); + + bitmap_size = BITS_TO_LONGS(mem_size >> PAGE_SHIFT) * sizeof(long); + + mfc_dev->mem_bitmap = kzalloc(bitmap_size, GFP_KERNEL); + if (!mfc_dev->mem_bitmap) { exynos_unconfigure_iommu(dev); - return ret; + return -ENOMEM; } - mfc_dev->dma_base[BANK1_CTX] = mfc_dev->fw_buf.dma; - mfc_dev->dma_base[BANK2_CTX] = mfc_dev->fw_buf.dma; + mfc_dev->mem_virt = dma_alloc_coherent(dev, mem_size, + &mfc_dev->mem_base, GFP_KERNEL); + if (!mfc_dev->mem_virt) { + kfree(mfc_dev->mem_bitmap); + dev_err(dev, "failed to preallocate %ld MiB for the firmware and context buffers\n", + (mem_size / SZ_1M)); + exynos_unconfigure_iommu(dev); + return -ENOMEM; + } + mfc_dev->mem_size = mem_size; + mfc_dev->dma_base[BANK1_CTX] = mfc_dev->mem_base; + mfc_dev->dma_base[BANK2_CTX] = mfc_dev->mem_base; + + /* Firmware allocation cannot fail in this case */ + s5p_mfc_alloc_firmware(mfc_dev); + + mfc_dev->mem_dev[BANK1_CTX] = mfc_dev->mem_dev[BANK2_CTX] = dev; vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); + dev_info(dev, "preallocated %ld MiB buffer for the firmware and context buffers\n", + (mem_size / SZ_1M)); + return 0; } @@ -1206,6 +1234,9 @@ static void s5p_mfc_unconfigure_common_memory(struct s5p_mfc_dev *mfc_dev) struct device *dev = &mfc_dev->plat_dev->dev; exynos_unconfigure_iommu(dev); + dma_free_coherent(dev, mfc_dev->mem_size, mfc_dev->mem_virt, + mfc_dev->mem_base); + kfree(mfc_dev->mem_bitmap); vb2_dma_contig_clear_max_seg_size(dev); } diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index cea17a737ef7..e64dc6e3c75e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -315,6 +315,10 @@ struct s5p_mfc_dev { unsigned int int_err; wait_queue_head_t queue; struct s5p_mfc_priv_buf fw_buf; + size_t mem_size; + dma_addr_t mem_base; + unsigned long *mem_bitmap; + void *mem_virt; dma_addr_t dma_base[BANK_CTX_NUM]; unsigned long hw_lock; struct s5p_mfc_ctx *ctx[MFC_NUM_CONTEXTS]; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.c index 9294ee124661..34a66189d980 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.c @@ -40,41 +40,60 @@ void s5p_mfc_init_regs(struct s5p_mfc_dev *dev) int s5p_mfc_alloc_priv_buf(struct s5p_mfc_dev *dev, unsigned int mem_ctx, struct s5p_mfc_priv_buf *b) { - struct device *mem_dev = dev->mem_dev[mem_ctx]; - dma_addr_t base = dev->dma_base[mem_ctx]; + unsigned int bits = dev->mem_size >> PAGE_SHIFT; + unsigned int count = b->size >> PAGE_SHIFT; + unsigned int align = (SZ_64K >> PAGE_SHIFT) - 1; + unsigned int start, offset; mfc_debug(3, "Allocating priv: %zu\n", b->size); - b->ctx = mem_ctx; - b->virt = dma_alloc_coherent(mem_dev, b->size, &b->dma, GFP_KERNEL); + if (dev->mem_virt) { + start = bitmap_find_next_zero_area(dev->mem_bitmap, bits, 0, count, align); + if (start > bits) + goto no_mem; - if (!b->virt) { - mfc_err("Allocating private buffer of size %zu failed\n", - b->size); - return -ENOMEM; - } + bitmap_set(dev->mem_bitmap, start, count); + offset = start << PAGE_SHIFT; + b->virt = dev->mem_virt + offset; + b->dma = dev->mem_base + offset; + } else { + struct device *mem_dev = dev->mem_dev[mem_ctx]; + dma_addr_t base = dev->dma_base[mem_ctx]; - if (b->dma < base) { - mfc_err("Invalid memory configuration - buffer (%pad) is below base memory address(%pad)\n", - &b->dma, &base); - dma_free_coherent(mem_dev, b->size, b->virt, b->dma); - return -ENOMEM; + b->ctx = mem_ctx; + b->virt = dma_alloc_coherent(mem_dev, b->size, &b->dma, GFP_KERNEL); + if (!b->virt) + goto no_mem; + if (b->dma < base) { + mfc_err("Invalid memory configuration - buffer (%pad) is below base memory address(%pad)\n", + &b->dma, &base); + dma_free_coherent(mem_dev, b->size, b->virt, b->dma); + return -ENOMEM; + } } mfc_debug(3, "Allocated addr %p %pad\n", b->virt, &b->dma); return 0; +no_mem: + mfc_err("Allocating private buffer of size %zu failed\n", b->size); + return -ENOMEM; } void s5p_mfc_release_priv_buf(struct s5p_mfc_dev *dev, struct s5p_mfc_priv_buf *b) { - struct device *mem_dev = dev->mem_dev[b->ctx]; + if (dev->mem_virt) { + unsigned int start = (b->dma - dev->mem_base) >> PAGE_SHIFT; + unsigned int count = b->size >> PAGE_SHIFT; + + bitmap_clear(dev->mem_bitmap, start, count); + } else { + struct device *mem_dev = dev->mem_dev[b->ctx]; - if (b->virt) { dma_free_coherent(mem_dev, b->size, b->virt, b->dma); - b->virt = NULL; - b->dma = 0; - b->size = 0; } + b->virt = NULL; + b->dma = 0; + b->size = 0; } From patchwork Tue Feb 14 07:52:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93922 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447276qgi; Mon, 13 Feb 2017 23:52:28 -0800 (PST) X-Received: by 10.98.102.21 with SMTP id a21mr30223882pfc.29.1487058748398; Mon, 13 Feb 2017 23:52:28 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.28; Mon, 13 Feb 2017 23:52:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752594AbdBNHw0 (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:26 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:39235 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752188AbdBNHwX (ORCPT ); Tue, 14 Feb 2017 02:52:23 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC003JOTV9U320@mailout1.w1.samsung.com>; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) Received: from eusmges1.samsung.com (unknown [203.254.199.239]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075221eucas1p157373b267c7f99f7cfee9c7a640621a5~jGAvV2xq32459424594eucas1p1t; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1.samsung.com (EUCPMTA) with SMTP id 66.51.16908.737B2A85; Tue, 14 Feb 2017 07:52:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075220eucas1p1451535e571c481c69aacec705a782c09~jGAuuwChf2142721427eucas1p1k; Tue, 14 Feb 2017 07:52:20 +0000 (GMT) X-AuditID: cbfec7ef-f79d26d00000420c-09-58a2b73738e0 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 51.6E.06687.387B2A85; Tue, 14 Feb 2017 07:53:39 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:20 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 13/15] media: s5p-mfc: Remove special configuration of IOMMU domain Date: Tue, 14 Feb 2017 08:52:06 +0100 Message-id: <1487058728-16501-14-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRmVeSWpSXmKPExsWy7djPc7rm2xdFGLxYqGBxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK+PE3yNsBTN0Kqb++8bcwPhUpYuRk0NCwERi0sb5jBC2mMSFe+vZuhi5OIQE ljFK7Dm5kRnC+cwo0f3yFStMx7lpa5jhqt6/WAflNDBJnN21kgWkik3AUKLrbRcbiC0i4CSx cNZfdpAiZoHvjBLfdp8GGsXBISwQKvFrcgqIySKgKvFmZxZIOa+Ap8S5k2eZIZbJSZw8Nhls MSdQfNPnKYwgYyQEnrNJPD7wkgmkV0JAVmLTAah6F4kFh7YxQdjCEq+Ob2GHsGUkOjsOQsX7 GSWaWrUh7BmMEufe8kLY1hKHj18E28UswCcxadt0ZojxvBIdbUIQJR4S05fPYIEIO0o0zq2C +HwOo0Tn52/MExhlFjAyrGIUSS0tzk1PLTbUK07MLS7NS9dLzs/dxAiM2dP/jr/fwfi0OeQQ owAHoxIP74QDCyOEWBPLiitzDzFKcDArifAy9C6KEOJNSaysSi3Kjy8qzUktPsQozcGiJM67 d8GVcCGB9MSS1OzU1ILUIpgsEwenVAOj6jR3jx3/Jx11jvz8Xv1ZvZfaM88PvUdq1gfNcnU4 ejDp+AnpA4tvqdYu8j6qOieFNUHM7tx690RJvdi39sdsJ7iUBDjPX7xPh5v71DF+tchL72pU VeecOHhjhnI19/m4+V9Kt1ww7SnR+b5ciHnZtU9+34u+L5Eut3i/YLaaTdQeMa6JZW0PlFiK MxINtZiLihMBZchixdUCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRmVeSWpSXmKPExsVy+t/xK7rN2xdFGHRukrK4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzlZpOR mpiSWqSQmpecn5KZl26rFBripmuhpJCXmJtqqxSh6xsSpKRQlphTCuQZGaABB+cA92AlfbsE t4wTf4+wFczQqZj67xtzA+NTlS5GTg4JAROJc9PWMEPYYhIX7q1n62Lk4hASWMIosX/SLHYI p4lJ4v/7i+wgVWwChhJdb7vYQGwRASeJhbP+gsWZBb4zSiy7mdbFyMEhLBAq8WtyCojJIqAq 8WZnFkgFr4CnxLmTZ6F2yUmcPDaZFcTmBIpv+jyFEcQWEvCQOLtmB/sERt4FjAyrGEVSS4tz 03OLDfWKE3OLS/PS9ZLzczcxAsN327Gfm3cwXtoYfIhRgINRiYd3woGFEUKsiWXFlbmHGCU4 mJVEeBl6F0UI8aYkVlalFuXHF5XmpBYfYjQFumkis5Rocj4wtvJK4g1NDM0tDY2MLSzMjYyU xHlLPlwJFxJITyxJzU5NLUgtgulj4uCUamBse77HuHzF+nlLxdvilbYe/OinFGOW2RQZl3PH /ZmfcdGFZyJuym/PneQ0qY4qDq8z2S13Kbei8rXktt3dXz8me3/19zh/1ri/6m+GtW3GjUA/ hryeaFbZj+EvChx/vMqdWSK8qFfhpZ0bZ+stDrldW9a3Fkx+ydE1PTnp12yRQ8UZAZHvkpVY ijMSDbWYi4oTAUN6qmV1AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075220eucas1p1451535e571c481c69aacec705a782c09 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075220eucas1p1451535e571c481c69aacec705a782c09 X-RootMTR: 20170214075220eucas1p1451535e571c481c69aacec705a782c09 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The main reason for using special configuration of IOMMU domain was the problem with MFC firmware, which failed to operate properly when placed at 0 DMA address. Instead of adding custom code for configuring each variant of IOMMU domain and architecture specific glue code, simply use what arch code provides and if the DMA base address equals zero, skip first 128 KiB to keep required alignment. This patch also make the driver operational on ARM64 architecture, because it no longer depends on ARM specific DMA-mapping and IOMMU glue code functions. Signed-off-by: Marek Szyprowski --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 30 +++++++-------- drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h | 51 +------------------------- 2 files changed, 14 insertions(+), 67 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 7492e81fde6d..8fc6fe4ba087 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1180,18 +1180,6 @@ static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) struct device *dev = &mfc_dev->plat_dev->dev; unsigned long mem_size = SZ_8M; unsigned int bitmap_size; - /* - * When IOMMU is available, we cannot use the default configuration, - * because of MFC firmware requirements: address space limited to - * 256M and non-zero default start address. - * This is still simplified, not optimal configuration, but for now - * IOMMU core doesn't allow to configure device's IOMMUs channel - * separately. - */ - int ret = exynos_configure_iommu(dev, S5P_MFC_IOMMU_DMA_BASE, - S5P_MFC_IOMMU_DMA_SIZE); - if (ret) - return ret; if (mfc_mem_size) mem_size = memparse(mfc_mem_size, NULL); @@ -1199,10 +1187,8 @@ static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) bitmap_size = BITS_TO_LONGS(mem_size >> PAGE_SHIFT) * sizeof(long); mfc_dev->mem_bitmap = kzalloc(bitmap_size, GFP_KERNEL); - if (!mfc_dev->mem_bitmap) { - exynos_unconfigure_iommu(dev); + if (!mfc_dev->mem_bitmap) return -ENOMEM; - } mfc_dev->mem_virt = dma_alloc_coherent(dev, mem_size, &mfc_dev->mem_base, GFP_KERNEL); @@ -1210,13 +1196,24 @@ static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) kfree(mfc_dev->mem_bitmap); dev_err(dev, "failed to preallocate %ld MiB for the firmware and context buffers\n", (mem_size / SZ_1M)); - exynos_unconfigure_iommu(dev); return -ENOMEM; } mfc_dev->mem_size = mem_size; mfc_dev->dma_base[BANK1_CTX] = mfc_dev->mem_base; mfc_dev->dma_base[BANK2_CTX] = mfc_dev->mem_base; + /* + * MFC hardware cannot handle 0 as a base address, so mark first 128K + * as used (to keep required base alignment) and adjust base address + */ + if (mfc_dev->mem_base == (dma_addr_t)0) { + unsigned int offset = 1 << MFC_BASE_ALIGN_ORDER; + + bitmap_set(mfc_dev->mem_bitmap, 0, offset >> PAGE_SHIFT); + mfc_dev->dma_base[BANK1_CTX] += offset; + mfc_dev->dma_base[BANK2_CTX] += offset; + } + /* Firmware allocation cannot fail in this case */ s5p_mfc_alloc_firmware(mfc_dev); @@ -1233,7 +1230,6 @@ static void s5p_mfc_unconfigure_common_memory(struct s5p_mfc_dev *mfc_dev) { struct device *dev = &mfc_dev->plat_dev->dev; - exynos_unconfigure_iommu(dev); dma_free_coherent(dev, mfc_dev->mem_size, mfc_dev->mem_virt, mfc_dev->mem_base); kfree(mfc_dev->mem_bitmap); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h b/drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h index 6962132ae8fa..76667924ee2a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h @@ -11,54 +11,13 @@ #ifndef S5P_MFC_IOMMU_H_ #define S5P_MFC_IOMMU_H_ -#define S5P_MFC_IOMMU_DMA_BASE 0x20000000lu -#define S5P_MFC_IOMMU_DMA_SIZE SZ_256M - -#if defined(CONFIG_EXYNOS_IOMMU) && defined(CONFIG_ARM_DMA_USE_IOMMU) - -#include +#if defined(CONFIG_EXYNOS_IOMMU) static inline bool exynos_is_iommu_available(struct device *dev) { return dev->archdata.iommu != NULL; } -static inline void exynos_unconfigure_iommu(struct device *dev) -{ - struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); - - arm_iommu_detach_device(dev); - arm_iommu_release_mapping(mapping); -} - -static inline int exynos_configure_iommu(struct device *dev, - unsigned int base, unsigned int size) -{ - struct dma_iommu_mapping *mapping = NULL; - int ret; - - /* Disable the default mapping created by device core */ - if (to_dma_iommu_mapping(dev)) - exynos_unconfigure_iommu(dev); - - mapping = arm_iommu_create_mapping(dev->bus, base, size); - if (IS_ERR(mapping)) { - pr_warn("Failed to create IOMMU mapping for device %s\n", - dev_name(dev)); - return PTR_ERR(mapping); - } - - ret = arm_iommu_attach_device(dev, mapping); - if (ret) { - pr_warn("Failed to attached device %s to IOMMU_mapping\n", - dev_name(dev)); - arm_iommu_release_mapping(mapping); - return ret; - } - - return 0; -} - #else static inline bool exynos_is_iommu_available(struct device *dev) @@ -66,14 +25,6 @@ static inline bool exynos_is_iommu_available(struct device *dev) return false; } -static inline int exynos_configure_iommu(struct device *dev, - unsigned int base, unsigned int size) -{ - return -ENOSYS; -} - -static inline void exynos_unconfigure_iommu(struct device *dev) { } - #endif #endif /* S5P_MFC_IOMMU_H_ */ From patchwork Tue Feb 14 07:52:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93924 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447282qgi; Mon, 13 Feb 2017 23:52:30 -0800 (PST) X-Received: by 10.84.169.36 with SMTP id g33mr34987942plb.36.1487058750291; Mon, 13 Feb 2017 23:52:30 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.30; Mon, 13 Feb 2017 23:52:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752188AbdBNHw3 (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:29 -0500 Received: from mailout3.w1.samsung.com ([210.118.77.13]:39761 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752593AbdBNHw0 (ORCPT ); Tue, 14 Feb 2017 02:52:26 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC003KDTVABA20@mailout3.w1.samsung.com>; Tue, 14 Feb 2017 07:52:22 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075221eucas1p126456f0fbe9c4265b93f27af397e41b3~jGAwLdRP72457924579eucas1p1u; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id 4F.15.30614.537B2A85; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075221eucas1p1c0acfa79289ebff6306c01e47c3e83a7~jGAvVG-Pi1962719627eucas1p1F; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) X-AuditID: cbfec7f1-f793f6d000007796-99-58a2b735ea9e Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E5.00.10233.837B2A85; Tue, 14 Feb 2017 07:52:24 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:20 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 14/15] media: s5p-mfc: Use preallocated block allocator always for MFC v6+ Date: Tue, 14 Feb 2017 08:52:07 +0100 Message-id: <1487058728-16501-15-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djP87qm2xdFGMyaq21xa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK6NrehdTwR/pitO3PrE2MN4R72Lk5JAQMJE4u/s9O4QtJnHh3no2EFtIYCmj xMXdvl2MXED2Z0aJGT8WMMI0nDv9hx0isYxR4saLr6wQTgOTxNldK1lAqtgEDCW63naBjRIR cJJYOOsvWAezwHdGiW+7T7OCJIQFYiR+7oDYzSKgKvF8ykZmEJtXwFPi95M2Joh1chInj00G q+cEim/6PIURZJCEwGs2iS8f7gA5HECOrMSmA8wQ9S4SJx+ehjpVWOLV8S1Qv8lIXJ7czQJh 9zNKNLVqQ9gzGCXOveWFsK0lDh+/CLaLWYBPYtK26cwQ43klOtqEIEo8JO5c3go1xlHi09pt zBDPz2GUeHX+D+MERpkFjAyrGEVSS4tz01OLjfSKE3OLS/PS9ZLzczcxAuP29L/jH3cwvj9h dYhRgINRiYfXYt/CCCHWxLLiytxDjBIczEoivAy9iyKEeFMSK6tSi/Lji0pzUosPMUpzsCiJ 8+5ZcCVcSCA9sSQ1OzW1ILUIJsvEwSnVwFif4qwTWCFetVfv8+fDDsIbd60qvHC9T/DnDpbl TWEmuS/2lAuoPb/vwxt245tYS7SeWEbk5ZCMBUFGmx1maZSterPI5rUs5/s3WsFmebN08pTv e/54w3nN8NOqIkarnxcyDixl0pp2NZDr71HON66ZJZvTtspMduSX+v47OGZ7aNSOwn8u6kos xRmJhlrMRcWJAAmGX07XAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRmVeSWpSXmKPExsVy+t/xK7oW2xdFGEy+IGtxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDnKzSYj NTEltUghNS85PyUzL91WKTTETddCSSEvMTfVVilC1zckSEmhLDGnFMgzMkADDs4B7sFK+nYJ bhld07uYCv5IV5y+9Ym1gfGOeBcjJ4eEgInEudN/2CFsMYkL99azdTFycQgJLGGU2H9qLTuE 08Qk8f/9RbAqNgFDia63XWwgtoiAk8TCWX/B4swC3xkllt1M62Lk4BAWiJF4M18MJMwioCrx fMpGZhCbV8BT4veTNiaIZXISJ49NZgWxOYHimz5PYQSxhQQ8JM6u2cE+gZF3ASPDKkaR1NLi 3PTcYiO94sTc4tK8dL3k/NxNjMAA3nbs55YdjF3vgg8xCnAwKvHwWuxbGCHEmlhWXJl7iFGC g1lJhJehd1GEEG9KYmVValF+fFFpTmrxIUZToKMmMkuJJucDoyuvJN7QxNDc0tDI2MLC3MhI SZx36ocr4UIC6YklqdmpqQWpRTB9TBycUg2Mx9NvN8Rmdk9N3ZqgsaJE+Fb7zKv8b5gNpKQO mC9QnXGirzbwj5399QWSYn9fbdxwUSqML9rkl+Utp5VRZobT7nyZ6/V8z1ThsFlPJPJn+d1Z O3dFQ+FP7YK2L15MqeeOlZ9S3a9tkiZ7atK7yJc7Skquuc5aLPDvkPpTpiINt5vufQpCISEl SizFGYmGWsxFxYkALqjAWHYCAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075221eucas1p1c0acfa79289ebff6306c01e47c3e83a7 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075221eucas1p1c0acfa79289ebff6306c01e47c3e83a7 X-RootMTR: 20170214075221eucas1p1c0acfa79289ebff6306c01e47c3e83a7 References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org It turned out that all versions of MFC v6+ hardware doesn't have a strict requirement for ALL buffers to be allocated on higher addresses than the firmware base like it was documented for MFC v5. This requirement is true only for the device and per-context buffers. All video data buffers can be allocated anywhere for all MFC v6+ versions. Basing on this fact, the special DMA configuration based on two reserved memory regions is not really needed for MFC v6+ devices, because the memory requirements for the firmware, device and per-context buffers can be fulfilled by the simple probe-time pre-allocated block allocator instroduced in previous patch. This patch enables support for such pre-allocated block based allocator always for MFC v6+ devices. Due to the limitations of the memory management subsystem the largest supported size of the pre-allocated buffer when no CMA (Contiguous Memory Allocator) is enabled is 4MiB. This patch also removes the requirement to provide two reserved memory regions for MFC v6+ devices in device tree. Now the driver is fully functional without them. Signed-off-by: Marek Szyprowski --- Documentation/devicetree/bindings/media/s5p-mfc.txt | 2 +- drivers/media/platform/s5p-mfc/s5p_mfc.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas diff --git a/Documentation/devicetree/bindings/media/s5p-mfc.txt b/Documentation/devicetree/bindings/media/s5p-mfc.txt index 2c901286d818..d3404b5d4d17 100644 --- a/Documentation/devicetree/bindings/media/s5p-mfc.txt +++ b/Documentation/devicetree/bindings/media/s5p-mfc.txt @@ -28,7 +28,7 @@ Optional properties: - memory-region : from reserved memory binding: phandles to two reserved memory regions, first is for "left" mfc memory bus interfaces, second if for the "right" mfc memory bus, used when no SYSMMU - support is available + support is available; used only by MFC v5 present in Exynos4 SoCs Obsolete properties: - samsung,mfc-r, samsung,mfc-l : support removed, please use memory-region diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 8fc6fe4ba087..36f0aec2a1b3 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1178,9 +1178,12 @@ static void s5p_mfc_unconfigure_2port_memory(struct s5p_mfc_dev *mfc_dev) static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) { struct device *dev = &mfc_dev->plat_dev->dev; - unsigned long mem_size = SZ_8M; + unsigned long mem_size = SZ_4M; unsigned int bitmap_size; + if (IS_ENABLED(CONFIG_DMA_CMA) || exynos_is_iommu_available(dev)) + mem_size = SZ_8M; + if (mfc_mem_size) mem_size = memparse(mfc_mem_size, NULL); @@ -1240,7 +1243,7 @@ static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) { struct device *dev = &mfc_dev->plat_dev->dev; - if (exynos_is_iommu_available(dev)) + if (exynos_is_iommu_available(dev) || !IS_TWOPORT(mfc_dev)) return s5p_mfc_configure_common_memory(mfc_dev); else return s5p_mfc_configure_2port_memory(mfc_dev); @@ -1251,7 +1254,7 @@ static void s5p_mfc_unconfigure_dma_memory(struct s5p_mfc_dev *mfc_dev) struct device *dev = &mfc_dev->plat_dev->dev; s5p_mfc_release_firmware(mfc_dev); - if (exynos_is_iommu_available(dev)) + if (exynos_is_iommu_available(dev) || !IS_TWOPORT(mfc_dev)) s5p_mfc_unconfigure_common_memory(mfc_dev); else s5p_mfc_unconfigure_2port_memory(mfc_dev); From patchwork Tue Feb 14 07:52:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 93925 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1447315qgi; Mon, 13 Feb 2017 23:52:35 -0800 (PST) X-Received: by 10.99.0.196 with SMTP id 187mr31541282pga.139.1487058755732; Mon, 13 Feb 2017 23:52:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si12354946pgg.245.2017.02.13.23.52.35; Mon, 13 Feb 2017 23:52:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752593AbdBNHwe (ORCPT + 4 others); Tue, 14 Feb 2017 02:52:34 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:39062 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751887AbdBNHw0 (ORCPT ); Tue, 14 Feb 2017 02:52:26 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OLC003L4TVADL20@mailout2.w1.samsung.com>; Tue, 14 Feb 2017 07:52:22 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075222eucas1p17a64be4675f8f9a4714cb3a9269a994c~jGAwSPMwb2143621436eucas1p14; Tue, 14 Feb 2017 07:52:22 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id C6.84.09557.537B2A85; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170214075221eucas1p18648b047f71e9dd95626e5766c74601b~jGAvjRCW02458324583eucas1p1q; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-bf-58a2b735cfcb Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id E1.6E.06687.487B2A85; Tue, 14 Feb 2017 07:53:40 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLC00FWGTUYP980@eusync2.samsung.com>; Tue, 14 Feb 2017 07:52:21 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Andrzej Hajda , Krzysztof Kozlowski , Inki Dae , Seung-Woo Kim Subject: [PATCH 15/15] ARM: dts: exynos: Remove MFC reserved buffers Date: Tue, 14 Feb 2017 08:52:08 +0100 Message-id: <1487058728-16501-16-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djPc7qm2xdFGLyYZGRxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK2NrW3rBJrWKZ/8XszYw7lDsYuTkkBAwkXg9rZsRwhaTuHBvPVsXIxeHkMBS RomzM/8zQjifGSX67s9mhenY/KiZHSKxjFFi//VpLBBOA5PEpot/mUCq2AQMJbredrGB2CIC ThILZ/0F62AW+M4o8W33abBRwgIuEh1Hm1lAbBYBVYm/vf/ZQWxeAU+JN7Ofs0Gsk5M4eWwy WD0nUHzT5ylgN0kIvGaTWHrvIFARB5AjK7HpADNEvYvEjR8boR4Slnh1fAs7hC0j0dlxkAnC 7meUaGrVhrBnMEqce8sLYVtLHD5+EWwXswCfxKRt05khxvNKdLQJQZR4SHzqfQs13lHi4dUd TBDPz2GUeLziAesERpkFjAyrGEVSS4tz01OLjfWKE3OLS/PS9ZLzczcxAuP29L/jn3Ywfj1h dYhRgINRiYd3woGFEUKsiWXFlbmHGCU4mJVEeBl6F0UI8aYkVlalFuXHF5XmpBYfYpTmYFES 592z4Eq4kEB6YklqdmpqQWoRTJaJg1OqgTHE1fTZggBH4cs+6vFNGw1eFux0mJAdtuVWRK9a uECce+vBXWFmDo4dM0QXtro9bDYRco51ffBM2veFSeSdf4vEZbe96yr/OfvT1c+5qiujfsXJ zZxYLZq+vfBxz4Kbxysn6k9tLt3IPF3i9+8dCvxL7ecZq/j8fGL0YtmUt4YF13kPz01sLlVi Kc5INNRiLipOBAAxNDRd1wIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRmVeSWpSXmKPExsVy+t/xK7ot2xdFGKzqFba4te4cq8Wk+xNY LM6f38Bu0bNhK6vFjPP7mCzWHrnLbnH4TTuQO/klmwOHx6ZVnWwefVtWMXp83iQXwBzlZpOR mpiSWqSQmpecn5KZl26rFBripmuhpJCXmJtqqxSh6xsSpKRQlphTCuQZGaABB+cA92AlfbsE t4ytbekFm9Qqnv1fzNrAuEOxi5GTQ0LARGLzo2Z2CFtM4sK99WxdjFwcQgJLGCVm393FCOE0 MUm8fHiOGaSKTcBQouttFxuILSLgJLFw1l+wbmaB74wSy26mgdjCAi4SHUebWUBsFgFVib+9 /8FqeAU8Jd7Mfs4GsU1O4uSxyawgNidQfNPnKYwgtpCAh8TZNTvYJzDyLmBkWMUoklpanJue W2yoV5yYW1yal66XnJ+7iREYwNuO/dy8g/HSxuBDjAIcjEo8vBMOLIwQYk0sK67MPcQowcGs JMLL0LsoQog3JbGyKrUoP76oNCe1+BCjKdBRE5mlRJPzgdGVVxJvaGJobmloZGxhYW5kpCTO W/LhSriQQHpiSWp2ampBahFMHxMHp1QDo81XU+2Ux2u/7Ft45KjdogXv0o7zLfDfOLH4as1i wfj83ZfPyW/clxmbLb7nOJ961RfNlZMVnv877sb8yCFyNes01tzsQ0djk9mOvfr7OV+7rfiK W4SY87qp86XFAoUYpK7f8ZVl+5d3e2/bB58ZV47/Wp4lzOniMiVPsn/BqrPpp39v2K9W+0aJ pTgj0VCLuag4EQCTrS4/dgIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170214075221eucas1p18648b047f71e9dd95626e5766c74601b X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170214075221eucas1p18648b047f71e9dd95626e5766c74601b X-RootMTR: 20170214075221eucas1p18648b047f71e9dd95626e5766c74601b References: <1487058728-16501-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org During my research I found that some of the requirements for the memory buffers for MFC v6+ devices were blindly copied from the previous (v5) version and simply turned out to be excessive. The relaxed requirements are applied by the recent patches to the MFC driver and the driver is now fully functional even without the reserved memory blocks for all v6+ variants. This patch removes those reserved memory nodes from all boards having MFC v6+ hardware block. Signed-off-by: Marek Szyprowski --- arch/arm/boot/dts/exynos5250-arndale.dts | 1 - arch/arm/boot/dts/exynos5250-smdk5250.dts | 1 - arch/arm/boot/dts/exynos5250-spring.dts | 1 - arch/arm/boot/dts/exynos5420-arndale-octa.dts | 1 - arch/arm/boot/dts/exynos5420-peach-pit.dts | 1 - arch/arm/boot/dts/exynos5420-smdk5420.dts | 1 - arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi | 1 - arch/arm/boot/dts/exynos5800-peach-pi.dts | 1 - 8 files changed, 8 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts index 6098dacd09f1..6a432460eb77 100644 --- a/arch/arm/boot/dts/exynos5250-arndale.dts +++ b/arch/arm/boot/dts/exynos5250-arndale.dts @@ -14,7 +14,6 @@ #include #include #include "exynos5250.dtsi" -#include "exynos-mfc-reserved-memory.dtsi" / { model = "Insignal Arndale evaluation board based on EXYNOS5250"; diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts index a97a785ccc6b..6632f657394e 100644 --- a/arch/arm/boot/dts/exynos5250-smdk5250.dts +++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts @@ -13,7 +13,6 @@ #include #include #include "exynos5250.dtsi" -#include "exynos-mfc-reserved-memory.dtsi" / { model = "SAMSUNG SMDK5250 board based on EXYNOS5250"; diff --git a/arch/arm/boot/dts/exynos5250-spring.dts b/arch/arm/boot/dts/exynos5250-spring.dts index 4d7bdb735ed3..95c3bcace9dc 100644 --- a/arch/arm/boot/dts/exynos5250-spring.dts +++ b/arch/arm/boot/dts/exynos5250-spring.dts @@ -14,7 +14,6 @@ #include #include #include "exynos5250.dtsi" -#include "exynos-mfc-reserved-memory.dtsi" / { model = "Google Spring"; diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts index 9cc83c51c925..ee1bb9b8b366 100644 --- a/arch/arm/boot/dts/exynos5420-arndale-octa.dts +++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts @@ -16,7 +16,6 @@ #include #include #include -#include "exynos-mfc-reserved-memory.dtsi" / { model = "Insignal Arndale Octa evaluation board based on EXYNOS5420"; diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts index 1f964ec35c5e..2cd65699a29c 100644 --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts @@ -16,7 +16,6 @@ #include #include "exynos5420.dtsi" #include "exynos5420-cpus.dtsi" -#include "exynos-mfc-reserved-memory.dtsi" / { model = "Google Peach Pit Rev 6+"; diff --git a/arch/arm/boot/dts/exynos5420-smdk5420.dts b/arch/arm/boot/dts/exynos5420-smdk5420.dts index aaccd0da41e5..08c8ab173e87 100644 --- a/arch/arm/boot/dts/exynos5420-smdk5420.dts +++ b/arch/arm/boot/dts/exynos5420-smdk5420.dts @@ -13,7 +13,6 @@ #include "exynos5420.dtsi" #include "exynos5420-cpus.dtsi" #include -#include "exynos-mfc-reserved-memory.dtsi" / { model = "Samsung SMDK5420 board based on EXYNOS5420"; diff --git a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi index 05b9afdd6757..657535e2e3cc 100644 --- a/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi +++ b/arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi @@ -18,7 +18,6 @@ #include #include "exynos5800.dtsi" #include "exynos5422-cpus.dtsi" -#include "exynos-mfc-reserved-memory.dtsi" / { memory@40000000 { diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts index f9ff7f07ae0c..ecf1c916e8fc 100644 --- a/arch/arm/boot/dts/exynos5800-peach-pi.dts +++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts @@ -16,7 +16,6 @@ #include #include "exynos5800.dtsi" #include "exynos5420-cpus.dtsi" -#include "exynos-mfc-reserved-memory.dtsi" / { model = "Google Peach Pi Rev 10+";