From: Nikhil Devshatwar Date: Fri, 18 Nov 2016 23:20:36 +0000 (-0200) Subject: [media] media: ti-vpe: vpdma: Use bidirectional cached buffers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=07e72eb0725ccd20b5cc26ee463def3f34606c7f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [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: Nikhil Devshatwar Signed-off-by: Benoit Parrot Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/ti-vpe/vpdma.c b/drivers/media/platform/ti-vpe/vpdma.c index 070937fe1af6..2d13644a28a8 100644 --- a/drivers/media/platform/ti-vpe/vpdma.c +++ b/drivers/media/platform/ti-vpe/vpdma.c @@ -367,7 +367,7 @@ int vpdma_map_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf) WARN_ON(buf->mapped); buf->dma_addr = dma_map_single(dev, buf->addr, buf->size, - DMA_TO_DEVICE); + DMA_BIDIRECTIONAL); if (dma_mapping_error(dev, buf->dma_addr)) { dev_err(dev, "failed to map buffer\n"); return -EINVAL; @@ -388,7 +388,8 @@ void vpdma_unmap_desc_buf(struct vpdma_data *vpdma, struct vpdma_buf *buf) struct device *dev = &vpdma->pdev->dev; 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; }