dmaengine: apple-admac: Allocate cache SRAM to channels
authorMartin Povišer <povik+lin@cutebit.org>
Wed, 19 Oct 2022 13:23:24 +0000 (15:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:46 +0000 (13:32 +0100)
commitd53171d1d0e76bd1ac608601ba84ff439d027ee0
tree70735ef69ca5572f317d5e5ab612849e30477fd8
parentcc743a1d832d7ab1f9024e32f241724dfcd3bee7
dmaengine: apple-admac: Allocate cache SRAM to channels

[ Upstream commit 568aa6dd641f63166bb60d769e256789b3ac42d4 ]

There's a previously unknown part of the controller interface: We have
to assign SRAM carveouts to channels to store their in-flight samples
in. So, obtain the size of the SRAM from a read-only register and divide
it into 2K blocks for allocation to channels. The FIFO depths we
configure will always fit into 2K.

(This fixes audio artifacts during simultaneous playback/capture on
multiple channels -- which looking back is fully accounted for by having
had the caches in the DMA controller overlap in memory.)

Fixes: b127315d9a78 ("dmaengine: apple-admac: Add Apple ADMAC driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20221019132324.8585-2-povik+lin@cutebit.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma/apple-admac.c