mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 08:02:07 +00:00
d1a792f3b4
I received a report this morning from one of the Novena developers that the behaviour of the iMX6 ASoC codec driver (using imx-pcm-dma.c) was sub-optimal under high system load. While there are issues relating to system load remaining, upon reviewing the ASoC imx-pcm-dma.c driver, it was noticed that it not using the residue support, because SDMA doesn't support it. This has the effect that SDMA has to make multiple calls into the ASoC and ALSA code, one for each period. Since ALSA's snd_pcm_elapsed() does not need to be called multiple times and it is entirely sufficient to call it once to update ALSA with the current buffer position via the pointer method, we can do better here. We can also avoid stopping the DMA entirely, just like real cyclic DMA implementations behave. While this means that we replay some old samples, this is a nicer behaviour than having audio stop and restart. The changes to achieve this are relatively minor - imx-sdma.c can track where the DMA is to the nearest descriptor boundary - it does this already when deciding how many callbacks to issue. In doing this, buf_tail always points at the descriptor which will complete next. The residue is defined by the bytes remaining to the end of the buffer, when the buffer is viewed as a single block of memory [start...end]. So, when we start out, there's a full buffer worth of residue, and this counts down as we approach the end of the buffer, eventually becoming zero at the end, before returning to the full buffer worth when we wrap back to the start. Moving the walking of the descriptors into the interrupt handler means that we can update the BD_DONE flag at interrupt time, thus avoiding a delayed tasklet stopping the cyclic DMA. This means that the residue can be calculated from (total descriptors - buf_tail) * descriptor size. This is what the change below does. We update imx-pcm-dma.c to remove the NO_RESIDUE flag since we now provide the residue. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com> |
||
---|---|---|
.. | ||
bestcomm | ||
dw | ||
ioat | ||
ipu | ||
ppc4xx | ||
sh | ||
xilinx | ||
acpi-dma.c | ||
amba-pl08x.c | ||
at_hdmac_regs.h | ||
at_hdmac.c | ||
bcm2835-dma.c | ||
coh901318_lli.c | ||
coh901318.c | ||
coh901318.h | ||
cppi41.c | ||
dma-jz4740.c | ||
dmaengine.c | ||
dmaengine.h | ||
dmatest.c | ||
edma.c | ||
ep93xx_dma.c | ||
fsl-edma.c | ||
fsldma.c | ||
fsldma.h | ||
imx-dma.c | ||
imx-sdma.c | ||
intel_mid_dma_regs.h | ||
intel_mid_dma.c | ||
iop-adma.c | ||
iovlock.c | ||
k3dma.c | ||
Kconfig | ||
Makefile | ||
mmp_pdma.c | ||
mmp_tdma.c | ||
moxart-dma.c | ||
mpc512x_dma.c | ||
mv_xor.c | ||
mv_xor.h | ||
mxs-dma.c | ||
of-dma.c | ||
omap-dma.c | ||
pch_dma.c | ||
pl330.c | ||
qcom_bam_dma.c | ||
s3c24xx-dma.c | ||
sa11x0-dma.c | ||
sirf-dma.c | ||
ste_dma40_ll.c | ||
ste_dma40_ll.h | ||
ste_dma40.c | ||
tegra20-apb-dma.c | ||
timb_dma.c | ||
TODO | ||
txx9dmac.c | ||
txx9dmac.h | ||
virt-dma.c | ||
virt-dma.h |