Porting realtek ALC5640(rt5640) codec to Nano

Hi Jon, thank you very much for replying!

But I met the following errors when executing the commands as you mentioned.

amixer: Cannot find the given element from control hw:1

roborock@jetson-nano:~$ amixer -c “tegrasndt210ref” cset name=‘HP Playback Switch’ on
amixer: Cannot find the given element from control hw:1

Best regards
wujz

Hi, Nvidia

Is there any demo or reference for porting ALC5640(rt5640) codec to Jetson Nano?

The only reference I have is the chapter “Audio Setup and Development” in “L4T document”.

I modified the pinmux configuration, and configured device tree configuration for ALC5640, etc.

But unfortunately, there is not any data on bus I2S between Nano module and ALC5640.

Thank you very much!

Best regards.
wujz

Hello!

I believe I missed the ‘x’ prefix for the controls. Can you try …

# playback
$ amixer -c "${scard}" cset name='x HP Playback Switch' on
$ amixer -c "${scard}" cset name='x Stereo DAC MIXL DAC L1 Switch' on
$ amixer -c "${scard}" cset name='x Stereo DAC MIXR DAC R1 Switch' on
$ amixer -c "${scard}" cset name='x HPO MIX DAC1 Switch' on
# capture
$ amixer -c "${scard}" cset name="x Stereo ADC MIXL ADC2 Switch" 0
$ amixer -c "${scard}" cset name="x Stereo ADC MIXR ADC2 Switch" 0
$ amixer -c "${scard}" cset name="x Int Mic Switch" 0
$ amixer -c "${scard}" cset name="x ADC Capture Switch" 1
$ amixer -c "${scard}" cset name="x RECMIXL BST1 Switch" 0
$ amixer -c "${scard}" cset name="x RECMIXR BST1 Switch" 0
$ amixer -c "${scard}" cset name="x RECMIXL BST2 Switch" 1
$ amixer -c "${scard}" cset name="x RECMIXR BST2 Switch" 1
$ amixer -c "${scard}" cset name="x Stereo ADC L1 Mux" "ADC"
$ amixer -c "${scard}" cset name="x Stereo ADC R1 Mux" "ADC"
$ amixer -c "${scard}" cset name="x Stereo ADC MIXL ADC1 Switch" 1
$ amixer -c "${scard}" cset name="x Stereo ADC MIXR ADC1 Switch" 1
$ amixer -c "${scard}" cset name="x Stereo ADC MIXL ADC2 Switch" 0
$ amixer -c "${scard}" cset name="x Stereo ADC MIXR ADC2 Switch" 0
$ amixer -c "${scard}" cset name="x IN1 Mode Control" "Single ended"
$ amixer -c "${scard}" cset name="x IN2 Mode Control" "Single ended"

Regards,
Jon

Otherwise you can dump all the controls and we can see what is there …

$ amixer -c tegrasndt210ref controls | grep "x "

Regards
Jon

Hi, Jon
Thank you very much for replying.
I dumped all the controls with the command as you mentioned and the result is as follows:

