Lines Matching refs:substream

75 static int preallocate_pcm_pages(struct snd_pcm_substream *substream,  in preallocate_pcm_pages()  argument
78 struct snd_dma_buffer *dmab = &substream->dma_buffer; in preallocate_pcm_pages()
79 struct snd_card *card = substream->pcm->card; in preallocate_pcm_pages()
85 substream->stream, size, dmab); in preallocate_pcm_pages()
94 substream->pcm->card->number, substream->pcm->device, in preallocate_pcm_pages()
95 substream->stream ? 'c' : 'p', substream->number, in preallocate_pcm_pages()
96 substream->pcm->name, orig_size); in preallocate_pcm_pages()
106 void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) in snd_pcm_lib_preallocate_free() argument
108 do_free_pages(substream->pcm->card, &substream->dma_buffer); in snd_pcm_lib_preallocate_free()
119 struct snd_pcm_substream *substream; in snd_pcm_lib_preallocate_free_for_all() local
122 for_each_pcm_substream(pcm, stream, substream) in snd_pcm_lib_preallocate_free_for_all()
123 snd_pcm_lib_preallocate_free(substream); in snd_pcm_lib_preallocate_free_for_all()
136 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_proc_read() local
137 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_buffer.bytes / 1024); in snd_pcm_lib_preallocate_proc_read()
148 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_max_proc_read() local
149 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_max / 1024); in snd_pcm_lib_preallocate_max_proc_read()
160 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_proc_write() local
161 struct snd_card *card = substream->pcm->card; in snd_pcm_lib_preallocate_proc_write()
166 if (substream->runtime) { in snd_pcm_lib_preallocate_proc_write()
173 if ((size != 0 && size < 8192) || size > substream->dma_max) { in snd_pcm_lib_preallocate_proc_write()
177 if (substream->dma_buffer.bytes == size) in snd_pcm_lib_preallocate_proc_write()
180 new_dmab.dev = substream->dma_buffer.dev; in snd_pcm_lib_preallocate_proc_write()
183 substream->dma_buffer.dev.type, in snd_pcm_lib_preallocate_proc_write()
184 substream->dma_buffer.dev.dev, in snd_pcm_lib_preallocate_proc_write()
185 substream->stream, in snd_pcm_lib_preallocate_proc_write()
189 substream->pcm->card->number, substream->pcm->device, in snd_pcm_lib_preallocate_proc_write()
190 substream->stream ? 'c' : 'p', substream->number, in snd_pcm_lib_preallocate_proc_write()
191 substream->pcm->name, size); in snd_pcm_lib_preallocate_proc_write()
194 substream->buffer_bytes_max = size; in snd_pcm_lib_preallocate_proc_write()
196 substream->buffer_bytes_max = UINT_MAX; in snd_pcm_lib_preallocate_proc_write()
198 if (substream->dma_buffer.area) in snd_pcm_lib_preallocate_proc_write()
199 do_free_pages(card, &substream->dma_buffer); in snd_pcm_lib_preallocate_proc_write()
200 substream->dma_buffer = new_dmab; in snd_pcm_lib_preallocate_proc_write()
206 static inline void preallocate_info_init(struct snd_pcm_substream *substream) in preallocate_info_init() argument
210 entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", in preallocate_info_init()
211 substream->proc_root); in preallocate_info_init()
213 snd_info_set_text_ops(entry, substream, in preallocate_info_init()
218 entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", in preallocate_info_init()
219 substream->proc_root); in preallocate_info_init()
221 snd_info_set_text_ops(entry, substream, in preallocate_info_init()
226 static inline void preallocate_info_init(struct snd_pcm_substream *substream) in preallocate_info_init() argument
234 static int preallocate_pages(struct snd_pcm_substream *substream, in preallocate_pages() argument
240 if (snd_BUG_ON(substream->dma_buffer.dev.type)) in preallocate_pages()
243 substream->dma_buffer.dev.type = type; in preallocate_pages()
244 substream->dma_buffer.dev.dev = data; in preallocate_pages()
249 err = preallocate_pcm_pages(substream, size, true); in preallocate_pages()
253 substream->number < maximum_substreams) { in preallocate_pages()
254 err = preallocate_pcm_pages(substream, size, false); in preallocate_pages()
260 if (substream->dma_buffer.bytes > 0) in preallocate_pages()
261 substream->buffer_bytes_max = substream->dma_buffer.bytes; in preallocate_pages()
262 substream->dma_max = max; in preallocate_pages()
264 preallocate_info_init(substream); in preallocate_pages()
266 substream->managed_buffer_alloc = 1; in preallocate_pages()
274 struct snd_pcm_substream *substream; in preallocate_pages_for_all() local
277 for_each_pcm_substream(pcm, stream, substream) { in preallocate_pages_for_all()
278 err = preallocate_pages(substream, type, data, size, max, managed); in preallocate_pages_for_all()
295 void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, in snd_pcm_lib_preallocate_pages() argument
299 preallocate_pages(substream, type, data, size, max, false); in snd_pcm_lib_preallocate_pages()
351 int snd_pcm_set_managed_buffer(struct snd_pcm_substream *substream, int type, in snd_pcm_set_managed_buffer() argument
354 return preallocate_pages(substream, type, data, size, max, true); in snd_pcm_set_managed_buffer()
389 int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size) in snd_pcm_lib_malloc_pages() argument
395 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_malloc_pages()
397 if (snd_BUG_ON(substream->dma_buffer.dev.type == in snd_pcm_lib_malloc_pages()
400 runtime = substream->runtime; in snd_pcm_lib_malloc_pages()
401 card = substream->pcm->card; in snd_pcm_lib_malloc_pages()
411 snd_pcm_lib_free_pages(substream); in snd_pcm_lib_malloc_pages()
413 if (substream->dma_buffer.area != NULL && in snd_pcm_lib_malloc_pages()
414 substream->dma_buffer.bytes >= size) { in snd_pcm_lib_malloc_pages()
415 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ in snd_pcm_lib_malloc_pages()
418 if (substream->dma_buffer.area && !substream->dma_max) in snd_pcm_lib_malloc_pages()
423 dmab->dev = substream->dma_buffer.dev; in snd_pcm_lib_malloc_pages()
425 substream->dma_buffer.dev.type, in snd_pcm_lib_malloc_pages()
426 substream->dma_buffer.dev.dev, in snd_pcm_lib_malloc_pages()
427 substream->stream, in snd_pcm_lib_malloc_pages()
431 substream->pcm->card->number, substream->pcm->device, in snd_pcm_lib_malloc_pages()
432 substream->stream ? 'c' : 'p', substream->number, in snd_pcm_lib_malloc_pages()
433 substream->pcm->name, size); in snd_pcm_lib_malloc_pages()
437 snd_pcm_set_runtime_buffer(substream, dmab); in snd_pcm_lib_malloc_pages()
451 int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream) in snd_pcm_lib_free_pages() argument
453 struct snd_card *card = substream->pcm->card; in snd_pcm_lib_free_pages()
456 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_free_pages()
458 runtime = substream->runtime; in snd_pcm_lib_free_pages()
461 if (runtime->dma_buffer_p != &substream->dma_buffer) { in snd_pcm_lib_free_pages()
466 snd_pcm_set_runtime_buffer(substream, NULL); in snd_pcm_lib_free_pages()
471 int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, in _snd_pcm_lib_alloc_vmalloc_buffer() argument
476 if (PCM_RUNTIME_CHECK(substream)) in _snd_pcm_lib_alloc_vmalloc_buffer()
478 runtime = substream->runtime; in _snd_pcm_lib_alloc_vmalloc_buffer()
499 int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream) in snd_pcm_lib_free_vmalloc_buffer() argument
503 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_free_vmalloc_buffer()
505 runtime = substream->runtime; in snd_pcm_lib_free_vmalloc_buffer()
522 struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, in snd_pcm_lib_get_vmalloc_page() argument
525 return vmalloc_to_page(substream->runtime->dma_area + offset); in snd_pcm_lib_get_vmalloc_page()