diff options
Diffstat (limited to 'drivers/media/pci')
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-417.c | 3 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-core.c | 5 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-dvb.c | 3 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-vbi.c | 9 | ||||
-rw-r--r-- | drivers/media/pci/cx23885/cx23885-video.c | 9 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-empress.c | 1 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-ts.c | 16 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-vbi.c | 15 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-video.c | 15 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134.h | 1 | ||||
-rw-r--r-- | drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 50 | ||||
-rw-r--r-- | drivers/media/pci/tw68/tw68-video.c | 8 |
12 files changed, 22 insertions, 113 deletions
diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index d72a3ec348ef..e4901a503c73 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1167,11 +1167,8 @@ static void buffer_finish(struct vb2_buffer *vb) struct cx23885_dev *dev = vb->vb2_queue->drv_priv; struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb); - struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); cx23885_free_buffer(dev, buf); - - dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); } static void buffer_queue(struct vb2_buffer *vb) 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) struct cx23885_dev *dev = port->dev; int size = port->ts_packet_size * port->ts_packet_count; struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb, 0); - int rc; dprintk(1, "%s: %p\n", __func__, buf); if (vb2_plane_size(&buf->vb, 0) < size) return -EINVAL; vb2_set_plane_payload(&buf->vb, 0, size); - rc = dma_map_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); - if (!rc) - return -EIO; - cx23885_risc_databuffer(dev->pci, &buf->risc, sgt->sgl, port->ts_packet_size, port->ts_packet_count, 0); diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 44fafba65c6f..c47d18270cfc 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c @@ -123,11 +123,8 @@ static void buffer_finish(struct vb2_buffer *vb) struct cx23885_dev *dev = port->dev; struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb); - struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); cx23885_free_buffer(dev, buf); - - dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); } static void buffer_queue(struct vb2_buffer *vb) diff --git a/drivers/media/pci/cx23885/cx23885-vbi.c b/drivers/media/pci/cx23885/cx23885-vbi.c index 1d339a69f0c8..d362d3838c84 100644 --- a/drivers/media/pci/cx23885/cx23885-vbi.c +++ b/drivers/media/pci/cx23885/cx23885-vbi.c @@ -143,7 +143,6 @@ static int buffer_prepare(struct vb2_buffer *vb) struct cx23885_buffer, vb); struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); unsigned lines = VBI_PAL_LINE_COUNT; - int ret; if (dev->tvnorm & V4L2_STD_525_60) lines = VBI_NTSC_LINE_COUNT; @@ -152,10 +151,6 @@ static int buffer_prepare(struct vb2_buffer *vb) return -EINVAL; vb2_set_plane_payload(vb, 0, lines * VBI_LINE_LENGTH * 2); - ret = dma_map_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); - if (!ret) - return -EIO; - cx23885_risc_vbibuffer(dev->pci, &buf->risc, sgt->sgl, 0, VBI_LINE_LENGTH * lines, @@ -166,14 +161,10 @@ static int buffer_prepare(struct vb2_buffer *vb) static void buffer_finish(struct vb2_buffer *vb) { - struct cx23885_dev *dev = vb->vb2_queue->drv_priv; struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb); - struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); cx23885_free_buffer(vb->vb2_queue->drv_priv, buf); - - dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); } /* diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 371eecfe7b32..5e93c682a3f5 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -335,7 +335,6 @@ static int buffer_prepare(struct vb2_buffer *vb) u32 line0_offset, line1_offset; struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); int field_tff; - int ret; buf->bpl = (dev->width * dev->fmt->depth) >> 3; @@ -343,10 +342,6 @@ static int buffer_prepare(struct vb2_buffer *vb) return -EINVAL; vb2_set_plane_payload(vb, 0, dev->height * buf->bpl); - ret = dma_map_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); - if (!ret) - return -EIO; - switch (dev->field) { case V4L2_FIELD_TOP: cx23885_risc_buffer(dev->pci, &buf->risc, @@ -414,14 +409,10 @@ static int buffer_prepare(struct vb2_buffer *vb) static void buffer_finish(struct vb2_buffer *vb) { - struct cx23885_dev *dev = vb->vb2_queue->drv_priv; struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb); - struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); cx23885_free_buffer(vb->vb2_queue->drv_priv, buf); - - dma_unmap_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); } /* diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index 8b3bb78b503b..594dc3ad4750 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c @@ -96,7 +96,6 @@ static struct vb2_ops saa7134_empress_qops = { .queue_setup = saa7134_ts_queue_setup, .buf_init = saa7134_ts_buffer_init, .buf_prepare = saa7134_ts_buffer_prepare, - .buf_finish = saa7134_ts_buffer_finish, .buf_queue = saa7134_vb2_buffer_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, diff --git a/drivers/media/pci/saa7134/saa7134-ts.c b/drivers/media/pci/saa7134/saa7134-ts.c index 8eff4a7d8ba3..2709b83d57b1 100644 --- a/drivers/media/pci/saa7134/saa7134-ts.c +++ b/drivers/media/pci/saa7134/saa7134-ts.c @@ -94,7 +94,6 @@ int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2) struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2); struct sg_table *dma = vb2_dma_sg_plane_desc(vb2, 0); unsigned int lines, llength, size; - int ret; dprintk("buffer_prepare [%p]\n", buf); @@ -108,25 +107,11 @@ int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2) vb2_set_plane_payload(vb2, 0, size); vb2->v4l2_buf.field = dev->field; - ret = dma_map_sg(&dev->pci->dev, dma->sgl, dma->nents, DMA_FROM_DEVICE); - if (!ret) - return -EIO; return saa7134_pgtable_build(dev->pci, &dmaq->pt, dma->sgl, dma->nents, saa7134_buffer_startpage(buf)); } EXPORT_SYMBOL_GPL(saa7134_ts_buffer_prepare); -void saa7134_ts_buffer_finish(struct vb2_buffer *vb2) -{ - struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv; - struct saa7134_dev *dev = dmaq->dev; - struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2); - struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0); - - dma_unmap_sg(&dev->pci->dev, dma->sgl, dma->nents, DMA_FROM_DEVICE); -} -EXPORT_SYMBOL_GPL(saa7134_ts_buffer_finish); - int saa7134_ts_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[]) @@ -188,7 +173,6 @@ struct vb2_ops saa7134_ts_qops = { .queue_setup = saa7134_ts_queue_setup, .buf_init = saa7134_ts_buffer_init, .buf_prepare = saa7134_ts_buffer_prepare, - .buf_finish = saa7134_ts_buffer_finish, .buf_queue = saa7134_vb2_buffer_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, diff --git a/drivers/media/pci/saa7134/saa7134-vbi.c b/drivers/media/pci/saa7134/saa7134-vbi.c index e2cc684a7c12..5306e549e526 100644 --- a/drivers/media/pci/saa7134/saa7134-vbi.c +++ b/drivers/media/pci/saa7134/saa7134-vbi.c @@ -120,7 +120,6 @@ static int buffer_prepare(struct vb2_buffer *vb2) struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2); struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0); unsigned int size; - int ret; if (dma->sgl->offset) { pr_err("The buffer is not page-aligned\n"); @@ -132,9 +131,6 @@ static int buffer_prepare(struct vb2_buffer *vb2) vb2_set_plane_payload(vb2, 0, size); - ret = dma_map_sg(&dev->pci->dev, dma->sgl, dma->nents, DMA_FROM_DEVICE); - if (!ret) - return -EIO; return saa7134_pgtable_build(dev->pci, &dmaq->pt, dma->sgl, dma->nents, saa7134_buffer_startpage(buf)); } @@ -170,21 +166,10 @@ static int buffer_init(struct vb2_buffer *vb2) return 0; } -static void buffer_finish(struct vb2_buffer *vb2) -{ - struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv; - struct saa7134_dev *dev = dmaq->dev; - struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2); - struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0); - - dma_unmap_sg(&dev->pci->dev, dma->sgl, dma->nents, DMA_FROM_DEVICE); -} - struct vb2_ops saa7134_vbi_qops = { .queue_setup = queue_setup, .buf_init = buffer_init, .buf_prepare = buffer_prepare, - .buf_finish = buffer_finish, .buf_queue = saa7134_vb2_buffer_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index ba029953db9d..701b52f34689 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c @@ -883,7 +883,6 @@ static int buffer_prepare(struct vb2_buffer *vb2) struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2); struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0); unsigned int size; - int ret; if (dma->sgl->offset) { pr_err("The buffer is not page-aligned\n"); @@ -896,23 +895,10 @@ static int buffer_prepare(struct vb2_buffer *vb2) vb2_set_plane_payload(vb2, 0, size); vb2->v4l2_buf.field = dev->field; - ret = dma_map_sg(&dev->pci->dev, dma->sgl, dma->nents, DMA_FROM_DEVICE); - if (!ret) - return -EIO; return saa7134_pgtable_build(dev->pci, &dmaq->pt, dma->sgl, dma->nents, saa7134_buffer_startpage(buf)); } -static void buffer_finish(struct vb2_buffer *vb2) -{ - struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv; - struct saa7134_dev *dev = dmaq->dev; - struct saa7134_buf *buf = container_of(vb2, struct saa7134_buf, vb2); - struct sg_table *dma = vb2_dma_sg_plane_desc(&buf->vb2, 0); - - dma_unmap_sg(&dev->pci->dev, dma->sgl, dma->nents, DMA_FROM_DEVICE); -} - static int queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[]) @@ -1005,7 +991,6 @@ static struct vb2_ops vb2_qops = { .queue_setup = queue_setup, .buf_init = buffer_init, .buf_prepare = buffer_prepare, - .buf_finish = buffer_finish, .buf_queue = saa7134_vb2_buffer_queue, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index c644c7da6859..8bf0553b8d2f 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -815,7 +815,6 @@ void saa7134_video_fini(struct saa7134_dev *dev); int saa7134_ts_buffer_init(struct vb2_buffer *vb2); int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2); -void saa7134_ts_buffer_finish(struct vb2_buffer *vb2); int saa7134_ts_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], void *alloc_ctxs[]); diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c index 4f6bfba58065..6e933d383fa2 100644 --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c @@ -463,7 +463,6 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc, struct solo_dev *solo_dev = solo_enc->solo_dev; struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0); int frame_size; - int ret; vb->v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME; @@ -473,22 +472,10 @@ static int solo_fill_jpeg(struct solo_enc_dev *solo_enc, frame_size = ALIGN(vop_jpeg_size(vh) + solo_enc->jpeg_len, DMA_ALIGN); vb2_set_plane_payload(vb, 0, vop_jpeg_size(vh) + solo_enc->jpeg_len); - /* may discard all previous data in vbuf->sgl */ - if (!dma_map_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, - DMA_FROM_DEVICE)) - return -ENOMEM; - ret = solo_send_desc(solo_enc, solo_enc->jpeg_len, vbuf, + return solo_send_desc(solo_enc, solo_enc->jpeg_len, vbuf, vop_jpeg_offset(vh) - SOLO_JPEG_EXT_ADDR(solo_dev), frame_size, SOLO_JPEG_EXT_ADDR(solo_dev), SOLO_JPEG_EXT_SIZE(solo_dev)); - dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, - DMA_FROM_DEVICE); - - /* add the header only after dma_unmap_sg() */ - sg_copy_from_buffer(vbuf->sgl, vbuf->nents, - solo_enc->jpeg_header, solo_enc->jpeg_len); - - return ret; } static int solo_fill_mpeg(struct solo_enc_dev *solo_enc, @@ -498,7 +485,6 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc, struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0); int frame_off, frame_size; int skip = 0; - int ret; if (vb2_plane_size(vb, 0) < vop_mpeg_size(vh)) return -EIO; @@ -521,21 +507,9 @@ static int solo_fill_mpeg(struct solo_enc_dev *solo_enc, sizeof(*vh)) % SOLO_MP4E_EXT_SIZE(solo_dev); frame_size = ALIGN(vop_mpeg_size(vh) + skip, DMA_ALIGN); - /* may discard all previous data in vbuf->sgl */ - if (!dma_map_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, - DMA_FROM_DEVICE)) - return -ENOMEM; - ret = solo_send_desc(solo_enc, skip, vbuf, frame_off, frame_size, + return solo_send_desc(solo_enc, skip, vbuf, frame_off, frame_size, SOLO_MP4E_EXT_ADDR(solo_dev), SOLO_MP4E_EXT_SIZE(solo_dev)); - dma_unmap_sg(&solo_dev->pdev->dev, vbuf->sgl, vbuf->nents, - DMA_FROM_DEVICE); - - /* add the header only after dma_unmap_sg() */ - if (!vop_type(vh)) - sg_copy_from_buffer(vbuf->sgl, vbuf->nents, - solo_enc->vop, solo_enc->vop_len); - return ret; } static int solo_enc_fillbuf(struct solo_enc_dev *solo_enc, @@ -793,9 +767,29 @@ static void solo_enc_stop_streaming(struct vb2_queue *q) spin_unlock_irqrestore(&solo_enc->av_lock, flags); } +static void solo_enc_buf_finish(struct vb2_buffer *vb) +{ + struct solo_enc_dev *solo_enc = vb2_get_drv_priv(vb->vb2_queue); + struct sg_table *vbuf = vb2_dma_sg_plane_desc(vb, 0); + + switch (solo_enc->fmt) { + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_H264: + if (vb->v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME) + sg_copy_from_buffer(vbuf->sgl, vbuf->nents, + solo_enc->vop, solo_enc->vop_len); + break; + default: /* V4L2_PIX_FMT_MJPEG */ + sg_copy_from_buffer(vbuf->sgl, vbuf->nents, + solo_enc->jpeg_header, solo_enc->jpeg_len); + break; + } +} + static struct vb2_ops solo_enc_video_qops = { .queue_setup = solo_enc_queue_setup, .buf_queue = solo_enc_buf_queue, + .buf_finish = solo_enc_buf_finish, .start_streaming = solo_enc_start_streaming, .stop_streaming = solo_enc_stop_streaming, .wait_prepare = vb2_ops_wait_prepare, diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 50dcce6251f6..8355e55b4e8e 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -462,17 +462,12 @@ static int tw68_buf_prepare(struct vb2_buffer *vb) struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb); struct sg_table *dma = vb2_dma_sg_plane_desc(vb, 0); unsigned size, bpl; - int rc; size = (dev->width * dev->height * dev->fmt->depth) >> 3; if (vb2_plane_size(vb, 0) < size) return -EINVAL; vb2_set_plane_payload(vb, 0, size); - rc = dma_map_sg(&dev->pci->dev, dma->sgl, dma->nents, DMA_FROM_DEVICE); - if (!rc) - return -EIO; - bpl = (dev->width * dev->fmt->depth) >> 3; switch (dev->field) { case V4L2_FIELD_TOP: @@ -506,11 +501,8 @@ static void tw68_buf_finish(struct vb2_buffer *vb) { struct vb2_queue *vq = vb->vb2_queue; struct tw68_dev *dev = vb2_get_drv_priv(vq); - struct sg_table *dma = vb2_dma_sg_plane_desc(vb, 0); struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb); - dma_unmap_sg(&dev->pci->dev, dma->sgl, dma->nents, DMA_FROM_DEVICE); - pci_free_consistent(dev->pci, buf->size, buf->cpu, buf->dma); } |