Orin Nx use rt5640 no sound in LOUT

Hi, we are using orin nx (JetPack6) with rt 5640 to do audio control. But when test playback, we can only get sound from speaker, Line out has no sound.

Here is the device tree

  bus@0 {	
		/*pin 232 234*/
		i2c@3160000 {		
			rt5640: rt5640@1c {
				status = "okay";
				compatible = "realtek,rt5640";
				reg = <0x1c>;

				clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
				clock-names = "mclk";
				sound-name-prefix = "CVB-RT";

				#sound-dai-cells = <1>;

				port {
					rt5640_ep: endpoint {
						remote-endpoint = <&i2s1_dap>;
						mclk-fs = <256>;
					};
				};
			};
		};
      };

    /*ALC5640*/
	tegra_sound_graph: tegra_sound: sound {
		compatible = "nvidia,tegra186-audio-graph-card",
			     "nvidia,tegra186-ape";
		clocks = <&bpmp TEGRA234_CLK_PLLA>,
			 <&bpmp TEGRA234_CLK_PLLA_OUT0>,
			 <&bpmp TEGRA234_CLK_AUD_MCLK>;
		clock-names = "pll_a", "plla_out0", "extern1";
		assigned-clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
		assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLA_OUT0>;

		nvidia-audio-card,name = "NVIDIA Jetson Orin NX APE";
		nvidia-audio-card,mclk-fs = <256>;

		nvidia-audio-card,widgets =
			"Headphone",	"CVB-RT Headphone Jack",
			"Microphone",	"CVB-RT Mic Jack",
			"Speaker",	    "CVB-RT Int Spk",
			"Microphone",	"CVB-RT Int Mic";

		nvidia-audio-card,routing =
			"CVB-RT Headphone Jack", "CVB-RT HPOL",
			"CVB-RT Headphone Jack", "CVB-RT HPOR",
			"CVB-RT IN2P",		     "CVB-RT Mic Jack",
			"CVB-RT IN2N",		     "CVB-RT Mic Jack",
			"CVB-RT IN2P",		     "CVB-RT Int Mic",
			"CVB-RT IN2N",		     "CVB-RT Int Mic",
			"CVB-RT Int Spk",	     "CVB-RT SPOLP",
			"CVB-RT Int Spk",	     "CVB-RT SPORP",
			"CVB-RT Int Spk",	     "CVB-RT LOUTL",
			"CVB-RT Int Spk",	     "CVB-RT LOUTR";
	};

.......


&i2s1_to_codec { 
	link-name = "rt5640-playback";
	bitclock-master;
    frame-master;
	codec {
		sound-dai = <&rt5640 0>;
		prefix = "CVB-RT";
	};
};

And here is our amixer set command

amixer -c APE cset name="ADMAIF1 Mux" I2S1
amixer -c APE cset name="I2S1 Mux" ADMAIF1
amixer -c APE cset name='CVB-RT DAC MIXL INF1 Switch' 1
amixer -c APE cset name='CVB-RT DAC MIXR INF1 Switch' 1
amixer -c APE cset name='CVB-RT Stereo DAC MIXL DAC L1 Switch' 1
amixer -c APE cset name='CVB-RT Stereo DAC MIXR DAC R1 Switch' 1
amixer -c APE cset name='CVB-RT LOUT MIX DAC L1 Switch' 1
amixer -c APE cset name='CVB-RT LOUT MIX DAC R1 Switch' 1
amixer -c APE cset name='CVB-RT LOUT MIX OUTVOL R Switch' 1
amixer -c APE cset name='CVB-RT LOUT MIX OUTVOL L Switch' 1
amixer -c APE cset name="CVB-RT OUT Playback Switch" "on,on"

amixer -c APE cset name='CVB-RT Speaker Channel Switch' on,on 
amixer -c APE cset name='CVB-RT Speaker L Playback Switch' 1
amixer -c APE cset name='CVB-RT Speaker R Playback Switch' 1

By the, although speaker can play but there is alot noise in the sound

*** Please note that this reply is generated by LLM automatically ***

Based on the provided context, it appears that you are experiencing issues with audio playback on the Jetson Orin NX using the RT5640 codec. Specifically, you are only able to get sound from the speaker, but not from the line out, and there is a significant amount of noise in the sound.

To address this issue, let’s break down the provided information and compare it to the context.

Firstly, the device tree and amixer set commands are not provided, so I’ll assume that they are correctly configured.

The context provides several examples of amixer commands for stereo playback to both playback ports. These commands are identical and include:

  • Setting the I2S1 Mux to ADMAIF1
  • Setting the CVB-RT HP Playback Volume to 30
  • Enabling the CVB-RT Stereo DAC MIXR DAC R1 Switch and CVB-RT Stereo DAC MIXL DAC L1 Switch
  • Enabling the CVB-RT HP R Playback Switch and CVB-RT HP L Playback Switch

