52 INIT_LIST_HEAD(&q->
list);
83 spin_unlock(&q->
lock);
92 if (!list_empty(&q->
list)) {
94 list_del_init(&mdl->
list);
99 spin_unlock(&q->
lock);
103 static void _cx18_mdl_update_bufs_for_cpu(
struct cx18_stream *
s,
112 if (bytesused >= buf_size) {
119 cx18_buf_sync_for_cpu(s, buf);
123 static inline void cx18_mdl_update_bufs_for_cpu(
struct cx18_stream *s,
128 if (list_is_singular(&mdl->
buf_list)) {
133 cx18_buf_sync_for_cpu(s, buf);
135 _cx18_mdl_update_bufs_for_cpu(s, mdl);
154 spin_lock(&s->
q_busy.lock);
168 "times - it must have dropped out of "
169 "rotation\n", s->
name, mdl->
id,
172 list_move_tail(&mdl->
list, &sweep_up);
181 list_del_init(&mdl->
list);
186 spin_unlock(&s->
q_busy.lock);
196 cx18_mdl_update_bufs_for_cpu(s, ret);
203 list_del_init(&mdl->
list);
204 cx18_enqueue(s, mdl, &s->
q_free);
210 static void cx18_queue_flush(
struct cx18_stream *s,
216 if (q_src == q_dst || q_dst == &s->
q_full || q_dst == &s->
q_busy)
219 spin_lock(&q_src->
lock);
220 spin_lock(&q_dst->
lock);
221 while (!list_empty(&q_src->
list)) {
223 list_move_tail(&mdl->
list, &q_dst->
list);
232 spin_unlock(&q_src->
lock);
233 spin_unlock(&q_dst->
lock);
253 cx18_queue_flush(s, &s->
q_busy, q_idle);
254 cx18_queue_flush(s, &s->
q_full, q_idle);
255 cx18_queue_flush(s, &s->
q_free, q_idle);
258 spin_lock(&q_idle->
lock);
260 while (!list_empty(&mdl->
buf_list)) {
270 spin_unlock(&q_idle->
lock);
284 u32 partial_buf_size;
308 &cx->
scb->cpu_mdl[mdl_id + i].paddr);
310 &cx->
scb->cpu_mdl[mdl_id + i].length);
322 if (partial_buf_size) {
323 cx18_writel(cx, partial_buf_size,
324 &cx->
scb->cpu_mdl[mdl_id + i - 1].length);
326 cx18_enqueue(s, mdl, &s->
q_free);
329 cx18_push(s, mdl, &s->
q_idle);
343 pci_dma_sync_single_for_device(pci_dev, buf->
dma_handle,
356 "(%d.%02d kB total)\n",
366 CX18_ERR(
"Too many buffers, cannot fit in SCB area\n");
375 for (i = 0; i < s->
buffers; i++) {
398 INIT_LIST_HEAD(&mdl->
list);
401 cx18_enqueue(s, mdl, &s->
q_idle);
403 INIT_LIST_HEAD(&buf->
list);
406 cx18_buf_sync_for_cpu(s, buf);
413 CX18_ERR(
"Couldn't allocate buffers for %s stream\n", s->
name);
436 list_del_init(&buf->
list);