ES8388 codec bring up question on orin nano r36.3

codec schematic diagram:




image-20241029133939596

image-20241029134118863
image-20241029134146684

I2C configuration:

gen1_i2c: i2c@3160000 {
			status = "okay";
                ES8323: es8388@11 {
                    compatible = "everest,es8388", "everest,es8323";
                    reg = <0x11>;
                    #sound-dai-cells = <1>;
                    sound-name-prefix = "x";
                    interrupt-parent = <&gpio>;
		            interrupts = <TEGRA234_MAIN_GPIO(H, 0) GPIO_ACTIVE_LOW>;
                    // clocks = <&sgtl5000_mclk>;
                    clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
                    clock-parents = <&bpmp TEGRA234_CLK_PLLA_OUT0>;
                    clock-names = "mclk";
                    port {
                             es8388_ep: endpoint {
                                remote-endpoint = <&i2s2_dap>;
                                mclk-fs = <256>;
                                };
                        };
                };
		};

i2s configuration:

bus@0 {
        aconnect@2900000 {
            status = "okay";
            tegra_ahub: ahub@2900800 {
            status = "okay";
                tegra_i2s2: i2s@2901100 {
                    compatible = "nvidia,tegra234-i2s",
                            "nvidia,tegra210-i2s";
							status = "okay";
							sound-name-prefix = "I2S2";
			                
							ports {
                                #address-cells = <1>;
                                #size-cells = <0>;
							    i2s2_port: port@1 {
                                    reg = <1>;

                                    i2s2_dap: endpoint {
                                        dai-format = "i2s";
                                        /* placeholder for external codec */
										remote-endpoint = <&es8388_ep>;
                                    };
                                };
							};
							
                    };
            };
        };
	};

sound configuration:

/{
	tegra_sound_graph: tegra_sound: sound-es8388 {
				compatible = "nvidia,tegra186-audio-graph-card",
						"nvidia,tegra186-ape";
				clocks = <&bpmp TEGRA234_CLK_PLLA>,
					<&bpmp TEGRA234_CLK_PLLA_OUT0>,
					<&bpmp TEGRA234_CLK_AUD_MCLK>;
				clock-names = "pll_a", "plla_out0", "extern1";
				assigned-clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
				assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLA_OUT0>;
				nvidia-audio-card,name = "NVIDIA Jetson Orin NX APE";

				nvidia-audio-card,widgets =
					"Headphones", "Headphone",   // 耳机 widget
					"Speakers", "Speaker",       // 扬声器 widget
					"Microphone", "Main Mic",     // 主麦克风 widget
					"Microphone", "Headset Mic",  // 耳机麦克风 widget
					"Headphone Power", "Headphone Power",  // 耳机 power
					"Speaker Power", "Speaker Power",  //// 扬声器 power

					"Lineout", "LOUT1",
					"Lineout", "ROUT1",
					"Lineout", "LOUT2",
					"Lineout", "ROUT2",
					"Line In", "LINPUT1",
					"Line In", "LINPUT2",
					"Line In", "RINPUT1",
					"Line In", "RINPUT2";

				nvidia-audio-card,routing =
					"Headphone", "LOUT1",
					"Headphone", "ROUT1",
					"Speaker", "LOUT2",
					"Speaker", "ROUT2",
					"Headphone", "Headphone Power",
					"Headphone", "Headphone Power",
					"Speaker", "Speaker Power",
					"Speaker", "Speaker Power",
					"LINPUT1", "Main Mic",
					"LINPUT2", "Main Mic",
					"RINPUT1", "Headset Mic",
					"RINPUT2", "Headset Mic";

				nvidia-audio-card,mclk-fs = <256>;
				nvidia-audio-card,dai-link@77 { 
					link-name = "ES8323 HiFi";
					i2s2_cpu: cpu {
                         sound-dai = <&tegra_i2s2 I2S_DAP>;
						 prefix = "I2S2";
                	};
        			codec {
            			sound-dai = <&ES8323 2>;
            			prefix = "x";
       				};
				};
			};    
};

Burning program results

sudo aplay -l // 并未生成 ape 声卡节点

Troubleshooting code:

source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_machine_driver.c

