media: set proper max seg size for devices on Exynos SoCs
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 24 May 2016 07:16:07 +0000 (09:16 +0200)
committerSylwester Nawrocki <s.nawrocki@samsung.com>
Fri, 3 Jun 2016 09:13:11 +0000 (11:13 +0200)
All multimedia devices found on Exynos SoCs support only contiguous
buffers, so set DMA max segment size to DMA_BIT_MASK(32) to let memory
allocator to correctly create contiguous memory mappings.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
drivers/media/platform/exynos-gsc/gsc-core.c
drivers/media/platform/exynos4-is/fimc-core.c
drivers/media/platform/exynos4-is/fimc-is.c
drivers/media/platform/exynos4-is/fimc-lite.c
drivers/media/platform/s5p-g2d/g2d.c
drivers/media/platform/s5p-jpeg/jpeg-core.c
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-tv/mixer_video.c

index c04973669a478d4f03717b0d79d76193f1b99b10..c9d2009c24767c25e148f807b4fd0fe00c498fe5 100644 (file)
@@ -1124,6 +1124,7 @@ static int gsc_probe(struct platform_device *pdev)
                goto err_m2m;
 
        /* Initialize continious memory allocator */
+       vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
        gsc->alloc_ctx = vb2_dma_contig_init_ctx(dev);
        if (IS_ERR(gsc->alloc_ctx)) {
                ret = PTR_ERR(gsc->alloc_ctx);
@@ -1153,6 +1154,7 @@ static int gsc_remove(struct platform_device *pdev)
        v4l2_device_unregister(&gsc->v4l2_dev);
 
        vb2_dma_contig_cleanup_ctx(gsc->alloc_ctx);
+       vb2_dma_contig_clear_max_seg_size(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
        gsc_clk_put(gsc);
 
index b1c1cea82a27cecaf2fca7face8f65657fc5259b..368f44f24d4c808db780a6b22b0442301240e820 100644 (file)
@@ -1019,6 +1019,7 @@ static int fimc_probe(struct platform_device *pdev)
        }
 
        /* Initialize contiguous memory allocator */
+       vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
        fimc->alloc_ctx = vb2_dma_contig_init_ctx(dev);
        if (IS_ERR(fimc->alloc_ctx)) {
                ret = PTR_ERR(fimc->alloc_ctx);
@@ -1124,6 +1125,7 @@ static int fimc_remove(struct platform_device *pdev)
 
        fimc_unregister_capture_subdev(fimc);
        vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
+       vb2_dma_contig_clear_max_seg_size(&pdev->dev);
 
        clk_disable(fimc->clock[CLK_BUS]);
        fimc_clk_put(fimc);
index 979c388ebf60cdd1a497aac2570aab05c5e800a6..bd98b56318b70865d2f0590001b01612a0308ac1 100644 (file)
@@ -847,6 +847,7 @@ static int fimc_is_probe(struct platform_device *pdev)
        if (ret < 0)
                goto err_pm;
 
+       vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
        is->alloc_ctx = vb2_dma_contig_init_ctx(dev);
        if (IS_ERR(is->alloc_ctx)) {
                ret = PTR_ERR(is->alloc_ctx);
@@ -940,6 +941,7 @@ static int fimc_is_remove(struct platform_device *pdev)
        free_irq(is->irq, is);
        fimc_is_unregister_subdevs(is);
        vb2_dma_contig_cleanup_ctx(is->alloc_ctx);
+       vb2_dma_contig_clear_max_seg_size(dev);
        fimc_is_put_clocks(is);
        fimc_is_debugfs_remove(is);
        release_firmware(is->fw.f_w);
index dc1b929f7a33d0a2f4e6a8ea04733a02123fcc36..27cb620cb714d514ceecc7ecb7972c0ce09d338a 100644 (file)
@@ -1551,6 +1551,7 @@ static int fimc_lite_probe(struct platform_device *pdev)
                        goto err_sd;
        }
 
+       vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
        fimc->alloc_ctx = vb2_dma_contig_init_ctx(dev);
        if (IS_ERR(fimc->alloc_ctx)) {
                ret = PTR_ERR(fimc->alloc_ctx);
@@ -1652,6 +1653,7 @@ static int fimc_lite_remove(struct platform_device *pdev)
        pm_runtime_set_suspended(dev);
        fimc_lite_unregister_capture_subdev(fimc);
        vb2_dma_contig_cleanup_ctx(fimc->alloc_ctx);
+       vb2_dma_contig_clear_max_seg_size(dev);
        fimc_lite_clk_put(fimc);
 
        dev_info(dev, "Driver unloaded\n");
index 612d1ea514f19720406a2ca1d2ef866c08d358e6..d3e3469db8dee9be076a0c66d1f8039d78835de1 100644 (file)
@@ -681,6 +681,7 @@ static int g2d_probe(struct platform_device *pdev)
                goto put_clk_gate;
        }
 
+       vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
        dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
        if (IS_ERR(dev->alloc_ctx)) {
                ret = PTR_ERR(dev->alloc_ctx);
@@ -757,6 +758,7 @@ static int g2d_remove(struct platform_device *pdev)
        video_unregister_device(dev->vfd);
        v4l2_device_unregister(&dev->v4l2_dev);
        vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
+       vb2_dma_contig_clear_max_seg_size(&pdev->dev);
        clk_unprepare(dev->gate);
        clk_put(dev->gate);
        clk_unprepare(dev->clk);
index caa19b408551d49f0cac97d5cc43059b03dfcf09..17bc94092864cff649004e022989eab8e414d120 100644 (file)
@@ -2843,6 +2843,7 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
                goto device_register_rollback;
        }
 
+       vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
        jpeg->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
        if (IS_ERR(jpeg->alloc_ctx)) {
                v4l2_err(&jpeg->v4l2_dev, "Failed to init memory allocator\n");
@@ -2942,6 +2943,7 @@ static int s5p_jpeg_remove(struct platform_device *pdev)
        video_unregister_device(jpeg->vfd_decoder);
        video_unregister_device(jpeg->vfd_encoder);
        vb2_dma_contig_cleanup_ctx(jpeg->alloc_ctx);
+       vb2_dma_contig_clear_max_seg_size(&pdev->dev);
        v4l2_m2m_release(jpeg->m2m_dev);
        v4l2_device_unregister(&jpeg->v4l2_dev);
 
index 501d822cad6b6fa6d33cdfb5ba335a9fb1ab3d29..d1d9d38864d766b0c8352f4c461a73fcf673198a 100644 (file)
@@ -1175,11 +1175,13 @@ static int s5p_mfc_probe(struct platform_device *pdev)
                }
        }
 
+       vb2_dma_contig_set_max_seg_size(dev->mem_dev_l, DMA_BIT_MASK(32));
        dev->alloc_ctx[0] = vb2_dma_contig_init_ctx(dev->mem_dev_l);
        if (IS_ERR(dev->alloc_ctx[0])) {
                ret = PTR_ERR(dev->alloc_ctx[0]);
                goto err_res;
        }
+       vb2_dma_contig_set_max_seg_size(dev->mem_dev_r, DMA_BIT_MASK(32));
        dev->alloc_ctx[1] = vb2_dma_contig_init_ctx(dev->mem_dev_r);
        if (IS_ERR(dev->alloc_ctx[1])) {
                ret = PTR_ERR(dev->alloc_ctx[1]);
@@ -1307,6 +1309,8 @@ static int s5p_mfc_remove(struct platform_device *pdev)
        s5p_mfc_release_firmware(dev);
        vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]);
        vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[1]);
+       vb2_dma_contig_clear_max_seg_size(dev->mem_dev_l);
+       vb2_dma_contig_clear_max_seg_size(dev->mem_dev_r);
        if (pdev->dev.of_node) {
                put_device(dev->mem_dev_l);
                put_device(dev->mem_dev_r);
index 7ab5578a040519761f1de671694444e0d2996143..123d27107f6058355a0f5ac8062586cdcfdd2d6d 100644 (file)
@@ -80,6 +80,7 @@ int mxr_acquire_video(struct mxr_device *mdev,
                goto fail;
        }
 
+       vb2_dma_contig_set_max_seg_size(mdev->dev, DMA_BIT_MASK(32));
        mdev->alloc_ctx = vb2_dma_contig_init_ctx(mdev->dev);
        if (IS_ERR(mdev->alloc_ctx)) {
                mxr_err(mdev, "could not acquire vb2 allocator\n");
@@ -152,6 +153,7 @@ void mxr_release_video(struct mxr_device *mdev)
                kfree(mdev->output[i]);
 
        vb2_dma_contig_cleanup_ctx(mdev->alloc_ctx);
+       vb2_dma_contig_clear_max_seg_size(mdev->dev);
        v4l2_device_unregister(&mdev->v4l2_dev);
 }