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

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.

1 Like

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.