Orin NX es8316 audio playback not work

My environment is : Orin NX 8GB module and customized carried board.
The resource is I2S2 and I2C0 (the same as 40-pin header)
I have success config es8316 codec in dts and driver.

When I try to play music,
SCLK LRCK and SDO output normal,
but MCLK always power on whether or not I play music, That is strange.

pinmux:
I use jetson-io to config pinmux temporarily, and it works fine:

es8316 driver is here, and it works well:
es8336.c (40.0 KB)

I can find APE cards:

What’s more, This is my widgets and routes contents:
contents.txt (789.9 KB)

I guess I should config route manually,
I running these command, but there is no music play

amixer -c 1 sset ‘I2S2 Mux’ ‘ADMAIF1’
amixer -c APE cset name="ES Left Hp mixer Left DAC Switch" 1
amixer -c APE cset name="ES Right Hp mixer Right DAC Switch" 1

aplay -D hw:1,0 1.wav

By the way , I use 35.3.1 SDK.
I have success config this chip in 32.7.3

But the audio framework is totally different in the new one.

Hi,can anybody help us config this codec?

Hi,
I will be happy to help resolve your issue with 35.3.1

Did you had a chance to check the Audio Setup and Development — Jetson Linux Developer Guide documentation for audio related changes to be done on 35.3.1

Hi,mkumard,
thank you for reply!
I have watch this topic and I try to config es8316 with these reference.

But I dont know whether my routes ,widgets and mixer controls config is ok,
This is my code:

nvidia-audio-card,widgets =
                 "Headphone",    "ES Headphone Jack",
                 "Microphone",   "ES Mic Jack",
                 "Speaker",      "ES Int Spk",
                 "Microphone",   "ES Int Mic";

                nvidia-audio-card,routing =
                 "ES Headphone Jack",     "ES HPOL",
                 "ES Headphone Jack",     "ES HPOR",
                 "ES MIC1",               "ES Mic Jack",
                 "ES MIC2",               "ES Mic Jack",
                 "ES DMIC",               "ES Int Mic";
                nvidia-audio-card,mclk-fs = <256>;

This is my mixer setting:

What is the behavior or error do you see during the playback of audio?.

Are you playing the audio with aplay command line util or on ubuntu gui apps?. Can you confirm with aplay whether the audio plays for right duration for e.g 10second wavefile should run aplay for 10 second if the DAPM connetions are proper. This will give some clue on the issue.

I didin’t see any error when I test,but just no voice output.

I use this command to play music.

aplay -D hw:1,0 1.wav

l check that running time is ok.

Ok, this confirms DAPM path is proper. As your first comment states SCLK, LRCK and SDOUT is proper that means data is sent out of Tegra to Codec es8316. Is the codec mixer control config is same as the one which is working on 32.7.3?

We need to put our effort on codec controls to see if anything missing there. Would it be possible to compare the regmap dump of codec registers on working 32.7.3 and r35.2.1

Thank you,
this is 32.7.3 mixer control:

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

35.3.1 is different because the different config framework.

The es8316.c is almost the same, and the same as registers config.

This is 32.7.3 codec driver:
es8316_32.7.3.c (36.7 KB)

35.3.1 just varies in kernel version and DT config which you already taken care as sound card registered properly.

Can you provide the dump of clock info on target with “cat /sys/kernel/debug/clk/clk_summary” during playback active.

I running and get the log:

amixer -c APE sset "I2S2 Mux" "ADMAIF1"
amixer -c APE cset name="ES Left Hp mixer Left DAC Switch" 1
amixer -c APE cset name="ES Left Hp mixer Left DAC Switch" 1

aplay -D hw:1,0 1.wav &
cat /sys/kernel/debug/clk/clk_summary > clk_summary.log

clk_summary.log (77.7 KB)

Thanks,
Both I2S2(44.1KHz) and AUD_MCLK(256Fs) clock rates are as expected.

Can you attach the whole DTS and driver files which are changed for es8316 support on orin NX(ignore codec driver).

Sure, this is my dts file.
And the password is “seavo”
tegra234-p3767-common-audio.rar (2.1 KB)

I believe got your problem, you connected the codec dai to I2S1, on Orin NX it should be like below. Please add fix like below

//Specific overrides for I2S2 DAI link */
&i2s2_to_codec {
link-name = “es8316-playback”;
codec {
sound-dai = <&es8316_codec 0>;
prefix = “ES”;
};
};

Thank you for check!
I fixed this mistake , but there is still no voice .

I suspect ”mixer controls“ config have some problems. Can you give me some suggestions?

Can you include the below change to codec node.
es8316_codec: es8316@10 {
#sound-dai-cells = <0>;
compatible = “everest,es8336”;
reg = <0x10>;
spk-con-gpio = <&tegra_main_gpio SPK_EN GPIO_ACTIVE_HIGH>;
clocks = <&bpmp_clks TEGRA234_CLK_AUD_MCLK>;
clock-names = “mclk”;
status = “okay”;
};

Also I noticed you have commented out codes related to mclk clock in codec driver which u can enable now with above entry.

If above mixer control worked earlier then it should not be different now as the driver is same.

I do this change, but kernel panic.

tegra234-p3767-common-audio.dtsi

                        reg = <0x10>;
                        spk-con-gpio = <&tegra_main_gpio SPK_EN GPIO_ACTIVE_HIGH>;
+                      clocks = <&bpmp_clks TEGRA234_CLK_AUD_MCLK>;
+                      clock-names = "mclk";
                        status = "okay";
                };

es8336.c

@@ -1075,7 +1075,7 @@ static int es8336_probe(struct snd_soc_component *component)
        if (PTR_ERR(es8336->mclk) == -EPROBE_DEFER)
                return -EPROBE_DEFER;
 
-#if 0
+#if 1
        ret = clk_prepare_enable(es8336->mclk);
        if (ret)
                return ret;

error.log (5.5 KB)

Hi,
Can you attach the es8316.c codec driver used by you on r35.3.1 .