roborock@jetson-nano:~$ amixer -c tegrasndt210ref controls | grep "x "
numid=536,iface=MIXER,name=‘codec-x format’
numid=535,iface=MIXER,name=‘codec-x rate’
numid=503,iface=MIXER,name=‘x ADC Boost Gain’
numid=500,iface=MIXER,name=‘x ADC Capture Switch’
numid=501,iface=MIXER,name=‘x ADC Capture Volume’
numid=505,iface=MIXER,name=‘x ADC IF1 Data Switch’
numid=507,iface=MIXER,name=‘x ADC IF2 Data Switch’
numid=504,iface=MIXER,name=‘x Class D SPK Ratio Control’
numid=506,iface=MIXER,name=‘x DAC IF1 Data Switch’
numid=508,iface=MIXER,name=‘x DAC IF2 Data Switch’
numid=706,iface=MIXER,name=‘x DAC L2 Mux’
numid=667,iface=MIXER,name=‘x DAC MIXL INF1 Switch’
numid=666,iface=MIXER,name=‘x DAC MIXL Stereo ADC Switch’
numid=669,iface=MIXER,name=‘x DAC MIXR INF1 Switch’
numid=668,iface=MIXER,name=‘x DAC MIXR Stereo ADC Switch’
numid=707,iface=MIXER,name=‘x DAC R2 Mux’
numid=495,iface=MIXER,name=‘x DAC1 Playback Volume’
numid=494,iface=MIXER,name=‘x DAC2 Playback Switch’
numid=664,iface=MIXER,name=‘x DAI select’
numid=676,iface=MIXER,name=‘x DIG MIXL DAC L1 Switch’
numid=677,iface=MIXER,name=‘x DIG MIXL DAC L2 Switch’
numid=678,iface=MIXER,name=‘x DIG MIXR DAC R1 Switch’
numid=679,iface=MIXER,name=‘x DIG MIXR DAC R2 Switch’
numid=489,iface=MIXER,name=‘x HP Channel Switch’
numid=704,iface=MIXER,name=‘x HP L Playback Switch’
numid=490,iface=MIXER,name=‘x HP Playback Volume’
numid=705,iface=MIXER,name=‘x HP R Playback Switch’
numid=730,iface=MIXER,name=‘x HPO MIX DAC1 Switch’
numid=729,iface=MIXER,name=‘x HPO MIX DAC2 Switch’
numid=731,iface=MIXER,name=‘x HPO MIX HPVOL Switch’
numid=499,iface=MIXER,name=‘x IN Capture Volume’
numid=496,iface=MIXER,name=‘x IN1 Boost’
numid=497,iface=MIXER,name=‘x IN2 Boost’
numid=498,iface=MIXER,name=‘x IN3 Boost’
numid=534,iface=MIXER,name=‘x Jack-state’
numid=698,iface=MIXER,name=‘x LOUT MIX DAC L1 Switch’
numid=699,iface=MIXER,name=‘x LOUT MIX DAC R1 Switch’
numid=700,iface=MIXER,name=‘x LOUT MIX OUTVOL L Switch’
numid=701,iface=MIXER,name=‘x LOUT MIX OUTVOL R Switch’
numid=502,iface=MIXER,name=‘x Mono ADC Capture Volume’
numid=653,iface=MIXER,name=‘x Mono ADC L1 Mux’
numid=652,iface=MIXER,name=‘x Mono ADC L2 Mux’
numid=660,iface=MIXER,name=‘x Mono ADC MIXL ADC1 Switch’
numid=661,iface=MIXER,name=‘x Mono ADC MIXL ADC2 Switch’
numid=662,iface=MIXER,name=‘x Mono ADC MIXR ADC1 Switch’
numid=663,iface=MIXER,name=‘x Mono ADC MIXR ADC2 Switch’
numid=654,iface=MIXER,name=‘x Mono ADC R1 Mux’
numid=655,iface=MIXER,name=‘x Mono ADC R2 Mux’
numid=670,iface=MIXER,name=‘x Mono DAC MIXL DAC L1 Switch’
numid=671,iface=MIXER,name=‘x Mono DAC MIXL DAC L2 Switch’
numid=672,iface=MIXER,name=‘x Mono DAC MIXL DAC R2 Switch’
numid=675,iface=MIXER,name=‘x Mono DAC MIXR DAC L2 Switch’
numid=673,iface=MIXER,name=‘x Mono DAC MIXR DAC R1 Switch’
numid=674,iface=MIXER,name=‘x Mono DAC MIXR DAC R2 Switch’
numid=486,iface=MIXER,name=‘x Mono DAC Playback Volume’
numid=736,iface=MIXER,name=‘x Mono MIX BST1 Switch’
numid=733,iface=MIXER,name=‘x Mono MIX DAC L2 Switch’
numid=732,iface=MIXER,name=‘x Mono MIX DAC R2 Switch’
numid=735,iface=MIXER,name=‘x Mono MIX OUTVOL L Switch’
numid=734,iface=MIXER,name=‘x Mono MIX OUTVOL R Switch’
numid=485,iface=MIXER,name=‘x Mono Playback Switch’
numid=492,iface=MIXER,name=‘x OUT Channel Switch’
numid=715,iface=MIXER,name=‘x OUT MIXL BST1 Switch’
numid=720,iface=MIXER,name=‘x OUT MIXL DAC L1 Switch’
numid=719,iface=MIXER,name=‘x OUT MIXL DAC L2 Switch’
numid=718,iface=MIXER,name=‘x OUT MIXL DAC R2 Switch’
numid=716,iface=MIXER,name=‘x OUT MIXL INL Switch’
numid=717,iface=MIXER,name=‘x OUT MIXL REC MIXL Switch’
numid=714,iface=MIXER,name=‘x OUT MIXL SPK MIXL Switch’
numid=723,iface=MIXER,name=‘x OUT MIXR BST1 Switch’
numid=722,iface=MIXER,name=‘x OUT MIXR BST2 Switch’
numid=726,iface=MIXER,name=‘x OUT MIXR DAC L2 Switch’
numid=728,iface=MIXER,name=‘x OUT MIXR DAC R1 Switch’
numid=727,iface=MIXER,name=‘x OUT MIXR DAC R2 Switch’
numid=724,iface=MIXER,name=‘x OUT MIXR INR Switch’
numid=725,iface=MIXER,name=‘x OUT MIXR REC MIXR Switch’
numid=721,iface=MIXER,name=‘x OUT MIXR SPK MIXR Switch’
numid=491,iface=MIXER,name=‘x OUT Playback Switch’
numid=493,iface=MIXER,name=‘x OUT Playback Volume’
numid=642,iface=MIXER,name=‘x RECMIXL BST1 Switch’
numid=641,iface=MIXER,name=‘x RECMIXL BST2 Switch’
numid=640,iface=MIXER,name=‘x RECMIXL BST3 Switch’
numid=638,iface=MIXER,name=‘x RECMIXL HPOL Switch’
numid=639,iface=MIXER,name=‘x RECMIXL INL Switch’
numid=643,iface=MIXER,name=‘x RECMIXL OUT MIXL Switch’
numid=648,iface=MIXER,name=‘x RECMIXR BST1 Switch’
numid=647,iface=MIXER,name=‘x RECMIXR BST2 Switch’
numid=646,iface=MIXER,name=‘x RECMIXR BST3 Switch’
numid=644,iface=MIXER,name=‘x RECMIXR HPOR Switch’
numid=645,iface=MIXER,name=‘x RECMIXR INR Switch’
numid=649,iface=MIXER,name=‘x RECMIXR OUT MIXR Switch’
numid=665,iface=MIXER,name=‘x SDI select’
numid=682,iface=MIXER,name=‘x SPK MIXL DAC L1 Switch’
numid=683,iface=MIXER,name=‘x SPK MIXL DAC L2 Switch’
numid=681,iface=MIXER,name=‘x SPK MIXL INL Switch’
numid=684,iface=MIXER,name=‘x SPK MIXL OUT MIXL Switch’
numid=680,iface=MIXER,name=‘x SPK MIXL REC MIXL Switch’
numid=687,iface=MIXER,name=‘x SPK MIXR DAC R1 Switch’
numid=688,iface=MIXER,name=‘x SPK MIXR DAC R2 Switch’
numid=686,iface=MIXER,name=‘x SPK MIXR INR Switch’
numid=689,iface=MIXER,name=‘x SPK MIXR OUT MIXR Switch’
numid=685,iface=MIXER,name=‘x SPK MIXR REC MIXR Switch’
numid=694,iface=MIXER,name=‘x SPOL MIX BST1 Switch’
numid=691,iface=MIXER,name=‘x SPOL MIX DAC L1 Switch’
numid=690,iface=MIXER,name=‘x SPOL MIX DAC R1 Switch’
numid=693,iface=MIXER,name=‘x SPOL MIX SPKVOL L Switch’
numid=692,iface=MIXER,name=‘x SPOL MIX SPKVOL R Switch’
numid=697,iface=MIXER,name=‘x SPOR MIX BST1 Switch’
numid=695,iface=MIXER,name=‘x SPOR MIX DAC R1 Switch’
numid=696,iface=MIXER,name=‘x SPOR MIX SPKVOL R Switch’
numid=487,iface=MIXER,name=‘x Speaker Channel Switch’
numid=702,iface=MIXER,name=‘x Speaker L Playback Switch’
numid=488,iface=MIXER,name=‘x Speaker Playback Volume’
numid=703,iface=MIXER,name=‘x Speaker R Playback Switch’
numid=656,iface=MIXER,name=‘x Stereo ADC MIXL ADC1 Switch’
numid=657,iface=MIXER,name=‘x Stereo ADC MIXL ADC2 Switch’
numid=658,iface=MIXER,name=‘x Stereo ADC MIXR ADC1 Switch’
numid=659,iface=MIXER,name=‘x Stereo ADC MIXR ADC2 Switch’
numid=651,iface=MIXER,name=‘x Stereo ADC1 Mux’
numid=650,iface=MIXER,name=‘x Stereo ADC2 Mux’
numid=710,iface=MIXER,name=‘x Stereo DAC MIXL ANC Switch’
numid=708,iface=MIXER,name=‘x Stereo DAC MIXL DAC L1 Switch’
numid=709,iface=MIXER,name=‘x Stereo DAC MIXL DAC L2 Switch’
numid=713,iface=MIXER,name=‘x Stereo DAC MIXR ANC Switch’
numid=711,iface=MIXER,name=‘x Stereo DAC MIXR DAC R1 Switch’
numid=712,iface=MIXER,name=‘x Stereo DAC MIXR DAC R2 Switch’

Hello!

Can you try …

# playback
$ amixer -c tegrasndt210ref cset name='x HP L Playback Switch' on
$ amixer -c tegrasndt210ref cset name='x HP R Playback Switch' on
$ amixer -c tegrasndt210ref cset name='x Stereo DAC MIXL DAC L1 Switch' on
$ amixer -c tegrasndt210ref cset name='x Stereo DAC MIXR DAC R1 Switch' on
$ amixer -c tegrasndt210ref cset name='x HPO MIX DAC1 Switch' on
# capture
$ amixer -c tegrasndt210ref cset name="x Stereo ADC MIXL ADC2 Switch" 0
$ amixer -c tegrasndt210ref cset name="x Stereo ADC MIXR ADC2 Switch" 0
$ amixer -c tegrasndt210ref cset name="x ADC Capture Switch" 1
$ amixer -c tegrasndt210ref cset name="x RECMIXL BST1 Switch" 0
$ amixer -c tegrasndt210ref cset name="x RECMIXR BST1 Switch" 0
$ amixer -c tegrasndt210ref cset name="x RECMIXL BST2 Switch" 1
$ amixer -c tegrasndt210ref cset name="x RECMIXR BST2 Switch" 1
$ amixer -c tegrasndt210ref cset name="x Stereo ADC L1 Mux" "ADC"
$ amixer -c tegrasndt210ref cset name="x Stereo ADC R1 Mux" "ADC"
$ amixer -c tegrasndt210ref cset name="x Stereo ADC MIXL ADC1 Switch" 1
$ amixer -c tegrasndt210ref cset name="x Stereo ADC MIXR ADC1 Switch" 1
$ amixer -c tegrasndt210ref cset name="x Stereo ADC MIXL ADC2 Switch" 0
$ amixer -c tegrasndt210ref cset name="x Stereo ADC MIXR ADC2 Switch" 0
$ amixer -c tegrasndt210ref cset name="x IN1 Mode Control" "Single ended"
$ amixer -c tegrasndt210ref cset name="x IN2 Mode Control" "Single ended"

