The audio codec es8316 can’t work on I2S0 for Xaiver NX

Hi wangxiaozhuang

This file is not readable. Can you please attach the correct file?

You are playing 48kHz/2-channel/16-bit audio stream. The expected MCLK clock is 12.288 MHz. As per your previous update, this clock was correct (~12.3 MHz). Can you confirm this again? Note that you need to probe the clocks after your run the speaker-test.

Thanks,
Sameer.

Hi,

  • So sorry, this is the correct file:
    tegra194-audio-p3668.dtsi (3.4 KB)

  • I reconfirmed that it was 11.3MHz before running “speaker-test” and ~12.3MHz after running “speaker-test”.

Thanks,
wangxiaozhuang

Hi,Sameer
I have a few more questions.

1, Why are there so many sound cards here, can they all work? Can I remove other ADMAIFx and keep only one ADMAIF1? Because es8316 only sees one sound card on other CPUs.
Display after executing “aplay - L” command:

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: tegrahdaxnx [tegra-hda-xnx], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: tegrahdaxnx [tegra-hda-xnx], device 7: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: tegrahdaxnx [tegra-hda-xnx], device 8: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: tegrahdaxnx [tegra-hda-xnx], device 9: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 0: ADMAIF1 CIF ADMAIF1-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 1: ADMAIF2 CIF ADMAIF2-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 2: ADMAIF3 CIF ADMAIF3-2 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 3: ADMAIF4 CIF ADMAIF4-3 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 4: ADMAIF5 CIF ADMAIF5-4 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 5: ADMAIF6 CIF ADMAIF6-5 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 6: ADMAIF7 CIF ADMAIF7-6 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 7: ADMAIF8 CIF ADMAIF8-7 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 8: ADMAIF9 CIF ADMAIF9-8 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 9: ADMAIF10 CIF ADMAIF10-9 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 10: ADMAIF11 CIF ADMAIF11-10 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 11: ADMAIF12 CIF ADMAIF12-11 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 12: ADMAIF13 CIF ADMAIF13-12 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 13: ADMAIF14 CIF ADMAIF14-13 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 14: ADMAIF15 CIF ADMAIF15-14 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 15: ADMAIF16 CIF ADMAIF16-15 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 16: ADMAIF17 CIF ADMAIF17-16 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 17: ADMAIF18 CIF ADMAIF18-17 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 18: ADMAIF19 CIF ADMAIF19-18 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 19: ADMAIF20 CIF ADMAIF20-19 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

2, After I modify the following files and run the ”sperker-test“ program, The es8616 driver can enter “es8316_pcm_startup” “es8316_pcm_hw_params” and “es8316_mute” functions, but these functions cannot be called before :

  • The “sources/kernel/nvidia/sound/soc/tegra-alt/utils/tegra_asoc_machine_alt.c” file is modified as follows:
@@ -1120,9 +1120,9 @@ struct snd_soc_dai_link tegra186_xbar_dai_links[TEGRA186_XBAR_DAI_LINKS] = {
                .name = "ADMAIF1 CIF",
                .stream_name = "ADMAIF1 CIF",
                .cpu_dai_name = "ADMAIF1",
-               .codec_dai_name = "ADMAIF1",
+               .codec_dai_name = "es8316-hifi",
                .cpu_name = "tegra186-admaif",
-               .codec_name = "tegra210-axbar",
+               .codec_name = "es8316.1-0010",
                .platform_name = "tegra186-admaif",
                .ignore_pmdown_time = 1,
        },

  • The “tegra194-audio-p3668.dtsi” file is modified as follows:
#include <audio/tegra-platforms-audio-dai-links.dtsi>

/ {
	aconnect@2a41000 {
		status = "okay";

		agic-controller@2a41000 {
			status = "okay";
		};

		adsp@2993000 {
			status = "okay";
		};
	};

	hda@3510000 {
		hda,card-name = "tegra-hda-xnx";
		status = "okay";
	};

	tegra_sound: sound {
		status = "okay";
		compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
		nvidia,model = "es8316-tegra";
		clocks = <&bpmp_clks TEGRA194_CLK_PLLA>,
			 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
			 <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
		clock-names = "pll_a", "pll_a_out0", "extern1";
		assigned-clocks = <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
				  <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
		assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLA>,
					 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>;

		nvidia,audio-routing =
			"x Headphone",          "x OUT";

		nvidia,xbar = <&tegra_axbar>;

		mclk-fs = <256>;

		nvidia,dai-link-1 {
			name-prefix = "n";
		};

		hdr40_snd_link_i2s: nvidia,dai-link-5 {
			name-prefix = "x";
			status = "okay";
		};

	};
};

  • Display after executing “aplay - L” command :
**** List of PLAYBACK Hardware Devices ****
card 0: tegrahdaxnx [tegra-hda-xnx], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: tegrahdaxnx [tegra-hda-xnx], device 7: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: tegrahdaxnx [tegra-hda-xnx], device 8: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: tegrahdaxnx [tegra-hda-xnx], device 9: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 0: ADMAIF1 CIF es8316-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 1: ADMAIF2 CIF ADMAIF2-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 2: ADMAIF3 CIF ADMAIF3-2 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 3: ADMAIF4 CIF ADMAIF4-3 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 4: ADMAIF5 CIF ADMAIF5-4 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 5: ADMAIF6 CIF ADMAIF6-5 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 6: ADMAIF7 CIF ADMAIF7-6 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 7: ADMAIF8 CIF ADMAIF8-7 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 8: ADMAIF9 CIF ADMAIF9-8 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 9: ADMAIF10 CIF ADMAIF10-9 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 10: ADMAIF11 CIF ADMAIF11-10 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 11: ADMAIF12 CIF ADMAIF12-11 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 12: ADMAIF13 CIF ADMAIF13-12 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 13: ADMAIF14 CIF ADMAIF14-13 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 14: ADMAIF15 CIF ADMAIF15-14 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 15: ADMAIF16 CIF ADMAIF16-15 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 16: ADMAIF17 CIF ADMAIF17-16 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 17: ADMAIF18 CIF ADMAIF18-17 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 18: ADMAIF19 CIF ADMAIF19-18 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: es8316tegra [es8316-tegra], device 19: ADMAIF20 CIF ADMAIF20-19 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
  • Run the ”sperker-test“ program, MCLK is still 12.3MHz, the audio output pin “I2S_ SDO” has no data. Any suggestions? I look forward to your reply .

  • The following is the modification of es8316. C file, only adding some printing at the beginning of the function:
    es8316.c (38.9 KB)

Here is the dmesg information:

root@nvidia-desktop:/home/nvidia# dmesg  | grep "8316"
[    2.253135] es8316_i2c_probe 1171=========================================
[    2.253139] es8316_i2c_probe 1176=========================================
[    2.253200] es8316_i2c_probe 1190=========================================
[    2.253208] es8316_i2c_probe 1245========================================= ret:0
[    2.330556] es8316_probe 1078=========================================
[    2.330577] es8316_probe 1090=========================================
[    2.336833] es8316_probe 1096=========================================
[    2.460927] es8316_init_regs 975=========================================
[    2.466145] es8316_probe 1123=========================================ret:0
[    2.532793] tegra-asoc: sound: es8316-hifi <-> ADMAIF1 mapping ok
[    3.543863]   #1: es8316-tegra
[   12.192713] es8316_pcm_startup 689=========================================
[   12.204273] es8316_pcm_hw_params 776=========================================
[   12.368143] es8316_pcm_startup 689=========================================
[   12.430300] es8316_pcm_hw_params 776=========================================
[   12.431327] es8316_mute 810=========================================
[   12.694965] es8316_pcm_startup 689=========================================
[   12.696773] es8316_pcm_hw_params 776=========================================
[   12.698310] es8316_mute 810=========================================
[   12.829020] es8316_pcm_startup 689=========================================
[   12.894370] es8316_pcm_hw_params 776=========================================
[   12.895004] es8316_mute 810=========================================
[   13.209240] es8316_pcm_startup 689=========================================
[   13.211053] es8316_pcm_hw_params 776=========================================
[   18.415351] es8316_mute 810=========================================
[ 1803.224945] es8316_pcm_startup 689=========================================
[ 1803.299709] es8316_pcm_hw_params 776=========================================
[ 1803.300736] es8316_mute 810=========================================
[ 1807.306781] es8316_mute 810=========================================
[ 1827.559439] es8316_mute 810=========================================
[ 2275.334851] es8316_pcm_startup 689=========================================
[ 2275.399522] es8316_pcm_hw_params 776=========================================
[ 2275.400437] es8316_mute 810=========================================
[ 2276.775491] es8316_mute 810=========================================

Thanks.
wangxiaozhuang

Hi wangxiaozhuang,

