[alsa-devel] [PATCH 3/5] ASoC: Blackfin: tweak how weinitialize the SPORT

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Jun 4 12:51:28 CEST 2009

On Thu, Jun 04, 2009 at 10:36:48AM +0800, Cai, Cliff wrote:

> This is not a problem of rate but format,I think combine the two flags
> will solve all the problems.

Ah, yes - I was remembering the ssm2602 driver which does do rate

> The reason I write this patch is that I found when some oss-based
> applications open soundcard ,the startup callbacks will be called
> several times.

All OSS applications do this, OSS has a separate ioctl for each
configuration option so you get lots of configuration calls.

> So using the counter to record opened pcm streams is not reliable.

It's only hw_params() that get called repeatedly.

I could be wrong but looking at the code I suspect you may just need to
make the reconfiguration conditional on if it's a capture or playback
stream and you'll be fine - at the minute you're configuring both RX and
TX on every hw_params() but there are separate tcr2 and rcr2 registers
that you write to.  If you only wrote to the appropriate one then you
wouldn't need to worry about interfering with another stream for that
configuration.  There is the wdsize parameter for the SPORT as well but
a brief glance at the code for that suggests that there are actually
separate RX and TX configurations there too.

If not then adding constraint code would help a lot.

More information about the Alsa-devel mailing list