[alsa-devel] ASoC: PCM formats for AC97

Jon Smirl jonsmirl at gmail.com
Sat Aug 8 20:44:48 CEST 2009


Tell me if this is right and I'll do a patch....

-----------------------------------------------------------
The current mpc5200 code has:

static const struct snd_pcm_hardware psc_dma_hardware = {
	.formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE |
		SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE,

struct snd_soc_dai psc_ac97_dai[] = {
{
	.playback = {
		.formats = SNDRV_PCM_FMTBIT_S32_BE,

I think I have this backwards, the ac97 driver can take 8/16/24/32
it's the Bestcomm program that doesn't know about anything except 32b.
So if we wrote new Bestcomm programs that expanded bytes from memory
out into 32b DMA register writes, we could support 8/16b formats.

The correct formats would be:
static const struct snd_pcm_hardware psc_dma_hardware = {
	.formats = SNDRV_PCM_FMTBIT_S32_BE,

struct snd_soc_dai psc_ac97_dai[] = {
{
	.playback = {
		.formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE |
			SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE,

After implementing new Bestcomm programs....

static const struct snd_pcm_hardware psc_dma_hardware = {
	.formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE |
		SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE,

-----------------------------------------------------------
A related issue in soc-dai.h:

#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S16_LE |\
                               SNDRV_PCM_FMTBIT_S32_LE |\
                               SNDRV_PCM_FMTBIT_S32_BE)

shouldn't this be
#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S16 |\
                               SNDRV_PCM_FMTBIT_S32)

The first form says the AC97 hardware can take both endians, but it
doesn't take both endians it takes the endian matching the machine it
is attached to.
Don't the standard AC97 formats also include 8 and 24b?

-- 
Jon Smirl
jonsmirl at gmail.com


More information about the Alsa-devel mailing list