12.3 MHz is expected rate once you start the speaker-test. So from clocking point of view it appears good.

What you see here are the playback or capture HW devices. Multiple devices can be used when there is a requirement of multiple stream playback or capture (For ex: ADMAIF1, ADMAIF2 …). You don’t have to worry about this. Your case may require just one device (ADMAIF1) and you can just use that. You can check following to see number of available sound cards:
cat /proc/asound/cards

Don’t modify this.

This looks incorrect. Can you try with following?

diff --git a/common/tegra194-audio-p3668.dtsi b/common/tegra194-audio-p3668.dtsi
index 32ea0bd..8188165 100644
--- a/common/tegra194-audio-p3668.dtsi
+++ b/common/tegra194-audio-p3668.dtsi
@@ -33,6 +33,14 @@
                status = "okay";
        };

+       i2c@c240000 {
+               es8316_codec: es8316@10 {
+                       compatible = "everest,es8316";
+                       reg = <0x10>;
+                       status = "okay";
+               };
+       };
+
        tegra_sound: sound {
                status = "okay";
                compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
@@ -47,8 +55,8 @@
                                         <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>;

                nvidia,audio-routing =
-                       "x Headphone",          "x OUT",
-                       "x IN",                 "x Mic",
+                       "x Headphone",          "x HPOL",
+                       "x Headphone",          "x HPOR",
                        "y Headphone",          "y OUT",
                        "y IN",                 "y Mic",
                        "z Headphone",          "z OUT",
@@ -74,6 +82,10 @@

                hdr40_snd_link_i2s: nvidia,dai-link-5 {
                        name-prefix = "x";
+
+                       link-name = "es8316-playback";
+                       codec-dai = <&es8316_codec>;
+                       codec-dai-name = "es8316-hifi";
                };

        };

Before you run speaker-test, set up audio path.

amixer -c es8316tegra "I2S5 Mux" "ADMAIF1"
speaker-test -D hw:es8316tegra,0 -c 2 -r 48000 -F S16_LE -t sine -f 500

Also are you checking playback on speaker or headphone? I see es8316 has some switch controls for headphone path. Try turning these switches ON before you start speaker-test.

numid=1143,iface=MIXER,name='x Left Hp mixer LLIN Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=1144,iface=MIXER,name='x Left Hp mixer Left DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=1145,iface=MIXER,name='x Right Hp mixer RLIN Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=1146,iface=MIXER,name='x Right Hp mixer Right DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off

Once you start speaker-test, you should see pcm_startup() and hw_param() calls from your codec driver. Keep those debug prints enabled as you have now.

Thanks,
Sameer.

Hi,Sameer

The “tegra_asoc_machine_alt.c” file has been restored without any modification ,And executed the following commands, except that MCLK has 12.3 MHz clock signal, other pins have no signal :

  • The “tegra194-audio-p3668.dtsi” file is modified as follows:
#include <audio/tegra-platforms-audio-dai-links.dtsi>

/ {
	aconnect@2a41000 {
		status = "okay";

		agic-controller@2a41000 {
			status = "okay";
		};

		adsp@2993000 {
			status = "okay";
		};
	};

	hda@3510000 {
		hda,card-name = "tegra-hda-xnx";
		status = "okay";
	};

	i2c@c240000 { 
		es8316_codec: es8316@10 {
			compatible = "everest,es8316";
			reg = <0x10>;
			status = "okay";
		};
	};

	tegra_sound: sound {
		status = "okay";
		compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
		nvidia,model = "es8316-tegra";
		clocks = <&bpmp_clks TEGRA194_CLK_PLLA>,
			 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
			 <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
		clock-names = "pll_a", "pll_a_out0", "extern1";
		assigned-clocks = <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
				  <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
		assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLA>,
					 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>;

		nvidia,audio-routing =
                        "x Headphone",          "x HPOL",
                        "x Headphone",          "x HPOR",
                        "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",
						"d2 Headphone",         "d2 OUT";

		nvidia,xbar = <&tegra_axbar>;

		mclk-fs = <256>;

		nvidia,dai-link-1 {
			name-prefix = "n";
		};

		hdr40_snd_link_i2s: nvidia,dai-link-5 {
			name-prefix = "x";
            link-name = "es8316-playback";
            codec-dai = <&es8316_codec>;
            codec-dai-name = "es8316-hifi";
			status = "okay";
		};

	};
};

  • Executed the following commands
amixer -c es8316tegra cset name="I2S5 Mux" "ADMAIF1"
amixer -c es8316tegra cset name="x Left Hp mixer LLIN Switch" 1
amixer -c es8316tegra cset name="x Left Hp mixer Left DAC Switch" 1
amixer -c es8316tegra cset name="x Right Hp mixer RLIN Switch" 1
amixer -c es8316tegra cset name="x Right Hp mixer Right DAC Switch" 1
speaker-test -D hw:es8316tegra,0 -c 2 -r 48000 -F S16_LE -t sine -f 500 music.wav

speaker-test 1.1.3

Playback device is hw:es8316tegra,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 500.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 8192
Period size range from 32 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 2048
was set buffer_size = 8192
 0 - Front Left
 1 - Front Right
Time per period = 0.112104
 0 - Front Left
 1 - Front Right
Time per period = 0.112295
 0 - Front Left
 1 - Front Right
Time per period = 0.112333
 0 - Front Left
 1 - Front Right
Time per period = 0.112348
 0 - Front Left
 1 - Front Right
Time per period = 0.112328
 0 - Front Left
 1 - Front Right
Time per period = 0.112309
 0 - Front Left
 1 - Front Right
Time per period = 0.112339
 0 - Front Left
......

  • The following is the status in contents:
numid=1143,iface=MIXER,name='x Left Hp mixer LLIN Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=1144,iface=MIXER,name='x Left Hp mixer Left DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=1145,iface=MIXER,name='x Right Hp mixer RLIN Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=1146,iface=MIXER,name='x Right Hp mixer Right DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on

amixer -c es8316tegra scontrols > scontrols.txt
amixer -c es8316tegra controls > controls.txt
amixer -c es8316tegra contents > contents.txt
contents.txt (293.2 KB)
scontrols.txt (48.4 KB)
controls.txt (53.8 KB)

  • Here is the dmesg information, the functions pcm_startup() and hw_param() were not called from my codec driver:
root@nvidia-desktop:/home/nvidia# dmesg  | grep "asoc"
dmesg  | grep "8316"
[    2.686527] tegra-asoc: sound: ADMAIF1 <-> ADMAIF1 mapping ok
[    2.686633] tegra-asoc: sound: ADMAIF2 <-> ADMAIF2 mapping ok
[    2.686734] tegra-asoc: sound: ADMAIF3 <-> ADMAIF3 mapping ok
[    2.686839] tegra-asoc: sound: ADMAIF4 <-> ADMAIF4 mapping ok
[    2.686935] tegra-asoc: sound: ADMAIF5 <-> ADMAIF5 mapping ok
[    2.687064] tegra-asoc: sound: ADMAIF6 <-> ADMAIF6 mapping ok
[    2.687187] tegra-asoc: sound: ADMAIF7 <-> ADMAIF7 mapping ok
[    2.687309] tegra-asoc: sound: ADMAIF8 <-> ADMAIF8 mapping ok
[    2.687412] tegra-asoc: sound: ADMAIF9 <-> ADMAIF9 mapping ok
[    2.687508] tegra-asoc: sound: ADMAIF10 <-> ADMAIF10 mapping ok
[    2.687603] tegra-asoc: sound: ADMAIF11 <-> ADMAIF11 mapping ok
[    2.687692] tegra-asoc: sound: ADMAIF12 <-> ADMAIF12 mapping ok
[    2.687784] tegra-asoc: sound: ADMAIF13 <-> ADMAIF13 mapping ok
[    2.687887] tegra-asoc: sound: ADMAIF14 <-> ADMAIF14 mapping ok
[    2.687984] tegra-asoc: sound: ADMAIF15 <-> ADMAIF15 mapping ok
[    2.688061] tegra-asoc: sound: ADMAIF16 <-> ADMAIF16 mapping ok
[    2.688157] tegra-asoc: sound: ADMAIF17 <-> ADMAIF17 mapping ok
[    2.688232] tegra-asoc: sound: ADMAIF18 <-> ADMAIF18 mapping ok
[    2.688306] tegra-asoc: sound: ADMAIF19 <-> ADMAIF19 mapping ok
[    2.688419] tegra-asoc: sound: ADMAIF20 <-> ADMAIF20 mapping ok
root@nvidia-desktop:/home/nvidia# dmesg  | grep "8316"
[    2.418568] es8316_i2c_probe 1171=========================================
[    2.418572] es8316_i2c_probe 1176=========================================
[    2.418641] es8316_i2c_probe 1190=========================================
[    2.418651] es8316_i2c_probe 1245========================================= ret:0
[    2.550148] es8316_probe 1078=========================================
[    2.550213] es8316_probe 1090=========================================
[    2.556568] es8316_probe 1096=========================================
[    2.676934] es8316_init_regs 975=========================================
[    2.682101] es8316_probe 1123=========================================ret:0
[    2.691096] tegra_machine_es8316_init 590=========================================
[    2.691099] es8316_set_dai_sysclk 562=========================================
[    2.691101] es8316_set_dai_sysclk===========8316codec================== 579
[    2.691104] es8316_set_dai_fmt 603=========================================
[    3.699929]   #1: es8316-tegra
[   12.596084] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   12.596088] es8316_set_dai_sysclk 562=========================================
[   12.596092] es8316_set_dai_sysclk===========8316codec================== 579
[   12.749777] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   12.749880] es8316_set_dai_sysclk 562=========================================
[   12.749889] es8316_set_dai_sysclk===========8316codec================== 579
[   12.871621] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   12.871628] es8316_set_dai_sysclk 562=========================================
[   12.871633] es8316_set_dai_sysclk===========8316codec================== 579
[   12.888984] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   12.888991] es8316_set_dai_sysclk 562=========================================
[   12.888996] es8316_set_dai_sysclk===========8316codec================== 579
[   13.074740] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   13.074747] es8316_set_dai_sysclk 562=========================================
[   13.074753] es8316_set_dai_sysclk===========8316codec================== 579
[ 1884.210144] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[ 1884.210150] es8316_set_dai_sysclk 562=========================================
[ 1884.210155] es8316_set_dai_sysclk===========8316codec================== 579
cat /proc/asound/cards 
 0 [tegrahdaxnx    ]: tegra-hda-xnx - tegra-hda-xnx
                      tegra-hda-xnx at 0x3518000 irq 66
 1 [es8316tegra    ]: es8316-tegra - es8316-tegra
                      es8316-tegra

