diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index d360655e5deb..22055bb2eba2 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -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,