Audio codec rt5631 on TX2 Jetpack 4.4

I wanna use I2S0 to connect with ALC5633 too.

so i followed that threads but a sound is not works. sound’s out pin works but i think that sound data is not coming anything. if playing some sound
device driver works someting

I think that point is different Jetpack version.
for example Jetpack 4.4 is not using tegra_t186ref_mobile_rt565x.c and instead of using tegra_machine_driver_mobile.c

But that be all… am I missing something?

My change point is like this

<div class="container">


+++ b/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-modules/tegra186-super-module-e2614-p2597-1000-a00.dtsi
@@ -28,6 +28,26 @@
 			vdd_IO-supply = <&spmic_sd3>;
 			status = "disabled";
 		};
+		
+		rt5631_codec: rt5631@1c {
+			compatible = "realtek,rt5631";
+			reg = <0x1c>;
+			status = "okay";
+		    gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(J , 5) GPIO_ACTIVE_HIGH>;
+		    realtek,jd-src = <1>; 
+		    realtek,dmic1-data-pin = <2>; 
+		};
+        		

--- a/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
+++ b/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
@@ -695,6 +695,8 @@
 	tegra_sound: sound {
 		compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
 		nvidia,model = "tegra-snd-t186ref-mobile-rt565x";
+
+		/* nvidia,num-codec-link = <12>; */
 		nvidia,num-codec-link = <12>;
 		clocks = <&tegra_car TEGRA186_CLK_PLLA>,
 			 <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
@@ -706,8 +708,8 @@
 					 <&tegra_car TEGRA186_CLK_PLL_A_OUT0>;
 		resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
 		reset-names = "extern1_rst";
-
 		status = "okay";
+/*
 		nvidia,audio-routing =
 			"x Headphone",		"x OUT",
 			"x IN",			"x Mic",
@@ -727,16 +729,70 @@
 			"d IN",			"d Mic",
 			"d1 Headphone",		"d1 OUT",
 			"d3 Headphone",		"d3 OUT";
+*/
+		nvidia,audio-routing =
+			"x Headphone",		"x Left DAC",
+			"x Headphone",		"x Right DAC",
+			"x IN",			"x Left ADC",
+			"x IN",			"x Right ADC",		
+			"y Headphone",		"y OUT",
+			"y IN",			"y Mic",
+			"z Headphone",		"z OUT",
+			"z IN",			"z Mic",
+			"m Headphone",		"m OUT",
+			"m IN",			"m Mic",
+			"n Headphone",		"n OUT",
+			"n IN",			"n Mic",
+			"o Headphone",		"o OUT",
+			"o IN",			"o Mic",
+			"a IN",			"a Mic",
+			"b IN",			"b Mic",
+			"c IN",			"c Mic",
+			"d IN",			"d Mic",
+			"d1 Headphone",		"d1 OUT",
+			"d3 Headphone",		"d3 OUT";
 
 		nvidia,xbar = <&tegra_axbar>;
 		mclk-fs = <256>;
 
 		rt565x_dai_link: nvidia,dai-link-1 {
-			link-name = "spdif-dit-0";
+			/* link-name = "spdif-dit-0"; */
+			link-name = "rt5631-playback";
 			cpu-dai = <&tegra_i2s1>;
-			codec-dai = <&spdif_dit0>;
+			/* codec-dai = <&spdif_dit0>;  */
+			codec-dai = <&rt5631_codec>;  
 			cpu-dai-name = "I2S1";
-			codec-dai-name = "dit-hifi";
+			/* codec-dai-name = "dit-hifi";  */
+			 codec-dai-name = "rt5631-hifi";   
 			format = "i2s";
 			bit-format = "s16_le";
 			srate = <48000>;

--- a/hardware/nvidia/platform/tegra/common/kernel-dts/audio/tegra-platforms-audio-dai-links.dtsi
+++ b/hardware/nvidia/platform/tegra/common/kernel-dts/audio/tegra-platforms-audio-dai-links.dtsi
@@ -57,8 +57,9 @@
 	};
 
 	tegra_sound: sound {
-		status = "disabled";
-		nvidia,num-codec-link = <12>;
+		status = "okay";
+		/* nvidia,num-codec-link = <12>; */
+		nvidia,num-codec-link = <11>;
 		nvidia,num-clk = <8>;
 		nvidia,clk-rates = < 270950400	/* PLLA_x11025_RATE */
 				     11289600	/* AUD_MCLK_x11025_RATE */
@@ -72,16 +73,24 @@
 		nvidia,xbar = <&tegra_axbar>;
 
 		nvidia,dai-link-1 {
-			link-name = "spdif-dit-0";
+			/* link-name = "spdif-dit-0"; */
+			link-name = "rt565x-playback";
 			cpu-dai = <&tegra_i2s1>;
-			codec-dai = <&spdif_dit0>;
+			/* codec-dai = <&spdif_dit0>; */
+		    codec-dai = <&rt5631_codec>; 
 			cpu-dai-name = "I2S1";
-			codec-dai-name = "dit-hifi";
+			/* codec-dai-name = "dit-hifi"; */
+			codec-dai-name = "rt5631-hifi";
 			format = "i2s";
+			bitclock-slave;
+			frame-slave;
+			bitclock-noninversion;
+			frame-noninversion;			
 			bit-format = "s16_le";
 			srate = <48000>;
 			num-channel = <2>;
-			ignore_suspend;
+			bclk_ratio = <0>;
 			name-prefix = "x";
 			status = "okay";
 
--- a/kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig
+++ b/kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig
@@ -831,6 +831,8 @@ CONFIG_SND_HDA_POWER_SAVE_DEFAULT=1
 CONFIG_SND_HDA_TEGRA=y
 CONFIG_SND_USB_AUDIO=y
 CONFIG_SND_SOC=y
+CONFIG_SND_SOC_RT5631=y
 CONFIG_SND_SOC_TAS2552=y


++ b/kernel/nvidia/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
@@ -344,17 +390,48 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
-	rtd = snd_soc_get_pcm_runtime(card, "spdif-dit-0");
+	rtd = snd_soc_get_pcm_runtime(card, "rt5631-playback");
 	if (rtd) {
+		printk("%s rt5631-playback start \n ", __func__);
 		dai_params =
 		(struct snd_soc_pcm_stream *)rtd->dai_link->params;
 
 		dai_params->rate_min = srate;
+		dai_params->formats = formats;
+
+		err = snd_soc_dai_set_pll(rtd->codec_dai, 0, 0, 0, 0);
+		if (err < 0) {
+			dev_err(card->dev, "failed to configure pll!\n");
+			return err;
+		}
+
+		err = snd_soc_dai_set_sysclk(rtd->codec_dai, 0,
+					     aud_mclk, SND_SOC_CLOCK_IN);
+		if (err < 0) {
+				dev_err(card->dev, "rt5631-playback failed to set codec clock to %d\n",
+					aud_mclk);
+			return err;
+		}
+	}
+	else {

@@ -607,10 +697,17 @@ static int codec_init(struct tegra_machine *machine)
 			continue;
 
 		if (strstr(dai_links[i].name, "rt565x-playback") ||
-		    strstr(dai_links[i].name, "rt565x-codec-sysclk-bclk1"))
+		    strstr(dai_links[i].name, "rt565x-codec-sysclk-bclk1")) {
+			dai_links[i].init = tegra_machine_rt565x_init;
+		}
+		else if (strstr(dai_links[i].name, "rt5631-playback"))	{
+			printk("%s dai_links[%d].name = %s\n", __func__, i, dai_links[i].name);
 			dai_links[i].init = tegra_machine_rt565x_init;
-		else if (strstr(dai_links[i].name, "fe-pi-audio-z-v2"))
+		}
+		else if (strstr(dai_links[i].name, "fe-pi-audio-z-v2")) {
+			printk("%s dai_links[%d].name = %s\n", __func__, i, dai_links[i].name);
 			dai_links[i].init = tegra_machine_fepi_init;
+		}
 	}


@@ -607,10 +697,17 @@ static int codec_init(struct tegra_machine *machine)
 			continue;
 
 		if (strstr(dai_links[i].name, "rt565x-playback") ||
-		    strstr(dai_links[i].name, "rt565x-codec-sysclk-bclk1"))
+		    strstr(dai_links[i].name, "rt565x-codec-sysclk-bclk1")) {
+			dai_links[i].init = tegra_machine_rt565x_init;
+		}
+		else if (strstr(dai_links[i].name, "rt5631-playback"))	{
+			printk("%s dai_links[%d].name = %s\n", __func__, i, dai_links[i].name);
 			dai_links[i].init = tegra_machine_rt565x_init;
-		else if (strstr(dai_links[i].name, "fe-pi-audio-z-v2"))
+		}
+		else if (strstr(dai_links[i].name, "fe-pi-audio-z-v2")) {
+			printk("%s dai_links[%d].name = %s\n", __func__, i, dai_links[i].name);
 			dai_links[i].init = tegra_machine_fepi_init;
+		}
 	}
