如何配置音频芯片ES8388

你好!
我硬件使用了Jetson orin nano模组和定制载板,SDK是 Jetson Linux 36.3
我已经开启了内核选项:CONFIG_SND_SOC_ES8328_I2C=y
设备树中添加了i2c节点:

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

硬件上使用的是I2S1
请问设备树中i2s和音频卡部分如何配置?

Could you check Audio Setup and Development — NVIDIA Jetson Linux Developer Guide 1 documentation to see if can help? Thanks

你好!
我看到文档中说明不是很详细,我在设备树中添加了如下代码:

sound {
		i2s4_to_codec: nvidia-audio-card,dai-link@79 {
			link-name = "fe-pi-audio-z-v2";
			bitclock-master;
			frame-master;
			status = "okay";
			codec {
				sound-dai = <&es8388_codec>;
				prefix = "H40-SGTL";
			};
		};
	};

	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_codec: es8388@10{
				compatible = "everest,es8388";
				reg = <0x10>;
				clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
				clock-names = "mclk";
				status= "okay";
			};
		};
		aconnect@2900000 {
			ahub@2900800 {
				i2s@2901300 {
					status = "okay";
				};
			};
		};
	};
  • 后我执行cat /sys/kernel/debug/asoc/components有显示es8328.0-0010
  • 但是执行dmesg |grep i2s和dmesg | grep "ASoC"没有任何信息
  • 请问是不是设备树还没有修改正确?
  • 内核有以下打印
[    3.823597] ALSA device list:
[    3.823601]   No soundcards found.

@KevinFFF 你好,可以帮我看一下这个问题吗?
现在我的设备树修改如下:

+++ b/user/dts/tegra234-p3768-0000+p3767-0000-nv.dts
@@ -8,7 +8,7 @@
 
 / {
     model = "EC5550";
-       version = "V1.0.1";
+       version = "V1.0.2.4";
 
        aliases {
                serial0 = &uartb;
@@ -22,6 +22,29 @@
                };
        };
 
+       sound {
+               i2s4_to_codec: nvidia-audio-card,dai-link@79 {
+                       link-name = "fe-pi-audio-z-v2";
+                       bitclock-master;
+                       frame-master;
+                       status = "okay";
+                       codec {
+                               sound-dai = <&es8388_codec>;
+                               prefix = "H40-SGTL";
+                       };
+               };
+       };
+
+       clocks {
+               es8388_mclk: es8388_mclk {
+                       compatible = "fixed-clock";
+                       #clock-cells = <0>;
+                       clock-frequency = <12288000>;
+                       clock-output-names = "es8388-mclk";
+                       status = "okay";
+               };
+       };
+
     bus@0 {
                uartb: serial@3110000 {
                        compatible = "nvidia,tegra194-hsuart";
@@ -47,6 +70,27 @@
                                clock-output-names = "hym8563";
                        };
                };
