public inbox for linux-media@vger.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 v2 14/15] media: s5p-mfc: Use preallocated block allocator always for MFC v6+
Date: Mon, 20 Feb 2017 14:39:03 +0100	[thread overview]
Message-ID: <1487597944-2000-15-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <1487597944-2000-1-git-send-email-m.szyprowski@samsung.com>

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 <m.szyprowski@samsung.com>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
 Documentation/devicetree/bindings/media/s5p-mfc.txt | 2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc.c            | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

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 b70cbd637851..b4a13e4cc9d4 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1182,9 +1182,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);
 
@@ -1244,7 +1247,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);
@@ -1255,7 +1258,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);
-- 
1.9.1

  parent reply	other threads:[~2017-02-20 13:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170220133910eucas1p10f347d7688dd51ea70d15994c9d5d1f1@eucas1p1.samsung.com>
2017-02-20 13:38 ` [PATCH v2 00/15] Exynos MFC v6+ - remove the need for the reserved memory Marek Szyprowski
2017-02-20 13:38   ` [PATCH v2 01/15] media: s5p-mfc: Remove unused structures and dead code Marek Szyprowski
2017-02-21 11:11     ` Andrzej Hajda
2017-03-03  9:24     ` [v2,01/15] " Smitha T Murthy
2017-03-03 11:56     ` Smitha T Murthy
2017-02-20 13:38   ` [PATCH v2 02/15] media: s5p-mfc: Use generic of_device_get_match_data helper Marek Szyprowski
2017-03-03 13:51     ` [v2, " Smitha T Murthy
2017-02-20 13:38   ` [PATCH v2 03/15] media: s5p-mfc: Replace mem_dev_* entries with an array Marek Szyprowski
2017-02-22 16:22     ` Shuah Khan
2017-03-17 11:29       ` Sylwester Nawrocki
2017-02-20 13:38   ` [PATCH v2 04/15] media: s5p-mfc: Replace bank1/bank2 " Marek Szyprowski
2017-02-20 13:38   ` [PATCH v2 05/15] media: s5p-mfc: Simplify alloc/release private buffer functions Marek Szyprowski
2017-02-20 13:38   ` [PATCH v2 06/15] media: s5p-mfc: Move setting DMA max segment size to DMA configure function Marek Szyprowski
2017-02-20 13:38   ` [PATCH v2 07/15] media: s5p-mfc: Put firmware to private buffer structure Marek Szyprowski
2017-02-20 13:38   ` [PATCH v2 08/15] media: s5p-mfc: Move firmware allocation to DMA configure function Marek Szyprowski
2017-02-20 13:49     ` Javier Martinez Canillas
2017-02-22 18:07     ` Shuah Khan
2017-02-23  7:30       ` Marek Szyprowski
2017-02-20 13:38   ` [PATCH v2 09/15] media: s5p-mfc: Allocate firmware with internal private buffer alloc function Marek Szyprowski
2017-02-20 13:38   ` [PATCH v2 10/15] media: s5p-mfc: Reduce firmware buffer size for MFC v6+ variants Marek Szyprowski
2017-02-20 13:39   ` [PATCH v2 11/15] media: s5p-mfc: Split variant DMA memory configuration into separate functions Marek Szyprowski
2017-02-20 13:39   ` [PATCH v2 12/15] media: s5p-mfc: Add support for probe-time preallocated block based allocator Marek Szyprowski
2017-02-20 13:39   ` [PATCH v2 13/15] media: s5p-mfc: Remove special configuration of IOMMU domain Marek Szyprowski
2017-02-20 13:39   ` Marek Szyprowski [this message]
2017-02-20 13:39   ` [PATCH v2 15/15] ARM: dts: exynos: Remove MFC reserved buffers 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=1487597944-2000-15-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox