Not getting sound in rt5640 audio codec with imx6sl

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Not getting sound in rt5640 audio codec with imx6sl

208 Views
wlchen
Contributor I
Hi NXP team,

Environment: i.MX6 SoloLite, Linux kernel 4.9.17

I am using the ALC5640 codec, currently set in codec master mode. When playing a 48kHz WAV file, I can see LRCK = 48kHz and BCLK = 3,072,000Hz on the oscilloscope, but there is no sound output from the speaker. Could you please help me identify the issue?
Thanks for your help!
 
The clocks are as follows:
    pll4                                  0            0   147456000          0 0  
       pll4_bypass                        0            0   147456000          0 0  
          pll4_audio                      0            0   147456000          0 0  
             pll4_post_div                0            0    36864000          0 0  
                pll4_audio_div            0            0    36864000          0 0  
    pll3                                  1            1   480000000          0 0  
       pll3_bypass                        1            1   480000000          0 0  
          pll3_usb_otg                    3            3   480000000          0 0  
             extern_audio_sel             1            1   480000000          0 0  
                extern_audio_pred           1            1    60000000          0 0  
                   extern_audio_podf           1            1    12000000          0 0  
                      extern_audio           1            1    12000000          0 0 
 
 
The related registers read with memtool are as follows:
Reading register: SSI2_SCR (Address: 202c010)
E
Reading 0x1 count starting at address 0x0202C010
0x0202C010:  0000115B
 
 
Reading register: SSI2_STCR (Address: 202c01c)
E
Reading 0x1 count starting at address 0x0202C01C
0x0202C01C:  0000038D
 
 
Reading register: SSI2_STCCR (Address: 202c024)
E
Reading 0x1 count starting at address 0x0202C024
0x0202C024:  0004E100
 
 
Reading register: CCM_CCGR5 (Address: 20c407c)
E
Reading 0x1 count starting at address 0x020C407C
0x020C407C:  FF330FFF
 
 
The DTS settings are as follows:
sound {
compatible = "fsl,imx-audio-rt5640";
model = "rt5640-audio";
audio-cpu = <&ssi2>;
audio-codec = <&rt5640>;
audio-routing =
"Ext Spk", "MONOP",
"Ext Spk", "MONON";
mux-int-port = <2>;
mux-ext-port = <3>;
codec-master;
};
 
&ssi2 {
assigned-clocks = <&clks IMX6SL_CLK_SSI2_SEL>,
  <&clks IMX6SL_CLK_SSI2>;
status = "okay";
};
 
&audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux3>;
status = "okay";
};
 
pinctrl_audmux3: audmux3grp {
fsl,pins = <
MX6SL_PAD_AUD_MCLK__AUDIO_CLK_OUT 0x0130b0
 
MX6SL_PAD_AUD_RXD__AUD3_RXD   0x0130b0
MX6SL_PAD_AUD_TXC__AUD3_TXC   0x0130b0
MX6SL_PAD_AUD_TXD__AUD3_TXD   0x0130b0
MX6SL_PAD_AUD_TXFS__AUD3_TXFS   0x0130b0
>;
};
 
rt5640: rt5640@1c {
compatible = "realtek,rt5640";
reg = <0x1c>;
clocks = <&clks IMX6SL_CLK_EXTERN_AUDIO>;
clock-names = "mclk";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_codec_pwr>;
realtek,ldo1-en-gpios = <&gpio4 2 GPIO_ACTIVE_HIGH>;
status = "okay";
};

i2s.png

Labels (2)
0 Kudos
Reply
3 Replies

136 Views
wlchen
Contributor I

Hello,

I can see sound card being registered

ALSA device list:
#0: rt5640-audio

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: rt5640audio [rt5640-audio], device 0: HiFi rt5640-aif1-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

With codec master mode, when I use aplay to play a WAV file, there is a signal on AUD_TXD on the oscilloscope.
The codec seeing looks correct and the whole DAPM route is already on, but I still don't get any sound. According to the I2S registers, is there anything that looks suspicious? 

Reading register: SSI2_SCR (Address: 202c010)
E
Reading 0x1 count starting at address 0x0202C010
0x0202C010:  0000115B
 
Reading register: SSI2_STCR (Address: 202c01c)
E
Reading 0x1 count starting at address 0x0202C01C
0x0202C01C:  0000038D
 
Reading register: SSI2_STCCR (Address: 202c024)
E
Reading 0x1 count starting at address 0x0202C024
0x0202C024:  0004E100
 
Reading register: CCM_CCGR5 (Address: 20c407c)
E
Reading 0x1 count starting at address 0x020C407C
0x020C407C:  FF330FFF

Thanks!
 
 
0 Kudos
Reply

105 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

SSI2_SCR seems to be correctly configured, it is in slave mode and when you read the register it was transferring data.

SSI2_STCR seems to be correctly configured, it has FIFOs enabled and is taking frame-sync and clock signal from CODEC configured as master.

SSI2_STCCR is using a 16 bit word length, please check that configuration in CODEC driver and supported word length in your device.

CCM_CCGR5 SSI2 clock is enabled.

Best regards.

0 Kudos
Reply

187 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Wednesday, October 9, 2024

10:56 AM

Hello,

The RT5640 audio CODEC is not supported by default on our BSP. To use this CODEC to your system, maybe you need to add a third-party driver provided by CODEC manufacturer and configure your device tree.

Unfortunately, there is no a guide to port this specific CODEC to the BSP. The references we have are the i.MX porting guide and EVK device tree (WM8962).

Please check if the card is being numbered during kernel booting and if you get some error at playing.

Also, you may use alsamixer command to adjust the volume and turn on some switches (depends on your audio codec driver).

Best regards.

0 Kudos
Reply