[alsa-devel] [PATCH 2/4] ASoC: fsi: Add FIFO size calculate

Kuninori Morimoto morimoto.kuninori at renesas.com
Thu Mar 25 03:39:57 CET 2010


Dear Liam, Mark

Thank you for checking patch

> > +	/* calculate FIFO size */
> > +	data = fsi_master_read(master, FIFO_SZ);
> > +	data >>= fsi_is_port_a(fsi) ? AO_SZ_SHIFT : BO_SZ_SHIFT;
> > +	data &= OUT_SZ_MASK;
> > +	fsi->fifo_max = 256;
> > +	for (i = 0; i < data; i++)
> > +		fsi->fifo_max <<= 1;
> 
> You don't really need the for loop here if you calculate the shift size
> and perform the shift in 1 operation. e.g.

Indeed
Thank you. I will modify this.

> > +	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 ?

> As Liam said it'd
> be good if you could check what's going on with these old dates.

Sorry so much

Best regards
--
Kuninori Morimoto
 


More information about the Alsa-devel mailing list