aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/cx23885/cx23885-core.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-11-24 06:50:31 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-25 06:01:16 -0500
commitd790b7eda953df474f470169ebdf111c02fa7a2d (patch)
tree31ad9dce666141bf0d83989717188fe8700ac310 /drivers/media/pci/cx23885/cx23885-core.c
parent0c3a14c177aa85afb991e7c2be3921aa9a52a893 (diff)
[media] vb2-dma-sg: move dma_(un)map_sg here
This moves dma_(un)map_sg to the get_userptr/put_userptr and alloc/put memops of videobuf2-dma-sg.c and adds dma_sync_sg_for_device/cpu to the prepare/finish memops. Now that vb2-dma-sg will sync the buffers for you in the prepare/finish memops we can drop that from the drivers that use dma-sg. For the solo6x10 driver that was a bit more involved because it needs to copy JPEG or MPEG headers to the buffer before returning it to userspace, and that cannot be done in the old place since the buffer there is still setup for DMA access, not for CPU access. However, the buf_finish op is the ideal place to do this. By the time buf_finish is called the buffer is available for CPU access, so copying to the buffer is fine. [mchehab@osg.samsung.com: Fix a compilation breakage: drivers/media/v4l2-core/videobuf2-dma-sg.c:150:19: error: 'struct vb2_dma_sg_buf' has no member named 'dma_sgt'] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Pawel Osciak <pawel@osciak.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/pci/cx23885/cx23885-core.c')
-rw-r--r--drivers/media/pci/cx23885/cx23885-core.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c
index d452b5c076e6..d07b04a5ce36 100644
--- a/drivers/media/pci/cx23885/cx23885-core.c
+++ b/drivers/media/pci/cx23885/cx23885-core.c
@@ -1453,17 +1453,12 @@ int cx23885_buf_prepare(struct cx23885_buffer *buf, struct cx23885_tsport *port)
1453 struct cx23885_dev *dev = port->dev; 1453 struct cx23885_dev *dev = port->dev;
1454 int size = port->ts_packet_size * port->ts_packet_count; 1454 int size = port->ts_packet_size * port->ts_packet_count;
1455 struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0); 1455 struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0);
1456 int rc;
1457 1456
1458 dprintk(1, "%s: %p\n", __func__, buf); 1457 dprintk(1, "%s: %p\n", __func__, buf);
1459 if (vb2_plane_size(&buf->vb, 0) < size) 1458 if (vb2_plane_size(&buf->vb, 0) < size)
1460 return -EINVAL; 1459 return -EINVAL;
1461 vb2_set_plane_payload(&buf->vb, 0, size); 1460 vb2_set_plane_payload(&buf->vb, 0, size);
1462 1461
1463 rc = dma_map_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE);
1464 if (!rc)
1465 return -EIO;
1466
1467 cx23885_risc_databuffer(dev->pci, &buf->risc, 1462 cx23885_risc_databuffer(dev->pci, &buf->risc,
1468 sgt->sgl, 1463 sgt->sgl,
1469 port->ts_packet_size, port->ts_packet_count, 0); 1464 port->ts_packet_size, port->ts_packet_count, 0);