Dear Support Team,
I have a problem with enabling sound on imx7d with sgtl5000 codec connected.
I've tried to follow recomendations from the latest i.MX Reference Manual available in Linux BSP (Chapter 7: Audio) but description of imx7 + sgtl5000 variant seems to be not present yet there.
I would be gratefull for supporting me with the issue.
My hardware setup is pretty much the same as for variant 1 (single audio codec) described here:
https://community.nxp.com/docs/DOC-334857
The only difference is that I2S_DOUT is not connected to SAI1_RX_DATA.
I'm using latest kernel from FSL BSP (https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fsource.codeaurora.org%2Fexternal%2Fim...).
My kernel configuration is arch/arm/configs/imx_v7_defconfig + following flags added:
CONFIG_SND_SIMPLE_CARD = y
I'm using simple-card.c driver instead of imx-sgtl5000.c because the second one does not support SAI interfaces (it handles SSI only).
My device tree is configured as follows (done based on imx7s-warp.dts + MCLK frequency change from 24,000 MHz to 12,288 MHz):
/dts-v1/;
#include "imx7d.dtsi"
/ {
model = "My device";
compatible = "my device";
sound {
compatible = "simple-audio-card";
simple-audio-card,name = "my_soundcard";
simple-audio-card,format = "i2s";
simple-audio-card,bitclock-master = <&dailink_master>;
simple-audio-card,frame-master = <&dailink_master>;
simple-audio-card,cpu {
sound-dai = <&sai1>;
};
dailink_master: simple-audio-card,codec {
sound-dai = <&audio_codec>;
clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
};
};
};
&sdma {
status = "okay";
};
&clks {
assigned-clocks = <&clks IMX7D_PLL_AUDIO_POST_DIV>,
<&clks IMX7D_AUDIO_MCLK_ROOT_SRC>,
<&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
assigned-clock-parents = <0>,
<&clks IMX7D_PLL_AUDIO_POST_DIV>,
<0>;
assigned-clock-rates = <884736000>,
<0>,
<12288000>;
};
&iomuxc {
pinctrl_i2c2: i2c2grp {
fsl,pins = <
MX7D_PAD_UART2_RX_DATA__I2C2_SCL 0x40000008
MX7D_PAD_UART2_TX_DATA__I2C2_SDA 0x40000008
>;
};
pinctrl_sai1: sai1grp {
fsl,pins = <
MX7D_PAD_SAI1_TX_BCLK__SAI1_TX_BCLK 0x0000001f
MX7D_PAD_SAI1_TX_DATA__SAI1_TX_DATA0 0x00000030
MX7D_PAD_SAI1_TX_SYNC__SAI1_TX_SYNC 0x0000001f
>;
};
pinctrl_sai1mclk: sai1mclkgrp {
fsl,pins = <
MX7D_PAD_SAI1_MCLK__SAI1_MCLK 0x0000001f
>;
};
};
&i2c2 {
clock-frequency = <100000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
audio_codec: sgtl5000@0a {
compatible = "fsl,sgtl5000";
reg = <0x0a>;
};
};
&sai1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai1>;
assigned-clocks = <&clks IMX7D_SAI1_ROOT_SRC>,
<&clks IMX7D_SAI1_ROOT_CLK>;
assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
assigned-clock-rates = <0>, <12288000>;
status = "okay";
};
&audio_codec {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai1mclk>;
#sound-dai-cells = <0>;
clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>;
VDDA-supply = <&vgen6_reg>;
VDDIO-supply = <&sw2_reg>;
VDDD-supply = <&sw2_reg>;
};
With setup described above link between soundcard and sai is created and the card is registered in the system:
# dmesg | grep sai
[ 4.743192] asoc-simple-card sound: sgtl5000 <-> 308a0000.sai mapping ok
# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imx7dgtl50 [imx7d-sgtl5000], device 0: 308a0000.sai-sgtl5000 sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
Playing wav using aplay gives following output:
# aplay /usr/share/sounds/alsa/Front_Right.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Right.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
Unfortunately I cannot hear any sound. I'm able to play audio from linear input of SGTL5000 so analog audio output works fine.
I examined SAI lines using scope and it seems valid audio data are not present on SAI1_TXD.
Yellow: SAI1_TXD (48 kHz),
RED: SAI1_TXC (1,56 MHz),
BLUE: SAI1_TXFS (48 kHz)

Yellow: MCLK (12,288 MHz)

Could you please advise me what shall I check or what I've missed?
Kind regards,
Łukasz