[alsa-devel] [PATCH 2/4] ASoC: fsi: Add FIFO size calculate
Liam Girdwood
lrg at slimlogic.co.uk
Thu Mar 25 09:56:14 CET 2010
On Thu, 2010-03-25 at 11:39 +0900, Kuninori Morimoto wrote:
>
> > > + dev_dbg(dai->dev, "fifo = %d words\n", fsi->fifo_max);
> > > +
> > > + for (i = 1; i < fsi->chan; i *= 2)
> > > + if (fsi->chan > i)
> > > + fsi->fifo_max >>= 1;
> >
> > Is the if really needed here. You may also want to calculate the shift
> > size rather than looping too.
>
> This calculate number of sample data.
> And it is depend on channel size.
> If chip fifo size is 256, the number of sample data will be...
>
> 1 chan : 256 (256 x 1 = 256)
> 2 chan : 128 (128 x 2 = 256)
> 3 chan : 64 ( 64 x 3 = 192)
> 4 chan : 64 ( 64 x 4 = 256)
> 5 chan : 32 ( 32 x 5 = 160)
> 6 chan : 32 ( 32 x 6 = 192)
> 7 chan : 32 ( 32 x 7 = 224)
> 8 chan : 32 ( 32 x 8 = 256)
>
> Above calculation is needed. but yes un-understandable.
> I don't know a method computable by one line.
> So, I will add tiny comment/document here.
> OK ?
>
Yes, this sounds fine :)
It wasn't understandable from the original code.
Thanks
Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
More information about the Alsa-devel
mailing list