kernel-fxtec-pro1x/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 ASoC: axi-{spdif,i2s}: Remove SND_DMAENGINE_PCM_FLAG_NO_RESIDUE flag 2014-01-14 21:28:39 +00:00
atmel sound updates for 3.16-rc1 2014-06-04 09:08:25 -07:00
au1x ASoC: au1x: Don't set unused struct snd_pcm_hardware fields 2013-12-21 14:23:20 +00:00
bcm ASoC: bcm: Remove obsoleted Kconfig dependency 2014-01-08 20:00:04 +00:00
blackfin ASoC: Blackfin: ADAU1X81 eval board support 2014-05-27 20:54:51 +01:00
cirrus Merge remote-tracking branch 'asoc/topic/cirrus' into asoc-next 2014-03-13 14:19:11 +00:00
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 ASoC: designware_i2s: Remove unnecessary dev_set_drvdata() 2013-08-29 13:18:32 +01:00
fsl Update imx-sdma cyclic handling to report residue 2014-07-01 12:23:42 +05:30
generic ASoC: simple-card: Support setting mclk via a fixed factor 2014-05-26 14:29:30 +01:00
intel Merge remote-tracking branches 'asoc/topic/gpio' and 'asoc/topic/intel' into asoc-next 2014-06-03 10:39:50 +01:00
jz4740 Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next 2014-05-22 00:23:54 +01:00
kirkwood ASoC: Remove needless snd_soc_dapm_enable_pin() from machine driver inits 2014-05-19 17:19:18 +01:00
mxs Merge remote-tracking branches 'asoc/topic/adsp', 'asoc/topic/atmel', 'asoc/topic/bcm2835', 'asoc/topic/docs', 'asoc/topic/fsl', 'asoc/topic/generic', 'asoc/topic/kirkwood', 'asoc/topic/mc13783', 'asoc/topic/mxs', 'asoc/topic/nuc900', 'asoc/topic/sai', 'asoc/topic/sh', 'asoc/topic/ssm2602', 'asoc/topic/tlv320aic3x', 'asoc/topic/twl4030', 'asoc/topic/ux500', 'asoc/topic/width' and 'asoc/topic/x86' into for-tiwai 2014-01-16 12:44:01 +00:00
nuc900 ASoC: nuc900: export nuc900_ac97_data 2014-04-30 20:32:20 -07:00
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 ASoC: s6105-ipcam: Convert to table based DAPM setup 2014-03-13 11:43:30 +00:00
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 ASoC: sirf: Move the tx rx enable from port to codec, that will not need register sharing 2014-04-14 17:28:17 +01:00
spear ASoC: spear: spdif_out: Fix mute control 2014-03-10 17:43:15 +00:00
tegra Merge remote-tracking branch 'asoc/topic/tegra' into asoc-next 2014-06-03 10:39:59 +01:00
txx9 ASoC: txx9aclc_ac97: Fix kernel crash on probe 2014-02-16 08:36:40 +08:00
ux500 ASoC: mop500_ab8500: Replace instances of rtd->codec->card with rtd->card 2014-05-20 22:55:39 +01:00
Kconfig ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec 2014-03-06 17:20:08 +08:00
Makefile ASoC: sirf: Add SiRF audio port driver is used by SiRF internal audio codec 2014-03-06 17:20:08 +08:00
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 ASoC: compress: indent an if statement 2014-05-14 16:15:03 +01:00
soc-core.c Merge remote-tracking branches 'asoc/topic/rt5651', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/sh', 'asoc/topic/simple', 'asoc/topic/sirf', 'asoc/topic/sta350' and 'asoc/topic/tlv320dac33' into asoc-next 2014-05-22 00:24:00 +01:00
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 ASoC: Export devm_snd_soc_register_platform() 2014-04-22 22:00:42 +01:00
soc-generic-dmaengine-pcm.c ASoC: core: Fix possible NULL pointer dereference of pcm->config 2014-01-16 14:11:49 +00:00
soc-io.c ASoC: Remove ASoC level IO tracing 2014-04-22 13:24:24 +01:00
soc-jack.c ASoC: jack: Add support for GPIO descriptor defined jack pins 2014-05-26 15:26:00 +01:00
soc-pcm.c Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next 2014-05-22 00:23:54 +01:00
soc-utils.c Merge remote-tracking branch 'asoc/topic/dapm' into for-tiwai 2014-01-16 12:42:53 +00:00