sudo cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 0/0   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |

Thanks,
wangxiaozhuang

Hi wangxiaozhuang,

Can you please confirm if you are testing on heapdhone?

**This points to some DAPM routing problem. This needs to be fixed before you proceed.
I had a look at es8316 codec driver. The “I2S IN” widget seems to use “I2S1 Playback” stream which I don’t find in the codec driver. Can you try if below helps?
diff --git a/es8316.c b/es8316.c
index c00931e…7ad827c 100644

--- a/es8316.c
+++ b/es8316.c
@@ -325,7 +325,7 @@ static const struct snd_soc_dapm_widget es8316_dapm_widgets[] = {
        SND_SOC_DAPM_AIF_OUT("I2S OUT", "I2S1 Capture",  1,
                             ES8316_SDP_ADCFMT_REG0A, 6, 0),

-       SND_SOC_DAPM_AIF_IN("I2S IN", "I2S1 Playback", 0,
+       SND_SOC_DAPM_AIF_IN("I2S IN", "Playback", 0,
                            SND_SOC_NOPM, 0, 0),

        /*  DACs DATA SRC MUX */

The DAPM trace logs you captured in previous comment is incomplete. Please enable trace events before you start speaker-test. Dump the trace logs once the speaker-test is done.

Also try with following controls only:

numid=1144,iface=MIXER,name='x Left Hp mixer Left DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=1146,iface=MIXER,name='x Right Hp mixer Right DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on

Thanks.

Hi, Sameer

Thank you very much. Great progress has been made according to your guidance

  1. Both heapdone and speaker are connected to sound output devices.

  2. Run the “speaker-test” and the signals can be detected on “I2S_MCK” “I2S_SCK” “I2S_SDO” and “I2S_LRCK” pins.

amixer -c es8316tegra cset name="I2S5 Mux" "ADMAIF1"
amixer -c es8316tegra cset name="x Left Hp mixer Left DAC Switch" 1
amixer -c es8316tegra cset name="x Right Hp mixer Right DAC Switch" 1

  1. The frequency of "I2S_ SCK” and “I2S_LRCK ” are correct?

I2S_MCK:


I2S_SCK:

I2S_SDO:

I2S_LPCK:

echo 0 | sudo tee /sys/kernel/debug/tracing/trace
echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable

speaker-test -D hw:es8316tegra,0 -c 2 -r 48000 -F S16_LE -t sine -f 500 

sudo cat /sys/kernel/debug/tracing/trace
  1. Here is the complete trace
sudo cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 26/26   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
    speaker-test-8177  [001] ....    97.410536: snd_soc_dapm_widget_power: widget=Playback 1 val=1
    speaker-test-8177  [001] ....    97.410543: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=1
    speaker-test-8177  [001] ....    97.410546: snd_soc_dapm_widget_power: widget=ADMAIF1 RX val=1
    speaker-test-8177  [001] ....    97.410552: snd_soc_dapm_widget_power: widget=I2S5 Mux val=1
    speaker-test-8177  [001] ....    97.410554: snd_soc_dapm_widget_power: widget=I2S5 TX val=1
    speaker-test-8177  [001] ....    97.410556: snd_soc_dapm_widget_power: widget=I2S5 Transmit val=1
    speaker-test-8177  [001] ....    97.410558: snd_soc_dapm_widget_power: widget=I2S5 Transmit-I2S5 CIF Receive val=1
    speaker-test-8177  [001] ....    97.410560: snd_soc_dapm_widget_power: widget=I2S5 CIF Receive val=1
    speaker-test-8177  [001] ....    97.410562: snd_soc_dapm_widget_power: widget=I2S5 CIF RX val=1
    speaker-test-8177  [001] ....    97.410564: snd_soc_dapm_widget_power: widget=I2S5 DAP TX val=1
    speaker-test-8177  [001] ....    97.410566: snd_soc_dapm_widget_power: widget=I2S5 DAP Transmit val=1
    speaker-test-8177  [001] ....    97.410568: snd_soc_dapm_widget_power: widget=I2S5 DAP Transmit-x Playback val=1
    speaker-test-8177  [001] ....    97.410569: snd_soc_dapm_widget_power: widget=x Playback val=1
    speaker-test-8177  [001] ....    97.410571: snd_soc_dapm_widget_power: widget=x I2S IN val=1
    speaker-test-8177  [001] ....    97.410573: snd_soc_dapm_widget_power: widget=x DAC SRC Mux val=1
    speaker-test-8177  [001] ....    97.410575: snd_soc_dapm_widget_power: widget=x Right DAC val=1
    speaker-test-8177  [001] ....    97.410577: snd_soc_dapm_widget_power: widget=x Left DAC val=1
    speaker-test-8177  [001] ....    97.410579: snd_soc_dapm_widget_power: widget=x Right Hp mixer val=1
    speaker-test-8177  [001] ....    97.410581: snd_soc_dapm_widget_power: widget=x Left Hp mixer val=1
    speaker-test-8177  [001] ....    97.410583: snd_soc_dapm_widget_power: widget=x HPCP R val=1
    speaker-test-8177  [001] ....    97.410586: snd_soc_dapm_widget_power: widget=x HPCP L val=1
    speaker-test-8177  [001] ....    97.410588: snd_soc_dapm_widget_power: widget=x HPVOL R val=1
    speaker-test-8177  [001] ....    97.410590: snd_soc_dapm_widget_power: widget=x HPVOL L val=1
    speaker-test-8177  [001] ....    97.410592: snd_soc_dapm_widget_power: widget=x HPOR val=1
    speaker-test-8177  [001] ....    97.410594: snd_soc_dapm_widget_power: widget=x HPOL val=1
    speaker-test-8177  [001] ....    97.410596: snd_soc_dapm_widget_power: widget=x Headphone val=1
root@nvidia-desktop:/home/nvidia# 

But there is still no sound from the speakers or headphones, Any suggestions ?

contents.txt (293.2 KB)
scontrols.txt (48.4 KB)
controls.txt (53.8 KB)

I play music with “aplay”, the frequencies of “I2S_MCK” “I2S_SCK” and “I2S_LRCK” are 5.65Mhz, 706KHz and 22KHz respectively. Is that normal ?

aplay -D hw:es8316tegra music.wav 
Playing WAVE 'music.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo

This playback is the same result, and the kernel throws an exception after playing for a while:

aplay -D hw:es8316tegra,0 -r 48000 music.wav
Playing WAVE 'music.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo

[  486.313693] Unable to handle kernel NULL pointer dereference at virtual address 00000628
[  486.313896] Mem abort info:
[  486.313960]   ESR = 0x96000005
[  486.314027]   Exception class = DABT (current EL), IL = 32 bits
[  486.314131]   SET = 0, FnV = 0
[  486.314190]   EA = 0, S1PTW = 0
[  486.314277] Data abort info:
[  486.314335]   ISV = 0, ISS = 0x00000005
[  486.314406]   CM = 0, WnR = 0
[  486.314474] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc1b7dfb000
[  486.314582] [0000000000000628] *pgd=0000000000000000, *pud=0000000000000000
[  486.314747] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[  486.314849] Modules linked in: fuse xt_conntrack ipt_MASQUERADE nf_nat_masquerade_ipv4 nf_conntrack_netlink nfnetlink xt_addrtype iptable_filter iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack br_netfilter zram 8723bu cfg80211 overlay userspace_alert nvgpu ip_tables x_tables
[  486.316124] CPU: 0 PID: 8098 Comm: aplay Not tainted 4.9.253-tegra #17
[  486.316593] Hardware name: NVIDIA Jetson Xavier NX Developer Kit (DT)
[  486.319431] task: ffffffc19eb6e200 task.stack: ffffffc1b904c000
[  486.324970] PC is at es8316_pcm_shutdown+0x20/0x168
[  486.330199] LR is at snd_soc_dai_link_event+0x27c/0x3d0
[  486.335443] pc : [<ffffff8008d72538>] lr : [<ffffff8008d61ccc>] pstate: 60400045
[  486.342705] sp : ffffffc1b904f890
[  486.345953] x29: ffffffc1b904f890 x28: 00000000ffffffff 
[  486.351456] x27: 00000000ffffffff x26: 0000000000000001 
[  486.356969] x25: ffffff800a1b2aa8 x24: ffffffc1e12b8840 
[  486.362567] x23: 0000000000000004 x22: ffffffc1e26956c0 
[  486.367396] x21: 0000000000000000 x20: ffffffc1da456c00 
[  486.372982] x19: ffffffc1b904f908 x18: 0000000000003524 
[  486.378754] x17: 0000007f8334cd40 x16: ffffff8008274b68 
[  486.384439] x15: 0000000000000345 x14: 000000000000293c 
[  486.390128] x13: 000000000000362b x12: 0000000000000400 
[  486.395817] x11: 000000000000000b x10: 0101010101010101 
[  486.401345] x9 : 0000000000000003 x8 : 7f7f7f7f7f7f7f7f 
[  486.407364] x7 : fefefeff646c606d x6 : 00170401e9e1acf4 
[  486.412630] x5 : 742c616901041700 x4 : 8080808000000000 
[  486.417966] x3 : b34b234b0963a000 x2 : ffffff8008d72518 
[  486.423552] x1 : 0000000000000000 x0 : 0000000000000000 
[  486.428643] 
[  486.430296] Process aplay (pid: 8098, stack limit = 0xffffffc1b904c000)
[  486.436682] Call trace:
[  486.438790] [<ffffff8008d72538>] es8316_pcm_shutdown+0x20/0x168
[  486.444647] [<ffffff8008d61ccc>] snd_soc_dai_link_event+0x27c/0x3d0
[  486.450254] [<ffffff8008d63350>] dapm_seq_check_event.isra.27+0x118/0x2d0
[  486.456722] [<ffffff8008d635e8>] dapm_seq_run_coalesced+0xb0/0x1e0
[  486.462326] [<ffffff8008d638bc>] dapm_seq_run+0x1a4/0x3d0
[  486.467660] [<ffffff8008d64a24>] dapm_power_widgets+0x484/0x9e0
[  486.473259] [<ffffff8008d673dc>] snd_soc_dapm_stream_event+0x9c/0xb8
[  486.479126] [<ffffff8008d6b278>] soc_pcm_close+0x158/0x2a0
[  486.484463] [<ffffff8008d1a64c>] snd_pcm_release_substream.part.17+0x5c/0xb0
[  486.490848] [<ffffff8008d1a7a4>] snd_pcm_release+0xb4/0xd0
[  486.496017] [<ffffff800825dcb8>] __fput+0x90/0x1d0
[  486.500825] [<ffffff800825de70>] ____fput+0x20/0x30
[  486.505643] [<ffffff80080d8dac>] task_work_run+0xbc/0xd8
[  486.511324] [<ffffff800808b334>] do_notify_resume+0xa4/0xb0
[  486.517096] [<ffffff800808379c>] work_pending+0x8/0x10
[  486.522093] ---[ end trace d5e71913c34b44b1 ]---
Segmentation fault
root@nvidia-desktop:/home/nvidia# 
root@nvidia-desktop:/home/nvidia# 

I guess the music “music.wav” is over.

Thanks
wangxiaozhuang

Hi wangxiaozhuang,

It is looking better.

Yes the clock frequencies seem to be correct. This confirms pinmux, driver and DT settings are fine.

You have to enable asoc events related to DAPM path. Please refer to section.

I hope you are getting codec pcm_startup() and hw_param() calls now. Can you please confirm?

I don’t know the stream configuration of music.wav and hence won’t be able to comment on this.
Test with below stream (it is 48000 Hz, 2-channel and 16-bit) and you should see the same clock frequencies with what you were getting for speaker-test run earlier.

Yes the music is probably over and the codec driver crashes when it finishes.

Thanks.

Hi,Sameer
Play your wav file and the clock is correct, but the codec driver is also broken, why ?

aplay -D hw:es8316tegra test.wav 
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
[ 1232.810104] Unable to handle kernel NULL pointer dereference at virtual address 00000628
[ 1232.810276] Mem abort info:
[ 1232.810367]   ESR = 0x96000005
[ 1232.810437]   Exception class = DABT (current EL), IL = 32 bits
[ 1232.810539]   SET = 0, FnV = 0
[ 1232.810597]   EA = 0, S1PTW = 0
[ 1232.810670] Data abort info:
[ 1232.810753]   ISV = 0, ISS = 0x00000005
[ 1232.810824]   CM = 0, WnR = 0
[ 1232.810886] user pgtable: 4k pages, 39-bit VAs, pgd = ffffffc1da320000
[ 1232.810994] [0000000000000628] *pgd=0000000000000000, *pud=0000000000000000
[ 1232.811145] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[ 1232.811246] Modules linked in: fuse xt_conntrack ipt_MASQUERADE nf_nat_masquerade_ipv4 nf_conntrack_netlink nfnetlink xt_addrtype iptable_filter iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack br_netfilter zram userspace_alert overlay 8723bu cfg80211 nvgpu ip_tables x_tables
[ 1232.812530] CPU: 0 PID: 8639 Comm: aplay Not tainted 4.9.253-tegra #18
[ 1232.812997] Hardware name: NVIDIA Jetson Xavier NX Developer Kit (DT)
[ 1232.815579] task: ffffffc1a0376200 task.stack: ffffffc1f62fc000
[ 1232.821366] PC is at es8316_pcm_shutdown+0x20/0x168
[ 1232.826350] LR is at snd_soc_dai_link_event+0x27c/0x3d0
[ 1232.831595] pc : [<ffffff8008d72668>] lr : [<ffffff8008d61ccc>] pstate: 60400045
[ 1232.838854] sp : ffffffc1f62ff890
[ 1232.842094] x29: ffffffc1f62ff890 x28: 00000000ffffffff 
[ 1232.847862] x27: 00000000ffffffff x26: 0000000000000001 
[ 1232.853376] x25: ffffff800a1b2aa8 x24: ffffffc1e10e50c0 
[ 1232.858973] x23: 0000000000000004 x22: ffffffc1e10496c0 
[ 1232.864048] x21: 0000000000000000 x20: ffffffc1a502e400 
[ 1232.869137] x19: ffffffc1f62ff908 x18: 0000000000000de3 
[ 1232.875160] x17: 0000000000004378 x16: 0000000000001a8f 
[ 1232.880848] x15: 0000000000000046 x14: 00000000000041d5 
[ 1232.886535] x13: 000000000000a44f x12: 0000000000000400 
[ 1232.892222] x11: 000000000000000b x10: 0101010101010101 
[ 1232.897999] x9 : 0000000000000003 x8 : 7f7f7f7f7f7f7f7f 
[ 1232.903525] x7 : fefefeff646c606d x6 : 00170401e9e1acf4 
[ 1232.909037] x5 : 742c616901041700 x4 : 8080808000000000 
[ 1232.914624] x3 : b34b234b0963a000 x2 : ffffff8008d72648 
[ 1232.919961] x1 : 0000000000000000 x0 : 0000000000000000 
[ 1232.925297] 
[ 1232.926702] Process aplay (pid: 8639, stack limit = 0xffffffc1f62fc000)
[ 1232.932831] Call trace:
[ 1232.935197] [<ffffff8008d72668>] es8316_pcm_shutdown+0x20/0x168
[ 1232.941054] [<ffffff8008d61ccc>] snd_soc_dai_link_event+0x27c/0x3d0
[ 1232.946918] [<ffffff8008d63350>] dapm_seq_check_event.isra.27+0x118/0x2d0
[ 1232.953047] [<ffffff8008d635e8>] dapm_seq_run_coalesced+0xb0/0x1e0
[ 1232.958992] [<ffffff8008d638bc>] dapm_seq_run+0x1a4/0x3d0
[ 1232.964066] [<ffffff8008d64a24>] dapm_power_widgets+0x484/0x9e0
[ 1232.969411] [<ffffff8008d673dc>] snd_soc_dapm_stream_event+0x9c/0xb8
[ 1232.975792] [<ffffff8008d6b278>] soc_pcm_close+0x158/0x2a0
[ 1232.980869] [<ffffff8008d1a64c>] snd_pcm_release_substream.part.17+0x5c/0xb0
[ 1232.987083] [<ffffff8008d1a7a4>] snd_pcm_release+0xb4/0xd0
[ 1232.992425] [<ffffff800825dcb8>] __fput+0x90/0x1d0
[ 1232.997491] [<ffffff800825de70>] ____fput+0x20/0x30
[ 1233.002306] [<ffffff80080d8dac>] task_work_run+0xbc/0xd8
[ 1233.007732] [<ffffff800808b334>] do_notify_resume+0xa4/0xb0
[ 1233.013504] [<ffffff800808379c>] work_pending+0x8/0x10
[ 1233.018500] ---[ end trace b343e83717dfe884 ]---
Segmentation fault
root@nvidia-desktop:/home/nvidia# 

pcm_startup() and hw_param() functions were called:

root@nvidia-desktop:/home/nvidia#  dmesg  | grep "asoc"
dmesg  | grep "8316"
[    2.619806] tegra-asoc: sound: ADMAIF1 <-> ADMAIF1 mapping ok
[    2.619942] tegra-asoc: sound: ADMAIF2 <-> ADMAIF2 mapping ok
[    2.620060] tegra-asoc: sound: ADMAIF3 <-> ADMAIF3 mapping ok
[    2.620160] tegra-asoc: sound: ADMAIF4 <-> ADMAIF4 mapping ok
[    2.620253] tegra-asoc: sound: ADMAIF5 <-> ADMAIF5 mapping ok
[    2.620351] tegra-asoc: sound: ADMAIF6 <-> ADMAIF6 mapping ok
[    2.620442] tegra-asoc: sound: ADMAIF7 <-> ADMAIF7 mapping ok
[    2.620536] tegra-asoc: sound: ADMAIF8 <-> ADMAIF8 mapping ok
[    2.620635] tegra-asoc: sound: ADMAIF9 <-> ADMAIF9 mapping ok
[    2.620754] tegra-asoc: sound: ADMAIF10 <-> ADMAIF10 mapping ok
[    2.620853] tegra-asoc: sound: ADMAIF11 <-> ADMAIF11 mapping ok
[    2.620944] tegra-asoc: sound: ADMAIF12 <-> ADMAIF12 mapping ok
[    2.621024] tegra-asoc: sound: ADMAIF13 <-> ADMAIF13 mapping ok
[    2.621095] tegra-asoc: sound: ADMAIF14 <-> ADMAIF14 mapping ok
[    2.621165] tegra-asoc: sound: ADMAIF15 <-> ADMAIF15 mapping ok
[    2.621234] tegra-asoc: sound: ADMAIF16 <-> ADMAIF16 mapping ok
[    2.621303] tegra-asoc: sound: ADMAIF17 <-> ADMAIF17 mapping ok
[    2.621373] tegra-asoc: sound: ADMAIF18 <-> ADMAIF18 mapping ok
[    2.621456] tegra-asoc: sound: ADMAIF19 <-> ADMAIF19 mapping ok
[    2.621542] tegra-asoc: sound: ADMAIF20 <-> ADMAIF20 mapping ok
root@nvidia-desktop:/home/nvidia# dmesg  | grep "8316"
[    1.831682] tegra_profiler: auth: init
[    2.348498] es8316_i2c_probe 1171=========================================
[    2.348501] es8316_i2c_probe 1176=========================================
[    2.348546] es8316_i2c_probe 1190=========================================
[    2.348554] es8316_i2c_probe 1245========================================= ret:0
[    2.482946] es8316_probe 1078=========================================1414
[    2.483012] es8316_probe 1090=========================================
[    2.489319] es8316_probe 1096=========================================
[    2.610059] es8316_init_regs 975=========================================
[    2.615278] es8316_probe 1123=========================================ret:0
[    2.623812] tegra_machine_es8316_init 590=========================================
[    2.623816] es8316_set_dai_sysclk 562=========================================
[    2.623818] es8316_set_dai_sysclk===========8316codec================== 579
[    2.623820] es8316_set_dai_fmt 603=========================================
[    3.622346]   #1: es8316-tegra
[   11.251481] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   11.251486] es8316_set_dai_sysclk 562=========================================
[   11.251489] es8316_set_dai_sysclk===========8316codec================== 579
[   11.410305] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   11.410310] es8316_set_dai_sysclk 562=========================================
[   11.410313] es8316_set_dai_sysclk===========8316codec================== 579
[   11.535986] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   11.535991] es8316_set_dai_sysclk 562=========================================
[   11.535994] es8316_set_dai_sysclk===========8316codec================== 579
[   11.552697] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   11.552702] es8316_set_dai_sysclk 562=========================================
[   11.552705] es8316_set_dai_sysclk===========8316codec================== 579
[   11.716783] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[   11.716789] es8316_set_dai_sysclk 562=========================================
[   11.716792] es8316_set_dai_sysclk===========8316codec================== 579
[  668.418316] RTW: _8051Reset8723: Finish
[ 1202.173769] tegra_machine_dai_init===========8316=======es8316-playback===========20211015 362
[ 1202.173798] es8316_set_dai_sysclk 562=========================================
[ 1202.173803] es8316_set_dai_sysclk===========8316codec================== 579
[ 1202.176603] es8316_pcm_startup 689=========================================
[ 1202.238524] es8316_pcm_hw_params 776=========================================
[ 1202.238966] es8316_mute 810=========================================
[ 1232.704094] es8316_mute 810=========================================
[ 1232.821366] PC is at es8316_pcm_shutdown+0x20/0x168
[ 1232.935197] [<ffffff8008d72668>] es8316_pcm_shutdown+0x20/0x168

