codec schematic diagram:
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?