Revert "Revert "ALSA: pcm: Use SG-buffer only when direct DMA is available""
This reverts commit 456a7a7340
which is
commit 7d50b295c4af16f814ee82369c4a234df5228801 upstream.
It breaks the Android abi. If it is required in the future, it can
come back in an abi-safe way.
Bug: 161946584
Change-Id: I517a84f35ae5d791dc6ad9bcdbe3296b9e28c2bd
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
3a3afa870a
commit
639cd43433
@ -11,6 +11,7 @@
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/info.h>
|
||||
@ -65,6 +66,19 @@ static int do_alloc_pages(struct snd_card *card, int type, struct device *dev,
|
||||
__update_allocated_size(card, size);
|
||||
mutex_unlock(&card->memory_mutex);
|
||||
|
||||
|
||||
#ifdef CONFIG_SND_DMA_SGBUF
|
||||
if ((type == SNDRV_DMA_TYPE_DEV_SG || type == SNDRV_DMA_TYPE_DEV_UC_SG) &&
|
||||
!dma_is_direct(get_dma_ops(dev))) {
|
||||
/* mutate to continuous page allocation */
|
||||
dev_dbg(dev, "Use continuous page allocator\n");
|
||||
if (type == SNDRV_DMA_TYPE_DEV_SG)
|
||||
type = SNDRV_DMA_TYPE_DEV;
|
||||
else
|
||||
type = SNDRV_DMA_TYPE_DEV_UC;
|
||||
}
|
||||
#endif /* CONFIG_SND_DMA_SGBUF */
|
||||
|
||||
err = snd_dma_alloc_pages(type, dev, size, dmab);
|
||||
if (!err) {
|
||||
/* the actual allocation size might be bigger than requested,
|
||||
|
Loading…
Reference in New Issue
Block a user