cancel
Showing results for 
Search instead for 
Did you mean: 

PCM3060 DAI driver ".format" value seems to be incorrect

TommyTom
Associate II

Hi,

I am using a PCM3060 codec connected to a STM32MP135 MPU over I2S1 and I2C, and compiling STM Linux (v6.1) (along with STM's version of TF-A, Optee, and U-Boot) using Buildroot.

I had some trouble getting ALSA to output to the codec, it kept giving the response:

 

 

44004000.audio-controller-pcm3060-dac: ASoC: pcm3060-dac <-> 44004000.audio-controller No matching formats

 

 

I managed to work around the issue by changing the formats entry in snd_soc_dai_driver, in pcm3060.c (https://github.com/STMicroelectronics/linux/blob/7928f69738d2e57ee2a0dba6e9e680a3bf75ded9/sound/soc/codecs/pcm3060.c#L189) to SNDRV_PCM_FMTBIT_S32_LE.

 

 

#define PCM3060_FORMATS (SNDRV_PCM_FMTBIT_S32_LE)

static struct snd_soc_dai_driver pcm3060_dai[] = {
	{
		.name = "pcm3060-dac",
		.id = PCM3060_DAI_ID_DAC,
		.playback = {
			.stream_name = "Playback",
			.channels_min = 2,
			.channels_max = 2,
			.rates = PCM3060_DAI_RATES_DAC,
			.formats = PCM3060_FORMATS,
		},
		.ops = &pcm3060_dai_ops,
	},
	{
		.name = "pcm3060-adc",
		.id = PCM3060_DAI_ID_ADC,
		.capture = {
			.stream_name = "Capture",
			.channels_min = 2,
			.channels_max = 2,
			.rates = PCM3060_DAI_RATES_ADC,
			.formats = PCM3060_FORMATS,
		},
		.ops = &pcm3060_dai_ops,
	},
};

 

 

Everything seems to be working great now. I'm party posting here in case anybody else searches for the same problem, but also because I don't really understand the underlying cause of the problem. Is this a bug in STM's implementation of Linux, or the mainline driver? Or just a quirk of my set up? It's a fairly old chip but the code seems to still be maintained so I'm just wondering if I should report a bug or if I've just mucked something up in my configuration?

 

Thanks for any advice,

Tom

1 ACCEPTED SOLUTION

Accepted Solutions
Erwan SZYMANSKI
ST Employee

Hello @TommyTom,
Yes that's right. In fact in <kernel>/sound/soc/stm/stm32_i2s.c file, you can see this : 

 

static void stm32_i2s_dai_init(struct snd_soc_pcm_stream *stream,
			       char *stream_name)
{
	stream->stream_name = stream_name;
	stream->channels_min = 1;
	stream->channels_max = 2;
	stream->rates = SNDRV_PCM_RATE_8000_192000;
	stream->formats = SNDRV_PCM_FMTBIT_S16_LE |
				   SNDRV_PCM_FMTBIT_S32_LE;
}

 

The format is either SNDRV_PCM_FMTBIT_S16_LE or SNDRV_PCM_FMTBIT_S32_LE. Why ? Because our DMA only support these sizes of transfer. Explanation is here.

Kind regards, and thank you for this interesting sharing that can help other community members !

Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

2 REPLIES 2
Erwan SZYMANSKI
ST Employee

Hello @TommyTom,
Yes that's right. In fact in <kernel>/sound/soc/stm/stm32_i2s.c file, you can see this : 

 

static void stm32_i2s_dai_init(struct snd_soc_pcm_stream *stream,
			       char *stream_name)
{
	stream->stream_name = stream_name;
	stream->channels_min = 1;
	stream->channels_max = 2;
	stream->rates = SNDRV_PCM_RATE_8000_192000;
	stream->formats = SNDRV_PCM_FMTBIT_S16_LE |
				   SNDRV_PCM_FMTBIT_S32_LE;
}

 

The format is either SNDRV_PCM_FMTBIT_S16_LE or SNDRV_PCM_FMTBIT_S32_LE. Why ? Because our DMA only support these sizes of transfer. Explanation is here.

Kind regards, and thank you for this interesting sharing that can help other community members !

Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thank you for the detailed response, that answers my question perfectly.

 

Tom