Lines Matching refs:stream
221 static bool copy_playback_data(struct ua101_stream *stream, struct urb *urb, in copy_playback_data() argument
228 runtime = stream->substream->runtime; in copy_playback_data()
229 frame_bytes = stream->frame_bytes; in copy_playback_data()
230 source = runtime->dma_area + stream->buffer_pos * frame_bytes; in copy_playback_data()
231 if (stream->buffer_pos + frames <= runtime->buffer_size) { in copy_playback_data()
235 frames1 = runtime->buffer_size - stream->buffer_pos; in copy_playback_data()
241 stream->buffer_pos += frames; in copy_playback_data()
242 if (stream->buffer_pos >= runtime->buffer_size) in copy_playback_data()
243 stream->buffer_pos -= runtime->buffer_size; in copy_playback_data()
244 stream->period_pos += frames; in copy_playback_data()
245 if (stream->period_pos >= runtime->period_size) { in copy_playback_data()
246 stream->period_pos -= runtime->period_size; in copy_playback_data()
325 static bool copy_capture_data(struct ua101_stream *stream, struct urb *urb, in copy_capture_data() argument
332 runtime = stream->substream->runtime; in copy_capture_data()
333 frame_bytes = stream->frame_bytes; in copy_capture_data()
334 dest = runtime->dma_area + stream->buffer_pos * frame_bytes; in copy_capture_data()
335 if (stream->buffer_pos + frames <= runtime->buffer_size) { in copy_capture_data()
339 frames1 = runtime->buffer_size - stream->buffer_pos; in copy_capture_data()
346 stream->buffer_pos += frames; in copy_capture_data()
347 if (stream->buffer_pos >= runtime->buffer_size) in copy_capture_data()
348 stream->buffer_pos -= runtime->buffer_size; in copy_capture_data()
349 stream->period_pos += frames; in copy_capture_data()
350 if (stream->period_pos >= runtime->period_size) { in copy_capture_data()
351 stream->period_pos -= runtime->period_size; in copy_capture_data()
360 struct ua101_stream *stream = &ua->capture; in capture_urb_complete() local
374 stream->frame_bytes; in capture_urb_complete()
381 do_period_elapsed = copy_capture_data(stream, urb, frames); in capture_urb_complete()
420 snd_pcm_period_elapsed(stream->substream); in capture_urb_complete()
442 static int submit_stream_urbs(struct ua101 *ua, struct ua101_stream *stream) in submit_stream_urbs() argument
446 for (i = 0; i < stream->queue_length; ++i) { in submit_stream_urbs()
447 int err = usb_submit_urb(&stream->urbs[i]->urb, GFP_KERNEL); in submit_stream_urbs()
457 static void kill_stream_urbs(struct ua101_stream *stream) in kill_stream_urbs() argument
461 for (i = 0; i < stream->queue_length; ++i) in kill_stream_urbs()
462 if (stream->urbs[i]) in kill_stream_urbs()
463 usb_kill_urb(&stream->urbs[i]->urb); in kill_stream_urbs()
868 struct ua101_stream *stream) in ua101_pcm_pointer() argument
874 pos = stream->buffer_pos; in ua101_pcm_pointer()
1052 static int alloc_stream_buffers(struct ua101 *ua, struct ua101_stream *stream) in alloc_stream_buffers() argument
1057 stream->queue_length = queue_length; in alloc_stream_buffers()
1058 stream->queue_length = max(stream->queue_length, in alloc_stream_buffers()
1060 stream->queue_length = min(stream->queue_length, in alloc_stream_buffers()
1069 remaining_packets = stream->queue_length; in alloc_stream_buffers()
1070 packets_per_page = PAGE_SIZE / stream->max_packet_bytes; in alloc_stream_buffers()
1071 for (i = 0; i < ARRAY_SIZE(stream->buffers); ++i) { in alloc_stream_buffers()
1073 size = packets * stream->max_packet_bytes; in alloc_stream_buffers()
1074 stream->buffers[i].addr = in alloc_stream_buffers()
1076 &stream->buffers[i].dma); in alloc_stream_buffers()
1077 if (!stream->buffers[i].addr) in alloc_stream_buffers()
1079 stream->buffers[i].size = size; in alloc_stream_buffers()
1091 static void free_stream_buffers(struct ua101 *ua, struct ua101_stream *stream) in free_stream_buffers() argument
1095 for (i = 0; i < ARRAY_SIZE(stream->buffers); ++i) in free_stream_buffers()
1097 stream->buffers[i].size, in free_stream_buffers()
1098 stream->buffers[i].addr, in free_stream_buffers()
1099 stream->buffers[i].dma); in free_stream_buffers()
1102 static int alloc_stream_urbs(struct ua101 *ua, struct ua101_stream *stream, in alloc_stream_urbs() argument
1105 unsigned max_packet_size = stream->max_packet_bytes; in alloc_stream_urbs()
1109 for (b = 0; b < ARRAY_SIZE(stream->buffers); ++b) { in alloc_stream_urbs()
1110 unsigned int size = stream->buffers[b].size; in alloc_stream_urbs()
1111 u8 *addr = stream->buffers[b].addr; in alloc_stream_urbs()
1112 dma_addr_t dma = stream->buffers[b].dma; in alloc_stream_urbs()
1115 if (u >= stream->queue_length) in alloc_stream_urbs()
1122 urb->urb.pipe = stream->usb_pipe; in alloc_stream_urbs()
1133 stream->urbs[u++] = urb; in alloc_stream_urbs()
1139 if (u == stream->queue_length) in alloc_stream_urbs()
1146 static void free_stream_urbs(struct ua101_stream *stream) in free_stream_urbs() argument
1150 for (i = 0; i < stream->queue_length; ++i) { in free_stream_urbs()
1151 kfree(stream->urbs[i]); in free_stream_urbs()
1152 stream->urbs[i] = NULL; in free_stream_urbs()