Commit 07e72eb0 authored by Nikhil Devshatwar's avatar Nikhil Devshatwar Committed by Mauro Carvalho Chehab

[media] media: ti-vpe: vpdma: Use bidirectional cached buffers

VPDMA buffer will be used by CPU as well as by the VPDMA.
CPU will write/update the VPDMA descriptors containing data
about the video buffer DMA addresses.
VPDMA will write the "write descriptor" containing the
data about the DMA operation.

When mapping/unmapping the buffer, driver has to take care of
WriteBack and invalidation of the cache so that all the
coherency is maintained from both directions.

Use DMA_BIDIRECTIONAL to maintain coherency between CPU and VPDMA.
Signed-off-by: default avatarNikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: default avatarBenoit Parrot <bparrot@ti.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c786595b
...@@ -367,7 +367,7 @@ int vpdma_map_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf) ...@@ -367,7 +367,7 @@ int vpdma_map_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf)
WARN_ON(buf->mapped); WARN_ON(buf->mapped);
buf->dma_addr = dma_map_single(dev, buf->addr, buf->size, buf->dma_addr = dma_map_single(dev, buf->addr, buf->size,
DMA_TO_DEVICE); DMA_BIDIRECTIONAL);
if (dma_mapping_error(dev, buf->dma_addr)) { if (dma_mapping_error(dev, buf->dma_addr)) {
dev_err(dev, "failed to map buffer\n"); dev_err(dev, "failed to map buffer\n");
return -EINVAL; return -EINVAL;
...@@ -388,7 +388,8 @@ void vpdma_unmap_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf) ...@@ -388,7 +388,8 @@ void vpdma_unmap_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf)
struct device *dev = &vpdma->pdev->dev; struct device *dev = &vpdma->pdev->dev;
if (buf->mapped) if (buf->mapped)
dma_unmap_single(dev, buf->dma_addr, buf->size, DMA_TO_DEVICE); dma_unmap_single(dev, buf->dma_addr, buf->size,
DMA_BIDIRECTIONAL);
buf->mapped = false; buf->mapped = false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment