[alsa-devel] force byte-swap at soc level before codec?
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
On Sat, May 23, 2009 at 06:28:41AM -0400, Brad Parker wrote:
The codec claims S16_LE. The i2s layer claims S16_LE as does the pcm
A change has been merged for 2.6.31 which makes CODEC drivers match against either endianess in order to support this use case, though obviously the 2.6.31 release won't happen for a while.
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.
Yes, if your driver tells userspace the format it needs then things should've been figured out by the time the driver sees the data. Change your CPU drivers to advertise _BE variants instead and either change the CODEC driver locally to do the same thing or run with the latest ASoC code which will make the change for you. The ASoC core will pass on the common constraints that the individual drivers advertise to userspace.
participants (2)
-
Brad Parker
-
Mark Brown