</div >


When playing sound rt5631 device driver looks work well and any other errors.
but sound data is not incoming.


// trace is look fine

test@test-desktop:~$ sudo cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 115/115   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
 alsa-sink-ADMAI-18710 [003] ....  1203.906044: snd_soc_dapm_start: card=tegra-snd-t186ref-mobile-rt565x
 alsa-sink-ADMAI-18710 [003] ....  1203.906213: snd_soc_dapm_widget_power: widget=Playback 1 val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906217: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906225: snd_soc_dapm_path: *ADMAIF1 RX <- (direct) <- ADMAIF1 Receive
 alsa-sink-ADMAI-18710 [003] ....  1203.906228: snd_soc_dapm_widget_power: widget=ADMAIF1 RX val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906241: snd_soc_dapm_path:  I2S1 Mux <- ARAD1 <- ARAD1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906245: snd_soc_dapm_path:  I2S1 Mux <- ADX4-4 <- ADX4-4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906248: snd_soc_dapm_path:  I2S1 Mux <- ADX4-3 <- ADX4-3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906252: snd_soc_dapm_path:  I2S1 Mux <- ADX4-2 <- ADX4-2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906254: snd_soc_dapm_path:  I2S1 Mux <- ADX4-1 <- ADX4-1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906257: snd_soc_dapm_path:  I2S1 Mux <- AMX4 <- AMX4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906259: snd_soc_dapm_path:  I2S1 Mux <- ADX3-4 <- ADX3-4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906262: snd_soc_dapm_path:  I2S1 Mux <- ADX3-3 <- ADX3-3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906264: snd_soc_dapm_path:  I2S1 Mux <- ADX3-2 <- ADX3-2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906267: snd_soc_dapm_path:  I2S1 Mux <- ADX3-1 <- ADX3-1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906269: snd_soc_dapm_path:  I2S1 Mux <- AMX3 <- AMX3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906272: snd_soc_dapm_path:  I2S1 Mux <- ASRC1-6 <- ASRC1-6 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906275: snd_soc_dapm_path:  I2S1 Mux <- ASRC1-5 <- ASRC1-5 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906278: snd_soc_dapm_path:  I2S1 Mux <- ASRC1-4 <- ASRC1-4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906280: snd_soc_dapm_path:  I2S1 Mux <- ASRC1-3 <- ASRC1-3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906282: snd_soc_dapm_path:  I2S1 Mux <- ASRC1-2 <- ASRC1-2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906285: snd_soc_dapm_path:  I2S1 Mux <- ASRC1-1 <- ASRC1-1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906288: snd_soc_dapm_path:  I2S1 Mux <- I2S6 <- I2S6 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906290: snd_soc_dapm_path:  I2S1 Mux <- DMIC4 <- DMIC4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906293: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF20 <- ADMAIF20 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906296: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF19 <- ADMAIF19 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906299: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF18 <- ADMAIF18 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906301: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF17 <- ADMAIF17 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906304: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF16 <- ADMAIF16 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906306: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF15 <- ADMAIF15 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906309: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF14 <- ADMAIF14 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906312: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF13 <- ADMAIF13 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906314: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF12 <- ADMAIF12 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906316: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF11 <- ADMAIF11 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906319: snd_soc_dapm_path:  I2S1 Mux <- ADX2-4 <- ADX2-4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906321: snd_soc_dapm_path:  I2S1 Mux <- ADX2-3 <- ADX2-3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906324: snd_soc_dapm_path:  I2S1 Mux <- ADX2-2 <- ADX2-2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906326: snd_soc_dapm_path:  I2S1 Mux <- ADX2-1 <- ADX2-1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906328: snd_soc_dapm_path:  I2S1 Mux <- AMX2 <- AMX2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906331: snd_soc_dapm_path:  I2S1 Mux <- ADX1-4 <- ADX1-4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906333: snd_soc_dapm_path:  I2S1 Mux <- ADX1-3 <- ADX1-3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906335: snd_soc_dapm_path:  I2S1 Mux <- ADX1-2 <- ADX1-2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906337: snd_soc_dapm_path:  I2S1 Mux <- ADX1-1 <- ADX1-1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906340: snd_soc_dapm_path:  I2S1 Mux <- AMX1 <- AMX1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906342: snd_soc_dapm_path:  I2S1 Mux <- DMIC3 <- DMIC3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906345: snd_soc_dapm_path:  I2S1 Mux <- DMIC2 <- DMIC2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906347: snd_soc_dapm_path:  I2S1 Mux <- DMIC1 <- DMIC1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906349: snd_soc_dapm_path:  I2S1 Mux <- IQC2-2 <- IQC2-2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906351: snd_soc_dapm_path:  I2S1 Mux <- IQC2-1 <- IQC2-1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906354: snd_soc_dapm_path:  I2S1 Mux <- IQC1-2 <- IQC1-2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906356: snd_soc_dapm_path:  I2S1 Mux <- IQC1-1 <- IQC1-1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906359: snd_soc_dapm_path:  I2S1 Mux <- MVC2 <- MVC2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906362: snd_soc_dapm_path:  I2S1 Mux <- MVC1 <- MVC1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906364: snd_soc_dapm_path:  I2S1 Mux <- OPE1 <- OPE1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906366: snd_soc_dapm_path:  I2S1 Mux <- AFC6 <- AFC6 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906369: snd_soc_dapm_path:  I2S1 Mux <- AFC5 <- AFC5 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906371: snd_soc_dapm_path:  I2S1 Mux <- AFC4 <- AFC4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906374: snd_soc_dapm_path:  I2S1 Mux <- AFC3 <- AFC3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906376: snd_soc_dapm_path:  I2S1 Mux <- AFC2 <- AFC2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906378: snd_soc_dapm_path:  I2S1 Mux <- AFC1 <- AFC1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906381: snd_soc_dapm_path:  I2S1 Mux <- MIXER1-5 <- MIXER1-5 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906384: snd_soc_dapm_path:  I2S1 Mux <- MIXER1-4 <- MIXER1-4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906386: snd_soc_dapm_path:  I2S1 Mux <- MIXER1-3 <- MIXER1-3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906389: snd_soc_dapm_path:  I2S1 Mux <- MIXER1-2 <- MIXER1-2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906391: snd_soc_dapm_path:  I2S1 Mux <- MIXER1-1 <- MIXER1-1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906397: snd_soc_dapm_path:  I2S1 Mux <- SFC4 <- SFC4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906400: snd_soc_dapm_path:  I2S1 Mux <- SFC3 <- SFC3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906403: snd_soc_dapm_path:  I2S1 Mux <- SFC2 <- SFC2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906405: snd_soc_dapm_path:  I2S1 Mux <- SFC1 <- SFC1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906408: snd_soc_dapm_path:  I2S1 Mux <- I2S5 <- I2S5 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906411: snd_soc_dapm_path:  I2S1 Mux <- I2S4 <- I2S4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906413: snd_soc_dapm_path:  I2S1 Mux <- I2S3 <- I2S3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906416: snd_soc_dapm_path:  I2S1 Mux <- I2S2 <- I2S2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906418: snd_soc_dapm_path:  I2S1 Mux <- I2S1 <- I2S1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906421: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF10 <- ADMAIF10 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906423: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF9 <- ADMAIF9 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906426: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF8 <- ADMAIF8 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906428: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF7 <- ADMAIF7 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906430: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF6 <- ADMAIF6 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906433: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF5 <- ADMAIF5 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906435: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF4 <- ADMAIF4 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906437: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF3 <- ADMAIF3 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906440: snd_soc_dapm_path:  I2S1 Mux <- ADMAIF2 <- ADMAIF2 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906442: snd_soc_dapm_path: *I2S1 Mux <- ADMAIF1 <- ADMAIF1 RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906445: snd_soc_dapm_widget_power: widget=I2S1 Mux val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906451: snd_soc_dapm_path: *I2S1 TX <- (direct) <- I2S1 Mux
 alsa-sink-ADMAI-18710 [003] ....  1203.906454: snd_soc_dapm_widget_power: widget=I2S1 TX val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906458: snd_soc_dapm_path: *I2S1 Transmit <- (direct) <- I2S1 TX
 alsa-sink-ADMAI-18710 [003] ....  1203.906460: snd_soc_dapm_widget_power: widget=I2S1 Transmit val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906465: snd_soc_dapm_path: *I2S1 Transmit-I2S1 CIF Receive <- (direct) <- I2S1 Transmit
 alsa-sink-ADMAI-18710 [003] ....  1203.906467: snd_soc_dapm_widget_power: widget=I2S1 Transmit-I2S1 CIF Receive val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906471: snd_soc_dapm_path: *I2S1 CIF Receive <- (direct) <- I2S1 Transmit-I2S1 CIF Receive
 alsa-sink-ADMAI-18710 [003] ....  1203.906474: snd_soc_dapm_widget_power: widget=I2S1 CIF Receive val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906478: snd_soc_dapm_path: *I2S1 CIF RX <- (direct) <- I2S1 CIF Receive
 alsa-sink-ADMAI-18710 [003] ....  1203.906480: snd_soc_dapm_widget_power: widget=I2S1 CIF RX val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906485: snd_soc_dapm_path: *I2S1 DAP TX <- (direct) <- I2S1 CIF RX
 alsa-sink-ADMAI-18710 [003] ....  1203.906487: snd_soc_dapm_widget_power: widget=I2S1 DAP TX val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906491: snd_soc_dapm_path: *I2S1 DAP Transmit <- (direct) <- I2S1 DAP TX
 alsa-sink-ADMAI-18710 [003] ....  1203.906494: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906498: snd_soc_dapm_path: *I2S1 DAP Transmit-x HIFI Playback <- (direct) <- I2S1 DAP Transmit
 alsa-sink-ADMAI-18710 [003] ....  1203.906501: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit-x HIFI Playback val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906504: snd_soc_dapm_path: *x HIFI Playback <- (direct) <- I2S1 DAP Transmit-x HIFI Playback
 alsa-sink-ADMAI-18710 [003] ....  1203.906507: snd_soc_dapm_widget_power: widget=x HIFI Playback val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906511: snd_soc_dapm_path: *x Right DAC <- (direct) <- x HIFI Playback
 alsa-sink-ADMAI-18710 [003] ....  1203.906514: snd_soc_dapm_widget_power: widget=x Right DAC val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906520: snd_soc_dapm_path: *x Left DAC <- (direct) <- x HIFI Playback
 alsa-sink-ADMAI-18710 [003] ....  1203.906522: snd_soc_dapm_widget_power: widget=x Left DAC val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906528: snd_soc_dapm_widget_power: widget=x DAC REF val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906531: snd_soc_dapm_widget_power: widget=x I2S val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906546: snd_soc_dapm_path: *x Headphone <- (direct) <- x Right DAC
 alsa-sink-ADMAI-18710 [003] ....  1203.906549: snd_soc_dapm_path: *x Headphone <- (direct) <- x Left DAC
 alsa-sink-ADMAI-18710 [003] ....  1203.906552: snd_soc_dapm_widget_power: widget=x Headphone val=1
 alsa-sink-ADMAI-18710 [003] ....  1203.906556: snd_soc_dapm_path: *x Right DAC_HP <- (direct) <- x Right DAC
 alsa-sink-ADMAI-18710 [003] ....  1203.906560: snd_soc_dapm_path: *x Left DAC_HP <- (direct) <- x Left DAC
 alsa-sink-ADMAI-18710 [003] ....  1203.906742: snd_soc_dapm_walk_done: tegra-snd-t186ref-mobile-rt565x: checks 22 power, 18 path, 107 neighbour

