diff options
author | Dylan Reid <dgreid@chromium.org> | 2013-04-15 14:57:05 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-04-16 01:15:31 -0400 |
commit | ae03bbb8f93b9e2c85a58e7476b87f7fb1c063ab (patch) | |
tree | 47f4d7dcf31343bbd03c10606da3728da0dad37f /sound/pci/hda/hda_intel.c | |
parent | ad2109d7d258a92fa016f1f36b423bfcc69f7efc (diff) |
ALSA: hda - Add codec delay to the capture time stamp.
For capture, the delay through the codec contributes to the time stamp
of the sample recorded at the A to D. Rename the codec time stamp
function appropriately.
Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 63734b531f36..7b213d589ef6 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1889,7 +1889,7 @@ static void azx_timecounter_init(struct snd_pcm_substream *substream, | |||
1889 | tc->cycle_last = last; | 1889 | tc->cycle_last = last; |
1890 | } | 1890 | } |
1891 | 1891 | ||
1892 | static u64 azx_subtract_codec_delay(struct snd_pcm_substream *substream, | 1892 | static u64 azx_adjust_codec_delay(struct snd_pcm_substream *substream, |
1893 | u64 nsec) | 1893 | u64 nsec) |
1894 | { | 1894 | { |
1895 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); | 1895 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); |
@@ -1903,6 +1903,9 @@ static u64 azx_subtract_codec_delay(struct snd_pcm_substream *substream, | |||
1903 | codec_nsecs = div_u64(codec_frames * 1000000000LL, | 1903 | codec_nsecs = div_u64(codec_frames * 1000000000LL, |
1904 | substream->runtime->rate); | 1904 | substream->runtime->rate); |
1905 | 1905 | ||
1906 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) | ||
1907 | return nsec + codec_nsecs; | ||
1908 | |||
1906 | return (nsec > codec_nsecs) ? nsec - codec_nsecs : 0; | 1909 | return (nsec > codec_nsecs) ? nsec - codec_nsecs : 0; |
1907 | } | 1910 | } |
1908 | 1911 | ||
@@ -1914,7 +1917,7 @@ static int azx_get_wallclock_tstamp(struct snd_pcm_substream *substream, | |||
1914 | 1917 | ||
1915 | nsec = timecounter_read(&azx_dev->azx_tc); | 1918 | nsec = timecounter_read(&azx_dev->azx_tc); |
1916 | nsec = div_u64(nsec, 3); /* can be optimized */ | 1919 | nsec = div_u64(nsec, 3); /* can be optimized */ |
1917 | nsec = azx_subtract_codec_delay(substream, nsec); | 1920 | nsec = azx_adjust_codec_delay(substream, nsec); |
1918 | 1921 | ||
1919 | *ts = ns_to_timespec(nsec); | 1922 | *ts = ns_to_timespec(nsec); |
1920 | 1923 | ||