How to configure custom audio card ES8388

Hello!

I used Orin nano module and custom board, used i2s1 and i2c2 interface connected to audio codec chip ES8388

There are some things I don’t understand in this document:
https://docs.nvidia.com/jetson/archives/r36.4/DeveloperGuide/SD/Communications/AudioSetupAndDevelopment.html#device-tree-configuration-for-a-custom-audio-card

  • Should the node corresponding to i2s1 be i2s@2901300? Whether it only needs to be enabled in the device tree:
bus@0 {
	aconnect@2900000 {
		ahub@2900800 {
			i2s@2901300 {
				status = "okay";
			};
		};
	};
};
  • Am I configuring the i2c node correctly?
clocks {
	es8388_mclk: es8388_mclk {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <12288000>;
		clock-output-names = "es8388-mclk";
		status = "okay";
	};
};
bus@0 {
i2c@3160000 {
	status = "okay";
	es8388: audio-codec@10{
		compatible = "everest,es8388";
		#sound-dai-cells = <0>;
		reg = <0x10>;
		VDDA-supply = <&vdd_3v3_ao>;
		VDDIO-supply = <&vdd_1v8_sys>;
		clocks = <&es8388_mclk>;
		status= "okay";
	};
};
};
  • Do I need to change the DAPM routes mentioned in the documentation?Where should it be configured
  • I see that the kernel supports this chip, do I just need to enable this configuration?
CONFIG_SND_SOC_ES8328_I2C=y
  • Is this the correct configuration for the i2s4_to_codec node?
sound {
	i2s4_to_codec {
		link-name = "fe-pi-audio-z-v2";
		bitclock-master;
		frame-master;
		status = "okay";
		format = "i2s";
		codec {
			sound-dai = <&es8388>;
			prefix = "H40-SGTL";
		};
	};
};
  • Do I need to configure other device trees?

I got the audio functionality working earlier this year in Jan on Jetson AGX Xavier Industrial with own carrier board designed.
I am attaching the dtsi file which we modified to get it work.

Kindly compare this with yours and do the changes accordingly.

Note: you need to enable the codec driver module in the defconfig either to “m” or “y”

CONFIG_SND_SOC_ES8328_I2C=y
or
CONFIG_SND_SOC_ES8328_I2C=m

We had used STGL codec and you are using ES8328.

tegra194-audio-p2822-0000.txt (16.3 KB)

Hello, I refer to your device tree modification, the kernel will print these error messages, do you know the reason?

root@edge-computer:/home/edge# dmesg|grep sound
[    3.214156]   No soundcards found.
[   13.375692] input: NVIDIA Jetson Orin NX HDA HDMI/DP,pcm=3 as /devices/platform/bus@0/3510000.hda/sound/card0/input1
[   13.397107] input: NVIDIA Jetson Orin NX HDA HDMI/DP,pcm=7 as /devices/platform/bus@0/3510000.hda/sound/card0/input2
[   13.421063] input: NVIDIA Jetson Orin NX HDA HDMI/DP,pcm=8 as /devices/platform/bus@0/3510000.hda/sound/card0/input3
[   13.450088] input: NVIDIA Jetson Orin NX HDA HDMI/DP,pcm=9 as /devices/platform/bus@0/3510000.hda/sound/card0/input4
[   15.436958] tegra-asoc: sound: ASoC: no source widget found for H40-SGTL HP_OUT
[   15.436968] tegra-asoc: sound: ASoC: Failed to add route H40-SGTL HP_OUT -> direct -> H40-SGTL Headphone
[   15.436991] tegra-asoc: sound: ASoC: no sink widget found for H40-SGTL MIC_IN
[   15.436993] tegra-asoc: sound: ASoC: Failed to add route H40-SGTL Mic -> direct -> H40-SGTL MIC_IN
[   15.437014] tegra-asoc: sound: ASoC: no source widget found for H40-SGTL Mic Bias
[   15.437015] tegra-asoc: sound: ASoC: Failed to add route H40-SGTL Mic Bias -> direct -> H40-SGTL ADC
[   15.437034] tegra-asoc: sound: ASoC: no sink widget found for H40-SGTL LINE_IN
[   15.437035] tegra-asoc: sound: ASoC: Failed to add route H40-SGTL Line In -> direct -> H40-SGTL LINE_IN
[   15.437052] tegra-asoc: sound: ASoC: no source widget found for H40-SGTL LINE_OUT
[   15.437053] tegra-asoc: sound: ASoC: Failed to add route H40-SGTL LINE_OUT -> direct -> H40-SGTL Line Out
[   15.442404] tegra-asoc: sound: snd_soc_register_card failed (-19)

Device tree changes are not updated correctly.
In the error messages you can see it mentions H40-SGTL, where as you are not using this Audio codec. Update those H40-SGTL entries with the corresponding Audio Codec you are using, ie., ES8328

Hello!

Ok, I modified nvidia-audio-card,routing, and now there is no error reported by asoc, but I used an oscilloscope to measure MCLK without clock output. Do you know the reason?
Here is my device tree and kernel log:
tegra234-p3768-0000+p3767-0000-nv.dts.txt (4.0 KB)
dmesg.log (133.4 KB)

May be you clock Input in device tree might be wrong.

@Sheetal.G @KevinFFF

Could you please look in to this issue.

Hi,

  • Is the codec connected to the aud_mclk pin of the Tegra when you probe the signal? If so, please try probing the aud_mclk without connecting the codec?
  • If there is still no signal, could you try modifying the pin’s pull state to either “down” or “up”? This can be done by directly editing the pinmux Device Tree file
  • Alternatively, codec Internal PLL can be used instead of MCLK incase the codec supports.