summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/omap3isp/ispqueue.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-01-02 20:06:08 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-25 11:18:42 -0300
commit2a0a5472af5caa0d0df334abb9975dc496f045da (patch)
treee6981f7cc0127340febff0021f398b7300345c47 /drivers/media/platform/omap3isp/ispqueue.c
parent9a8c7fffa2293417d0245fb9f618564d7dee04a6 (diff)
downloadop-kernel-dev-2a0a5472af5caa0d0df334abb9975dc496f045da.zip
op-kernel-dev-2a0a5472af5caa0d0df334abb9975dc496f045da.tar.gz
[media] omap3isp: Use the ARM DMA IOMMU-aware operations
Attach an ARM DMA I/O virtual address space to the ISP device. This switches to the IOMMU-aware ARM DMA backend, we can thus remove the explicit calls to the OMAP IOMMU map and unmap functions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/platform/omap3isp/ispqueue.c')
-rw-r--r--drivers/media/platform/omap3isp/ispqueue.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/media/platform/omap3isp/ispqueue.c b/drivers/media/platform/omap3isp/ispqueue.c
index cee1b5d..9c90fb0 100644
--- a/drivers/media/platform/omap3isp/ispqueue.c
+++ b/drivers/media/platform/omap3isp/ispqueue.c
@@ -26,7 +26,6 @@
#include <asm/cacheflush.h>
#include <linux/dma-mapping.h>
#include <linux/mm.h>
-#include <linux/omap-iommu.h>
#include <linux/pagemap.h>
#include <linux/poll.h>
#include <linux/scatterlist.h>
@@ -159,7 +158,7 @@ static int isp_video_buffer_prepare_kernel(struct isp_video_buffer *buf)
struct isp_video *video = vfh->video;
return dma_get_sgtable(video->isp->dev, &buf->sgt, buf->vaddr,
- buf->paddr, PAGE_ALIGN(buf->vbuf.length));
+ buf->dma, PAGE_ALIGN(buf->vbuf.length));
}
/*
@@ -170,18 +169,10 @@ static int isp_video_buffer_prepare_kernel(struct isp_video_buffer *buf)
*/
static void isp_video_buffer_cleanup(struct isp_video_buffer *buf)
{
- struct isp_video_fh *vfh = isp_video_queue_to_isp_video_fh(buf->queue);
- struct isp_video *video = vfh->video;
enum dma_data_direction direction;
DEFINE_DMA_ATTRS(attrs);
unsigned int i;
- if (buf->dma) {
- omap_iommu_vunmap(video->isp->domain, video->isp->dev,
- buf->dma);
- buf->dma = 0;
- }
-
if (buf->vbuf.memory == V4L2_MEMORY_USERPTR) {
if (buf->skip_cache)
dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, &attrs);
@@ -419,11 +410,8 @@ done:
*/
static int isp_video_buffer_prepare(struct isp_video_buffer *buf)
{
- struct isp_video_fh *vfh = isp_video_queue_to_isp_video_fh(buf->queue);
- struct isp_video *video = vfh->video;
enum dma_data_direction direction;
DEFINE_DMA_ATTRS(attrs);
- unsigned long addr;
int ret;
switch (buf->vbuf.memory) {
@@ -458,23 +446,15 @@ static int isp_video_buffer_prepare(struct isp_video_buffer *buf)
goto done;
}
+ buf->dma = sg_dma_address(buf->sgt.sgl);
break;
default:
return -EINVAL;
}
- addr = omap_iommu_vmap(video->isp->domain, video->isp->dev, 0,
- &buf->sgt, IOVMF_ENDIAN_LITTLE | IOVMF_ELSZ_8);
- if (IS_ERR_VALUE(addr)) {
- ret = -EIO;
- goto done;
- }
-
- buf->dma = addr;
-
- if (!IS_ALIGNED(addr, 32)) {
- dev_dbg(video->isp->dev,
+ if (!IS_ALIGNED(buf->dma, 32)) {
+ dev_dbg(buf->queue->dev,
"Buffer address must be aligned to 32 bytes boundary.\n");
ret = -EINVAL;
goto done;
@@ -576,7 +556,7 @@ static int isp_video_queue_free(struct isp_video_queue *queue)
if (buf->vaddr) {
dma_free_coherent(queue->dev,
PAGE_ALIGN(buf->vbuf.length),
- buf->vaddr, buf->paddr);
+ buf->vaddr, buf->dma);
buf->vaddr = NULL;
}
@@ -632,7 +612,7 @@ static int isp_video_queue_alloc(struct isp_video_queue *queue,
buf->vbuf.m.offset = i * PAGE_ALIGN(size);
buf->vaddr = mem;
- buf->paddr = dma;
+ buf->dma = dma;
}
buf->vbuf.index = i;
@@ -1079,7 +1059,7 @@ int omap3isp_video_queue_mmap(struct isp_video_queue *queue,
*/
vma->vm_pgoff = 0;
- ret = dma_mmap_coherent(queue->dev, vma, buf->vaddr, buf->paddr, size);
+ ret = dma_mmap_coherent(queue->dev, vma, buf->vaddr, buf->dma, size);
if (ret < 0)
goto done;
OpenPOWER on IntegriCloud