Question
stm32mp135 - pcm5102a - sai1a
Hello,
I try to connect a popular Arduino board PCM5102a with my board which is base on STM32MP135.

I read some documentation from the link
- https://wiki.st.com/stm32mpu/wiki/ALSA_overview
- https://wiki.st.com/stm32mpu/wiki/Soundcard_configuration
- https://wiki.st.com/stm32mpu/wiki/SAI_device_tree_configuration
- https://wiki.st.com/stm32mpu/wiki/SAI_Linux_driver
but pcm, i2s and sound topics are something I have only a base knowledge of, so please give some advice and hints.
My dts looks like
/ {
sound {
compatible = "audio-graph-card";
label = "STM32MP1-audio-test-card";
routing =
"Playback" , "MCLK",
"Capture" , "MCLK",
"MICL" , "Mic Bias";
dais = <&i2s1_port>;
status = "okay";
};
codec: pcm5102a-codec {
compatible = "ti,pcm5102a";
#sound-dai-cells = <0>;
clocks = <&i2s1>; /* The codec is a consumer of I2S2 master clock */
clock-names = "MCLK"; /* Feed MCLK codec clock with I2S2 master clock provider */
codec_port: port {
codec_endpoint: endpoint {
remote-endpoint = <&i2s1_endpoint>;
frame-master; /* Set codec as master of SAI1A for FS clock. */
bitclock-master; /* Set codec as master of SAI1A for SCK clock. */
};
};
};
};
sai1a_pins_mx: sai1a_mx-0 {
pins {
pinmux = <STM32_PINMUX('C', 0, AF2)>, /* SAI1_SCK_A */
<STM32_PINMUX('C', 3, AF10)>, /* SAI1_MCLK_A */
<STM32_PINMUX('E', 11, AF6)>, /* SAI1_FS_A */
<STM32_PINMUX('F', 12, AF6)>; /* SAI1_SD_A */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
sai1a_sleep_pins_mx: sai1a_sleep_mx-0 {
pins {
pinmux = <STM32_PINMUX('C', 0, ANALOG)>, /* SAI1_SCK_A */
<STM32_PINMUX('C', 3, ANALOG)>, /* SAI1_MCLK_A */
<STM32_PINMUX('E', 11, ANALOG)>, /* SAI1_FS_A */
<STM32_PINMUX('F', 12, ANALOG)>; /* SAI1_SD_A */
};
};
&sai1{
pinctrl-names = "default", "sleep";
pinctrl-0 = <&sai1a_pins_mx>;
pinctrl-1 = <&sai1a_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN sai1 */
#clock-cells = <0>;
clocks = <&rcc SAI1>, <&scmi_clk CK_SCMI_PLL3_Q>, <&scmi_clk CK_SCMI_PLL3_R>;
clock-names = "pclk", "x8k", "x11k";
#sound-dai-cells = <1>;
/* USER CODE END sai1 */
sai1a:audio-controller@4400a004{
status = "okay";
/* USER CODE BEGIN sai1a */
compatible = "st,stm32-sai-sub-a";
reg = <0x4 0x1C>;
clocks = <&rcc SAI1>;
clock-names = "sai_ck";
#clock-cells = <0>;
dma-names = "tx";
/*dmas = <&dmamux1 1 87 0x400 0x0>;*/
/*dma-names = "tx";*/
i2s1_port: port {
i2s1_endpoint: endpoint {
remote-endpoint = <&codec_endpoint>;
format = "i2s";
mclk-fs = <256>;
};
};
/* USER CODE END sai1a */
};
};
I get an error like
root@mp1-sagittarius:~# dmesg | grep audio
[ 0.057703] OF: /pcm5102a-codec: could not get #clock-cells for /soc/audio-controller@44004000
[ 35.535330] platform 4400a004.audio-controller: Fixing up cyclic dependency with pcm5102a-codec
[ 39.684607] OF: /pcm5102a-codec: could not get #clock-cells for /soc/audio-controller@44004000
[ 39.692414] st,stm32-sai-sub 4400a004.audio-controller: Missing dma channel for stream: 0
[ 39.836205] st,stm32-sai-sub 4400a004.audio-controller: ASoC: error at snd_soc_pcm_component_new on 4400a004.audio-controller: -22
[ 39.923241] asoc-audio-graph-card sound: ASoC: can't create pcm 4400a004.audio-controller-pcm5102a-hifi :-22
[ 39.932041] asoc-audio-graph-card sound: parse error -22
[ 40.049044] asoc-audio-graph-card: probe of sound failed with error -22
root@mp1-sagittarius:~#
in optte dts I use CLK_SAI1_PLL4Q for SAI1a.
BR Michal
