linux/sound/soc
Oskar Schirmer 68f9672b13 ASoC: fsl: imx-pcm-fiq: remove bogus period delta calculation
Originally snd_hrtimer_callback() used iprtd->period_time for
some jiffies based estimation to determine the right moment
to call snd_pcm_period_elapsed(). As timer drifts may well be a
problem, this was changed in commit b4e82b5b78 to be based
on buffer transmission progress, using iprtd->offset and
runtime->buffer_size to calculate the amount of data since last
period had elapsed.

Unfortunately, iprtd->offset counts in bytes, while
runtime->buffer_size counts frames, so adding these to find some
delta is like comparing apples and oranges, and eventually results
in negative delta values every now and then. This is no big harm,
because it simply causes snd_pcm_period_elapsed() being called
more often than necessary, as negative delta is taken for a
large unsigned value by implicit conversion rule.
Nonetheless, the calculation is broken, so one would replace
the runtime->buffer_size by its equivalent in bytes.

But then, there are chances snd_pcm_period_elapsed() is called
late, because calculating the moment for the elapsed period
into delta is based against the iprtd->last_offset, which is not
necessarily the first byte of the period in question, but some
random byte which the FIQ handler left us with in r8/r9 by
accident. Again, negative impact is low, as there are plenty of
periods already prefilled with data, and snd_pcm_period_elapsed()
will probably be called latest when the following period is
reached. However, the calculation is conceptually broken, and we
are best off removing the clever stuff altogether.

snd_pcm_period_elapsed() is now simply called once everytime
snd_hrtimer_callback() is run, which may not be most accurate,
but at least this way we are quite sure we dont miss an end of
period. There is not much extra effort wasted by superfluous
calls to snd_pcm_period_elapsed(), as the timer frequency
closely matches the period size anyway.

Signed-off-by: Oskar Schirmer <oskar@scara.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-06 09:41:57 +00:00
..
atmel ASoC: atmel: disable error interrupt 2013-09-04 10:47:27 +01:00
au1x Merge remote-tracking branch 'asoc/topic/au1x' into asoc-next 2013-08-22 14:28:29 +01:00
blackfin ASoC: bf5xx-ac97: Remove unused extern declaration 2013-07-30 13:01:09 +01:00
cirrus Merge remote-tracking branch 'asoc/topic/ep93xx' into tmp 2013-08-30 11:04:21 +01:00
codecs Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
davinci sound updates for 3.11 2013-07-03 19:52:22 -07:00
dwc ASoC: designware_i2s: Remove unnecessary dev_set_drvdata() 2013-08-29 13:18:32 +01:00
fsl ASoC: fsl: imx-pcm-fiq: remove bogus period delta calculation 2013-11-06 09:41:57 +00:00
generic ASoC: simple-card: Provide owner and MODULE_ALIAS() 2013-08-23 19:04:20 +01:00
jz4740 ASoC: jz4740-i2s: Use clk_prepare_enable/clk_disable_unprepare 2013-05-12 22:09:03 +04:00
kirkwood ASoC: kirkwood: change the compatible string of the kirkwood-i2s driver 2013-09-06 10:29:58 +01:00
mid-x86 ASoC: mfld: Remove unused variable 2013-06-28 10:59:14 +01:00
mxs Merge remote-tracking branch 'asoc/topic/fsl' into tmp 2013-09-01 21:15:52 +01:00
nuc900 ASoC: nuc900: don't check resource with devm_ioremap_resource 2013-07-24 15:34:16 +01:00
omap ASoC: Updates for v3.12 2013-08-23 14:12:22 +02:00
pxa ASoC: pxa: Remove duplicate inclusion of dmaengine.h 2013-08-22 10:43:49 +01:00
s6000 ASoC: s6105-ipcam: Fix incorrect placement of __initdata 2013-08-08 14:27:59 +01:00
samsung Remove GENERIC_HARDIRQ config option 2013-09-13 15:09:52 +02:00
sh ASoC: rsnd: fixup flag name of rsnd_scu_platform_info 2013-09-09 16:06:20 +01:00
spear ALSA: move dmaengine implementation from ASoC to ALSA core 2013-08-15 11:18:09 +01:00
tegra Merge remote-tracking branch 'asoc/topic/tegra' into asoc-next 2013-08-22 14:28:52 +01:00
txx9 ASoC: txx9: don't check resource with devm_ioremap_resource 2013-07-24 15:37:48 +01:00
ux500 ASoC: mop500: add .owner to struct snd_soc_card 2013-07-15 11:12:24 +01:00
Kconfig ALSA: move dmaengine implementation from ASoC to ALSA core 2013-08-15 11:18:09 +01:00
Makefile ALSA: move dmaengine implementation from ASoC to ALSA core 2013-08-15 11:18:09 +01:00
soc-cache.c
soc-compress.c ASoC: compress: Use power efficient workqueue 2013-08-12 11:04:54 +01:00
soc-core.c Merge remote-tracking branch 'asoc/topic/core' into tmp 2013-08-30 11:04:14 +01:00
soc-dapm.c Merge remote-tracking branch 'asoc/topic/dapm' into tmp 2013-09-01 21:15:50 +01:00
soc-generic-dmaengine-pcm.c ASoC: generic-dmaengine-pcm: call dma_request_slave_channel() 2013-04-23 11:34:29 +01:00
soc-io.c PTR_RET is now PTR_ERR_OR_ZERO(): Replace most. 2013-07-15 11:25:01 +09:30
soc-jack.c ASoC: jack: Remove unnecessary call to snd_soc_dapm_new_widgets() 2013-08-27 15:37:33 +01:00
soc-pcm.c Merge remote-tracking branch 'asoc/topic/fsl' into tmp 2013-09-01 21:15:52 +01:00
soc-utils.c ASoC: simplify registration of snd-soc-dummy device 2013-05-17 12:07:49 +01:00