Regards,
Jon

Hi, Jon
Thank you very much for your reply!

I’ve tried these commands as you mentioned and I heared the sound from the headphone successfully. Thank you very much again, Jon!

But there is so much noise in the sound from the headphone that I can hardly tell whether it is the correct music. Have you ever had the same situation?

Best Regards
wujz

Hello Wujz,

No I have not seen this, but the first thing to check would be the clocking. What clock is used to drive the RT5640 MCLK?

Regards,
Jon

Hi,
i meet the same problem, i check i2s3 pinmux, aud_mclk pinmux is ok, but 5640 not work, how to settle the problem, check and verify it?

Thank & best regards!

richard

Hello!

Assuming that the Tegra AUD_MCLK is driving the codec MCLK and so Tegra is the I2S bit-clock and frame-clock master, then you need to ensure that snd_soc_dai_set_sysclk() is being called in the Tegra machine driver (by the function tegra_machine_dai_init()) for your DAI link to configure the codec clock correctly. See the following example for the ‘rt565x-playback’ DAI link …

https://nv-tegra.nvidia.com/gitweb/?p=linux-nvidia.git;a=blob;f=sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c;h=fbca4699d353de7e7eb2b8984c07efab954e5b15;hb=refs/heads/l4t/l4t-r32.4.2#l314

There are some more details in the L4T documentation …

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fasoc_driver.18.2.html%23wwpID0E0QS0HA

Regards
Jon

Hi, Jon
Thank you very much for replying.

In my case, the Tegra AUD_MCLK is driving the codec MCLK and Tegra is the I2S bit-clock and frame-clock master indeed. I configured the pinmux for AUD_MCLK correctly, and I could mesure Clock on the AUD_MCLK pin.

