Commit 137ec7a9 authored by Stefan Roese's avatar Stefan Roese Committed by Greg Kroah-Hartman

ALSA: pcm: Use dma_bytes as size parameter in dma_mmap_coherent()

commit 9066ae7f upstream.

When trying to use the driver (e.g. aplay *.wav), the 4MiB DMA buffer
will get mmapp'ed in 16KiB chunks. But this fails with the 2nd 16KiB
area, as the page offset is outside of the VMA range (size), which is
currently used as size parameter in snd_pcm_lib_default_mmap(). By
using the DMA buffer size (dma_bytes) instead, the complete DMA buffer
can be mmapp'ed and the issue is fixed.

This issue was detected on an ARM platform (TI AM57xx) using the RME
HDSP MADI PCIe soundcard.

Fixes: 657b1989 ("ALSA: pcm - Use dma_mmap_coherent() if available")
Signed-off-by: default avatarStefan Roese <sr@denx.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 123bc864
...@@ -3408,7 +3408,7 @@ int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, ...@@ -3408,7 +3408,7 @@ int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream,
area, area,
substream->runtime->dma_area, substream->runtime->dma_area,
substream->runtime->dma_addr, substream->runtime->dma_addr,
area->vm_end - area->vm_start); substream->runtime->dma_bytes);
#endif /* CONFIG_X86 */ #endif /* CONFIG_X86 */
/* mmap with fault handler */ /* mmap with fault handler */
area->vm_ops = &snd_pcm_vm_ops_data_fault; area->vm_ops = &snd_pcm_vm_ops_data_fault;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment