Lines Matching refs:substream
51 static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t size) in preallocate_pcm_pages() argument
53 struct snd_dma_buffer *dmab = &substream->dma_buffer; in preallocate_pcm_pages()
68 substream->pcm->card->number, substream->pcm->device, in preallocate_pcm_pages()
69 substream->stream ? 'c' : 'p', substream->number, in preallocate_pcm_pages()
70 substream->pcm->name, orig_size); in preallocate_pcm_pages()
77 static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream) in snd_pcm_lib_preallocate_dma_free() argument
79 if (substream->dma_buffer.area == NULL) in snd_pcm_lib_preallocate_dma_free()
81 snd_dma_free_pages(&substream->dma_buffer); in snd_pcm_lib_preallocate_dma_free()
82 substream->dma_buffer.area = NULL; in snd_pcm_lib_preallocate_dma_free()
93 int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) in snd_pcm_lib_preallocate_free() argument
95 snd_pcm_lib_preallocate_dma_free(substream); in snd_pcm_lib_preallocate_free()
97 snd_info_free_entry(substream->proc_prealloc_max_entry); in snd_pcm_lib_preallocate_free()
98 substream->proc_prealloc_max_entry = NULL; in snd_pcm_lib_preallocate_free()
99 snd_info_free_entry(substream->proc_prealloc_entry); in snd_pcm_lib_preallocate_free()
100 substream->proc_prealloc_entry = NULL; in snd_pcm_lib_preallocate_free()
115 struct snd_pcm_substream *substream; in snd_pcm_lib_preallocate_free_for_all() local
119 for (substream = pcm->streams[stream].substream; substream; substream = substream->next) in snd_pcm_lib_preallocate_free_for_all()
120 snd_pcm_lib_preallocate_free(substream); in snd_pcm_lib_preallocate_free_for_all()
135 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_proc_read() local
136 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_buffer.bytes / 1024); in snd_pcm_lib_preallocate_proc_read()
147 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_max_proc_read() local
148 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_max / 1024); in snd_pcm_lib_preallocate_max_proc_read()
159 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_proc_write() local
164 if (substream->runtime) { in snd_pcm_lib_preallocate_proc_write()
171 if ((size != 0 && size < 8192) || size > substream->dma_max) { in snd_pcm_lib_preallocate_proc_write()
175 if (substream->dma_buffer.bytes == size) in snd_pcm_lib_preallocate_proc_write()
178 new_dmab.dev = substream->dma_buffer.dev; in snd_pcm_lib_preallocate_proc_write()
180 if (snd_dma_alloc_pages(substream->dma_buffer.dev.type, in snd_pcm_lib_preallocate_proc_write()
181 substream->dma_buffer.dev.dev, in snd_pcm_lib_preallocate_proc_write()
186 substream->buffer_bytes_max = size; in snd_pcm_lib_preallocate_proc_write()
188 substream->buffer_bytes_max = UINT_MAX; in snd_pcm_lib_preallocate_proc_write()
190 if (substream->dma_buffer.area) in snd_pcm_lib_preallocate_proc_write()
191 snd_dma_free_pages(&substream->dma_buffer); in snd_pcm_lib_preallocate_proc_write()
192 substream->dma_buffer = new_dmab; in snd_pcm_lib_preallocate_proc_write()
198 static inline void preallocate_info_init(struct snd_pcm_substream *substream) in preallocate_info_init() argument
202 …if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", substream->proc_root)) !… in preallocate_info_init()
206 entry->private_data = substream; in preallocate_info_init()
212 substream->proc_prealloc_entry = entry; in preallocate_info_init()
213 …if ((entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", substream->proc_root… in preallocate_info_init()
215 entry->private_data = substream; in preallocate_info_init()
221 substream->proc_prealloc_max_entry = entry; in preallocate_info_init()
231 static int snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, in snd_pcm_lib_preallocate_pages1() argument
235 if (size > 0 && preallocate_dma && substream->number < maximum_substreams) in snd_pcm_lib_preallocate_pages1()
236 preallocate_pcm_pages(substream, size); in snd_pcm_lib_preallocate_pages1()
238 if (substream->dma_buffer.bytes > 0) in snd_pcm_lib_preallocate_pages1()
239 substream->buffer_bytes_max = substream->dma_buffer.bytes; in snd_pcm_lib_preallocate_pages1()
240 substream->dma_max = max; in snd_pcm_lib_preallocate_pages1()
241 preallocate_info_init(substream); in snd_pcm_lib_preallocate_pages1()
258 int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, in snd_pcm_lib_preallocate_pages() argument
262 substream->dma_buffer.dev.type = type; in snd_pcm_lib_preallocate_pages()
263 substream->dma_buffer.dev.dev = data; in snd_pcm_lib_preallocate_pages()
264 return snd_pcm_lib_preallocate_pages1(substream, size, max); in snd_pcm_lib_preallocate_pages()
286 struct snd_pcm_substream *substream; in snd_pcm_lib_preallocate_pages_for_all() local
290 for (substream = pcm->streams[stream].substream; substream; substream = substream->next) in snd_pcm_lib_preallocate_pages_for_all()
291 if ((err = snd_pcm_lib_preallocate_pages(substream, type, data, size, max)) < 0) in snd_pcm_lib_preallocate_pages_for_all()
308 struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset) in snd_pcm_sgbuf_ops_page() argument
310 struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); in snd_pcm_sgbuf_ops_page()
332 int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size) in snd_pcm_lib_malloc_pages() argument
337 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_malloc_pages()
339 if (snd_BUG_ON(substream->dma_buffer.dev.type == in snd_pcm_lib_malloc_pages()
342 runtime = substream->runtime; in snd_pcm_lib_malloc_pages()
352 snd_pcm_lib_free_pages(substream); in snd_pcm_lib_malloc_pages()
354 if (substream->dma_buffer.area != NULL && in snd_pcm_lib_malloc_pages()
355 substream->dma_buffer.bytes >= size) { in snd_pcm_lib_malloc_pages()
356 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ in snd_pcm_lib_malloc_pages()
361 dmab->dev = substream->dma_buffer.dev; in snd_pcm_lib_malloc_pages()
362 if (snd_dma_alloc_pages(substream->dma_buffer.dev.type, in snd_pcm_lib_malloc_pages()
363 substream->dma_buffer.dev.dev, in snd_pcm_lib_malloc_pages()
369 snd_pcm_set_runtime_buffer(substream, dmab); in snd_pcm_lib_malloc_pages()
384 int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream) in snd_pcm_lib_free_pages() argument
388 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_free_pages()
390 runtime = substream->runtime; in snd_pcm_lib_free_pages()
393 if (runtime->dma_buffer_p != &substream->dma_buffer) { in snd_pcm_lib_free_pages()
398 snd_pcm_set_runtime_buffer(substream, NULL); in snd_pcm_lib_free_pages()
404 int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, in _snd_pcm_lib_alloc_vmalloc_buffer() argument
409 if (PCM_RUNTIME_CHECK(substream)) in _snd_pcm_lib_alloc_vmalloc_buffer()
411 runtime = substream->runtime; in _snd_pcm_lib_alloc_vmalloc_buffer()
432 int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream) in snd_pcm_lib_free_vmalloc_buffer() argument
436 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_free_vmalloc_buffer()
438 runtime = substream->runtime; in snd_pcm_lib_free_vmalloc_buffer()
455 struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, in snd_pcm_lib_get_vmalloc_page() argument
458 return vmalloc_to_page(substream->runtime->dma_area + offset); in snd_pcm_lib_get_vmalloc_page()