Liam Girdwood wrote:
On big-endian platforms like mine, CS4270_FORMATS will be SNDRV_PCM_FORMAT_S24_BE and on little-endian platforms it will be SNDRV_PCM_FORMAT_S24_LE. Assuming the I2S registers are the same endian as the platform, will this work?
I think this probably depends on how your audio FIFO's align the data received from memory/DMA. They should do any bit reordering based on the audio format, and size etc set in the control register. (Although, ymmv.)
Ok, I'm a little confused. I was going to specify the SNDRV_PCM_FORMAT_S24_BE for my I2C device because the actual 32-bit memory-mapped registers are big-endian. The structure definition even uses __be32 for each field.
My goal was to specify a single value (i.e. SNDRV_PCM_FORMAT_S24_BE) such that ALSA would give me a 32-bit quantity that exactly matches what my device expects.
I wish asound.h had more documentation. I don't know what any of these macros *really* mean.
#define CS4270_FORMATS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE)
That would tell ALSA that the CS4270 supports both formats, which isn't technically true, but it wouldn't matter because the I2S interface is what determines the actual "endianness" of the serial data.
This looks fine as a workaround atm, I'll try and have a look at this bug tomorrow so we don't need to do this.
Ok, I'll do this for now.