All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Inki Dae <inki.dae@samsung.com>,
	Seung-Woo Kim <sw0312.kim@samsung.com>
Subject: [PATCH v3 06/16] media: s5p-mfc: Move setting DMA max segment size to DMA configure function
Date: Mon, 20 Mar 2017 11:56:32 +0100	[thread overview]
Message-ID: <1490007402-30265-7-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <1490007402-30265-1-git-send-email-m.szyprowski@samsung.com>

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 <m.szyprowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Andrzej Hajda <a.hajda@samsung.com>
Tested-by: Smitha T Murthy <smitha.t@samsung.com>
---
 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 c03ed1a737b7..1fe790d88e70 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1117,9 +1117,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;
 	}
 
@@ -1138,6 +1142,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;
 }
 
@@ -1147,11 +1156,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 */
@@ -1209,11 +1221,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;
@@ -1346,8 +1353,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;
-- 
1.9.1

  parent reply	other threads:[~2017-03-20 10:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170320105648eucas1p29654616c7d29c45abdc3c2ba002126ec@eucas1p2.samsung.com>
2017-03-20 10:56 ` [PATCH v3 00/16] Exynos MFC v6+ - remove the need for the reserved memory Marek Szyprowski
     [not found]   ` <CGME20170320105649eucas1p111bb7137d958831701debe9704844017@eucas1p1.samsung.com>
2017-03-20 10:56     ` [PATCH v3 01/16] media: s5p-mfc: Remove unused structures and dead code Marek Szyprowski
     [not found]   ` <CGME20170320105649eucas1p2e296c309f82d635df78b1e1ec1fe21aa@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 02/16] media: s5p-mfc: Use generic of_device_get_match_data helper Marek Szyprowski
     [not found]   ` <CGME20170320105650eucas1p16eab3e05a99c2ce8464687400b47d09e@eucas1p1.samsung.com>
2017-03-20 10:56     ` [PATCH v3 03/16] media: s5p-mfc: Replace mem_dev_* entries with an array Marek Szyprowski
     [not found]   ` <CGME20170320105650eucas1p299820f40e39d09fe4a1591917dd8fc6c@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 04/16] media: s5p-mfc: Replace bank1/bank2 " Marek Szyprowski
     [not found]   ` <CGME20170320105650eucas1p2837a16c0855f77680d10f63efed9fac5@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 05/16] media: s5p-mfc: Simplify alloc/release private buffer functions Marek Szyprowski
     [not found]   ` <CGME20170320105651eucas1p1c80766207bf60d211200f2f5daa2c799@eucas1p1.samsung.com>
2017-03-20 10:56     ` Marek Szyprowski [this message]
     [not found]   ` <CGME20170320105651eucas1p2f4a367546f4f33c652b36415b8542e3b@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 07/16] media: s5p-mfc: Put firmware to private buffer structure Marek Szyprowski
     [not found]   ` <CGME20170320105651eucas1p2ff2722b748f1ceb529c4fd844f320c9b@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 08/16] media: s5p-mfc: Move firmware allocation to DMA configure function Marek Szyprowski
     [not found]   ` <CGME20170320105652eucas1p1176471116a8764dd0b0c70e58a2806b3@eucas1p1.samsung.com>
2017-03-20 10:56     ` [PATCH v3 09/16] media: s5p-mfc: Allocate firmware with internal private buffer alloc function Marek Szyprowski
     [not found]   ` <CGME20170320105652eucas1p1dfa223654e55908446103109d97aa2c2@eucas1p1.samsung.com>
2017-03-20 10:56     ` [PATCH v3 10/16] media: s5p-mfc: Reduce firmware buffer size for MFC v6+ variants Marek Szyprowski
     [not found]   ` <CGME20170320105653eucas1p27e61ab46b1804c710d4767d94aab27cd@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 11/16] media: s5p-mfc: Split variant DMA memory configuration into separate functions Marek Szyprowski
     [not found]   ` <CGME20170320105653eucas1p20276c75ba618fbed0e70a78fc14394f8@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 12/16] media: s5p-mfc: Add support for probe-time preallocated block based allocator Marek Szyprowski
     [not found]   ` <CGME20170320105653eucas1p236609e0bbed00d32b41c3eb8b63a159d@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 13/16] media: s5p-mfc: Remove special configuration of IOMMU domain Marek Szyprowski
     [not found]   ` <CGME20170320105654eucas1p13c5d9a82f7410c53e427340b8a572f96@eucas1p1.samsung.com>
2017-03-20 10:56     ` [PATCH v3 14/16] media: s5p-mfc: Use preallocated block allocator always for MFC v6+ Marek Szyprowski
     [not found]   ` <CGME20170320105654eucas1p26e4fb044e6b814d4a349f2d2831076d7@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 15/16] media: s5p-mfc: Rename BANK1/2 to BANK_L/R to better match documentation Marek Szyprowski
     [not found]   ` <CGME20170320105655eucas1p21706c33b5c1b413126fbfd1e23a34058@eucas1p2.samsung.com>
2017-03-20 10:56     ` [PATCH v3 16/16] ARM: dts: exynos: Remove MFC reserved buffers Marek Szyprowski
2017-05-15 16:43       ` Krzysztof Kozlowski
     [not found]   ` <CGME20170322103434eucas1p201996d20d01cdca113b9764117ce6167@eucas1p2.samsung.com>
2017-03-22 10:34     ` [PATCH] media: s5p-mfc: Don't allocate codec buffers from pre-allocated region Marek Szyprowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490007402-30265-7-git-send-email-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=inki.dae@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sw0312.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.