linux/sound/soc/fsl
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
..
efika-audio-fabric.c ASoC: fsl: Add .owner to struct snd_soc_card 2011-12-22 17:34:32 +00:00
eukrea-tlv320.c ASoC: eukrea-tlv320: Add DT support. 2014-03-03 12:27:52 +08:00
fsl_dma.c ASoC: fsl: Fix build problem 2014-06-12 00:34:16 +01:00
fsl_dma.h ASoC: multi-component - ASoC Multi-Component Support 2010-08-12 14:00:00 +01:00
fsl_esai.c Merge remote-tracking branches 'asoc/topic/devm', 'asoc/topic/fsl', 'asoc/topic/fsl-esai', 'asoc/topic/fsl-sai', 'asoc/topic/fsl-spdif' and 'asoc/topic/fsl-ssi' into asoc-next 2014-05-22 00:23:51 +01:00
fsl_esai.h ASoC: fsl-esai: fix ESAI TDM slot setting 2014-02-10 13:39:18 +00:00
fsl_sai.c ASoC: fsl_sai: Use FSL_SAI_xXR() and regmap_update_bits() to simplify code 2014-04-14 21:46:46 +01:00
fsl_sai.h ASoC: fsl_sai: Add clock controls for SAI 2014-04-14 17:26:05 +01:00
fsl_spdif.c ASoC: fsl_spdif: Fix integer overflow when calculating divisors 2014-06-09 21:00:42 +01:00
fsl_spdif.h ASoC: fsl_spdif: Rename all _div to _df 2014-05-05 12:27:39 -07:00
fsl_ssi_dbg.c ASoC: fsl-ssi: Move debugging to seperate file 2014-05-20 23:02:26 +01:00
fsl_ssi.c Merge branch 'topic/fsl' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-fsl-ssi 2014-06-01 14:02:07 +01:00
fsl_ssi.h ASoC: fsl-ssi: Use regmap 2014-06-01 11:55:08 +01:00
fsl_utils.c ASoC: fsl-utils: Add fsl_asoc_xlate_tdm_slot_mask() support. 2014-03-25 13:06:43 +00:00
fsl_utils.h ASoC: fsl-utils: Add fsl_asoc_xlate_tdm_slot_mask() support. 2014-03-25 13:06:43 +00:00
imx-audmux.c ASoC: imx-audmux: Fix section mismatch 2014-04-24 11:22:53 +01:00
imx-audmux.h ASoC: imx-audmux: Move definitions to dt-bindings 2013-08-16 11:05:17 +01:00
imx-mc13783.c ASoC: fsl: fix pm support of machine drivers 2014-02-10 13:18:37 +00:00
imx-pcm-dma.c Update imx-sdma cyclic handling to report residue 2014-07-01 12:23:42 +05:30
imx-pcm-fiq.c ASoC: fsl: imx-pcm-fiq: Remove unneeded 'out' label 2014-02-24 14:41:15 +09:00
imx-pcm.h ASoC: fsl: Use devm_snd_dmaengine_pcm_register() 2013-12-02 11:48:54 +00:00
imx-sgtl5000.c ASoC: fsl: fix pm support of machine drivers 2014-02-10 13:18:37 +00:00
imx-spdif.c Merge remote-tracking branches 'asoc/topic/ad1836', 'asoc/topic/ad193x', 'asoc/topic/adav80x', 'asoc/topic/adsp', 'asoc/topic/ak4641', 'asoc/topic/ak4642', 'asoc/topic/arizona', 'asoc/topic/atmel', 'asoc/topic/au1x', 'asoc/topic/axi', 'asoc/topic/bcm2835', 'asoc/topic/blackfin', 'asoc/topic/cs4271', 'asoc/topic/cs42l52', 'asoc/topic/da7210', 'asoc/topic/davinci', 'asoc/topic/ep93xx', 'asoc/topic/fsl', 'asoc/topic/fsl-mxs', 'asoc/topic/generic', 'asoc/topic/hdmi', 'asoc/topic/jack', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/mxs', 'asoc/topic/omap', 'asoc/topic/pxa', 'asoc/topic/rcar', 'asoc/topic/s6000', 'asoc/topic/sai', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/spear', 'asoc/topic/ssm2518', 'asoc/topic/ssm2602', 'asoc/topic/tegra', 'asoc/topic/tlv320aic3x', 'asoc/topic/twl6040', 'asoc/topic/txx9', 'asoc/topic/uda1380', 'asoc/topic/width', 'asoc/topic/wm8510', 'asoc/topic/wm8523', 'asoc/topic/wm8580', 'asoc/topic/wm8711', 'asoc/topic/wm8728', 'asoc/topic/wm8731', 'asoc/topic/wm8741', 'asoc/topic/wm8750', 'asoc/topic/wm8753', 'asoc/topic/wm8776', 'asoc/topic/wm8804', 'asoc/topic/wm8900', 'asoc/topic/wm8901', 'asoc/topic/wm8940', 'asoc/topic/wm8962', 'asoc/topic/wm8974', 'asoc/topic/wm8985', 'asoc/topic/wm8988', 'asoc/topic/wm8990', 'asoc/topic/wm8991', 'asoc/topic/wm8994', 'asoc/topic/wm8995', 'asoc/topic/wm9081' and 'asoc/topic/x86' into asoc-next 2014-01-02 13:01:55 +00:00
imx-ssi.c ASoC: imx-ssi: Add .xlate_tdm_slot_mask() support. 2014-03-25 13:06:43 +00:00
imx-ssi.h ASoC: fsl: imx-ssi: omit ssi counter to avoid harm in unbalanced situation 2013-12-02 11:57:02 +00:00
imx-wm8962.c ASoC: fsl: fix pm support of machine drivers 2014-02-10 13:18:37 +00:00
Kconfig Merge remote-tracking branch 'asoc/topic/fsl-ssi' into asoc-next 2014-06-03 10:39:49 +01:00
Makefile ASoC: fsl-ssi: Move debugging to seperate file 2014-05-20 23:02:26 +01:00
mpc5200_dma.c ASoC: fsl: Don't set unused struct snd_pcm_hardware fields 2014-01-07 11:40:24 +00:00
mpc5200_dma.h ASoC: fsl: mpc5200 combine psc_dma platform data 2012-09-18 23:03:42 -04:00
mpc5200_psc_ac97.c drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00
mpc5200_psc_ac97.h ASoC: multi-component - ASoC Multi-Component Support 2010-08-12 14:00:00 +01:00
mpc5200_psc_i2s.c ASoC: fsl: Don't mix SNDRV_PCM_RATE_CONTINUOUS with specific rates 2014-01-14 20:42:26 +00:00
mpc8610_hpcd.c drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00
mx27vis-aic32x4.c ASoC: fsl: remove use of imx-pcm-audio from imx-ssi 2013-05-15 09:27:27 +04:00
p1022_ds.c drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00
p1022_rdk.c drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00
pcm030-audio-fabric.c ASoC: fsl: set correct platform drvdata in pcm030_fabric_probe() 2013-12-02 11:13:19 +00:00
phycore-ac97.c ASoC: fsl: remove use of imx-fiq-pcm-audio from imx-ssi 2013-05-15 09:27:27 +04:00
wm1133-ev1.c ASoC: wm1133-ev1: Convert to table based DAPM setup 2014-03-03 16:06:20 +08:00