Hi,

The post https://forums.developer.nvidia.com/t/audio-codec-rt5631-on-tx2/59379 is very old.

Kindly refer to the codec porting guide here and ensure below :

  1. Check if codec is registered (cmd: sudo cat /sys/kernel/debug/asoc/codecs | grep 5631 )
  2. Ensure pinmux settings are done correctly (cmd: sudo /opt/nvidia/jetson-io/config-by-function.py -o dtb i2s1 aud_mclk; sudo reboot)
  3. Check if sound card registration is successful (cmd: cat /proc/asound/cards)
  4. Check if DAPM path is setup fine during the usecase
  5. If playback is still not working, kindly provide mixer control settings and register dumps as per the information in troubleshooting guide available at here

Thanks,
Sharad

alc5633 and rt5631 is almost similar at least it can hear sound so reason why using rt5631 but default rt5631 is not work. and rt5631 dapm have errors too.

i checked your suggstion

  1. codec is registered
  2. nothing changed
  3. rt5631’s DAPM has a lost of errors
    i checked others but
    i dont know why x OUT. x IN still got error. is those declared in tegra186-quill-common.dtsi?

Jan 28 10:58:18 test-desktop kernel: [ 4.772192] tegra-asoc: sound: ASoC: no source widget found for x OUT
Jan 28 10:58:18 test-desktop kernel: [ 4.772196] tegra-asoc: sound: ASoC: Failed to add route x OUT → direct → x Headphone
Jan 28 10:58:18 test-desktop kernel: [ 4.772215] tegra-asoc: sound: ASoC: no sink widget found for x IN
Jan 28 10:58:18 test-desktop kernel: [ 4.772217] tegra-asoc: sound: ASoC: Failed to add route x Mic → direct → x IN
but “x IN”, “x OUT” still got errors
trouble shooting saying CONFIG_SND_SOC_SDPIF=y … but nothing changed and CONFIGS not using that too

