R36.4.4 audio driver error

When adapting to es8316 codecs, an error occurred

dts:

            i2c@3160000 {
                    es8316_codec: es8316@10 {
                            #sound-dai-cells = <0>;
                            compatible = "everest,es8316";
                            reg = <0x10>;
                            spk-con-gpio = <&gpio TEGRA234_MAIN_GPIO(H, 0) GPIO_ACTIVE_LOW>;
                            clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
                            clock-names = "mclk";
                            status = "okay";
                    };
            };
    tegra_sound_graph: tegra_sound: sound {
            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 AGX Orin APE";
            nvidia,model = "es8316 snd";
            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";

            mclk-fs = <256>;
            //hdr40_snd_link_i2s: nvidia-audio-card,dai-link@77
    };

&i2s2_to_codec {
link-name = “es8316-playback”;
codec {
sound-dai = <&es8316_codec 0>;
prefix = “ES”;
};
};

Hi,

  • It seems the invalid audio format issue. Please share the input file audio format.
  • Also please fetch the DT from the platform and share.

Hi, Sheetal.G
the input file audio format is wav

tegra234-p3768-0000+p3767-xxxx-nv-common.txt (10.0 KB)

  • Please share the DT logs from platform. Command to fetch the DT $ dtc -I fs -O dts /proc/device-tree >/tmp/dt.log
  • By input file audio format I meant the sample rate, bit width and channels of the file.
  • Did you perform the pinmux settings for I2S2?
    • To confirm please share the output of cat /sys/kernel/debug/pinctrl/<addr>.pinmux/pinconf-groups > ~/pinmux_<addr>

`

thank you for your detailed guidance:

train.wav.txt (55.4 KB)

pinmux_2430000.txt (31.5 KB)

dt.log (313.2 KB)

Hi

Is this still an issue, apologies for delay. The attached wave file seems to be mono channels. Could you give a try with 48KHz, 2ch, 16bps?.

The problem still exists. I’ll try switching to a different WAV file

Did you followed the codec set sysclk function as per Audio Setup and Development — NVIDIA Jetson Linux Developer Guide 1 documentation . The error in your log indicates this could be one of the reason.

Yes, there is no modification to sysclk. Please help confirm whether the driver code is correct

tegra_codecs.txt (2.2 KB)

[ 105.978744] ==================tegra_codecs_runtime_setup=========================
[ 105.978769] ==================es8316-playback=================
[ 105.981074] es8316 0-0010: ASoC: error at snd_soc_dai_hw_params on ES8316 HiFi: -22
[ 105.981085] tegra-asoc: sound: ASoC: PRE_PMU: es8316-playback-playback event failed: -22
[ 195.959796] ==================tegra_codecs_runtime_setup=========================
[ 195.959825] ==================es8316-playback=================
[ 195.963608] es8316 0-0010: ASoC: error at snd_soc_dai_hw_params on ES8316 HiFi: -22
[ 195.963627] tegra-asoc: sound: ASoC: PRE_PMU: es8316-playback-playback event failed: -22

hzx@hzx-desktop:~$ aplay -D hw:APE,0 test.wav
Playing WAVE ‘test.wav’ : Signed 16 bit Little Endian, Rate 16000 Hz, Stereo

I see a minor issue with your change, please update as per the attached patch

es8316.txt (1.3 KB)

Also mclk-fs = <256>; in sound {} node is not necessary as codec driver would control the MCLK as we providing it from codec dt node

Even after making the modifications according to your suggestions, it still doesn’t work

When playing audio, there is no error reported, it immediately returns, and the playback is not maintained

root@hzx-desktop:/home/hzx# aplay -D hw:APE,0 test.wav
Playing WAVE ‘test.wav’ : Signed 16 bit Little Endian, Rate 16000 Hz, Stereo

Sorry, the issue with the “quit immediately” is related to the wav file. It can be played, but there is no sound

Could you probe I2S DOUT signal to check if we have valid data coming out?. If so, we might need to check the codec mixer control config like mute/volume etc..

I2S DOUT should have a signal

When starting or stopping the broadcast, there is a slight electrical humming sound

After updating the es8316 driver, sound is now playing, but there is a significant background noise resembling snowflakes. By executing the command to play the mono file “train.wav” followed by the stereo file, and then playing both mono and stereo files afterwards, the sound is normal. What additional configuration might be needed?
aplay -D hw:APE,0 train.wav

The first time there was snowflake effect, after playing mono audio, the audio with snowflake effect played normally. The register values for the two audio plays were the same.

root@hzx-desktop:/home/hzx# i2cdump -f -y 0 0x10
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: c0 77 08 20 11 00 11 00 00 04 0c 0c ff 00 3f 1f ?w? ?.?..???..??
10: 11 fc 28 00 88 00 bb 66 00 02 10 30 00 00 92 82 ??(.?.?f.??0..??
20: ff f9 20 20 01 0a 10 c0 00 dd 1a a0 32 06 61 00 .? ???.???2?a.
30: 10 20 00 84 84 1f f7 fd ff 1f f7 fd ff 1f f7 fd ? .???.???.???
40: ff 1f f7 fd ff 1f f7 fd ff 1f f7 fd ff 00 f3 22 .???.???.???..?"
50: a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?..
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
80: c0 77 08 20 11 00 11 00 00 04 0c 0c ff 00 3f 1f ?w? ?.?..???..??
90: 11 fc 28 00 88 00 bb 66 00 02 10 30 00 00 92 82 ??(.?.?f.??0..??
a0: ff f9 20 20 01 0a 10 c0 00 dd 1a a0 32 06 61 00 .? ???.???2?a.
b0: 10 20 00 84 84 1f f7 fd ff 1f f7 fd ff 1f f7 fd ? .???.???.???
c0: ff 1f f7 fd ff 1f f7 fd ff 1f f7 fd ff 00 f3 22 .???.???.???..?"
d0: a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?..
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …

root@hzx-desktop:/home/hzx# i2cdump -f -y 0 0x10
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: c0 77 08 20 11 00 11 00 00 04 0c 0c ff 00 3f 1f ?w? ?.?..???..??
10: 11 fc 28 00 88 00 bb 66 00 02 10 30 00 00 92 82 ??(.?.?f.??0..??
20: ff f9 20 20 01 0a 10 c0 00 dd 1a a0 32 06 61 00 .? ???.???2?a.
30: 10 20 00 84 84 1f f7 fd ff 1f f7 fd ff 1f f7 fd ? .???.???.???
40: ff 1f f7 fd ff 1f f7 fd ff 1f f7 fd ff 00 f3 22 .???.???.???..?"
50: a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?..
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
80: c0 77 08 20 11 00 11 00 00 04 0c 0c ff 00 3f 1f ?w? ?.?..???..??
90: 11 fc 28 00 88 00 bb 66 00 02 10 30 00 00 92 82 ??(.?.?f.??0..??
a0: ff f9 20 20 01 0a 10 c0 00 dd 1a a0 32 06 61 00 .? ???.???2?a.
b0: 10 20 00 84 84 1f f7 fd ff 1f f7 fd ff 1f f7 fd ? .???.???.???
c0: ff 1f f7 fd ff 1f f7 fd ff 1f f7 fd ff 00 f3 22 .???.???.???..?"
d0: a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?..
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 …

Could you please take a look? Thank you