[alsa-devel] force byte-swap at soc level before codec?

Brad Parker brad at heeltoe.com
Sat May 23 12:28:41 CEST 2009


Hi

I'm an ALSA SOC newbie.  I created a new SOC driver for a new ARM chip
but I'm having endian issues at the codec.

I started with the pxa soc code since I am failure with the pxa* i2s
hardware.  The new code is working and data flows fine but due to
hardware constraints the bytes arrive at the codec swapped.

The codec claims S16_LE.  The i2s layer claims S16_LE as does the pcm
layer inside soc.  The source data in user land is S16_LE.  But when the
i2s hardware (which I can't change) does dma the bytes go to the codec
in reverse order.

So, I need a byte swap somewhere.  I verified this by sending constant
data from user land via the oss compat layer (i.e. /dev/dsp).  If I swap
them in userland they come out on the scope at the codec in the correct
order.

Any know the simplest way to do this?

I've tried a bunch of ways but nothing seems to work correctly. It seems like
ALSA already handles this as long as I tell the right thing from below.

-brad


More information about the Alsa-devel mailing list