alistair23-linux/sound
Henrik Eriksson 20e3f985bb ALSA: pcm: update tstamp only if audio_tstamp changed
commit 3179f62001 ("ALSA: core: add .get_time_info") had a side effect
of changing the behaviour of the PCM runtime tstamp.  Prior to this
change tstamp was not updated by snd_pcm_update_hw_ptr0() unless the
hw_ptr had moved, after this change tstamp was always updated.

For an application using alsa-lib, doing snd_pcm_readi() followed by
snd_pcm_status() to estimate the age of the read samples by subtracting
status->avail * [sample rate] from status->tstamp this change degraded
the accuracy of the estimate on devices where the pcm hw does not
provide a granular hw_ptr, e.g., devices using
soc-generic-dmaengine-pcm.c and a dma-engine with residue_granularity
DMA_RESIDUE_GRANULARITY_DESCRIPTOR.  The accuracy of the estimate
depended on the latency between the PCM hw completing a period and the
driver called snd_pcm_period_elapsed() to notify ALSA core, typically
determined by interrupt handling latency.  After the change the accuracy
of the estimate depended on the latency between the PCM hw completing a
period and the application calling snd_pcm_status(), determined by the
scheduling of the application process.  The maximum error of the
estimate is one period length in both cases, but the error average and
variance is smaller when it depends on interrupt latency.

Instead of always updating tstamp, update it only if audio_tstamp
changed.

Fixes: 3179f62001 ("ALSA: core: add .get_time_info")
Suggested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Henrik Eriksson <henrik.eriksson@axis.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-11-21 13:59:19 +01:00
..
ac97 ALSA: ac97: add an ac97 bus 2017-09-04 18:24:56 +01:00
aoa License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
arm Merge remote-tracking branches 'asoc/topic/ac97', 'asoc/topic/ac97-mfd', 'asoc/topic/amd' and 'asoc/topic/arizona-mfd' into asoc-next 2017-11-10 21:31:02 +00:00
atmel ASoC: Updates for v4.14 2017-09-04 14:50:49 +02:00
core ALSA: pcm: update tstamp only if audio_tstamp changed 2017-11-21 13:59:19 +01:00
drivers ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
firewire License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hda ALSA: hda: Fix too short HDMI/DP chmap reporting 2017-11-17 12:20:37 +01:00
i2c ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
isa ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
mips ALSA: mips: constify snd_pcm_ops structures 2017-08-19 11:02:18 +02:00
oss ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
parisc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci ALSA: hda/realtek: Add headset mic support for Intel NUC Skull Canyon 2017-11-20 08:37:10 +01:00
pcmcia ALSA: pcmcia: constify snd_pcm_ops structures 2017-08-19 11:02:21 +02:00
ppc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sh ALSA: sh: aica: Convert timers to use timer_setup() 2017-10-05 08:20:17 +02:00
soc ASoC: Fix for Intel Kconfig 2017-11-15 17:11:16 +01:00
sparc License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
spi License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
synth ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
usb ALSA: usb-audio: uac1: Invalidate ctl on interrupt 2017-11-17 11:55:45 +01:00
x86 main drm pull for v4.13 2017-07-09 18:48:37 -07:00
ac97_bus.c
Kconfig ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
last.c
Makefile ASoC: Updates for v4.15 2017-11-13 15:45:57 +01:00
sound_core.c