Re: Driver code with mpc5200 pointer problem.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 26, 2009 at 10:25 AM, Jon Smirl <jonsmirl@xxxxxxxxx> wrote:

> static snd_pcm_uframes_t
> psc_dma_pcm_pointer(struct snd_pcm_substream *substream)
> {
>        struct snd_pcm_runtime *runtime = substream->runtime;
>        struct snd_soc_pcm_runtime *rtd = substream->private_data;
>        struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data;
>        struct psc_dma_stream *s;
>        dma_addr_t count;
>        snd_pcm_uframes_t frames;
>        int delta;
>
>        if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
>                s = &psc_dma->capture;
>        else
>                s = &psc_dma->playback;
>
>        count = s->period_current_pt - s->period_start;
>
>        delta = jiffies - s->jiffies;
>        delta = delta * runtime->rate / HZ;
>        frames = bytes_to_frames(substream->runtime, count);

Have you considered using the timebase register instead of jiffies?
It's more accurate, and you can use tb_ticks_per_usec.

-- 
Timur Tabi
Linux kernel developer at Freescale
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux