|
@@ -422,19 +422,30 @@ static void cx23885_wakeup(struct cx23885_tsport *port,
|
|
|
struct cx23885_dmaqueue *q, u32 count)
|
|
|
{
|
|
|
struct cx23885_buffer *buf;
|
|
|
-
|
|
|
- if (list_empty(&q->active))
|
|
|
- return;
|
|
|
- buf = list_entry(q->active.next,
|
|
|
- struct cx23885_buffer, queue);
|
|
|
-
|
|
|
- buf->vb.vb2_buf.timestamp = ktime_get_ns();
|
|
|
- buf->vb.sequence = q->count++;
|
|
|
- dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
|
|
|
- buf->vb.vb2_buf.index,
|
|
|
- count, q->count);
|
|
|
- list_del(&buf->queue);
|
|
|
- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
|
|
+ int count_delta;
|
|
|
+ int max_buf_done = 5; /* service maximum five buffers */
|
|
|
+
|
|
|
+ do {
|
|
|
+ if (list_empty(&q->active))
|
|
|
+ return;
|
|
|
+ buf = list_entry(q->active.next,
|
|
|
+ struct cx23885_buffer, queue);
|
|
|
+
|
|
|
+ buf->vb.vb2_buf.timestamp = ktime_get_ns();
|
|
|
+ buf->vb.sequence = q->count++;
|
|
|
+ if (count != (q->count % 65536)) {
|
|
|
+ dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
|
|
|
+ buf->vb.vb2_buf.index, count, q->count);
|
|
|
+ } else {
|
|
|
+ dprintk(7, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
|
|
|
+ buf->vb.vb2_buf.index, count, q->count);
|
|
|
+ }
|
|
|
+ list_del(&buf->queue);
|
|
|
+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
|
|
|
+ max_buf_done--;
|
|
|
+ /* count register is 16 bits so apply modulo appropriately */
|
|
|
+ count_delta = ((int)count - (int)(q->count % 65536));
|
|
|
+ } while ((count_delta > 0) && (max_buf_done > 0));
|
|
|
}
|
|
|
|
|
|
int cx23885_sram_channel_setup(struct cx23885_dev *dev,
|