linux-kernel-test/sound
Oskar Schirmer d6437c14df 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-12-02 11:13:19 +00:00
..
aoa ALSA: snd-aoa: Add a layout entry for PowerBook6,5 2013-05-16 07:19:01 +02:00
arm ALSA: pxa: slightly refactor reset handling 2013-10-18 00:35:00 +01:00
atmel
core ALSA: compress: Make sure we trigger STOP before closing the stream. 2013-09-26 09:28:22 +02:00
drivers ALSA: replace strict_strto*() with kstrto*() 2013-07-21 11:56:18 +02:00
firewire Merge branch 'for-3.12' into for-next 2013-07-15 12:09:28 +02:00
i2c [media] tea575x: Move from sound to media 2013-08-18 08:09:59 -03:00
isa Merge remote-tracking branch 'asoc/fix/fsl' into asoc-linus 2013-09-11 11:17:15 +01:00
mips
oss ASoC: Updates for v3.12 2013-08-23 14:12:22 +02:00
parisc ALSA: Remove the rest of *_set_drvdata(NULL) calls 2013-05-29 12:50:59 +02:00
pci ALSA: hdsp - info leak in snd_hdsp_hwdep_ioctl() 2013-10-16 11:22:46 +02:00
pcmcia
ppc ALSA: powermac: Remove redundant platform_set_drvdata() 2013-05-23 14:35:58 +02:00
sh ALSA: sh_dac_audio: Remove redundant platform_set_drvdata() 2013-05-23 14:36:45 +02:00
soc ASoC: fsl: imx-pcm-fiq: remove bogus period delta calculation 2013-12-02 11:13:19 +00:00
sparc ALSA: Remove the rest of *_set_drvdata(NULL) calls 2013-05-29 12:50:59 +02:00
spi ALSA: Remove the rest of *_set_drvdata(NULL) calls 2013-05-29 12:50:59 +02:00
synth
usb ALSA: us122l: Fix pcm_usb_stream mmapping regression 2013-10-15 11:35:54 +02:00
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c drivers: avoid format string in dev_set_name 2013-07-03 16:07:41 -07:00
sound_firmware.c