The audio codec es8316 can’t work on I2S0 for Xaiver NX

Hi, spujar,

  • I have changed MCLK to 2.8MHz, but it doesn’t work , The default clock is 11.30MHz,when I play music on the command line, it becomes 12.30Mhz
--- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
+++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
@@ -363,7 +363,7 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
         //dai_params->channels_min = channels;
 
                //err = es8316_set_dai_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK,aud_mclk, SND_SOC_CLOCK_IN);
-               err = snd_soc_dai_set_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 12288000,SND_SOC_CLOCK_IN);
+               err = snd_soc_dai_set_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 2800000,SND_SOC_CLOCK_IN);
                if (err < 0) {
                        dev_err(card->dev, "codec_dai clock not set\n");
                        return err;
@@ -575,7 +575,7 @@ static int tegra_machine_es8316_init(struct snd_soc_pcm_runtime *rtd)       //wxz
        int err;
 
        //err = es8316_set_dai_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 11289600,SND_SOC_CLOCK_IN);
-       err = snd_soc_dai_set_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK, 12288000,SND_SOC_CLOCK_IN);
+       err = snd_soc_dai_set_sysclk(rtd->codec_dai, ES8316_SCLK_S_MCLK,  2800000,SND_SOC_CLOCK_IN);
        if (err) {
                dev_err(dev, "failed to set es8316 sysclk!\n");
                return err;

  • cmdlineis : speaker-test -D hw:es8316tegra,0 -c 2 -r 48000 -F S16_LE -t sine -f 500
    still no sound .

  • Codec as the master mode ? Can I modify it this way? It’s still 11.30MHz.

--- a/kernel-dts/common/tegra186-p3636-0001-a00-audio.dtsi
+++ b/kernel-dts/common/tegra186-p3636-0001-a00-audio.dtsi
@@ -99,8 +99,8 @@
                        cpu-dai-name = "I2S1";
                        codec-dai-name = "es8316-hifi";
                        format = "i2s";
-                       bitclock-master;
-                       frame-master;
+                       bitclock-slave;
+                       frame-slave;
                        format = "dsp_a";
                        fsync-width = <0>;
                        bit-format = "s16_le";

  • dmesg has no errors .
root@nvidia-desktop:/home/nvidia# dmesg  | grep "asoc"
[    1.728433] tegra-asoc: sound: ADMAIF1 <-> ADMAIF1 mapping ok
[    1.728508] tegra-asoc: sound: ADMAIF2 <-> ADMAIF2 mapping ok
[    1.728582] tegra-asoc: sound: ADMAIF3 <-> ADMAIF3 mapping ok
[    1.728651] tegra-asoc: sound: ADMAIF4 <-> ADMAIF4 mapping ok
[    1.728888] tegra-asoc: sound: ADMAIF5 <-> ADMAIF5 mapping ok
[    1.728962] tegra-asoc: sound: ADMAIF6 <-> ADMAIF6 mapping ok
[    1.729028] tegra-asoc: sound: ADMAIF7 <-> ADMAIF7 mapping ok
[    1.729093] tegra-asoc: sound: ADMAIF8 <-> ADMAIF8 mapping ok
[    1.729163] tegra-asoc: sound: ADMAIF9 <-> ADMAIF9 mapping ok
[    1.729229] tegra-asoc: sound: ADMAIF10 <-> ADMAIF10 mapping ok
[    1.729300] tegra-asoc: sound: ADMAIF11 <-> ADMAIF11 mapping ok
[    1.729366] tegra-asoc: sound: ADMAIF12 <-> ADMAIF12 mapping ok
[    1.729434] tegra-asoc: sound: ADMAIF13 <-> ADMAIF13 mapping ok
[    1.729502] tegra-asoc: sound: ADMAIF14 <-> ADMAIF14 mapping ok
[    1.729571] tegra-asoc: sound: ADMAIF15 <-> ADMAIF15 mapping ok
[    1.729639] tegra-asoc: sound: ADMAIF16 <-> ADMAIF16 mapping ok
[    1.729712] tegra-asoc: sound: ADMAIF17 <-> ADMAIF17 mapping ok
[    1.729779] tegra-asoc: sound: ADMAIF18 <-> ADMAIF18 mapping ok
[    1.729845] tegra-asoc: sound: ADMAIF19 <-> ADMAIF19 mapping ok
[    1.729915] tegra-asoc: sound: ADMAIF20 <-> ADMAIF20 mapping ok

root@nvidia-desktop:/home/nvidia# dmesg  | grep "8316"
[    1.527406] es8316_i2c_probe 1163=========================================
[    1.527409] es8316_i2c_probe 1168=========================================
[    1.527452] es8316_i2c_probe 1182=========================================
[    1.527459] es8316_i2c_probe 1237========================================= ret:0
[    1.606226] es8316_probe 1070=========================================
[    1.606388] es8316_probe 1082=========================================
[    1.612269] es8316_probe 1088=========================================
[    1.721835] es8316_init_regs 967=========================================
[    1.723671] es8316_probe 1115=========================================ret:0
[    1.732722] es8316_set_dai_sysclk===========8316codec================== 586
[    1.820772]   #1: es8316-tegra
[   12.265902] tegra_machine_dai_init===========8316=======es8316-playback=========== 355
[   12.265906] es8316_set_dai_sysclk===========8316codec================== 586
[   12.416972] tegra_machine_dai_init===========8316=======es8316-playback=========== 355
[   12.416975] es8316_set_dai_sysclk===========8316codec================== 586
[   12.545349] tegra_machine_dai_init===========8316=======es8316-playback=========== 355
[   12.545352] es8316_set_dai_sysclk===========8316codec================== 586
[   12.557054] tegra_machine_dai_init===========8316=======es8316-playback=========== 355
[   12.557057] es8316_set_dai_sysclk===========8316codec================== 586
[   12.716711] tegra_machine_dai_init===========8316=======es8316-playback=========== 355
[   12.716714] es8316_set_dai_sysclk===========8316codec================== 586
  • Here are the details of demsg

dmesg.txt (110.9 KB)
es8316.c (38.1 KB)

  • Is there a problem with the routing channel on the platform side? Can you help me configure it with amixer ?

contents.txt (293.2 KB)
scontrols.txt (48.4 KB)
controls.txt (54.2 KB)

root@nvidia-desktop:/home/nvidia# cat /proc/asound/cards
 0 [tegrahda       ]: tegra-hda - tegra-hda
                      tegra-hda at 0x3518000 irq 382
 1 [es8316tegra    ]: es8316-tegra - es8316-tegra
                      es8316-tegra

In addition, we have a seven day holiday on national day. We may not reply to you until after national day

thanks,
wangxiaozhuang.