Thanks
wangxiaozhuang

You may want to check the codec crash with codec vendor. Also confirm the codec settings with them. I see there is a mute() call from codec. Please make sure that the audio is not really muted. You can also check with increasing playback volume from codec mixer control settings.

From clock, driver and DT setup wise things look good. You are able to get the required clocks and able to get expected driver callbacks. There is data signal on SDO line as well.

Hi
Thank you very much for your support ,the audio problem on NX and TX2 platforms has been solved . es8316 can play music normally on NX and TX2 platforms. But I had a problem on the Jeston Nano platform. There are no signals on MCK, SCK and LRCK pins

Jeston NX platform, the audio is OK:

amixer -c es8316tegra cset name="I2S5 Mux" "ADMAIF1"
amixer -c es8316tegra cset name="x Left Hp mixer Left DAC Switch" 1
amixer -c es8316tegra cset name="x Right Hp mixer Right DAC Switch" 1
aplay -D hw:es8316tegra test.wav 

“tegra194-audio-p3668.dtsi” and “tegra194-p3668-common.dtsi”:

#include <audio/tegra-platforms-audio-dai-links.dtsi>

/ {
	aconnect@2a41000 {
		status = "okay";

		agic-controller@2a41000 {
			status = "okay";
		};

		adsp@2993000 {
			status = "okay";
		};
	};

	hda@3510000 {
		hda,card-name = "tegra-hda-xnx";
		status = "okay";
	};

	tegra_sound: sound {
		status = "okay";
		compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
		nvidia,model = "es8316-tegra";
		clocks = <&bpmp_clks TEGRA194_CLK_PLLA>,
			 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
			 <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
		clock-names = "pll_a", "pll_a_out0", "extern1";
		assigned-clocks = <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
				  <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
		assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLA>,
					 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>;

		nvidia,audio-routing =
            "x Headphone",          "x HPOL",
            "x Headphone",          "x HPOR",
            "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",
			"d2 Headphone",         "d2 OUT";



		nvidia,xbar = <&tegra_axbar>;

		mclk-fs = <256>;

		nvidia,dai-link-1 {
			name-prefix = "n";
		};

		hdr40_snd_link_i2s: nvidia,dai-link-5 {
			name-prefix = "x";
			link-name = "es8316-playback";
			codec-dai = <&es8316_codec>;
			codec-dai-name = "es8316-hifi";
			status = "okay";
		};

	};
};

