aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2015-02-24 08:00:29 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-03-03 09:17:56 -0500
commitc5036d61e0bed3f4f51391a145638b426825e69c (patch)
tree7fc4649e2977f5a61b6f5372e89e5fdb0119bb6c
parent48205533bab78ffb504af3baf783c8f46942c16d (diff)
[media] media: au0828: drop vbi_buffer_filled() and re-use buffer_filled()
The vbi_buffer_filled() and buffer_filled() did the same functionality except for incrementing the buffer sequence, this patch drops the vbi_buffer_filled() and re-uses buffer_filled() for vbi buffers as well by adding the check for vb2-queue type while incrementing the sequence numbers. Along side this patch aligns the input parameters of buffer_filled() function appropriately. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/usb/au0828/au0828-video.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index b49fe9192559..61e525fcdcc3 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -299,29 +299,23 @@ static int au0828_init_isoc(struct au0828_dev *dev, int max_packets,
299 * Announces that a buffer were filled and request the next 299 * Announces that a buffer were filled and request the next
300 */ 300 */
301static inline void buffer_filled(struct au0828_dev *dev, 301static inline void buffer_filled(struct au0828_dev *dev,
302 struct au0828_dmaqueue *dma_q, 302 struct au0828_dmaqueue *dma_q,
303 struct au0828_buffer *buf) 303 struct au0828_buffer *buf)
304{ 304{
305 /* Advice that buffer was filled */ 305 struct vb2_buffer vb = buf->vb;
306 au0828_isocdbg("[%p/%d] wakeup\n", buf, buf->top_field); 306 struct vb2_queue *q = vb.vb2_queue;
307
308 buf->vb.v4l2_buf.sequence = dev->frame_count++;
309 buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED;
310 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
311 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE);
312}
313 307
314static inline void vbi_buffer_filled(struct au0828_dev *dev,
315 struct au0828_dmaqueue *dma_q,
316 struct au0828_buffer *buf)
317{
318 /* Advice that buffer was filled */ 308 /* Advice that buffer was filled */
319 au0828_isocdbg("[%p/%d] wakeup\n", buf, buf->top_field); 309 au0828_isocdbg("[%p/%d] wakeup\n", buf, buf->top_field);
320 310
321 buf->vb.v4l2_buf.sequence = dev->vbi_frame_count++; 311 if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
322 buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; 312 vb.v4l2_buf.sequence = dev->frame_count++;
323 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); 313 else
324 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); 314 vb.v4l2_buf.sequence = dev->vbi_frame_count++;
315
316 vb.v4l2_buf.field = V4L2_FIELD_INTERLACED;
317 v4l2_get_timestamp(&vb.v4l2_buf.timestamp);
318 vb2_buffer_done(&vb, VB2_BUF_STATE_DONE);
325} 319}
326 320
327/* 321/*
@@ -574,9 +568,7 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb)
574 if (fbyte & 0x40) { 568 if (fbyte & 0x40) {
575 /* VBI */ 569 /* VBI */
576 if (vbi_buf != NULL) 570 if (vbi_buf != NULL)
577 vbi_buffer_filled(dev, 571 buffer_filled(dev, vbi_dma_q, vbi_buf);
578 vbi_dma_q,
579 vbi_buf);
580 vbi_get_next_buf(vbi_dma_q, &vbi_buf); 572 vbi_get_next_buf(vbi_dma_q, &vbi_buf);
581 if (vbi_buf == NULL) 573 if (vbi_buf == NULL)
582 vbioutp = NULL; 574 vbioutp = NULL;
@@ -945,7 +937,7 @@ static void au0828_vbi_buffer_timeout(unsigned long data)
945 if (buf != NULL) { 937 if (buf != NULL) {
946 vbi_data = vb2_plane_vaddr(&buf->vb, 0); 938 vbi_data = vb2_plane_vaddr(&buf->vb, 0);
947 memset(vbi_data, 0x00, buf->length); 939 memset(vbi_data, 0x00, buf->length);
948 vbi_buffer_filled(dev, dma_q, buf); 940 buffer_filled(dev, dma_q, buf);
949 } 941 }
950 vbi_get_next_buf(dma_q, &buf); 942 vbi_get_next_buf(dma_q, &buf);
951 943