static int add_dai_links(struct snd_soc_card *card)
{
	int ret;     //发现代码在这里终止,下面的码没有得到执行。
	ret = parse_card_info(card, &tegra_machine_pcm_ops,
			      &tegra_machine_compr_ops);
	if (ret < 0)
		return ret;      
    
	ret = tegra_codecs_init(card);
	if (ret < 0)
		return ret;
	return 0;
}
It is found that the code terminates at the above position, and subsequent code does not seem to be executed. At the same time, dmesg reported the following error:
[   11.819179] tegra-asoc:: probe of sound failed with error -22

The above code has not completed execution

Regarding the code, I made the following modifications:

liukuangjie@ubuntu20:~/work/nvida-ld620/jetson-36p3/source/kernel_src/kernel/kernel-jammy-src/drivers/neardi_driver/codec$ git diff /samba/home/liukuangjie/work/nvida-ld620/jetson-36p3/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c
diff --git a/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c b/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c
index e16ec7d89..1822e0762 100644
--- a/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c
+++ b/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c
@@ -87,6 +87,15 @@ dai_init:
        return tegra_audio_dai_init(rtd);
 }
 
+static int tegra_machine_es8388_init(struct snd_soc_pcm_runtime *rtd)
+{
+
:...skipping...
diff --git a/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c b/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c
index e16ec7d89..1822e0762 100644
--- a/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c
+++ b/source/kernel_src/nvidia-oot/sound/soc/tegra/tegra_codecs.c
@@ -87,6 +87,15 @@ dai_init:
        return tegra_audio_dai_init(rtd);
 }
 
+static int tegra_machine_es8388_init(struct snd_soc_pcm_runtime *rtd)
+{
+
+       struct snd_soc_card *card = rtd->card;
+       snd_soc_dapm_sync(&card->dapm);
+printk(KERN_EMERG "%s", "liukuangjie-----tegra_machine_es8388_init\n");
+       return tegra_audio_dai_init(rtd);
+}
+
 static int tegra_machine_fepi_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct device *dev = rtd->card->dev;
@@ -279,6 +288,8 @@ int tegra_codecs_init(struct snd_soc_card *card)
                        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, "ES8323-HiFi"))
+                       dai_links[i].init = tegra_machine_es8388_init;
        }
 
        return 0;

question:

Why is the sound node not generated?

Hi,

Greetings! I see that widgets and routes are not framed correctly. Please refer link to help frame the widgets and routes

Sharing other references that could help:

  1. Codec integration guide at Audio Setup and Development — NVIDIA Jetson Linux Developer Guide 1 documentation thoroughly to understand the codec integration process
  2. TroubleShooting at Audio Setup and Development — NVIDIA Jetson Linux Developer Guide 1 documentation
  3. Examples at Audio Setup and Development — NVIDIA Jetson Linux Developer Guide 1 documentation

Further, I am attaching reference overlay used for another sample codec. Please note that these are for reference and cannot be used directly

	fragment@0 {
		target-path = "/i2c@31e0000";

		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;

			rt5658: rt5659.7-001a@1a {
				compatible = "realtek,rt5658";
				reg = <0x1a>;

				/* refer include/sound/rt5659.h for the values to be used */
				realtek,jd-src = <2>; /* RT5659_JD_HDA_HEADER */
				realtek,dmic1-data-pin = <0>; /* RT5659_DMIC1_NULL */
				realtek,dmic2-data-pin = <0>; /* RT5659_DMIC2_NULL */

				/* Codec IRQ output */
				interrupt-parent = <&tegra_main_gpio>;
				interrupts = <TEGRA234_MAIN_GPIO(AC, 5) GPIO_ACTIVE_HIGH>;

				clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
				clock-names = "mclk";

				#sound-dai-cells = <1>;

				sound-name-prefix = "CVB-RT";

				status = "okay";

				port {
					rt5658_ep: endpoint {
						remote-endpoint = <&i2s1_dap_ep>;
						mclk-fs = <256>;
						link-name = "rt565x-playback";
					};
				};
			};
		};
	};

	fragment@1 {
		target = <&tegra_sound>;

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

			nvidia-audio-card,routing =
				"CVB-RT Headphone Jack",     "CVB-RT HPO L Playback",
				"CVB-RT Headphone Jack",     "CVB-RT HPO R Playback",
				"CVB-RT IN1P",               "CVB-RT Mic Jack",
				"CVB-RT IN2P",               "CVB-RT Mic Jack",
				"CVB-RT Int Spk",            "CVB-RT SPO Playback",
				"CVB-RT DMIC L1",            "CVB-RT Int Mic",
				"CVB-RT DMIC L2",            "CVB-RT Int Mic",
				"CVB-RT DMIC R1",            "CVB-RT Int Mic",
				"CVB-RT DMIC R2",            "CVB-RT Int Mic";

			nvidia-audio-card,mclk-fs = <256>;
		};
	};

	fragment@2 {
		target = <&i2s1_to_codec>;

		__overlay__ {
			link-name = "rt565x-playback";
			codec {
				sound-dai = <&rt5658 0>;
				prefix = "CVB-RT";
			};
		};
	};

	fragment@3 {
		target = <&tegra_sound_graph>;

		__overlay__ {
			widgets = "Headphone",    "CVB-RT Headphone Jack",
				  "Microphone",   "CVB-RT Mic Jack",
				  "Speaker",      "CVB-RT Int Spk",
				  "Microphone",   "CVB-RT Int Mic";

			routing = "CVB-RT Headphone Jack",     "CVB-RT HPO L Playback",
				  "CVB-RT Headphone Jack",     "CVB-RT HPO R Playback",
				  "CVB-RT IN1P",               "CVB-RT Mic Jack",
				  "CVB-RT IN2P",               "CVB-RT Mic Jack",
				  "CVB-RT Int Spk",            "CVB-RT SPO Playback",
				  "CVB-RT DMIC L1",            "CVB-RT Int Mic",
				  "CVB-RT DMIC L2",            "CVB-RT Int Mic",
				  "CVB-RT DMIC R1",            "CVB-RT Int Mic",
				  "CVB-RT DMIC R2",            "CVB-RT Int Mic";

			mclk-fs = <256>;
		};
	};

	fragment@4 {
		target = <&i2s1_dap_ep>;

		__overlay__ {
			remote-endpoint = <&rt5658_ep>;
		};
	};
};

