ASoC: intel: atom: Fix breakage for PCM buffer address setup
Subsystems (3)
PATCH 1/1 ASoC: intel: atom: Fix breakage for PCM buffer address setup
The commit 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM buffer address") changed the reference of PCM buffer address to substream->runtime->dma_addr as the buffer address may change dynamically. However, I forgot that the dma_addr field is still not set up for the CONTINUOUS buffer type (that this driver uses) yet in 5.14 and earlier kernels, and it resulted in garbage I/O. The problem will be fixed in 5.15, but we need to address it quickly for now.
The fix is to deduce the address again from the DMA pointer with virt_to_phys(), but from the right one, substream->runtime->dma_area.
--- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/atom/sst-mfld-platform-pcm.c +1 -1
@@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream,snd_pcm_uframes_t period_size;ssize_t periodbytes;ssize_t buffer_bytes =snd_pcm_lib_buffer_bytes (substream); -u32 buffer_addr = substream->runtime->dma_addr; +u32 buffer_addr =virt_to_phys (substream->runtime->dma_area); channels = substream->runtime->channels; period_size = substream->runtime->period_size;
Signature · 1 line
2.26.2
Quoted 12 lines · Takashi Iwai
The commit
2e6b836312a4("ASoC: intel: atom: Fix reference to PCM buffer address") changed the reference of PCM buffer address tosubstream->runtime->dma_addras the buffer address may change dynamically. However, I forgot that thedma_addrfield is still not set up for the CONTINUOUS buffer type (that this driver uses) yet in 5.14 and earlier kernels, and it resulted in garbage I/O. The problem will be fixed in 5.15, but we need to address it quickly for now.The fix is to deduce the address again from the DMA pointer with
virt_to_phys(), but from the right one,substream->runtime->dma_area.
Quoted 6 lines
Fixes 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM buffer address")Reported-and-tested-by Hans de Goede <[email protected]>Cc <[email protected]>Signed-off-by Takashi Iwai <[email protected]>---
Mark, as it's close to the 5.14 final, exceptionally I'd like to merge this into my tree directly now, so that it can be certainly included in the next PR to Linus.
(Also because the commit will be reverted on for-next again, too.)
After the merge, feel free to pull my for-linus branch into yours.
thanks,
Takashi
Quoted 6 lines · Takashi Iwai
Mark, as it's close to the 5.14 final, exceptionally I'd like to merge this into my tree directly now, so that it can be certainly included in the next PR to Linus.
(Also because the commit will be reverted on for-next again, too.)After the merge, feel free to pull my for-linus branch into yours.
Quoted 11 lines · Mark Brown
Quoted 6 lines · Takashi Iwai
Mark, as it's close to the 5.14 final, exceptionally I'd like to merge this into my tree directly now, so that it can be certainly included in the next PR to Linus.
(Also because the commit will be reverted on for-next again, too.)After the merge, feel free to pull my for-linus branch into yours.
Acked-by Mark Brown <[email protected]>
Thanks, now merged and pushed out for-linus branch, commit 65ca89c2b12cca0d473f3dd54267568ad3af55cc.
Takashi