These commands are likely necessary to enable stereo playback to both playback ports. However, since you are only getting sound from the speaker, it’s possible that the line out is not correctly configured.

The context also provides an example of amixer commands for stereo mic capture from both recording ports. These commands include:

  • Setting the ADMAIF1 Mux to I2S1
  • Enabling capture from PORT 1L and PORT 1R
  • Setting the volume control for PORT 1L and PORT 1R
  • Enabling the CVB-RT Stereo ADC MIXL ADC1 Switch and CVB-RT Stereo ADC MIXR ADC1 Switch

These commands are not directly related to playback, but they do provide some insight into the configuration of the RT5640 codec.

To troubleshoot the issue, I would recommend trying the following:

  1. Verify that the line out is correctly configured in the device tree.
  2. Check that the amixer commands are correctly setting the CVB-RT HP Playback Volume and enabling the CVB-RT Stereo DAC MIXR DAC R1 Switch and CVB-RT Stereo DAC MIXL DAC L1 Switch.
  3. Try setting the CVB-RT HP R Playback Switch and CVB-RT HP L Playback Switch to “off” and see if the line out produces sound.
  4. Check for any noise or distortion in the audio signal by using a tool such as arecord to capture the audio and then playing it back using aplay.

Regarding the noise in the sound, it’s possible that it’s related to the configuration of the RT5640 codec or the device tree. I would recommend trying the following:

  1. Check the device tree configuration for the RT5640 codec and ensure that it is correctly configured.
  2. Try adjusting the CVB-RT HP Playback Volume to a lower value to see if it reduces the noise.
  3. Check for any noise or distortion in the audio signal by using a tool such as arecord to capture the audio and then playing it back using aplay.

In summary, the issue appears to be related to the configuration of the RT5640 codec and the device tree. By verifying the configuration and trying the suggested troubleshooting steps, you should be able to resolve the issue and get sound from the line out with minimal noise.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

I set this and linout can get sound

amixer -c APE cset name='CVB-RT HP L Playback Switch' 1
amixer -c APE cset name='CVB-RT HP R Playback Switch' 1
amixer -c APE cset name='CVB-RT HPO MIX HPVOL Switch' 1
amixer -c APE cset name='CVB-RT HPO MIX DAC1 Switch'  1

Good to hear Line Out is up and running! Let us know if you need help with anything else

Hi, I have another issue that our speaker only L can output audio, the R channel has no audio

here is the setting

amixer -c APE cset name="ADMAIF1 Mux" I2S1
amixer -c APE cset name="I2S1 Mux" ADMAIF1
amixer -c APE cset name='CVB-RT DAC MIXL INF1 Switch' 1
amixer -c APE cset name='CVB-RT DAC MIXR INF1 Switch' 1
amixer -c APE cset name='CVB-RT Stereo DAC MIXL DAC L1 Switch' 1
amixer -c APE cset name='CVB-RT Stereo DAC MIXR DAC R1 Switch' 1


amixer -c APE cset name='CVB-RT Speaker L Playback Switch' 1
amixer -c APE cset name='CVB-RT SPOL MIX DAC L1 Switch' 1
amixer -c APE cset name='CVB-RT SPOL MIX SPKVOL L Switch' 1

amixer -c APE cset name='CVB-RT SPOL MIX SPKVOL R Switch' 1
amixer -c APE cset name='CVB-RT SPOL MIX DAC R1 Switch' 1
amixer -c APE cset name='CVB-RT Speaker R Playback Switch' 1

And I can control the L speaker enable and disable as well, we measure the wave there is no signal output in R speaker

Sorry for the late response.
Is this still an issue to support? Any result can be shared?

I’ve already fix only L can output. It turns out that I missed opening R switch. By setting as below, speaker can work fine

amixer -c APE cset name='CVB-RT SPOL MIX DAC L1 Switch' 1
amixer -c APE cset name='CVB-RT SPOR MIX DAC R1 Switch' 1
amixer -c APE cset name='CVB-RT SPOL MIX SPKVOL L Switch' 1
amixer -c APE cset name='CVB-RT SPOL MIX SPKVOL R Switch' 1
amixer -c APE cset name='CVB-RT SPOL MIX DAC R1 Switch' 1
amixer -c APE cset name='CVB-RT SPOR MIX SPKVOL R Switch' 1
amixer -c APE cset name='CVB-RT Speaker L Playback Switch' 1
amixer -c APE cset name='CVB-RT Speaker R Playback Switch' 1

Thanks

Glad to know issue resolved. Thanks for youir update.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.