+++ b/common/tegra194-p3668-common.dtsi
@@ -26,6 +26,7 @@
 #include <t19x-common-platforms/tegra194-no-pll-aon-clock.dtsi>
 #include "tegra194-p3668-pcie-plugin-manager.dtsi"
 #include "tegra194-plugin-manager-p3668.dtsi"
+#include <dt-common/jetson/tegra194-p3668-all-p3509-0000.h>
 
 / {
        nvidia,fastboot-usb-vid = <0x0955>;
@@ -79,6 +80,56 @@
                };
        };
 
+
+       pinmux@2430000 {
+               status = "okay";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdr40_pinmux>;
+
+               hdr40_pinmux: header-40pin-pinmux {
+                       pin7 {
+                               nvidia,pins = HDR40_PIN7;
+                               nvidia,function = HDR40_CLK;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+
+                       pin12 {
+                               nvidia,pins = HDR40_PIN12;
+                               nvidia,function = HDR40_I2S;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+
+                       pin35 {
+                               nvidia,pins = HDR40_PIN35;
+                               nvidia,function = HDR40_I2S;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+
+                       pin38 {
+                               nvidia,pins = HDR40_PIN38;
+                               nvidia,function = HDR40_I2S;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+
+                       pin40 {
+                               nvidia,pins = HDR40_PIN40;
+                               nvidia,function = HDR40_I2S;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+               };        
+        
+       };

Jeston TX2 platform, the audio is OK:

amixer -c es8316tegra cset name="I2S1 Mux" "ADMAIF1"
amixer -c es8316tegra cset name="x Left DAC Switch" 1
amixer -c es8316tegra cset name="x Right DAC Switch" 1
aplay -D hw:es8316tegra test.wav 

“tegra186-p3636-0001-a00-audio.dtsi” and “tegra186-p3636-0001-common.dtsi”:

#include <audio/tegra-platforms-audio-dai-links.dtsi>

/ {
	i2s@2901000 {
		status = "okay";
		bclk-ratio = <4>;
	};

	hda@3510000 {
		status = "okay";
	};
	tegra_sound: sound {
		status = "okay";
		compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
		nvidia,model = "es8316-tegra";
		clocks = <&tegra_car TEGRA186_CLK_PLLA>,
			 <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
			 <&tegra_car TEGRA186_CLK_AUD_MCLK>;
		clock-names = "pll_a", "pll_a_out0", "extern1";
		assigned-clocks = <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
				  <&tegra_car TEGRA186_CLK_AUD_MCLK>;
		assigned-clock-parents = <&tegra_car TEGRA186_CLK_PLLA>,
					 <&tegra_car TEGRA186_CLK_PLL_A_OUT0>;

		resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
		reset-names = "extern1_rst";

		mclk-fs = <256>;

		nvidia,audio-routing = 
                        "x Headphone",          "x HPOL",
                        "x Headphone",          "x HPOR",
                        "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",
			"d2 Headphone",         "d2 OUT";


		nvidia,xbar = <&tegra_axbar>;

		/* TODO Avoid rt565x_dai_link definition by modifying common base file
		 * since current base does not have definition of dai link as
		 * rt565x_dai_link,  had to add here
		 */

		hdr40_snd_link_i2s: rt565x_dai_link: nvidia,dai-link-1 {
			name-prefix = "x";
			link-name = "es8316-playback";
            		codec-dai = <&es8316_codec>;
            		codec-dai-name = "es8316-hifi";    		
			status = "okay";			
		};
		hdr40_i2c1: i2c@c240000 { };
	};
};

--- a/kernel-dts/common/tegra186-p3636-0001-common.dtsi
+++ b/kernel-dts/common/tegra186-p3636-0001-common.dtsi
@@ -36,6 +36,7 @@
 #include "tegra186-p3636-0001-a00-comms.dtsi"
 #include <dt-bindings/pinctrl/pinctrl-tegra.h>
 #include <dt-bindings/gpio/tegra186-gpio.h>
+#include <dt-common/jetson/tegra186-p3509-0000-p3636-0001.h>
 
 #define EXTCON_NONE            0
 #define EXTCON_USB             1
@@ -64,6 +65,7 @@
        };
 
        serial@c280000 {
+               compatible = "nvidia,tegra186-hsuart";
                status = "disabled";
        };
 
@@ -78,19 +80,78 @@
                status="okay";
        };
 
+       pinmux@2430000 {
+               status = "okay";
+               pinctrl-names = "default";
+               pinctrl-0 = <&hdr40_pinmux>;
+
+               hdr40_pinmux: header-40pin-pinmux {
+                       pin7 {
+                               nvidia,pins = HDR40_PIN7;
+                               nvidia,function = HDR40_CLK;
+                               nvidia,pull = <TEGRA_PIN_PULL_NONE>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+
+                       pin12 {
+                               nvidia,pins = HDR40_PIN12;
+                               nvidia,function = HDR40_I2S;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+
+                       pin35 {
+                               nvidia,pins = HDR40_PIN35;
+                               nvidia,function = HDR40_I2S;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+
+                       pin38 {
+                               nvidia,pins = HDR40_PIN38;
+                               nvidia,function = HDR40_I2S;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_ENABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_ENABLE>;
+                       };
+
+                       pin40 {
+                               nvidia,pins = HDR40_PIN40;
+                               nvidia,function = HDR40_I2S;
+                               nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
+                               nvidia,tristate = <TEGRA_PIN_DISABLE>;
+                               nvidia,enable-input = <TEGRA_PIN_DISABLE>;
+                       };
+               };        
+        
+       };

       i2c@3160000 {
                status="okay";
                es8316_codec: es8316@10 {
                        compatible = "everest,es8316";
                        reg = <0x10>;
                        status = "okay";
                };
        };


The following is the driver of the es8316:
es8316.c (37.6 KB)

Changes to “tegra_machine_driver_mobile.c” are as follows :

--- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
+++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
@@ -29,10 +29,16 @@
 #include <sound/soc.h>
 #include <dt-bindings/sound/tas2552.h>
 #include "rt5659.h"
+#include "es8316.h"
 #include "sgtl5000.h"
 #include "tegra_asoc_machine_alt.h"
 #include "tegra210_xbar_alt.h"
 
+enum {
+       ES8316_SCLK_S_MCLK = 0,
+       ES8316_SCLK_S_PLL1,
+       ES8316_SCLK_S_RCCLK,
+};
 #define DRV_NAME "tegra-asoc:"
 
 #define PARAMS(sformat, channels)              \
@@ -169,6 +175,8 @@ static const struct snd_soc_dapm_widget tegra_machine_dapm_widgets[] = {
        SND_SOC_DAPM_LINE("y Line Out", NULL),
        SND_SOC_DAPM_LINE("x Line In", NULL),
        SND_SOC_DAPM_LINE("y Line In", NULL),
+       SND_SOC_DAPM_LINE("x IN", NULL),
+       SND_SOC_DAPM_LINE("x OUT",NULL),
 };
 
 static struct snd_soc_pcm_stream tegra_machine_asrc_link_params[] = {
@@ -335,13 +343,33 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
 
        aud_mclk = machine->audio_clock.set_aud_mclk_rate;
 
-       pr_debug("pll_a_out0 = %u Hz, aud_mclk = %u Hz, sample rate = %u Hz\n",
+       printk("pll_a_out0 = %u Hz, aud_mclk = %u Hz, sample rate = %u Hz\n",
                 machine->audio_clock.set_pll_out_rate, aud_mclk, srate);
 
        err = tegra_machine_set_params(card, machine, srate, channels, formats);
        if (err < 0)
                return err;
 
+       rtd = snd_soc_get_pcm_runtime(card, "es8316-playback"); //wxz
+       if (rtd) {
+               printk("%s===========8316=======es8316-playback=========== %d\n",__func__,__LINE__);
+               dai_params =
+               (struct snd_soc_pcm_stream *)rtd->dai_link->params;
+
+               dai_params->formats = (machine->fmt_via_kcontrol == 2) ?
+                       (1ULL << SNDRV_PCM_FORMAT_S32_LE) : formats;
+
+        dai_params->rate_min = srate;
+        dai_params->channels_min = channels;
+
+               //err = es8316_set_dai_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK,aud_mclk, SND_SOC_CLOCK_IN);
+               err = snd_soc_dai_set_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 12288000,SND_SOC_CLOCK_IN);
+               if (err < 0) {
+                       dev_err(card->dev, "codec_dai clock not set\n");
+                       return err;
+               }
+       }
+
        rtd = snd_soc_get_pcm_runtime(card, "rt565x-playback");
        if (rtd) {
                dai_params =
@@ -541,6 +569,21 @@ static int tegra_machine_fepi_init(struct snd_soc_pcm_runtime *rtd)
        return 0;
 }
 
+static int tegra_machine_es8316_init(struct snd_soc_pcm_runtime *rtd)  //wxz
+{
+       struct device *dev = rtd->card->dev;
+       int err;
+
+       //err = es8316_set_dai_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 11289600,SND_SOC_CLOCK_IN);
+       err = snd_soc_dai_set_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 12288000,SND_SOC_CLOCK_IN);
+       if (err) {
+               dev_err(dev, "failed to set es8316 sysclk!\n");
+               return err;
+       }
+
+       return 0;
+}
+
 static int tegra_machine_rt565x_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_card *card = rtd->card;
@@ -602,6 +645,8 @@ static int codec_init(struct tegra_machine *machine)
                        dai_links[i].init = tegra_machine_fepi_init;
                else if (strstr(dai_links[i].name, "respeaker-4-mic-array"))
                        dai_links[i].init = tegra_machine_respeaker_init;
+               else if (strstr(dai_links[i].name, "es8316-playback"))  //wxz
+                       dai_links[i].init = tegra_machine_es8316_init;
        }
 
        return 0;
@@ -784,8 +829,8 @@ static int tegra_machine_driver_probe(struct platform_device *pdev)
 
        ret = snd_soc_register_card(card);
        if (ret) {
-               dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
-                       ret);
+               dev_err(&pdev->dev, "snd_soc_register_card failed (%d) %s %d\n",
+                       ret,__FILE__,__LINE__);
                goto cleanup_asoc;
        }

But I had a problem on the Jeston nano platform, I think I2S is not working, and there is no signal on MCK, SCK and LRCK pins :

1, the U-Boot command line:

Tegra210 (P3450-Porg) # mw 0x6000d204 0

2, “tegra210-porg-pinmux-p3448-0002-b00.dtsi” file:

--- a/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
+++ b/kernel-dts/porg-platforms/tegra210-porg-pinmux-p3448-0002-b00.dtsi
@@ -497,7 +497,7 @@
                        /* GPIO Pin Configuration */
                        aud_mclk_pbb0 {
                                nvidia,pins = "aud_mclk_pbb0";
-                               nvidia,function = "rsvd1";
+                               nvidia,function = "aud";^M
                                nvidia,pull = <TEGRA_PIN_PULL_UP>;
                                nvidia,tristate = <TEGRA_PIN_DISABLE>;
                                nvidia,enable-input = <TEGRA_PIN_ENABLE>;
@@ -673,7 +673,7 @@
 
                        dap4_din_pj5 {
                                nvidia,pins = "dap4_din_pj5";
-                               nvidia,function = "rsvd1";
+                               nvidia,function = "i2s4b";^M
                                nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                                nvidia,tristate = <TEGRA_PIN_DISABLE>;
                                nvidia,enable-input = <TEGRA_PIN_ENABLE>;
@@ -681,7 +681,7 @@
 
                        dap4_dout_pj6 {
                                nvidia,pins = "dap4_dout_pj6";
-                               nvidia,function = "rsvd1";
+                               nvidia,function = "i2s4b";^M
                                nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                                nvidia,tristate = <TEGRA_PIN_DISABLE>;
                                nvidia,enable-input = <TEGRA_PIN_ENABLE>;
@@ -689,7 +689,7 @@
 
                        dap4_fs_pj4 {
                                nvidia,pins = "dap4_fs_pj4";
-                               nvidia,function = "rsvd1";
+                               nvidia,function = "i2s4b";^M
                                nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                                nvidia,tristate = <TEGRA_PIN_DISABLE>;
                                nvidia,enable-input = <TEGRA_PIN_ENABLE>;
@@ -697,7 +697,7 @@
 
                        dap4_sclk_pj7 {
                                nvidia,pins = "dap4_sclk_pj7";
-                               nvidia,function = "rsvd1";
+                               nvidia,function = "i2s4b";^M
                                nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
                                nvidia,tristate = <TEGRA_PIN_DISABLE>;
                                nvidia,enable-input = <TEGRA_PIN_ENABLE>;

3, tegra210-porg-gpio-p3448-0002-b00.dtsi:

--- a/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-b00.dtsi
+++ b/kernel-dts/porg-platforms/tegra210-porg-gpio-p3448-0002-b00.dtsi
@@ -26,7 +26,6 @@
 
                gpio_default: default {
                        gpio-input = <
-                               TEGRA_GPIO(BB, 0)
                                TEGRA_GPIO(B, 4)
                                TEGRA_GPIO(B, 5)
                                TEGRA_GPIO(B, 6)
@@ -43,10 +42,6 @@
                                TEGRA_GPIO(V, 0)
                                TEGRA_GPIO(V, 1)
                                TEGRA_GPIO(Z, 0)
-                               TEGRA_GPIO(J, 5)
-                               TEGRA_GPIO(J, 6)
-                               TEGRA_GPIO(J, 4)
-                               TEGRA_GPIO(J, 7)
                                TEGRA_GPIO(G, 2)
                                TEGRA_GPIO(G, 3)
                                TEGRA_GPIO(C, 0)

4, “tegra210-porg-p3448-common.dtsi” about es8316:

 756     hdr40_i2c0: i2c@7000c000 {
 765         es8316_codec: es8316@10 {
 766                 compatible = "everest,es8316";
 767                 reg = <0x10>;
 768                 status = "okay";                                                                                                                                                                       
 769         };
 771     };

5, cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep i2s:

    type: MUX_GROUP controller 700008d4.pinmux group: dmic1_clk_pe0 (52) function: i2s3 (24)
    type: MUX_GROUP controller 700008d4.pinmux group: dmic1_dat_pe1 (53) function: i2s3 (24)
    type: MUX_GROUP controller 700008d4.pinmux group: dmic2_clk_pe2 (54) function: i2s3 (24)
    type: MUX_GROUP controller 700008d4.pinmux group: dmic2_dat_pe3 (55) function: i2s3 (24)
    type: MUX_GROUP controller 700008d4.pinmux group: dap2_din_paa2 (89) function: i2s2 (23)
    type: MUX_GROUP controller 700008d4.pinmux group: dap2_dout_paa3 (90) function: i2s2 (23)
    type: MUX_GROUP controller 700008d4.pinmux group: dap2_fs_paa0 (88) function: i2s2 (23)
    type: MUX_GROUP controller 700008d4.pinmux group: dap2_sclk_paa1 (91) function: i2s2 (23)
    type: MUX_GROUP controller 700008d4.pinmux group: dap4_din_pj5 (93) function: i2s4b (26)
    type: MUX_GROUP controller 700008d4.pinmux group: dap4_dout_pj6 (94) function: i2s4b (26)
    type: MUX_GROUP controller 700008d4.pinmux group: dap4_fs_pj4 (92) function: i2s4b (26)
    type: MUX_GROUP controller 700008d4.pinmux group: dap4_sclk_pj7 (95) function: i2s4b (26)

6, cat /sys/kernel/debug/pinctrl/pinctrl-handles | grep aud:

    type: MUX_GROUP controller 700008d4.pinmux group: aud_mclk_pbb0 (107) function: aud (0)
    type: CONFIGS_GROUP controller 700008d4.pinmux group aud_mclk_pbb0 (107)config pull=2
    type: MUX_GROUP controller 700008d4.pinmux group: gpio_x1_aud_pbb3 (110) function: rsvd0 (41)
    type: CONFIGS_GROUP controller 700008d4.pinmux group gpio_x1_aud_pbb3 (110)config pull=1
    type: MUX_GROUP controller 700008d4.pinmux group: gpio_x3_aud_pbb4 (111) function: rsvd0 (41)
    type: CONFIGS_GROUP controller 700008d4.pinmux group gpio_x3_aud_pbb4 (111)config pull=1
    type: CONFIGS_PIN controller pinctrl-pmc-io-pads pin audio (0)config 00008000
    type: CONFIGS_PIN controller pinctrl-pmc-io-pads pin audio-hv (1)config 00008000

7, cat /sys/kernel/debug/tegra_gpio :

Name:Bank:Port CNF OE OUT IN INT_STA INT_ENB INT_LVL
 A: 0:0 64 40 40 04 00 00 000000
 B: 0:1 f0 00 00 00 00 00 000000
 C: 0:2 1f 00 00 18 00 00 000000
 D: 0:3 00 00 00 00 00 00 000000
 E: 1:0 40 00 00 40 00 00 000000
 F: 1:1 00 00 00 00 00 00 000000
 G: 1:2 0c 00 00 0c 00 00 000000
 H: 1:3 fd 99 00 60 00 00 000000
 I: 2:0 07 07 03 00 00 00 000000
 J: 2:1 00 00 00 00 00 00 000000
 K: 2:2 00 00 00 00 00 00 000000
 L: 2:3 00 00 00 00 00 00 000000
 M: 3:0 00 00 00 00 00 00 000000
 N: 3:1 00 00 00 00 00 00 000000
 O: 3:2 00 00 00 00 00 00 000000
 P: 3:3 00 00 00 00 00 00 000000
 Q: 4:0 00 00 00 00 00 00 000000
 R: 4:1 00 00 00 00 00 00 000000
 S: 4:2 a0 80 00 20 00 00 000000
 T: 4:3 01 01 00 00 00 00 000000
 U: 5:0 00 00 00 00 00 00 000000
 V: 5:1 03 00 00 01 00 00 000000
 W: 5:2 00 00 00 00 00 00 000000
 X: 5:3 78 08 08 70 00 60 606000
 Y: 6:0 06 00 00 02 00 00 000000
 Z: 6:1 0b 08 00 01 00 00 000000
AA: 6:2 00 00 00 00 00 00 000000
BB: 6:3 01 00 00 01 00 00 000000
CC: 7:0 92 80 80 00 00 12 121200
DD: 7:1 01 00 00 00 00 00 000000
EE: 7:2 00 00 00 00 00 00 000000
FF: 7:3 00 00 00 00 00 00 000000

scontrols.txt (25.8 KB)
controls.txt (29.7 KB)
contents.txt (143.4 KB)

According to the reference here, I found that my uboot does not have a ”pinmux-config-p3450-porg.h“ file.

My uboot is downloaded here:
https://developer.nvidia.com/embedded/l4t/r32_release_v6.1/sources/t210/public_sources.tbz2
Hope to get your help, thank you
wangxiaozhuang

Hi
Nano‘s audio is also OK. thanks.
The U-Boot command lines:

mw 0x6000d204 0
mw 0x6000d60c 0

Good to know it works for you now.

Most likely you have pinmux problem and that is why I2S clock signals are not working.
Can you try with following?

diff --git a/kernel-dts/tegra210-porg-p3448-common.dtsi b/kernel-dts/tegra210-porg-p3448-common.dtsi
index bf4875b..e541fef 100644
--- a/kernel-dts/tegra210-porg-p3448-common.dtsi
+++ b/kernel-dts/tegra210-porg-p3448-common.dtsi
@@ -376,6 +376,25 @@
                status = "okay";
        };

+       gpio@6000d000 {
+               40pin_audio_pinmux: audio_pins {
+                       gpio-hog;
+                       function;
+                       gpios = <
+                               TEGRA_GPIO(J, 4) 0
+                               TEGRA_GPIO(J, 5) 0
+                               TEGRA_GPIO(J, 6) 0
+                               TEGRA_GPIO(J, 7) 0
+                               TEGRA_GPIO(BB, 0) 0
+                               TEGRA_GPIO(S, 5) 0
+                               >;
+                       label = "I2S4_LRCLK", "I2S4_SDIN", "I2S4_SDOUT",
+                               "I2S4_CLK", "AUDIO_MCLK", "AUD_RST";
+
+                       status = "okay";
+               };
+       };
+

Alternatively you can make use of Jetson IO tool and configure the pinmux accordingly.

Test after you configure the pinmux.

That’s cool. Can this post be closed now? Since TX2, NX and Nano all work I am wondering if the subject needs to be updated. It will help someone who might be looking for a solution on particular platform.

Hi,
One last question, how can this command be written to the driver and executed automatically ?

amixer -c es8316tegra cset name="I2S4 Mux" ADMAIF1

OK,you can close this post.
Thanks.

You can place the required default settings in 00-tegra.conf file. Some default controls are already present depending on the sound card/platform. Does this not work for you?
rootfs/usr/share/alsa/init/postinit/00-tegra.conf

Hi
“00-tegra.conf”, I tried to change it and it didn’t work. What format should this configuration file be? Can you give an example? The following is my command to manually set the audio configuration

amixer -c es8316tegra cset name="I2S5 Mux" "ADMAIF1"
amixer -c es8316tegra cset name="x Left DAC Switch" 1
amixer -c es8316tegra cset name="x Right DAC Switch" 1

cat /proc/asound/cards:

 0 [tegrahdaxnx    ]: tegra-hda-xnx - tegra-hda-xnx
                      tegra-hda-xnx at 0x3518000 irq 66
 1 [es8316tegra    ]: es8316-tegra - es8316-tegra
                      es8316-tegra

Thanks a lot.
wangxiaozhuang

Since you have changed driver name, you need to update the conf file accordingly.
For illustration, see below:

diff --git a/rfs/usr/share/alsa/init/postinit/00-tegra.conf b/rfs/usr/share/alsa/init/postinit/00-tegra.conf
index e776b0a..528b5cc 100644
--- a/rfs/usr/share/alsa/init/postinit/00-tegra.conf
+++ b/rfs/usr/share/alsa/init/postinit/00-tegra.conf
@@ -11,7 +11,7 @@
 #
 # Configuration for Tegra soundcards

-CARDINFO{driver}=="tegra-snd-t210r", GOTO="Tegra210 Init"
+CARDINFO{driver}=="es8316-tegra", GOTO="Tegra210 Init"
 CARDINFO{driver}=="tegra-snd-t186r", GOTO="Tegra186 Init"
 CARDINFO{driver}=="tegra-snd-t19x-", GOTO="Tegra186 Init"
 CARDINFO{driver}=="jetson-xaviernx", GOTO="Tegra186 Init"

You need to update all the “driver” references like above and add specific DAC switch settings similar to already existing controls. Since I2S interface used is different on different Jetson platforms, you can use unique names to differentiate between platforms, so that you can use a common conf file.

Hi
Thank you very much. He has worked. This is the modification record on Xaiver NX:

diff --git a/00-tegra.conf b/00-tegra.conf
index e776b0a..fb2ecf8 100644
--- a/00-tegra.conf
+++ b/00-tegra.conf
@@ -13,7 +13,7 @@
 
 CARDINFO{driver}=="tegra-snd-t210r", GOTO="Tegra210 Init"
 CARDINFO{driver}=="tegra-snd-t186r", GOTO="Tegra186 Init"
-CARDINFO{driver}=="tegra-snd-t19x-", GOTO="Tegra186 Init"
+CARDINFO{driver}=="es8316-tegra", GOTO="Tegra186 Init"
 CARDINFO{driver}=="jetson-xaviernx", GOTO="Tegra186 Init"
 RESULT="false", EXIT="return"
 
@@ -65,6 +65,7 @@ CTL{name}="Numerator3 Mux", CTL{value}="None"
 CTL{name}="Numerator4 Mux", CTL{value}="None"
 CTL{name}="Numerator5 Mux", CTL{value}="None"
 CTL{name}="Numerator6 Mux", CTL{value}="None"
+CTL{name}="I2S5 Mux", CTL{value}="ADMAIF1"
 
 LABEL="Tegra Common Init"
 CTL{reset}="mixer"
@@ -98,7 +99,7 @@ CTL{name}="I2S1 Mux", CTL{value}="None"
 CTL{name}="I2S2 Mux", CTL{value}="None"
 CTL{name}="I2S3 Mux", CTL{value}="None"
 CTL{name}="I2S4 Mux", CTL{value}="None"
-CTL{name}="I2S5 Mux", CTL{value}="None"
+CTL{name}="I2S5 Mux", CTL{value}="ADMAIF1"
 CTL{name}="MIXER1-1 Mux", CTL{value}="None"
 CTL{name}="MIXER1-2 Mux", CTL{value}="None"
 CTL{name}="MIXER1-3 Mux", CTL{value}="None"
@@ -127,11 +128,9 @@ CARDINFO{driver}=="tegra-snd-t210r",                       \
        CTL{name}="I2S4 Loopback", CTL{do_search}=="1", \
        CTL{name}="ADMAIF1 Mux", CTL{value}="I2S4"      \
        CTL{name}="I2S4 Mux", CTL{value}="ADMAIF1"
-CARDINFO{driver}=="tegra-snd-t210r",                   \
-       CTL{name}="I2S1 Loopback", CTL{do_search}=="1", \
-       CTL{name}="I2S4 Loopback", CTL{do_search}=="1", \
-       CTL{name}="ADMAIF1 Mux", CTL{value}="I2S1"      \
-       CTL{name}="I2S1 Mux", CTL{value}="ADMAIF1"
+CARDINFO{driver}=="es8316-tegra",                      \
+       CTL{name}="x Letf DAC Switch", CTL{do_search}=="1",     \
+       CTL{name}="x Right DAC Switch", CTL{do_search}=="1"
 CARDINFO{driver}=="tegra-snd-t186r",                   \
        CTL{name}="ADMAIF1 Mux", CTL{value}="I2S1"      \
        CTL{name}="I2S1 Mux", CTL{value}="ADMAIF1"

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