aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-01-02 08:27:12 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-25 10:09:25 -0400
commitcbde9e9d7f2ad0eb9c61563540ef1427e380c5e1 (patch)
treedbfcab5cd6dc0e538075871cb3c688aa98450b3c /drivers/media
parent4d4c00d4fd7fa49f9105c3543c06a3990eb9094f (diff)
[media] omap3isp: stat: Merge dma_addr and iommu_addr fields
The fields store buffer addresses as seen from the device. The first one is used with an external DMA engine while the second one is used with the ISP DMA engine. As they're never used together, merge them. 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')
-rw-r--r--drivers/media/platform/omap3isp/isph3a_aewb.c2
-rw-r--r--drivers/media/platform/omap3isp/isph3a_af.c2
-rw-r--r--drivers/media/platform/omap3isp/ispstat.c21
-rw-r--r--drivers/media/platform/omap3isp/ispstat.h1
4 files changed, 11 insertions, 15 deletions
diff --git a/drivers/media/platform/omap3isp/isph3a_aewb.c b/drivers/media/platform/omap3isp/isph3a_aewb.c
index 75fd82b152ba..d6811ce263eb 100644
--- a/drivers/media/platform/omap3isp/isph3a_aewb.c
+++ b/drivers/media/platform/omap3isp/isph3a_aewb.c
@@ -47,7 +47,7 @@ static void h3a_aewb_setup_regs(struct ispstat *aewb, void *priv)
47 if (aewb->state == ISPSTAT_DISABLED) 47 if (aewb->state == ISPSTAT_DISABLED)
48 return; 48 return;
49 49
50 isp_reg_writel(aewb->isp, aewb->active_buf->iommu_addr, 50 isp_reg_writel(aewb->isp, aewb->active_buf->dma_addr,
51 OMAP3_ISP_IOMEM_H3A, ISPH3A_AEWBUFST); 51 OMAP3_ISP_IOMEM_H3A, ISPH3A_AEWBUFST);
52 52
53 if (!aewb->update) 53 if (!aewb->update)
diff --git a/drivers/media/platform/omap3isp/isph3a_af.c b/drivers/media/platform/omap3isp/isph3a_af.c
index a0bf5af32438..6fc960cd30f5 100644
--- a/drivers/media/platform/omap3isp/isph3a_af.c
+++ b/drivers/media/platform/omap3isp/isph3a_af.c
@@ -51,7 +51,7 @@ static void h3a_af_setup_regs(struct ispstat *af, void *priv)
51 if (af->state == ISPSTAT_DISABLED) 51 if (af->state == ISPSTAT_DISABLED)
52 return; 52 return;
53 53
54 isp_reg_writel(af->isp, af->active_buf->iommu_addr, OMAP3_ISP_IOMEM_H3A, 54 isp_reg_writel(af->isp, af->active_buf->dma_addr, OMAP3_ISP_IOMEM_H3A,
55 ISPH3A_AFBUFST); 55 ISPH3A_AFBUFST);
56 56
57 if (!af->update) 57 if (!af->update)
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
index b1eb90210388..dba713f2a0d0 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -361,21 +361,19 @@ static void isp_stat_bufs_free(struct ispstat *stat)
361 struct ispstat_buffer *buf = &stat->buf[i]; 361 struct ispstat_buffer *buf = &stat->buf[i];
362 362
363 if (!ISP_STAT_USES_DMAENGINE(stat)) { 363 if (!ISP_STAT_USES_DMAENGINE(stat)) {
364 if (IS_ERR_OR_NULL((void *)buf->iommu_addr)) 364 if (IS_ERR_OR_NULL((void *)buf->dma_addr))
365 continue; 365 continue;
366 if (buf->iovm) 366 if (buf->iovm)
367 dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl, 367 dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl,
368 buf->iovm->sgt->nents, 368 buf->iovm->sgt->nents,
369 DMA_FROM_DEVICE); 369 DMA_FROM_DEVICE);
370 omap_iommu_vfree(isp->domain, isp->dev, 370 omap_iommu_vfree(isp->domain, isp->dev, buf->dma_addr);
371 buf->iommu_addr);
372 } else { 371 } else {
373 if (!buf->virt_addr) 372 if (!buf->virt_addr)
374 continue; 373 continue;
375 dma_free_coherent(stat->isp->dev, stat->buf_alloc_size, 374 dma_free_coherent(stat->isp->dev, stat->buf_alloc_size,
376 buf->virt_addr, buf->dma_addr); 375 buf->virt_addr, buf->dma_addr);
377 } 376 }
378 buf->iommu_addr = 0;
379 buf->iovm = NULL; 377 buf->iovm = NULL;
380 buf->dma_addr = 0; 378 buf->dma_addr = 0;
381 buf->virt_addr = NULL; 379 buf->virt_addr = NULL;
@@ -396,12 +394,12 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat,
396 struct isp_device *isp = stat->isp; 394 struct isp_device *isp = stat->isp;
397 struct iovm_struct *iovm; 395 struct iovm_struct *iovm;
398 396
399 buf->iommu_addr = omap_iommu_vmalloc(isp->domain, isp->dev, 0, 397 buf->dma_addr = omap_iommu_vmalloc(isp->domain, isp->dev, 0,
400 size, IOMMU_FLAG); 398 size, IOMMU_FLAG);
401 if (IS_ERR((void *)buf->iommu_addr)) 399 if (IS_ERR_VALUE(buf->dma_addr))
402 return -ENOMEM; 400 return -ENOMEM;
403 401
404 iovm = omap_find_iovm_area(isp->dev, buf->iommu_addr); 402 iovm = omap_find_iovm_area(isp->dev, buf->dma_addr);
405 if (!iovm) 403 if (!iovm)
406 return -ENOMEM; 404 return -ENOMEM;
407 405
@@ -410,8 +408,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat,
410 return -ENOMEM; 408 return -ENOMEM;
411 409
412 buf->iovm = iovm; 410 buf->iovm = iovm;
413 buf->virt_addr = omap_da_to_va(stat->isp->dev, 411 buf->virt_addr = omap_da_to_va(stat->isp->dev, buf->dma_addr);
414 (u32)buf->iommu_addr);
415 412
416 return 0; 413 return 0;
417} 414}
@@ -478,8 +475,8 @@ static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size)
478 buf->empty = 1; 475 buf->empty = 1;
479 476
480 dev_dbg(stat->isp->dev, 477 dev_dbg(stat->isp->dev,
481 "%s: buffer[%u] allocated. iommu=0x%08lx dma=0x%08lx virt=0x%08lx", 478 "%s: buffer[%u] allocated. dma=0x%08lx virt=0x%08lx",
482 stat->subdev.name, i, buf->iommu_addr, 479 stat->subdev.name, i,
483 (unsigned long)buf->dma_addr, 480 (unsigned long)buf->dma_addr,
484 (unsigned long)buf->virt_addr); 481 (unsigned long)buf->virt_addr);
485 } 482 }
diff --git a/drivers/media/platform/omap3isp/ispstat.h b/drivers/media/platform/omap3isp/ispstat.h
index 9a047c929b9f..8e76846da8d6 100644
--- a/drivers/media/platform/omap3isp/ispstat.h
+++ b/drivers/media/platform/omap3isp/ispstat.h
@@ -46,7 +46,6 @@
46struct ispstat; 46struct ispstat;
47 47
48struct ispstat_buffer { 48struct ispstat_buffer {
49 unsigned long iommu_addr;
50 struct iovm_struct *iovm; 49 struct iovm_struct *iovm;
51 void *virt_addr; 50 void *virt_addr;
52 dma_addr_t dma_addr; 51 dma_addr_t dma_addr;