From patchwork Mon Feb 20 13:38: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: 94222 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1327293qgi; Mon, 20 Feb 2017 05:40:12 -0800 (PST) X-Received: by 10.99.188.10 with SMTP id q10mr27628176pge.106.1487598012408; Mon, 20 Feb 2017 05:40:12 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si18592166pge.343.2017.02.20.05.40.12; Mon, 20 Feb 2017 05:40:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-media-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-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753278AbdBTNkK (ORCPT + 4 others); Mon, 20 Feb 2017 08:40:10 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:21520 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752726AbdBTNjS (ORCPT ); Mon, 20 Feb 2017 08:39:18 -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 <0OLO0073FDXEZG50@mailout2.w1.samsung.com>; Mon, 20 Feb 2017 13:39:14 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170220133914eucas1p12ee472f3d5c1cef42d6eabb6f9f624a9~lAnUmqVSN0280602806eucas1p1l; Mon, 20 Feb 2017 13:39:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 5F.E8.09557.181FAA85; Mon, 20 Feb 2017 13:39:13 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170220133913eucas1p15e11eb9f365d85f48afe724d168dd44f~lAnT_gaS70280202802eucas1p1m; Mon, 20 Feb 2017 13:39:13 +0000 (GMT) X-AuditID: cbfec7f2-f790f6d000002555-c3-58aaf1810350 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id BA.E7.06687.5D1FAA85; Mon, 20 Feb 2017 13:40:37 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OLO00HBFDX6PK30@eusync1.samsung.com>; Mon, 20 Feb 2017 13:39:13 +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 v2 06/15] media: s5p-mfc: Move setting DMA max segment size to DMA configure function Date: Mon, 20 Feb 2017 14:38:55 +0100 Message-id: <1487597944-2000-7-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1487597944-2000-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsWy7djP87qNH1dFGMyeYmxxa905VotJ9yew WJw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3Ygd/JLNgcOj02rOtk8+rasYvT4vEkugDmKyyYl NSezLLVI3y6BK+P0lRlMBetEK64+W8HYwDhdqIuRk0NCwESice52ZghbTOLCvfVsXYxcHEIC SxklFm4/xA7hfGaU2Hn4ATtMx/VL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X571Mk1g5F3AyLCKUSS1tDg3 PbfYUK84Mbe4NC9dLzk/dxMjMIC3Hfu5eQfjpY3BhxgFOBiVeHg1Zq6MEGJNLCuuzD3EKMHB rCTCe/nlqggh3pTEyqrUovz4otKc1OJDjKZAN01klhJNzgdGV15JvKGJobmloZGxhYW5kZGS OG/JhyvhQgLpiSWp2ampBalFMH1MHJxSDYwTHjutvOnaa1wz4fLhrjfWvDUFjouk9ny7vThy mU1G8DfxnL3szjve6eQfWf+u+dOEY7NK3y6d2s9r8+KEg22oSeOruivh6VsrbLiXy6tcUDHq 8T/M5VeWy/RucnpoFecqdzHG2rudF0/3LcsW7X33pnhbzSORn+18Cu8VEiYUHd9daZ4s8lKJ pTgj0VCLuag4EQAl5YiXdgIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170220133913eucas1p15e11eb9f365d85f48afe724d168dd44f 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: 20170220133913eucas1p15e11eb9f365d85f48afe724d168dd44f X-RootMTR: 20170220133913eucas1p15e11eb9f365d85f48afe724d168dd44f References: <1487597944-2000-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 Reviewed-by: Javier Martinez Canillas Tested-by: Javier Martinez Canillas --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) -- 1.9.1 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;