In my case, the function “tegra_machine_dai_init()” is as follows:

static int tegra_machine_dai_init(struct snd_soc_pcm_runtime runtime,
int rate,
int channels,
u64 formats,
bool is_playback)
{


/
roborock alc5640/rt5640 codec */
rtd = snd_soc_get_pcm_runtime(card, “rt5640_playback”);
if (rtd) {
dai_params =
(struct snd_soc_pcm_stream *)rtd->dai_link->params;

	dai_params->rate_min = clk_rate;
	dai_params->formats = (machine->fmt_via_kcontrol == 2) ?
			(1ULL << SNDRV_PCM_FORMAT_S32_LE) : formats;

	if (machine->is_hs_supported) {
		err = snd_soc_dai_set_sysclk(rtd->codec_dai,
					RT5640_SCLK_S_MCLK, clk_out_rate, SND_SOC_CLOCK_IN);
		if (err < 0) {
			dev_err(card->dev, "codec_dai clock not set\n");
			return err;
		}
	}
}



}

I’m sure the function “snd_soc_dai_set_sysclk” is invoked by the function “tegra_machine_dai_init”, because I added lots of debugging code using “printk” and these debugging code could run correcttly.

I added these code in the function “dai_link_setup” to set init function for my dai_link “rt5640_playback” as follows:

