ALSA: hda: read trigger_timestamp immediately after starting DMA
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 6 Feb 2015 21:55:52 +0000 (15:55 -0600)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 Feb 2015 15:02:11 +0000 (16:02 +0100)
Make sure wallclock counter and trigger timestamp are read very
close to each other for better alignment.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_controller.c

index 27dcb142f596ea8219be6aef0744c2b6a6c1537d..dfcb5e929f9fc9643701eb33f04aa8efd7f101d3 100644 (file)
@@ -657,6 +657,9 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
                azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits);
        if (start) {
                azx_timecounter_init(substream, 0, 0);
+               snd_pcm_gettime(substream->runtime, &substream->runtime->trigger_tstamp);
+               substream->runtime->trigger_tstamp_latched = true;
+
                if (nsync > 1) {
                        cycle_t cycle_last;