+               i2c@3160000 {
+                       status = "okay";
+                       es8388_codec: es8388@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";
+                       };
+               };
+               aconnect@2900000 {
+                       status = "okay";
+                       ahub@2900800 {
+                               status = "okay";
+                               i2s@2901300 {
+                                       status = "okay";
+                               };
+                       };
+               };
                spi@3210000{
                        status = "okay";
                        cs-gpios = <&gpio TEGRA234_MAIN_GPIO(Z, 6) GPIO_ACTIVE_LOW>;

还是一样的问题,我使用示波器测量MCLK没有信号
这是我使用的引脚:

Hi qiaowei,

Are you using I2C and I2S from 40 pins expansion header?
How do you configure those pins in pinmux spreadsheet?

Please share the full dmesg and the device tree for further check.
You can run the following command to extract the device tree configuration on your board.

$ sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

Hi,

Please help with below details:

  • Please provide the output of cat /proc/asound/cards. Is the APE card included in the list?
  • It appears that I2S4 is being utilized based on the device tree changes. Can you confirm this?
  • Share the output of cat /sys/kernel/debug/pinctrl/<addr>.pinmux/pinconf-groups to confirm AUD_MCLK and I2S4 pinmux settings.
  • Share the ALSA mixer control settings and other commands used to run the usecase.
  • Please provide the complete dmesg logs and the device tree file.
  • Also, the routing and widget configurations for the sound node should be adjusted according to the specific audio chip being used.

Hello!
Not find APE card

root@edge-computer:/home/edge# cat /proc/asound/cards
 0 [HDA            ]: tegra-hda - NVIDIA Jetson Orin NX HDA
                      NVIDIA Jetson Orin NX HDA at 0x3518000 irq 120

Because on the hardware I use I2S1
image
I see in the pinmux table that I2S1 corresponds to I2S4


This is cat /sys/kernel/debug/pinctrl/2430000.pinmux/pinconf-groups > pinconf.txtoutput:
pinconf.txt (31.5 KB)
This is kernel log:
dmesg.log (81.6 KB)
This is dtc -I fs -O dts -o extracted_proc.dts.txt /proc/device-tree output:
extracted_proc.dts.txt (327.7 KB)

As per dmesg logs

[   18.339723] tegra-asoc: sound: cpu subnode is missing
[   18.339746] tegra-asoc:: probe of sound failed with error -2

The dai-link defined in your DT is creating a new dai-link named i2s4_to_codec rather than updating the existing dai-link of I2S4 i.e. dai-link@79. Please define like below and update the link-name and sound-dai properties as per the codec being used and see APE card is registered. If still card is not registered, please share the dmesg logs again,

		/* I2S4 dai node */
		nvidia-audio-card,dai-link@79 {
			link-name = "rt5640-playback";
			codec {
				sound-dai = <&rt5640 0>;
				prefix = "CVB-RT";
			};
		};

Hello!
I still can’t register the sound card after modifying the device tree. The following is the kernel log:

[   15.979466] tegra-asoc: sound: ASoC: no source widget found for CVB-RT HPOL
[   15.979478] tegra-asoc: sound: ASoC: Failed to add route CVB-RT HPOL -> direct -> CVB-RT Headphone Jack
[   15.979517] tegra-asoc: sound: ASoC: no source widget found for CVB-RT HPOR
[   15.979519] tegra-asoc: sound: ASoC: Failed to add route CVB-RT HPOR -> direct -> CVB-RT Headphone Jack
[   15.979549] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT IN1P
[   15.979551] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic Jack -> direct -> CVB-RT IN1P
[   15.979578] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT IN2P
[   15.979580] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic Jack -> direct -> CVB-RT IN2P
[   15.979603] tegra-asoc: sound: ASoC: no source widget found for CVB-RT SPOLP
[   15.979605] tegra-asoc: sound: ASoC: Failed to add route CVB-RT SPOLP -> direct -> CVB-RT Int Spk
[   15.979629] tegra-asoc: sound: ASoC: no source widget found for CVB-RT SPORP
[   15.979630] tegra-asoc: sound: ASoC: Failed to add route CVB-RT SPORP -> direct -> CVB-RT Int Spk
[   15.979657] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT DMIC1
[   15.979658] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Int Mic -> direct -> CVB-RT DMIC1
[   15.979686] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT DMIC2
[   15.979687] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Int Mic -> direct -> CVB-RT DMIC2
[   15.989973] tegra-asoc: sound: snd_soc_register_card failed (-19)

dmesg.log (79.8 KB)
How should the nvidia-audio-card,widgets and nvidia-audio-card,routing parameters be configured?
This is my modified device tree:
tegra234-p3768-0000+p3767-0000-nv.txt (5.2 KB)

		nvidia-audio-card,routing =
				"CVB-RT Headphone Jack",     "CVB-RT HPOL",
				"CVB-RT Headphone Jack",     "CVB-RT HPOR",
				"CVB-RT IN1P",               "CVB-RT Mic Jack",
				"CVB-RT IN2P",               "CVB-RT Mic Jack",
				"CVB-RT Int Spk",            "CVB-RT SPOLP",
				"CVB-RT Int Spk",            "CVB-RT SPORP",
				"CVB-RT DMIC1",              "CVB-RT Int Mic",
				"CVB-RT DMIC2",              "CVB-RT Int Mic";

HPOL, HPOR, SPOLP, SPORP are output dapm widgets and IN1P, IN2P, DMIC1, DMIC2 are input dapm widgets as per RT5640 codec.
Please update them according to es8388 codec dapm widgets.

For reference,
The audio codec ES8388 does not work on Jetson nano - #10 by mkumard. Please note DT nodes format is different there as its on older release.

Hello!
After I modified the kernel still reported an error:

nvidia-audio-card,routing =
			"x Headphone", "x LOUT1",
			"x LINPUT1", "x Mic",
			"x Headphone", "x ROUT1",
			"x RINPUT1", "x Mic",
			"y Headphone", "y OUT",
			"y IN", "y Mic",
			"a IN", "a Mic",
			"b IN", "b Mic";
[   17.522505] tegra-asoc: sound: ASoC: no source widget found for x LOUT1
[   17.522516] tegra-asoc: sound: ASoC: Failed to add route x LOUT1 -> direct -> x Headphone
[   17.522564] tegra-asoc: sound: ASoC: no source widget found for x Mic
[   17.522566] tegra-asoc: sound: ASoC: Failed to add route x Mic -> direct -> x LINPUT1
[   17.522598] tegra-asoc: sound: ASoC: no source widget found for x ROUT1
[   17.522600] tegra-asoc: sound: ASoC: Failed to add route x ROUT1 -> direct -> x Headphone
[   17.522630] tegra-asoc: sound: ASoC: no source widget found for x Mic
[   17.522632] tegra-asoc: sound: ASoC: Failed to add route x Mic -> direct -> x RINPUT1
[   17.522660] tegra-asoc: sound: ASoC: no source widget found for y OUT
[   17.522662] tegra-asoc: sound: ASoC: Failed to add route y OUT -> direct -> y Headphone
[   17.522690] tegra-asoc: sound: ASoC: no source widget found for y Mic
[   17.522691] tegra-asoc: sound: ASoC: Failed to add route y Mic -> direct -> y IN
[   17.522719] tegra-asoc: sound: ASoC: no source widget found for a Mic
[   17.522720] tegra-asoc: sound: ASoC: Failed to add route a Mic -> direct -> a IN
[   17.522747] tegra-asoc: sound: ASoC: no source widget found for b Mic
[   17.522749] tegra-asoc: sound: ASoC: Failed to add route b Mic -> direct -> b IN
[   17.538271] tegra-asoc: sound: snd_soc_register_card failed (-19)

I’m really sorry because I’m not familiar with audio and DAPM,I can’t understand the meaning of nvidia-audio-card,widgets and nvidia-audio-card,routing, do I need to check them in the driver?

  • Please don’t replace CVB-RT with x/y/a/b. Retain CVB-RT. It should match with prefix defined in dai-link.
  • To identify the available widgets, please examine the ES8388 codec driver code. Specifically, look for the “SND_SOC_DAPM_OUTPUT” and “SND_SOC_DAPM_INPUT” entries within the dapm_widgets definition for that codec.

I have replaced it with CVB-RT, but the kernel is still reporting an error:

		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", "CVB-RT LOUT1",
			"CVB-RT LINPUT1", "CVB-RT Mic",
			"CVB-RT Headphone", "CVB-RT ROUT1",
			"CVB-RT RINPUT1", "CVB-RT Mic",
			"CVB-RT Headphone", "CVB-RT OUT",
			"CVB-RT IN", "CVB-RT Mic",
			"CVB-RT IN", "CVB-RT Mic",
			"CVB-RT IN", "CVB-RT Mic";

		nvidia-audio-card,dai-link@79 {
			link-name = "es8388-playback";
			bitclock-master;
			frame-master;
			status = "okay";
			codec {
				sound-dai = <&es8388>;
				prefix = "CVB-RT";
			};
		};
[   15.983577] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT Headphone
[   15.983589] tegra-asoc: sound: ASoC: Failed to add route CVB-RT LOUT1 -> direct -> CVB-RT Headphone
[   15.983626] tegra-asoc: sound: ASoC: no source widget found for CVB-RT Mic
[   15.983628] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic -> direct -> CVB-RT LINPUT1
[   15.983660] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT Headphone
[   15.983662] tegra-asoc: sound: ASoC: Failed to add route CVB-RT ROUT1 -> direct -> CVB-RT Headphone
[   15.983691] tegra-asoc: sound: ASoC: no source widget found for CVB-RT Mic
[   15.983693] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic -> direct -> CVB-RT RINPUT1
[   15.983724] tegra-asoc: sound: ASoC: no source widget found for CVB-RT OUT
[   15.983726] tegra-asoc: sound: ASoC: Failed to add route CVB-RT OUT -> direct -> CVB-RT Headphone
[   15.983754] tegra-asoc: sound: ASoC: no source widget found for CVB-RT Mic
[   15.983755] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic -> direct -> CVB-RT IN
[   15.983783] tegra-asoc: sound: ASoC: no source widget found for CVB-RT Mic
[   15.983784] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic -> direct -> CVB-RT IN
[   15.983813] tegra-asoc: sound: ASoC: no source widget found for CVB-RT Mic
[   15.983814] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic -> direct -> CVB-RT IN
[   15.994616] tegra-asoc: sound: snd_soc_register_card failed (-19)

I see in the driver code es8328_dapm_widgets structure and device tree format is not the same, how to correspond
This is the driver and device tree file I use, can you help me modify it?
tegra234-p3768-0000+p3767-0000-nv.txt (5.1 KB)
es8328.c.txt (24.2 KB)

  • Please update like below, assuming headphones are being used,
		nvidia-audio-card,widgets =
			"Headphone",    "CVB-RT Headphone Jack",
			"Microphone",   "CVB-RT Mic Jack",

		nvidia-audio-card,routing =
			"CVB-RT Headphone Jack", "CVB-RT LOUT1",
			"CVB-RT Headphone Jack", "CVB-RT ROUT1",
			"CVB-RT LINPUT1", "CVB-RT Mic Jack",
			"CVB-RT RINPUT1", "CVB-RT Mic Jack";
  • Also, need to add link-name “es8388-playback” in machine driver like other codec link-names in tegra_codecs.c or use other codec link-name that has similar settings like es8388 settings for sysclk.

  • For clock update below properties in “es8388: es8388@10 {”

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

Please share the dmesg logs alongwith updated DT if still face any issue

Hi, I modified the device tree, and now there is no error reported by asoc, but I used an oscilloscope to measure MCLK without clock output
For this node “link-name”, I’ll use the existing one “fe-pi-audio-z-v2”
I executed “aplay -l” command to output many audio cards, which one should I use?

root@edge-computer:/home/edge# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDA [NVIDIA Jetson Orin NX HDA], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDA [NVIDIA Jetson Orin NX HDA], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDA [NVIDIA Jetson Orin NX HDA], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDA [NVIDIA Jetson Orin NX HDA], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 0: tegra-dlink-0 XBAR-ADMAIF1-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 1: tegra-dlink-1 XBAR-ADMAIF2-1 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 2: tegra-dlink-2 XBAR-ADMAIF3-2 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 3: tegra-dlink-3 XBAR-ADMAIF4-3 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 4: tegra-dlink-4 XBAR-ADMAIF5-4 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 5: tegra-dlink-5 XBAR-ADMAIF6-5 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 6: tegra-dlink-6 XBAR-ADMAIF7-6 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 7: tegra-dlink-7 XBAR-ADMAIF8-7 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 8: tegra-dlink-8 XBAR-ADMAIF9-8 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 9: tegra-dlink-9 XBAR-ADMAIF10-9 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 10: tegra-dlink-10 XBAR-ADMAIF11-10 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 11: tegra-dlink-11 XBAR-ADMAIF12-11 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 12: tegra-dlink-12 XBAR-ADMAIF13-12 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 13: tegra-dlink-13 XBAR-ADMAIF14-13 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 14: tegra-dlink-14 XBAR-ADMAIF15-14 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 15: tegra-dlink-15 XBAR-ADMAIF16-15 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 16: tegra-dlink-16 XBAR-ADMAIF17-16 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 17: tegra-dlink-17 XBAR-ADMAIF18-17 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 18: tegra-dlink-18 XBAR-ADMAIF19-18 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: APE [NVIDIA Jetson Orin NX APE], device 19: tegra-dlink-19 XBAR-ADMAIF20-19 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@edge-computer:/home/edge# cat /proc/asound/cards
 0 [HDA            ]: tegra-hda - NVIDIA Jetson Orin NX HDA
                      NVIDIA Jetson Orin NX HDA at 0x3518000 irq 120
 1 [APE            ]: tegra-ape - NVIDIA Jetson Orin NX APE
                      NVIDIA-EC5550-NotSpecified-Jetson

pinmux I’ve set up correctly:



2430000.pinmux.txt (31.5 KB)
c300000.pinmux.txt (6.3 KB)

Here is my device tree and kernel log:
tegra234-p3768-0000+p3767-0000-nv.dts.txt (3.7 KB)
dmesg.log (106.8 KB)

pinconf shared here doesn’t have that setting that’s why asked this 如何配置音频芯片ES8388 - #9 by qiaowei but the latest one you had shared reflecting the pinconf update.

Can you please let me know which pin you are probing?

Refer Audio Setup and Development — NVIDIA Jetson Linux Developer Guide 1 documentation

Additionally note setup codec specific controls as well to complete dapm route.