From: Takashi Iwai Subject: Re: [PATCH] ALSA: hda - Add codec delay to the capture time stamp. Date: Tue, 16 Apr 2013 07:18:52 +0200 Message-ID: References: <1366052225-27828-1-git-send-email-dgreid@chromium.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id C66422652A6 for ; Tue, 16 Apr 2013 07:18:55 +0200 (CEST) In-Reply-To: <1366052225-27828-1-git-send-email-dgreid@chromium.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Dylan Reid Cc: alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com List-Id: alsa-devel@alsa-project.org At Mon, 15 Apr 2013 11:57:05 -0700, Dylan Reid wrote: > > 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 Applied, thanks. Takashi > --- > sound/pci/hda/hda_intel.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c > index 63734b5..7b213d5 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, > tc->cycle_last = last; > } > > -static u64 azx_subtract_codec_delay(struct snd_pcm_substream *substream, > +static u64 azx_adjust_codec_delay(struct snd_pcm_substream *substream, > u64 nsec) > { > struct azx_pcm *apcm = snd_pcm_substream_chip(substream); > @@ -1903,6 +1903,9 @@ static u64 azx_subtract_codec_delay(struct snd_pcm_substream *substream, > codec_nsecs = div_u64(codec_frames * 1000000000LL, > substream->runtime->rate); > > + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) > + return nsec + codec_nsecs; > + > return (nsec > codec_nsecs) ? nsec - codec_nsecs : 0; > } > > @@ -1914,7 +1917,7 @@ static int azx_get_wallclock_tstamp(struct snd_pcm_substream *substream, > > nsec = timecounter_read(&azx_dev->azx_tc); > nsec = div_u64(nsec, 3); /* can be optimized */ > - nsec = azx_subtract_codec_delay(substream, nsec); > + nsec = azx_adjust_codec_delay(substream, nsec); > > *ts = ns_to_timespec(nsec); > > -- > 1.8.1.3.605.g02339dd >