[alsa-devel] [PATCH 1/4] ASoC: pxa-ssp: enhance I2S and add Left_J support

Mark Brown broonie at opensource.wolfsonmicro.com
Mon Jun 8 18:53:28 CEST 2009

On Mon, Jun 08, 2009 at 01:03:20PM -0300, Daniel Ribeiro wrote:
> Em Seg, 2009-06-08 às 13:40 +0100, Mark Brown escreveu:

> > I'm inclined to go with sample here since it seems harder for the
> > machine drivers to get wrong but I've not really thought it through yet?

> But sample wouldn't cover all cases. eg, magician and ezx uses the same
> sample size, but magician needs 16bit frames and ezx 32bits frames.

See my reply to Philip - even with frame size his case is going to be
very hard to cover in a standard fashion since it's not clear what to do
when your frame clock is run too fast relative to your bit clock.  On
the receive side a lot of devices are just going to discard incomplete
stereo frames.

> Just to confirm that I'm understanding the terminology here..
> Sample size is SNDRV_PCM_FORMAT_*, and frame size is the actual distance
> in clocks between each SSPFRM assertion. Is this correct?

That's pretty much my understanding - sample size is the number of bits
clocked per mono sample on the wire and frame size is the number of bits
clocked per cycle of the frame clock.

> > OTOH I don't really see much difference between the two cases - it's
> > just an extra couple of parameters on the end of the call.  That said,

> I agree with pHilipp, I don't need to set network mode for normal
> operation, but i want to be able to use real network mode.

Network mode is just a detail of the implementation of the PXA here - it
should not be visible outside the pxa-ssp driver.  Or to put it another
way setting a tdm_slot of 1, 1 ought to result in the same behaviour as
disabling TDM as far as the user is concerned.

> Using set_tdm_slot to setup this also seems awkward, because the dma
> configuration to use is also affected by the frame size.

I'd not expect it to be?

> And finally, set_tdm_mode doesn't cover all use cases, I may want to
> receive on a timeslot and keep the TX line high impedance, or I may want
> to use a different timeslot for TX...

Yes, set_tdm_mode() needs separate RX and TX configuration regardless -
if we added the framing configuration in there we should definitely make
that change at that point.

> My suggestion here is to make a clear distinction between normal mode
> and network mode. We should not abuse SSCR0_MOD when we don't need it.
> We should not require the machine driver to call set_tdm_slot when it
> doesn't need to. And for frame sizes that really need SSCR0_MOD to be
> set we should issue a warning telling that network mode was
> "automatically" enabled.

I'd like to see all these details handled within the driver - knowing if
and when network mode are to be set up is the sort of thing that users
ought to be able to rely on the driver for.

More information about the Alsa-devel mailing list