AnsweredAssumed Answered

SSI and PCM Format

Question asked by Paul Katarzis on Mar 19, 2019
Latest reply on Mar 20, 2019 by igorpadykov

I am trying to understand how to write platform, codec, and machine drivers for ALSA SoC. I will be using the SSI platform driver written by Freescale, my own codec driver, and will link the two in a machine driver. I am having some trouble understanding the PCM formats given by the SNDRV_PCM_FMTBIT_* definitions and how to correctly set the PCM format field in snd_soc_dai_driver structures. I tried looking elsewhere online but unfortunately a lot of the documentation related to ALSA is either ambiguous or just non existent.

  • What is the meaning of big-endian and little-endian in the SNDRV_PCM_FMTBIT_* definitions? Is it a statement about how multi-byte PCM data is stored in memory? Is it a statement about the order in which bytes are sent across an audio interface such as I2S? Is it a statement about the order in which bits are sent across an audio interface such as I2S?
  • The Linux SSI driver written by Freescale says the following in a comment about PCM format: "The SSI has a limitation in that the samples must be in the same byte order as the host CPU. This is because when multiple bytes are written to the STX register, the bytes and bits must be written in the same order." Is this saying that if a multi-byte PCM data value is stored in big-endian in memory then it will be written to the STX register with the most significant byte in the lower end of the register?
  • The codec that I am using requires data over I2S to be sent most significant bit first with multi-byte data sent in big-endian. The data will be stored in big-endian within the codec. Because of this, I set the PCM data format as big-endian in the snd_soc_dai_driver structure of my codec driver. I noticed that the Linux SSI driver written by Freescale sets the PCM data format as little-endian in its snd_soc_dai_driver. Will there be a fundamental incompatibility in the snd_soc_dai_link structure of my machine driver that connects SSI and the codec?
  • According to the SSI section of the i.MX6 Quad reference manual, there doesn't seem to be a restriction as to whether or not PCM data has to be signed or unsigned. However, the Linux SSI driver written by Freescale sets the format to only signed when setting up its snd_soc_dai_driver structure. Why is this?

Outcomes