Hope above information helps in resolving the issue. If not, please get in touch for follow up!

Warm Regards

The sound node was not generated before because the codec driver failed to load. Now the node is generated and the mclk signal can be detected. However, when I use the following command to play, there is no signal in i2c2, and the signal comes out from the following pin. from i2c4 and not from scheduled i2c2

$ amixer -c APE cset name=“I2S2 Mux” ADMAIF2
$ aplay -D hw:APE,1 xxx.wav

Is there a problem with my pin relationship and controller correspondence? If there is a problem, how should I know the address of the i2s controller corresponding to the pin I am using?
Since I didn’t find the TRM of orin nano, I used the address determined by orin’s TRM. Will this cause a mismatch? Can you check it for me?

When I changed the dts corresponding to i2s2 to i2s4 in the device tree and played the sound, I found that the waveform could be measured on both i2s2 and i2s4. But the codec chip does not output, and dmesg does not see an error. Is there something wrong?

Hi,

I apologize for the delay. There was a 4-day holiday. Pinmux sheet indicates the I2S controller index and the pin number

If you have connected 193, 195, 197, 199, it is I2S2
and If you are using 226, 220, 222, 224, it is I2S4

Ensure to set SCLK and FS as birectional for the I2S that you chose to connect to the codec

For the sake of convenience, I would suggest to integrate on I2S4 as the integration guide is available for I2S on 40-pin header. Please note that you have to make suitable changes correponding to I2S4 i.e choose appropriate DAI link. Further ensure that pinmux is set. Details on this are available in the previous links that I shared for Codec integration

When I changed the dts corresponding to i2s2 to i2s4 in the device tree and played the sound, I found that the waveform could be measured on both i2s2 and i2s4. "

Playback from both is not possible per your settings. Probe DOUT pin to observe data

But the codec chip does not output, and dmesg does not see an error. Is there something wrong?

Share the mixer control dump and dapm trace. Check the trouble shooting section for more details as to how to obtain these - link

Regards

Hi NV
Thank you very much for your help. After investigation, I found that the codec chip driver was not fully effective. I used amixer configuration and assisted i2ctools to modify the register to complete the codec function, but the effect was not very good. My codec driver file is from rockchip sdk I got it, I would like to ask if there is a driver for the es8388 chip that has been verified on orin nano.

Hi,

I would like to ask if there is a driver for the es8388 chip that has been verified on orin nano.

We verify Orin audio interfaces with one sample codec. Hence, have not verified es8388

There is a codec driver attached at The audio codec ES8388 does not work on Jetson nano - #43 by mkumard

Please check if this helps. Otherwise, suggest to get in touch with codec vendor to provide the same for your kernel version

Regards

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