[alsa-devel] [PATCH 2/2] ALSA: hda: support for wallclock timestamps

Raymond Yau superquad.vortex2 at gmail.com
Sat Sep 29 03:47:24 CEST 2012


>
> Reuse code from clocksource to handle wall clock counter.
> Since wrapparound occurs, the audio timestamp is reinitialized
> to zero on a trigger. Synchronized linked devices will
> start counting from same reference to avoid any drift.

> @@ -2024,6 +2096,22 @@ static int azx_pcm_trigger(struct
snd_pcm_substream *substream, int cmd)
>                         azx_readl(chip, OLD_SSYNC) & ~sbits);
>         else
>                 azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits);
> +       if (start) {
> +               azx_timecounter_init(substream, 0, 0);
> +               if (nsync > 1) {
> +                       cycle_t cycle_last;
> +
> +                       /* same start cycle for master and group */
> +                       azx_dev = get_azx_dev(substream);
> +                       cycle_last = azx_dev->azx_tc.cycle_last;
> +
> +                       snd_pcm_group_for_each_entry(s, substream) {
> +                               if (s->pcm->card != substream->pcm->card)
> +                                       continue;
> +                               azx_timecounter_init(s, 1, cycle_last);
> +                       }
> +               }
> +       }
>         spin_unlock(&chip->reg_lock);
>         return 0;
>  }

Will the timer reinitialise when multistreaming using front panel headphone
, rear panel speakers , digital output and hdmi ?


More information about the Alsa-devel mailing list