Lines Matching refs:runtime

79 	struct snd_compr_runtime *runtime;  in snd_compr_open()  local
120 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); in snd_compr_open()
121 if (!runtime) { in snd_compr_open()
126 runtime->state = SNDRV_PCM_STATE_OPEN; in snd_compr_open()
127 init_waitqueue_head(&runtime->sleep); in snd_compr_open()
128 data->stream.runtime = runtime; in snd_compr_open()
134 kfree(runtime); in snd_compr_open()
144 struct snd_compr_runtime *runtime = data->stream.runtime; in snd_compr_free() local
148 switch (runtime->state) { in snd_compr_free()
159 if (!data->stream.runtime->dma_buffer_p) in snd_compr_free()
160 kfree(data->stream.runtime->buffer); in snd_compr_free()
161 kfree(data->stream.runtime); in snd_compr_free()
175 stream->runtime->total_bytes_transferred = tstamp->copied_total; in snd_compr_update_tstamp()
177 stream->runtime->total_bytes_available = tstamp->copied_total; in snd_compr_update_tstamp()
188 if (stream->runtime->total_bytes_available == 0 && in snd_compr_calc_avail()
189 stream->runtime->state == SNDRV_PCM_STATE_SETUP && in snd_compr_calc_avail()
192 return stream->runtime->buffer_size; in snd_compr_calc_avail()
195 stream->runtime->total_bytes_available, in snd_compr_calc_avail()
196 stream->runtime->total_bytes_transferred); in snd_compr_calc_avail()
197 if (stream->runtime->total_bytes_available == in snd_compr_calc_avail()
198 stream->runtime->total_bytes_transferred) { in snd_compr_calc_avail()
201 return stream->runtime->buffer_size; in snd_compr_calc_avail()
208 avail->avail = stream->runtime->total_bytes_available - in snd_compr_calc_avail()
209 stream->runtime->total_bytes_transferred; in snd_compr_calc_avail()
211 avail->avail = stream->runtime->buffer_size - avail->avail; in snd_compr_calc_avail()
233 switch (stream->runtime->state) { in snd_compr_ioctl_avail()
253 struct snd_compr_runtime *runtime = stream->runtime; in snd_compr_write_data() local
255 u64 app_pointer = div64_u64(runtime->total_bytes_available, in snd_compr_write_data()
256 runtime->buffer_size); in snd_compr_write_data()
257 app_pointer = runtime->total_bytes_available - in snd_compr_write_data()
258 (app_pointer * runtime->buffer_size); in snd_compr_write_data()
260 dstn = runtime->buffer + app_pointer; in snd_compr_write_data()
263 if (count < runtime->buffer_size - app_pointer) { in snd_compr_write_data()
267 copy = runtime->buffer_size - app_pointer; in snd_compr_write_data()
270 if (copy_from_user(runtime->buffer, buf + copy, count - copy)) in snd_compr_write_data()
293 switch (stream->runtime->state) { in snd_compr_write()
316 stream->runtime->total_bytes_available += retval; in snd_compr_write()
320 if (stream->runtime->state == SNDRV_PCM_STATE_SETUP) { in snd_compr_write()
321 stream->runtime->state = SNDRV_PCM_STATE_PREPARED; in snd_compr_write()
348 switch (stream->runtime->state) { in snd_compr_read()
373 stream->runtime->total_bytes_transferred += retval; in snd_compr_read()
407 switch (stream->runtime->state) { in snd_compr_poll()
416 poll_wait(f, &stream->runtime->sleep, wait); in snd_compr_poll()
421 switch (stream->runtime->state) { in snd_compr_poll()
427 stream->runtime->state = SNDRV_PCM_STATE_SETUP; in snd_compr_poll()
432 if (avail >= stream->runtime->fragment_size) in snd_compr_poll()
494 if (snd_BUG_ON(!(stream) || !(stream)->runtime)) in snd_compr_malloc_pages()
507 stream->runtime->dma_bytes = size; in snd_compr_malloc_pages()
514 struct snd_compr_runtime *runtime; in snd_compr_free_pages() local
516 if (snd_BUG_ON(!(stream) || !(stream)->runtime)) in snd_compr_free_pages()
518 runtime = stream->runtime; in snd_compr_free_pages()
519 if (runtime->dma_area == NULL) in snd_compr_free_pages()
521 if (runtime->dma_buffer_p != &stream->dma_buffer) { in snd_compr_free_pages()
523 snd_dma_free_pages(runtime->dma_buffer_p); in snd_compr_free_pages()
524 kfree(runtime->dma_buffer_p); in snd_compr_free_pages()
546 if (stream->runtime->dma_buffer_p) { in snd_compr_allocate_buffer()
548 if (buffer_size > stream->runtime->dma_buffer_p->bytes) in snd_compr_allocate_buffer()
552 buffer = stream->runtime->dma_buffer_p->area; in snd_compr_allocate_buffer()
561 stream->runtime->fragment_size = params->buffer.fragment_size; in snd_compr_allocate_buffer()
562 stream->runtime->fragments = params->buffer.fragments; in snd_compr_allocate_buffer()
563 stream->runtime->buffer = buffer; in snd_compr_allocate_buffer()
564 stream->runtime->buffer_size = buffer_size; in snd_compr_allocate_buffer()
592 if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) { in snd_compr_set_params()
618 stream->runtime->state = SNDRV_PCM_STATE_SETUP; in snd_compr_set_params()
710 switch (stream->runtime->state) { in snd_compr_pause()
714 stream->runtime->state = SNDRV_PCM_STATE_PAUSED; in snd_compr_pause()
733 switch (stream->runtime->state) { in snd_compr_resume()
737 stream->runtime->state = SNDRV_PCM_STATE_RUNNING; in snd_compr_resume()
756 switch (stream->runtime->state) { in snd_compr_start()
769 stream->runtime->state = SNDRV_PCM_STATE_RUNNING; in snd_compr_start()
777 switch (stream->runtime->state) { in snd_compr_stop()
793 stream->runtime->total_bytes_available = 0; in snd_compr_stop()
794 stream->runtime->total_bytes_transferred = 0; in snd_compr_stop()
808 wake_up(&stream->runtime->sleep); in error_delayed_work()
827 if (stream->runtime->state == state) in snd_compr_stop_error()
830 stream->runtime->state = state; in snd_compr_stop_error()
852 stream->runtime->state = SNDRV_PCM_STATE_DRAINING; in snd_compress_wait_for_drain()
861 ret = wait_event_interruptible(stream->runtime->sleep, in snd_compress_wait_for_drain()
862 (stream->runtime->state != SNDRV_PCM_STATE_DRAINING)); in snd_compress_wait_for_drain()
869 wake_up(&stream->runtime->sleep); in snd_compress_wait_for_drain()
879 switch (stream->runtime->state) { in snd_compr_drain()
894 wake_up(&stream->runtime->sleep); in snd_compr_drain()
906 if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) in snd_compr_next_track()
931 switch (stream->runtime->state) { in snd_compr_partial_drain()
955 wake_up(&stream->runtime->sleep); in snd_compr_partial_drain()