[alsa-devel] Swapped channels issue on pxa-ssp based platforms

Clemens Ladisch clemens at ladisch.de
Mon Nov 7 21:19:07 CET 2011

Daniel Mack wrote:
> we're hunting a weird bug on PXA3xx/ssp based audio devices which causes
> the playback channels to be swapped when the capture stream is started
> at the same time. Content for the left channel appears on the right and
> vice versa, in approximately 50% of all test runs

IIRC there was some other CPU where it was tried to program a generic
serial output to handle I²S data.  The same symptoms appeared because
it was not possible to synchronize the start of the L/R signal to the
start of the DMA.

Apparently, the starting of the capture stream affects the L/R
synchronization of the playback stream.

Does starting playback first work?

> I guess this is some sort of a race condition in the stream startup,
> and suspected sound/soc/pxa/pxa-ssp.c to lack some locking, so I added
> a spinlock around all register read-modify-write cycles. But that doesn't
> seem to be the reason.

I'd guess this is a race in the programming of the L/R clock signals;
try putting a lock/mutex about all the stream initialization code, and
maybe adding some delay.


More information about the Alsa-devel mailing list