It seems DAPM routes are not updated : Please try changing DAPM routes as mentioned in the comment Audio codec rt5631 on TX2 - #16 by jonathanh.

i already added but still remained

This is bit confusing. DAPM route error wasn’t observed as per you first comment.

Can you share “hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi”?

--- a/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
+++ b/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
@@ -695,6 +695,8 @@
 	tegra_sound: sound {
 		compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
 		nvidia,model = "tegra-snd-t186ref-mobile-rt565x";
+
+		/* nvidia,num-codec-link = <12>; */
 		nvidia,num-codec-link = <12>;
 		clocks = <&tegra_car TEGRA186_CLK_PLLA>,
 			 <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
@@ -706,8 +708,8 @@
 					 <&tegra_car TEGRA186_CLK_PLL_A_OUT0>;
 		resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
 		reset-names = "extern1_rst";
-
 		status = "okay";
+/*
 		nvidia,audio-routing =
 			"x Headphone",		"x OUT",
 			"x IN",			"x Mic",
@@ -727,16 +729,70 @@
 			"d IN",			"d Mic",
 			"d1 Headphone",		"d1 OUT",
 			"d3 Headphone",		"d3 OUT";
+*/
+		nvidia,audio-routing =
+			"x Headphone",		"x Left DAC",
+			"x Headphone",		"x Right DAC",
+			"x IN",			"x Left ADC",
+			"x IN",			"x Right ADC",		
+			"y Headphone",		"y OUT",
+			"y IN",			"y Mic",
+			"z Headphone",		"z OUT",
+			"z IN",			"z Mic",
+			"m Headphone",		"m OUT",
+			"m IN",			"m Mic",
+			"n Headphone",		"n OUT",
+			"n IN",			"n Mic",
+			"o Headphone",		"o OUT",
+			"o IN",			"o Mic",
+			"a IN",			"a Mic",
+			"b IN",			"b Mic",
+			"c IN",			"c Mic",
+			"d IN",			"d Mic",
+			"d1 Headphone",		"d1 OUT",
+			"d3 Headphone",		"d3 OUT";
 
 		nvidia,xbar = <&tegra_axbar>;
 		mclk-fs = <256>;
 
 		rt565x_dai_link: nvidia,dai-link-1 {
-			link-name = "spdif-dit-0";
+			/* link-name = "spdif-dit-0"; */
+			link-name = "rt5631-playback";
 			cpu-dai = <&tegra_i2s1>;
-			codec-dai = <&spdif_dit0>;
+			/* codec-dai = <&spdif_dit0>;  */
+			codec-dai = <&rt5631_codec>;  
 			cpu-dai-name = "I2S1";
-			codec-dai-name = "dit-hifi";
+			/* codec-dai-name = "dit-hifi";  */
+			 codec-dai-name = "rt5631-hifi";   
 			format = "i2s";
 			bit-format = "s16_le";
 			srate = <48000>;

that’s all in tegra186-quill-common.dtsi

Routing looks ok in the attached file. Could be an issue with Device tree file used on Jetson. Please share more info : On Jetson :
# dtc -I fs -O dts /proc/device-tree >/tmp/dt.log
# cat /proc/device-tree/sound/nvidia-audio-card,routing > /tmp/dapm.log

Attach dt.log and dapm.log.

1 Like

dapm.log (280 Bytes)
dt.log (334.5 KB)
kern.log (187.0 KB)

i fixed some of wrong codes but “x IN” still remained

Jan 28 11:01:17 test-desktop kernel: [ 4.812936] tegra-asoc: sound: ASoC: Failed to add route x Left ADC → direct → x IN
Jan 28 11:01:17 test-desktop kernel: [ 4.812963] tegra-asoc: sound: ASoC: no sink widget found for x IN
Jan 28 11:01:17 test-desktop kernel: [ 4.812965] tegra-asoc: sound: ASoC: Failed to add route x Right ADC → direct → x IN

Jan 28 11:04:41 test-desktop kernel: [ 395.219311] rt5631 1-001c: enter rt5631_hifi_pcm_params
Jan 28 11:10:15 test-desktop kernel: [ 395.224661] rt5631_hifi_pcm_params , rt5631->sysclk = 11289600 rt5631->rx_rate = 44100 ,rt5631->bclk_rate =1411200 , (32) timesofbclk = 32
Jan 28 11:10:15 test-desktop kernel: [ 728.974242] pll_a_out0 = 45158400 Hz, aud_mclk = 11289600 Hz, sample rate = 44100 Hz

pcm is something to do but audio still not works

Please make below changes to the routes:

-           "x IN",            "x Left ADC",
-           "x IN",            "x Right ADC",
+	        "x Left ADC",      "x Mic",
+		    "x Right ADC",     "x Mic",

Thanks,
Sharad

all widgets found Thanks!
but speaker is still not work
so tried trace dapm

echo 0 > /sys/kernel/debug/tracing/trace
echo 0 > /sys/kernel/debug/tracing/events/enable
echo 1 > /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_path/enable
echo 1 > /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_start/enable
echo 1 > /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_walk_done/enable
echo 1 > /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
~

but it has problem…

1.txt (10.0 KB)

[000] … 1408.906206: snd_soc_dapm_start: card=tegra-snd-t186ref-mobile-rt565x
[000] … 1408.906487: snd_soc_dapm_widget_power: widget=Playback 1 val=1
[000] … 1408.906530: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=1
[000] … 1408.906540: snd_soc_dapm_path: *ADMAIF1 RX ← (direct) ← ADMAIF1 Receive

traces show not works but i2c is works and dapm is looks good .
where is debug point?

and old threads kernal logs shows “codec-dai “rt5631-hifi” registered”

[    7.854757] input: tegra-snd-t186ref-mobile-rt565x Headphone Jack as /devices/sound/sound/card1/input2
[    7.855144] tegra-snd-t186ref-mobile-rt565x sound: codec-dai "rt5631-hifi" registered

but my case i added some msg in “nvidia/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c”

tegra_machine_driver_probe …
printk("%s :: codec_name"%s" registered\n", func, card->dai_link->codec_name);
printk("%s ::card->dai_link->codec_dai_name"%s" registered\n", func, card->dai_link->codec_dai_name);
printk("%s :: card->dai_link->num_codecs “%d” registered\n", func, card->dai_link->num_codecs);
printk("%s :: codecs->dai_name"%s" registered\n", func, card->dai_link->codecs->dai_name);

Jan 28 11:06:04 test-desktop kernel: [ 4.855409] tegra_machine_driver_probe ::card->dai_link->codec_dai_name"ADMAIF1" registered
Jan 28 11:06:04 test-desktop kernel: [ 4.855411] tegra_machine_driver_probe :: card->dai_link->num_codecs “1” registered
Jan 28 11:06:04 test-desktop kernel: [ 4.855412] tegra_machine_driver_probe :: codecs->dai_name"ADMAIF1" registered

is it shows rt5631-hifi ?

JETPACK 4.4 need a change to i2s1 pinmux setting