diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-09-20 20:29:12 -0700 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-09-23 11:24:42 +0200 |
commit | 9d069dc00b02b886abe3cab5e369140f7cd78965 (patch) | |
tree | d2f29878332a7c36a6c30128b67b2780c4a44f41 /sound | |
parent | 3d98c21d064bfbb8c6fddc659471acb4950320fa (diff) | |
download | blackbird-op-linux-9d069dc00b02b886abe3cab5e369140f7cd78965.tar.gz blackbird-op-linux-9d069dc00b02b886abe3cab5e369140f7cd78965.zip |
ALSA: Make snd_sgbuf_get_{ptr|addr}() available for non-SG cases
Passing struct snd_dma_buffer pointer instead, so that they work no
matter whether real SG buffer is used or not.
This is a preliminary work for the HD-audio DSP loader code.
Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/pcm_memory.c | 26 | ||||
-rw-r--r-- | sound/core/sgbuf.c | 27 |
2 files changed, 27 insertions, 26 deletions
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index 957131366dd9..69e01c4fc32d 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c @@ -327,32 +327,6 @@ struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigne } EXPORT_SYMBOL(snd_pcm_sgbuf_ops_page); - -/* - * compute the max chunk size with continuous pages on sg-buffer - */ -unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, - unsigned int ofs, unsigned int size) -{ - struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream); - unsigned int start, end, pg; - - start = ofs >> PAGE_SHIFT; - end = (ofs + size - 1) >> PAGE_SHIFT; - /* check page continuity */ - pg = sg->table[start].addr >> PAGE_SHIFT; - for (;;) { - start++; - if (start > end) - break; - pg++; - if ((sg->table[start].addr >> PAGE_SHIFT) != pg) - return (start << PAGE_SHIFT) - ofs; - } - /* ok, all on continuous pages */ - return size; -} -EXPORT_SYMBOL(snd_pcm_sgbuf_get_chunk_size); #endif /* CONFIG_SND_DMA_SGBUF */ /** diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c index d0f00356fc11..0a418503ec41 100644 --- a/sound/core/sgbuf.c +++ b/sound/core/sgbuf.c @@ -22,6 +22,7 @@ #include <linux/slab.h> #include <linux/mm.h> #include <linux/vmalloc.h> +#include <linux/export.h> #include <sound/memalloc.h> @@ -136,3 +137,29 @@ void *snd_malloc_sgbuf_pages(struct device *device, snd_free_sgbuf_pages(dmab); /* free the table */ return NULL; } + +/* + * compute the max chunk size with continuous pages on sg-buffer + */ +unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab, + unsigned int ofs, unsigned int size) +{ + struct snd_sg_buf *sg = dmab->private_data; + unsigned int start, end, pg; + + start = ofs >> PAGE_SHIFT; + end = (ofs + size - 1) >> PAGE_SHIFT; + /* check page continuity */ + pg = sg->table[start].addr >> PAGE_SHIFT; + for (;;) { + start++; + if (start > end) + break; + pg++; + if ((sg->table[start].addr >> PAGE_SHIFT) != pg) + return (start << PAGE_SHIFT) - ofs; + } + /* ok, all on continuous pages */ + return size; +} +EXPORT_SYMBOL(snd_sgbuf_get_chunk_size); |