Lines Matching refs:substream

36 static int preallocate_pcm_pages(struct snd_pcm_substream *substream, size_t size)  in preallocate_pcm_pages()  argument
38 struct snd_dma_buffer *dmab = &substream->dma_buffer; in preallocate_pcm_pages()
53 substream->pcm->card->number, substream->pcm->device, in preallocate_pcm_pages()
54 substream->stream ? 'c' : 'p', substream->number, in preallocate_pcm_pages()
55 substream->pcm->name, orig_size); in preallocate_pcm_pages()
62 static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream) in snd_pcm_lib_preallocate_dma_free() argument
64 if (substream->dma_buffer.area == NULL) in snd_pcm_lib_preallocate_dma_free()
66 snd_dma_free_pages(&substream->dma_buffer); in snd_pcm_lib_preallocate_dma_free()
67 substream->dma_buffer.area = NULL; in snd_pcm_lib_preallocate_dma_free()
76 void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream) in snd_pcm_lib_preallocate_free() argument
78 snd_pcm_lib_preallocate_dma_free(substream); in snd_pcm_lib_preallocate_free()
89 struct snd_pcm_substream *substream; in snd_pcm_lib_preallocate_free_for_all() local
93 for (substream = pcm->streams[stream].substream; substream; substream = substream->next) in snd_pcm_lib_preallocate_free_for_all()
94 snd_pcm_lib_preallocate_free(substream); in snd_pcm_lib_preallocate_free_for_all()
107 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_proc_read() local
108 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_buffer.bytes / 1024); in snd_pcm_lib_preallocate_proc_read()
119 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_max_proc_read() local
120 snd_iprintf(buffer, "%lu\n", (unsigned long) substream->dma_max / 1024); in snd_pcm_lib_preallocate_max_proc_read()
131 struct snd_pcm_substream *substream = entry->private_data; in snd_pcm_lib_preallocate_proc_write() local
136 if (substream->runtime) { in snd_pcm_lib_preallocate_proc_write()
143 if ((size != 0 && size < 8192) || size > substream->dma_max) { in snd_pcm_lib_preallocate_proc_write()
147 if (substream->dma_buffer.bytes == size) in snd_pcm_lib_preallocate_proc_write()
150 new_dmab.dev = substream->dma_buffer.dev; in snd_pcm_lib_preallocate_proc_write()
152 if (snd_dma_alloc_pages(substream->dma_buffer.dev.type, in snd_pcm_lib_preallocate_proc_write()
153 substream->dma_buffer.dev.dev, in snd_pcm_lib_preallocate_proc_write()
158 substream->buffer_bytes_max = size; in snd_pcm_lib_preallocate_proc_write()
160 substream->buffer_bytes_max = UINT_MAX; in snd_pcm_lib_preallocate_proc_write()
162 if (substream->dma_buffer.area) in snd_pcm_lib_preallocate_proc_write()
163 snd_dma_free_pages(&substream->dma_buffer); in snd_pcm_lib_preallocate_proc_write()
164 substream->dma_buffer = new_dmab; in snd_pcm_lib_preallocate_proc_write()
170 static inline void preallocate_info_init(struct snd_pcm_substream *substream) in preallocate_info_init() argument
174 entry = snd_info_create_card_entry(substream->pcm->card, "prealloc", in preallocate_info_init()
175 substream->proc_root); in preallocate_info_init()
177 snd_info_set_text_ops(entry, substream, in preallocate_info_init()
182 entry = snd_info_create_card_entry(substream->pcm->card, "prealloc_max", in preallocate_info_init()
183 substream->proc_root); in preallocate_info_init()
185 snd_info_set_text_ops(entry, substream, in preallocate_info_init()
196 static void snd_pcm_lib_preallocate_pages1(struct snd_pcm_substream *substream, in snd_pcm_lib_preallocate_pages1() argument
200 if (size > 0 && preallocate_dma && substream->number < maximum_substreams) in snd_pcm_lib_preallocate_pages1()
201 preallocate_pcm_pages(substream, size); in snd_pcm_lib_preallocate_pages1()
203 if (substream->dma_buffer.bytes > 0) in snd_pcm_lib_preallocate_pages1()
204 substream->buffer_bytes_max = substream->dma_buffer.bytes; in snd_pcm_lib_preallocate_pages1()
205 substream->dma_max = max; in snd_pcm_lib_preallocate_pages1()
206 preallocate_info_init(substream); in snd_pcm_lib_preallocate_pages1()
220 void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, in snd_pcm_lib_preallocate_pages() argument
224 substream->dma_buffer.dev.type = type; in snd_pcm_lib_preallocate_pages()
225 substream->dma_buffer.dev.dev = data; in snd_pcm_lib_preallocate_pages()
226 snd_pcm_lib_preallocate_pages1(substream, size, max); in snd_pcm_lib_preallocate_pages()
245 struct snd_pcm_substream *substream; in snd_pcm_lib_preallocate_pages_for_all() local
249 for (substream = pcm->streams[stream].substream; substream; substream = substream->next) in snd_pcm_lib_preallocate_pages_for_all()
250 snd_pcm_lib_preallocate_pages(substream, type, data, size, max); in snd_pcm_lib_preallocate_pages_for_all()
264 struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset) in snd_pcm_sgbuf_ops_page() argument
266 struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); in snd_pcm_sgbuf_ops_page()
287 int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size) in snd_pcm_lib_malloc_pages() argument
292 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_malloc_pages()
294 if (snd_BUG_ON(substream->dma_buffer.dev.type == in snd_pcm_lib_malloc_pages()
297 runtime = substream->runtime; in snd_pcm_lib_malloc_pages()
307 snd_pcm_lib_free_pages(substream); in snd_pcm_lib_malloc_pages()
309 if (substream->dma_buffer.area != NULL && in snd_pcm_lib_malloc_pages()
310 substream->dma_buffer.bytes >= size) { in snd_pcm_lib_malloc_pages()
311 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ in snd_pcm_lib_malloc_pages()
316 dmab->dev = substream->dma_buffer.dev; in snd_pcm_lib_malloc_pages()
317 if (snd_dma_alloc_pages(substream->dma_buffer.dev.type, in snd_pcm_lib_malloc_pages()
318 substream->dma_buffer.dev.dev, in snd_pcm_lib_malloc_pages()
324 snd_pcm_set_runtime_buffer(substream, dmab); in snd_pcm_lib_malloc_pages()
338 int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream) in snd_pcm_lib_free_pages() argument
342 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_free_pages()
344 runtime = substream->runtime; in snd_pcm_lib_free_pages()
347 if (runtime->dma_buffer_p != &substream->dma_buffer) { in snd_pcm_lib_free_pages()
352 snd_pcm_set_runtime_buffer(substream, NULL); in snd_pcm_lib_free_pages()
357 int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, in _snd_pcm_lib_alloc_vmalloc_buffer() argument
362 if (PCM_RUNTIME_CHECK(substream)) in _snd_pcm_lib_alloc_vmalloc_buffer()
364 runtime = substream->runtime; in _snd_pcm_lib_alloc_vmalloc_buffer()
385 int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream) in snd_pcm_lib_free_vmalloc_buffer() argument
389 if (PCM_RUNTIME_CHECK(substream)) in snd_pcm_lib_free_vmalloc_buffer()
391 runtime = substream->runtime; in snd_pcm_lib_free_vmalloc_buffer()
408 struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, in snd_pcm_lib_get_vmalloc_page() argument
411 return vmalloc_to_page(substream->runtime->dma_area + offset); in snd_pcm_lib_get_vmalloc_page()