[alsa-devel] what is the difference between SNDRV_PCM_FMTBIT_S24_LE and SNDRV_PCM_FMTBIT_S24_3LE

Gabriel M. Beddingfield gabrbedd at gmail.com
Thu Apr 11 17:27:21 CEST 2013


On 04/11/2013 02:35 AM, Clemens Ladisch wrote:
> (please do not drop the mailing list from replies.)
>
> Zhang wei wrote:
>> I do not really understand. For example,an codec is wm8985 ...
>
> The SNDRV_PCM_* symbols specify the format in which samples are
> stored in memory.
>
> I do not know how ASoC maps these symbols to on-the-wire formats.

The SNDRV_PCM_* symbol specifies the format of the audio in RAM, and 
transfers that audio to the digital audio interface (DAI) on the CPU 
side.  (E.g. the OMAP McBSP.)

The on-the-wire format is set up by the ASoC machine driver (i.e. "sound 
card.")  It will configure the CPU DAI (e.g. the OMAP McBSP) and the 
codec (e.g. wm8985) to expect the same "on-the-wire" format.  For 
example, in sound/soc/omap/omap-twl4030.c (beagleboard's machine driver) 
the on-the-wire format is done in omap_twl4030_hw_params() like this 
(edited for brevity):

         fmt =   SND_SOC_DAIFMT_I2S |
                 SND_SOC_DAIFMT_NB_NF |
                 SND_SOC_DAIFMT_CBM_CFM;

         /* Set codec DAI configuration */
         ret = snd_soc_dai_set_fmt(codec_dai, fmt);

         /* Set cpu DAI configuration */
         ret = snd_soc_dai_set_fmt(cpu_dai, fmt);

The CPU DAI is responsible for converting the SNDRV_PCM_* format into 
the serial format.  Therefore, the conversions that it supports is 
totally hardware-dependent.

-gabriel



More information about the Alsa-devel mailing list