android_kernel_xiaomi_sm8350/sound/soc
Russell King - ARM Linux d1a792f3b4 Update imx-sdma cyclic handling to report residue
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>
2014-07-01 12:23:42 +05:30
..
adi
atmel sound updates for 3.16-rc1 2014-06-04 09:08:25 -07:00
au1x
bcm
blackfin
cirrus
codecs ASoC: sigmadsp: Split regmap and I2C support into separate modules 2014-06-06 14:09:45 +01:00
davinci Merge remote-tracking branches 'asoc/topic/omap' and 'asoc/topic/rcar' into asoc-next 2014-06-03 10:39:53 +01:00
dwc
fsl Update imx-sdma cyclic handling to report residue 2014-07-01 12:23:42 +05:30
generic
intel Merge remote-tracking branches 'asoc/topic/gpio' and 'asoc/topic/intel' into asoc-next 2014-06-03 10:39:50 +01:00
jz4740
kirkwood
mxs
nuc900
omap ASoC: Fix wrong argument for card remove callbacks 2014-06-03 12:52:21 +02:00
pxa Merge remote-tracking branches 'asoc/fix/fsl-dma', 'asoc/fix/fsl-spdif', 'asoc/fix/pxa', 'asoc/fix/rcar' and 'asoc/fix/sigmadsp' into asoc-linus 2014-06-16 16:05:16 +01:00
s6000
samsung ASoC: Fix wrong argument for card remove callbacks 2014-06-03 12:52:21 +02:00
sh ASoC: rsnd: fixup index of src/dst mod when capture 2014-06-12 00:33:44 +01:00
sirf
spear
tegra Merge remote-tracking branch 'asoc/topic/tegra' into asoc-next 2014-06-03 10:39:59 +01:00
txx9
ux500
Kconfig
Makefile
soc-cache.c ASoC: cache: Fix error code when not using ASoC level cache 2014-06-02 16:08:21 +01:00
soc-compress.c
soc-core.c
soc-dapm.c ASoC: dapm: Make sure register value is in sync with DAPM kcontrol state 2014-06-09 20:56:53 +01:00
soc-devres.c
soc-generic-dmaengine-pcm.c
soc-io.c
soc-jack.c
soc-pcm.c
soc-utils.c