static void dai_link_setup(struct platform_device *pdev)
{


for (i = 0; i < machine->num_codec_links; i++) {
if (tegra_machine_codec_links[i].name) {


else if (strstr(tegra_machine_codec_links[i].name, “rt5640_playback”)) {
codec_dai_name = tegra_machine_codec_links[i].codec_dai_name;

			if (!strcmp("dit-hifi", codec_dai_name)) {
				dev_info(&pdev->dev, "This is a dummy codec\n");
				machine->is_hs_supported = false;
				d_printk("This is a dummy codec\n");
			} else {
				machine->is_hs_supported = true;
				tegra_machine_codec_links[i].init =
						tegra_machine_rt565x_init;
				d_printk("set init for rt5640_playback\n");
			}
		} 



}
}

I’m sure that the above code was running correctly, and the function “tegra_machine_rt565x_init” was invoked.

By the way, I did’t modify the function “tegra_machine_rt565x_init”.

The sound node in the device-tree is as follows:

sound_card: sound {
status = “okay”;
compatible = “nvidia,tegra-audio-t210ref-mobile-rt565x”;
nvidia,model = “tegra-snd-t210ref-mobile-rt5640”;

clocks = <&tegra_car TEGRA210_CLK_PLL_P_OUT1>,
<&tegra_car TEGRA210_CLK_PLL_A>,
<&tegra_car TEGRA210_CLK_PLL_A_OUT0>,
<&tegra_car TEGRA210_CLK_D_AUDIO>,
<&tegra_car TEGRA210_CLK_CLK_M>,
<&tegra_car TEGRA210_CLK_EXTERN1>;
clock-names = “pll_p_out1”, “pll_a”, “pll_a_out0”, “ahub”,
“clk_m”, “extern1”;

	assigned-clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
		<&tegra_car TEGRA210_CLK_PLL_A_OUT0>,
		<&tegra_car TEGRA210_CLK_D_AUDIO>,
		<&tegra_car TEGRA210_CLK_EXTERN1>;
	assigned-clock-rates = <368640000>, <45158400>,
		<36864000>, <12288000>;

nvidia,mclk-rate = <36864000>;
mclk_parent = “ahub”;

nvidia,num-codec-link = <4>;



i2s_dai_link1: nvidia,dai-link-1 {
link-name = “rt5640_playback”;
cpu-dai = <&tegra_i2s4>;
codec-dai = <&rt5640_codec>;
cpu-dai-name = “I2S4”;
codec-dai-name = “rt5640-aif1”;
format = “i2s”;
bitclock-slave;
frame-slave;
bitclock-noninversion;
frame-noninversion;
bit-format = “s16_le”;
bclk_ratio = <1>;
srate = <48000>;
num-channel = <2>;
ignore_suspend;
name-prefix = “x”;
status = “okay”;
};


}

I added the propety of “nvidia,mclk-rate” and “mclk_parent” in the sound node as follows:

nvidia,mclk-rate = <36864000>;
mclk_parent = “ahub”;

I’m not sure about the vaule for the propety of “nvidia,mclk-rate” and “mclk_parent” .

I found the following relationship between these functions:

tegra_machine_dai_init —> snd_soc_dai_set_sysclk —> rt5640_set_dai_sysclk

And I’m sure that the function “rt5640_set_dai_sysclk” was invoked correctly with the help of printk.

I’m not sure about the clock configuration for the sound node in the device-tree file.

In my case, the Tegra AUD_MCLK is driving the codec MCLK and Tegra is the I2S bit-clock and frame-clock master, and I did the following steps:

(1) Pinmux Configuration
I’m sure the pinmux configuration for the I2C, I2S and AUD_MCLK are correct.

(2) Device Tree Configuration for a Custom Audio Card
I added the “rt5640_codec” subnode in the i2c controller node, and the function “rt5640_probe” was run correctly

I modified the status of “i2s@702d1300” from “disabled” to “okay”.

I modified the “sound” node as mentioned above, but I’m not sure about the clock configuration propeties for the “sound” node.

I added the “nvidia,mclk-rate” and “mclk_parent” propety, but I’m not sure about the values for these propeties.

I added the subnode “nvidia,dai-link-1” in the sound node as mentioned above, and the function “snd_soc_register_card” returned correctly.
But I’m not quite sure about the propeties for the subnode “nvidia,dai-link-1”.

(3) Adding init code in the funtion “tegra_machine_dai_init”
I added these code in the function “tegra_machine_dai_init”:

rtd = snd_soc_get_pcm_runtime(card, "rt5640_playback");
if (rtd) {	
	dai_params =
	(struct snd_soc_pcm_stream *)rtd->dai_link->params;

	dai_params->rate_min = clk_rate;
	dai_params->formats = (machine->fmt_via_kcontrol == 2) ?
			(1ULL << SNDRV_PCM_FORMAT_S32_LE) : formats;

	if (machine->is_hs_supported) {
		err = snd_soc_dai_set_sysclk(rtd->codec_dai,
					RT5640_SCLK_S_MCLK, clk_out_rate, SND_SOC_CLOCK_IN);
		if (err < 0) {
			dev_err(card->dev, "codec_dai clock not set\n");
			return err;
		}
	}
}

I’m sure the function “snd_soc_dai_set_sysclk” was invoked by function “tegra_machine_dai_init”.

(4) Adding init code in the function “dai_link_setup”

I added these code in the function “dai_link_setup” as follows:

for (i = 0; i < machine->num_codec_links; i++) {

else if (strstr(tegra_machine_codec_links[i].name, “rt5640_playback”)) {
codec_dai_name =
tegra_machine_codec_links[i].codec_dai_name;

			if (!strcmp("dit-hifi", codec_dai_name)) {
				dev_info(&pdev->dev, "This is a dummy codec\n");
				machine->is_hs_supported = false;
			} else {
				machine->is_hs_supported = true;
				tegra_machine_codec_links[i].init =
						tegra_machine_rt565x_init;
			}
		}

}

And I’m sure the function “tegra_machine_rt565x_init” was invoked during the initilization.

I did not modify the function “tegra_machine_rt565x_init”.

(5) Updating dtb and Image

(6) Configuring the controls
I used these commands to configure the contros for playback.

$ amixer -c tegrasndt210ref cset name=‘x HP L Playback Switch’ on
$ amixer -c tegrasndt210ref cset name=‘x HP R Playback Switch’ on
$ amixer -c tegrasndt210ref cset name=‘x Stereo DAC MIXL DAC L1 Switch’ on
$ amixer -c tegrasndt210ref cset name=‘x Stereo DAC MIXR DAC R1 Switch’ on
$ amixer -c tegrasndt210ref cset name=‘x HPO MIX DAC1 Switch’ on

(7) Play music
I used the following command to play a music:

aplay -D plughw:CARD=tegrasndt210ref,DEV=0 xp_start.wav

(8) Result
I can hear the music from the headphone, and I can tell it’s the correct music. But there is a lot of noise in the music.

What is the problem in my case? Thank you very much!

Best regards!
wujz

By the way, I did’t modify rt5640’s driver file(“kernel_src/kernel/kernel-4.9/sound/soc/codecs/rt5640.c”).

Hi, all
i check in our board, i2s3, aud_mclk, pinmux is good,
PBB0–>AUD, PE0-PE3–>I2S3

i read rt5640 register, find out power is down, modules is mute, rt5640 doesnt work.

i want to know why, and how to find the problem?

thanks

richard