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: 9582883 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0ED306042F for ; Mon, 20 Feb 2017 13:40:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00EBE2887B for ; Mon, 20 Feb 2017 13:40:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9BFF2887E; Mon, 20 Feb 2017 13:40:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E5F42887B for ; Mon, 20 Feb 2017 13:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753500AbdBTNkK (ORCPT ); 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/J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xOXfp6Gc JiaJ9Vd62UCq2AQMJbredoHZIgJOEgtn/WUHsZkFvjNKLLuZBmILC6RL3J/YxwhiswioSkxp /MQKYvMKuEvc2DudCWKbnMTJY5OB4hwcnAIeEjvak0HCQkAlX571Mk1g5F3AyLCKUSS1tDg3 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?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= 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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;