Orin nx add a es8156 codec, but now no sound output, please help, thanks

Hi:

  1. we use orin nx(5.1.2/35.4.1) add a codec(only playback,no capture).
  2. hardware not connect MCLK, codec can work without MCLK(use SCLK)
  3. I modified dtsi config, add codec driver to kernel. no more other changes.
  4. after modprobe snd-soc-tegra-machine-driver/snd-soc-tegra210-i2s/es8156
    can find APE now.
    root@desktop:/# cat /proc/asound/cards
    0 [HDA ]: tegra-hda - NVIDIA Jetson Orin NX HDA
    NVIDIA Jetson Orin NX HDA at 0x3518000 irq 109
    1 [APE ]: tegra-ape - NVIDIA Jetson Orin NX APE
    NVIDIA Jetson Orin NX APE

Question:

  1. for hardware not connect MCLK, i set it to i2s‘s clock, i do not know whether this can work or not.

  2. in es8156.c, for compile error “no sink DAC_1”, i shield the dapm_route member:
    { “DAC_1”, “Switch” , “DACL” },
    { “DAC_1”, “Switch” , “DACR” },
    { “LOUT”, NULL, “DAC_1” },
    { “ROUT”, NULL, “DAC_1” },
    whether this can influnce the playback?

  3. i use cmd “for i in find /sys/kernel/debug/tracing/events -name "enable" | grep snd_soc_ ; do echo 1 > $i; done” to check DAPM path, it output nothing.

  4. use cmd “cat /sys/kernel/debug/tracing/trace_pipe” to check, but no return any result.

  5. below is my modification in dts, and attachment is the codec driver code.
    es8156.c.txt (26.0 KB)

    tegra_sound: sound {

             nvidia-audio-card,widgets =
                  "Headphone",    "Headphone Jack",
                   "Speaker",      "Int Spk";
             nvidia-audio-card,routing =
                  "Headphone Jack",     "LOUT",
                  "Headphone Jack",     "ROUT";
    
             nvidia-audio-card,mclk-fs = <256>;
     };
     i2s@2901300 {  //I2S 4
            status = "okay";
     };
     i2c@c240000 {
            es8156: es8156@08 {
                 #sound-dai-cells = <0>;
                 compatible = "everest,es8156";
                 reg = <0x8>;
                 clocks = <&bpmp_clks TEGRA234_CLK_I2S4>;
                 clock-names = "i2s";
            };
     };
    

&i2s2_to_codec {

link-name = "es8156-playback";
codec {
    sound-dai = <&es8156 0>;
  //        prefix = "ES";
};

};
6. ape controls:
ape_controls.txt (75.1 KB)
7. when use aplay, no sound out and no signal found in SCLK/LRCLK/DIN/DOUT

  1. When i use amixer to set play according to Audio Setup and Development — Jetson Linux Developer Guide documentation
    return error:
    1.1this can run without error, but ruturn many enum value:
    amixer -c APE sset “I2S2 Mux” “ADMAIF1”
    1.2 running failed
    root@desktop:/home# amixer -c APE cset name=“ES Right Headphone Mixer Right DAC Switch” 1
    amixer: Cannot find the given element from control hw:1
    root@desktop:/home# amixer -c APE cset name=“ES Left Headphone Mixer Left DAC Switch” 1
    amixer: Cannot find the given element from control hw:1

  2. when use aplay, kernel return error for no MCLK.
    aplay -D hw:APE,0 1.wav
    Playing WAVE ‘1.wav’ : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
    error log in kernel:
    [ 364.205069] es8156 1-0008: Codec driver requires MCLK to configure internal registers! define MCLK here.
    [ 364.215137] es8156 1-0008: ASoC: error at snd_soc_dai_hw_params on es8156.1-0008: -22
    [ 364.223207] tegra-asoc: sound: ASoC: PRE_PMU: es8156-playback-playback event failed: -22

3. modify es8156 to set sysclk fix to 12288000
3.1 when insmod es8156, there are errors in kernel.
[ 50.954702] es8156 1-0008: es8156_pcm_hw_params, fs 44100 lrck_fs 278.
[ 50.962096] es8156 1-0008: Unsupported ratio!
[ 50.966596] es8156 1-0008: ASoC: error at snd_soc_dai_hw_params on es8156.1-0008: -22
[ 50.974663] tegra-asoc: sound: ASoC: PRE_PMU: es8156-playback-playback event failed: -22

3.2 use aplay still no sound.
root@desktop:/home# aplay -D hw:APE,0 1.wav
Playing WAVE ‘1.wav’ : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
kernel log:
[ 460.179334] es8156_set_bias_level:level=1
[ 460.179343] es8156_set_bias_level standby
[ 460.184868] es8156_set_bias_level:level=2
[ 460.184871] es8156_set_bias_level prepare
[ 460.186667] es8156 1-0008: es8156_pcm_hw_params, fs 48000 lrck_fs 256.
[ 460.195277] es8156_set_bias_level:level=3
[ 460.195281] es8156_set_bias_level on
[ 463.397917] es8156_set_bias_level:level=2
[ 463.397934] es8156_set_bias_level prepare
[ 463.398908] es8156_set_bias_level:level=1
[ 463.398911] es8156_set_bias_level standby
[ 463.398916] es8156_set_bias_level:level=0
[ 463.398921] es8156_set_bias_level off

who can help me to analyze?
thanks

reconfig pinmux for i2s2,for no mclk(GPIO09),in code_init set clock value to I2S’s value(1536000),lrck_fs set to 32,when use aplay still no sound, log is below:
[ 539.042155] pll_a_out0 = 49152000 Hz, aud_mclk = 1536000 Hz, sample rate = 48000 Hz
[ 539.050219] tegra_codecs_runtime_setup:srate,channel,mclk=[48000,1,1536000]
[ 539.065937] es8156 1-0008: es8156_pcm_hw_params, fs 48000 lrck_fs 32.
[ 539.042155] pll_a_out0 = 49152000 Hz, aud_mclk = 1536000 Hz, sample rate = 48000 Hz
[ 539.050219] tegra_codecs_runtime_setup:srate,channel,mclk=[48000,1,1536000]
[ 539.058745] es8156_set_bias_level:level=1
[ 539.058748] es8156_set_bias_level standby
[ 539.064183] es8156_set_bias_level:level=2
[ 539.064185] es8156_set_bias_level prepare
[ 539.065937] es8156 1-0008: es8156_pcm_hw_params, fs 48000 lrck_fs 32.
[ 539.077495] es8156_set_bias_level:level=3
[ 539.077499] es8156_set_bias_level on
[ 542.280790] es8156_set_bias_level:level=2
[ 542.280808] es8156_set_bias_level prepare
[ 542.281863] es8156_set_bias_level:level=1
[ 542.281868] es8156_set_bias_level standby
[ 542.281873] es8156_set_bias_level:level=0
[ 542.281876] es8156_set_bias_level off

Hi lishu2002

There is following comment in the codec driver:

/* Enable the following code if there is no mclk.
	 * a clock named "mclk" need to be defined in the dts (see sample dts)
	 *
	 * No need to enable the following code to get mclk if:
	 * 1. sclk/bclk is used as mclk
	 * 2. mclk is controled by soc I2S
	 */

I believe you want to use one of these two options. In both of these cases you need not supply any clock from the codec node. So remove following entries from the codec node.

clocks = <&bpmp_clks TEGRA234_CLK_I2S4>;
clock-names = "i2s";

Not sure what you are trying to do here. But if you have compilation and DAPM route issue check with the codec vendor to fix it properly.

Refer to Audio Setup and Development — Jetson Linux Developer Guide documentation to understand the driver changes you need to make for codec integration. It captures all the details from device tree to machine driver side changes.

You need to make sure you don’t get any clock error when you start aplay. Refer to Audio Setup and Development — Jetson Linux Developer Guide documentation to quickly check what issue you may have.

thanks for your reply. modify according your advice and no error output, butstill no sound output.

  1. I had read the URL before you provided and made change in tegra_codec.c code, only set sysclk to 1536000.(in function tegra_codecs_init & tegra_codecs_runtime_setup)
  2. also made change according your advice.
    2.1 delete clk confg in dts, set nvidia-audio-card,mclk-fs = <32>
    2.2 set i2s clk value to codec sysclk in funciton codec_probe
    es8156->sysclk = 1536000;
  3. made change about route
    {“LOUT”, NULL, “DACL”},
    {“ROUT”, NULL, “DACR”},
  4. play 1.wav according to
  5. latest source file:
    es8156.c.txt (26.3 KB)

log----aplay -D hw:APE,0 1.wav
[ 156.201694] pll_a_out0 = 49152000 Hz, aud_mclk = 1536000 Hz, sample rate = 48000 Hz
[ 156.209875] tegra_codecs_runtime_setup:srate,channel,mclk=[48000,1,1536000]
[ 156.226066] es8156 1-0008: es8156_pcm_hw_params, fs 48000 lrck_fs 32.
[ 156.201694] pll_a_out0 = 49152000 Hz, aud_mclk = 1536000 Hz, sample rate = 48000 Hz
[ 156.209875] tegra_codecs_runtime_setup:srate,channel,mclk=[48000,1,1536000]
[ 156.218320] es8156_set_bias_level:level=1
[ 156.218323] es8156_set_bias_level standby
[ 156.223769] es8156_set_bias_level:level=2
[ 156.223773] es8156_set_bias_level prepare
[ 156.226066] es8156 1-0008: es8156_pcm_hw_params, fs 48000 lrck_fs 32.
[ 156.235926] es8156_set_bias_level:level=3
[ 156.235928] es8156_set_bias_level on
[ 159.438944] es8156_set_bias_level:level=2
[ 159.438961] es8156_set_bias_level prepare
[ 159.545607] es8156 mute
[ 159.545740] es8156_set_bias_level:level=1
[ 159.545746] es8156_set_bias_level standby
[ 159.545750] es8156_set_bias_level:level=0
[ 159.545753] es8156_set_bias_level off

log----insmod snd-soc-es8156.ko
[ 80.228587] debugfs: File ‘ES SDOUT’ in directory ‘dapm’ already present!
[ 80.000116] es8156_i2c_probe start
[ 80.153107] es8156_probe start
[ 80.153118] avdd volt satge 1
[ 80.153121] sysclk value = 1536000
[ 80.196869] es8156_set_dai_fmt ES8156 in slave mode
[ 80.197330] es8156_set_dai_fmt ES8156 fmt is I2S
[ 80.228587] debugfs: File ‘ES SDOUT’ in directory ‘dapm’ already present!
[ 82.522892] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 82.531116] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.689364] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 82.697444] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.713957] es8156 1-0008: es8156_pcm_hw_params, fs 44100 lrck_fs 32.
[ 82.732363] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 82.740433] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.932122] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 82.940199] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.955955] es8156 1-0008: es8156_pcm_hw_params, fs 44100 lrck_fs 32.
[ 83.113778] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 83.121887] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.472918] es8156_set_dai_fmt ES8156 in slave mode
[ 82.473376] es8156_set_dai_fmt ES8156 fmt is I2S
[ 82.474372] es8156_set_dai_fmt ES8156 in slave mode
[ 82.474821] es8156_set_dai_fmt ES8156 fmt is I2S
[ 82.522892] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 82.531116] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.689364] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 82.697444] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.705857] es8156_set_bias_level:level=1
[ 82.705863] es8156_set_bias_level standby
[ 82.711316] es8156_set_bias_level:level=2
[ 82.711320] es8156_set_bias_level prepare
[ 82.713957] es8156 1-0008: es8156_pcm_hw_params, fs 44100 lrck_fs 32.
[ 82.723813] es8156_set_bias_level:level=3
[ 82.723819] es8156_set_bias_level on
[ 82.732363] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 82.740433] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.749435] es8156_set_bias_level:level=2
[ 82.749440] es8156_set_bias_level prepare
[ 82.857207] es8156 mute
[ 82.857621] es8156_set_bias_level:level=1
[ 82.857625] es8156_set_bias_level standby
[ 82.857627] es8156_set_bias_level:level=0
[ 82.857628] es8156_set_bias_level off
[ 82.932122] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 82.940199] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 82.948820] es8156_set_bias_level:level=1
[ 82.948825] es8156_set_bias_level standby
[ 82.954315] es8156_set_bias_level:level=2
[ 82.954318] es8156_set_bias_level prepare
[ 82.955955] es8156 1-0008: es8156_pcm_hw_params, fs 44100 lrck_fs 32.
[ 82.965329] es8156_set_bias_level:level=3
[ 82.965335] es8156_set_bias_level on
[ 83.113778] pll_a_out0 = 45158400 Hz, aud_mclk = 1411200 Hz, sample rate = 44100 Hz
[ 83.121887] tegra_codecs_runtime_setup:srate,channel,mclk=[44100,2,1411200]
[ 88.115530] es8156_set_bias_level:level=2
[ 88.115541] es8156_set_bias_level prepare
[ 88.229298] es8156 mute
[ 88.229516] es8156_set_bias_level:level=1
[ 88.229521] es8156_set_bias_level standby
[ 88.229523] es8156_set_bias_level:level=0
[ 88.229526] es8156_set_bias_level off

Hi lishu2002

Can you probe I2S signals and make sure you are getting expected clock rates?
Are you connecting codec over 40-pin header? Share the schematic for reference.

Sorry for late reply.

  1. Cannot find signals from I2S pins.
    Because I had config I2S pinmux and flash to module to orin nx, how to check whether I2S does work as config to I2S or still as normal gpios?

  2. yes. we connet i2s0 in 40-pins, codec not connect to GPIO09(MCLK)



hi spujar:
if need more info to check?

thanks.

Hi lishu2002

In earlier references I see you are modifying “i2s2_to_codec” node in device tree. Since you are using i2s0 signals from the schematic, you should use “i2s1_to_codec” instead. Please update your device tree and check signals again. Please note that you need to check signals when aplay is running.

Thanks for your rapid reply.
in fact i use i2s2 just because the url Audio Setup and Development — Jetson Linux Developer Guide documentation and the pinmux config table shows i2s2

i will use i2s1_to_codec to try later.

another question:
when use aplay, can I change user to root user ?
I test each time use root.

thanks

Hi spujar:

I reconfig i2s2 with jetson-io, and when use aplay, i can get signal from clk & dout pin.
but still no sound output.

I check some info:

  1. wav file info: Playing WAVE ‘1.wav’ : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
    root@desktop:/# cat /proc/asound/card1/pcm0p/sub0/hw_params
    access: RW_INTERLEAVED
    format: S16_LE
    subformat: STD
    channels: 1
    rate: 48000 (48000/1)
    period_size: 4096
    buffer_size: 16384

  2. clk_summary:
    i2s2_sync_input 0 0 0 0 0 0 0 50000
    i2s2_sync_clk 0 0 0 0 0 0 0 50000
    i2s2 1 1 0 767999 768000 0 0 50000

  3. from i2s2’s pins, i can got two signals, one is 48k, another is about 768k

  4. How to check whether playback audio path is enabled correctly or not??
    below is result what i use cmd in Audio Setup and Development — Jetson Linux Developer Guide documentation
    root@desktop:/# for i in find /sys/kernel/debug/tracing/events -name "enable" | grep snd_soc_; do echo 1 > $i; done
    root@desktop:/# cat /sys/kernel/debug/tracing/trace_pipe | grep *
    aplay-7198 [003] … 3307.223113: snd_soc_dapm_path: *ADMAIF1 XBAR-RX ← (direct) ← ADMAIF1 XBAR-Playback
    aplay-7198 [003] … 3307.223182: snd_soc_dapm_path: *I2S2 Mux ← ADMAIF1 ← ADMAIF1 XBAR-RX
    aplay-7198 [003] … 3307.223184: snd_soc_dapm_path: *I2S2 XBAR-TX ← (direct) ← I2S2 Mux
    aplay-7198 [003] … 3307.223186: snd_soc_dapm_path: *I2S2 XBAR-Capture ← (direct) ← I2S2 XBAR-TX
    aplay-7198 [003] … 3307.223187: snd_soc_dapm_path: *tegra-dlink-65-playback ← (direct) ← I2S2 XBAR-Capture
    aplay-7198 [003] … 3307.223187: snd_soc_dapm_path: *I2S2 CIF-Playback ← (direct) ← tegra-dlink-65-playback
    aplay-7198 [003] … 3307.223188: snd_soc_dapm_path: *I2S2 RX ← (direct) ← I2S2 CIF-Playback
    aplay-7198 [003] … 3307.223191: snd_soc_dapm_path: *I2S2 DAP-Capture ← (direct) ← I2S2 RX
    aplay-7198 [003] … 3307.223192: snd_soc_dapm_path: *es8156-playback-playback ← (direct) ← I2S2 DAP-Capture
    aplay-7198 [003] … 3307.223192: snd_soc_dapm_path: *ES Playback ← (direct) ← es8156-playback-playback
    aplay-7198 [003] … 3307.223195: snd_soc_dapm_path: *ES DACR ← (direct) ← ES Playback
    aplay-7198 [003] … 3307.223196: snd_soc_dapm_path: *ES DACR ← (direct) ← ES Channel Select Mux
    aplay-7198 [003] … 3307.223197: snd_soc_dapm_path: *ES Channel Select Mux ← Left to Left, Right to Right ← ES SDIN
    aplay-7198 [003] … 3307.223198: snd_soc_dapm_path: *ES SDIN ← (direct) ← ES Playback
    aplay-7198 [003] … 3307.223200: snd_soc_dapm_path: *ES DACL ← (direct) ← ES Playback
    aplay-7198 [003] … 3307.223201: snd_soc_dapm_path: *ES DACL ← (direct) ← ES Channel Select Mux
    aplay-7198 [003] … 3307.223203: snd_soc_dapm_path: *ES ROUT ← (direct) ← ES DACR
    aplay-7198 [003] … 3307.223203: snd_soc_dapm_path: *ES LOUT ← (direct) ← ES DACL
    aplay-7198 [003] … 3307.223206: snd_soc_dapm_path: *ES SDOUT TRISTATE ← (direct) ← ES SDIN
    aplay-7198 [003] … 3307.223207: snd_soc_dapm_path: *ES Headphone Jack ← (direct) ← ES ROUT
    aplay-7198 [003] … 3307.223207: snd_soc_dapm_path: *ES Headphone Jack ← (direct) ← ES LOUT
    aplay-7198 [003] … 3310.440061: snd_soc_dapm_path: *ADMAIF1 XBAR-Playback ← (direct) ← tegra-dlink-44-playback
    aplay-7198 [003] … 3310.440062: snd_soc_dapm_path: *ADMAIF1 XBAR-Playback ← (direct) ← ADMAIF1 Playback
    aplay-7198 [003] … 3310.440063: snd_soc_dapm_path: *ADMAIF1 XBAR-RX ← (direct) ← ADMAIF1 XBAR-Playback
    aplay-7198 [003] … 3310.440120: snd_soc_dapm_path: *I2S2 Mux ← ADMAIF1 ← ADMAIF1 XBAR-RX
    aplay-7198 [003] … 3310.440123: snd_soc_dapm_path: *I2S2 XBAR-TX ← (direct) ← I2S2 Mux
    aplay-7198 [003] … 3310.440124: snd_soc_dapm_path: *I2S2 XBAR-Capture ← (direct) ← I2S2 XBAR-TX
    aplay-7198 [003] … 3310.440125: snd_soc_dapm_path: *tegra-dlink-65-playback ← (direct) ← I2S2 XBAR-Capture
    aplay-7198 [003] … 3310.440128: snd_soc_dapm_path: *I2S2 CIF-Playback ← (direct) ← tegra-dlink-65-playback
    aplay-7198 [003] … 3310.440128: snd_soc_dapm_path: *I2S2 RX ← (direct) ← I2S2 CIF-Playback
    aplay-7198 [003] … 3310.440129: snd_soc_dapm_path: *I2S2 DAP-Capture ← (direct) ← I2S2 RX
    aplay-7198 [003] … 3310.440130: snd_soc_dapm_path: *es8156-playback-playback ← (direct) ← I2S2 DAP-Capture
    aplay-7198 [003] … 3310.440132: snd_soc_dapm_path: *ES Playback ← (direct) ← es8156-playback-playback
    aplay-7198 [003] … 3310.440134: snd_soc_dapm_path: *ES DACR ← (direct) ← ES Playback
    aplay-7198 [003] … 3310.440134: snd_soc_dapm_path: *ES DACR ← (direct) ← ES Channel Select Mux
    aplay-7198 [003] … 3310.440138: snd_soc_dapm_path: *ES Channel Select Mux ← Left to Left, Right to Right ← ES SDIN
    aplay-7198 [003] … 3310.440139: snd_soc_dapm_path: *ES SDIN ← (direct) ← ES Playback
    aplay-7198 [003] … 3310.440140: snd_soc_dapm_path: *ES DACL ← (direct) ← ES Playback
    aplay-7198 [003] … 3310.440140: snd_soc_dapm_path: *ES DACL ← (direct) ← ES Channel Select Mux
    aplay-7198 [003] … 3310.440142: snd_soc_dapm_path: *ES ROUT ← (direct) ← ES DACR
    aplay-7198 [003] … 3310.440144: snd_soc_dapm_path: *ES LOUT ← (direct) ← ES DACL
    aplay-7198 [003] … 3310.440145: snd_soc_dapm_path: *ES Headphone Jack ← (direct) ← ES ROUT
    aplay-7198 [003] … 3310.440145: snd_soc_dapm_path: *ES Headphone Jack ← (direct) ← ES LOUT

  5. from codec’s output pin, I can got signal about 470k, but speaker no sound output
    aplay log:
    2660.073230] pll_a_out0 = 49152000 Hz, aud_mclk = 1536000 Hz, sample rate = 48000 Hz
    [ 2660.081247] tegra_codecs_runtime_setup:srate,channel,mclk=[48000,1,1536000]
    [ 2660.088425] es8156_set_dai_sysclk sysclk = 1536000
    [ 2660.089127] es8156_set_bias_level:level=1
    [ 2660.089129] es8156_set_bias_level standby
    [ 2660.094530] es8156_set_bias_level:level=2
    [ 2660.094532] es8156_set_bias_level prepare
    [ 2660.096337] es8156 1-0008: es8156_pcm_hw_params, fs 48000 lrck_fs 32.
    [ 2660.105180] es8156_set_bias_level:level=3
    [ 2660.105181] es8156_set_bias_level on
    [ 2663.305517] es8156_set_bias_level:level=2
    [ 2663.305522] es8156_set_bias_level prepare
    [ 2663.413034] es8156 mute
    [ 2663.413063] es8156_set_bias_level:level=1
    [ 2663.413065] es8156_set_bias_level standby
    [ 2663.413067] es8156_set_bias_level:level=0
    [ 2663.413069] es8156_set_bias_level off

1. For MCLK, we does not connect, but I set nvidia-audio-card,mclk-fs = <32>
below pic showes nvidia-audio-card,mclk-fs will set for MCLK. I try to delete the mclk-fs config, but will cause no sysclk value.
2. so how to process the mclk & sysclk? in tegra_codecs.c, whether can i use a fixed clock to replace samplerate*mclk-fs value or not? if use fixed value, which value is proper?
3. now my modification in tegra_codecs.c,
for no MCLK, I just use I2S’s config clock:1536000, can be set to other value?
static int tegra_machine_es8156_init(struct snd_soc_pcm_runtime *rtd)
{

err = snd_soc_dai_set_sysclk(rtd->dais[rtd->num_cpus], 0, 1536000,SND_SOC_CLOCK_IN);

}

whether aud_mclk can be set to a fixed value?? which value proper??
int tegra_codecs_runtime_setup(struct snd_soc_card *card,
unsigned int srate,
unsigned int channels,
unsigned int aud_mclk)
{

rtd = get_pcm_runtime(card, “es8156-playback”);
if (rtd) {
printk(KERN_WARNING “%s:srate,channel,mclk=[%d,%d,%d]\n”, func, srate, channels, aud_mclk);
err = snd_soc_dai_set_sysclk(rtd->dais[rtd->num_cpus], 0,aud_mclk, SND_SOC_CLOCK_IN);

}
}

This looks correct. You can confirm once by actually probing the clock signals and make sure you get above frequencies in the oscilloscope.

If you are not connecting MCLK to the codec n your schematic, then please ignore respective configurations. You don’t need to worry about mclk-fs factor.
Now in this case you are probably want to use I2S bit clock as source for your codec sysclk. Please make sure you set the source properly in your codec driver and then check the aplay.

Hi spujar:
Thanks for your reply, still need your help.

  1. we probe the signal with oscilloscope, and found that the SCLK is 768k/LRCK is 48k.
    so when use aplay, speaker output noise, not the sound we expected.
    But NOTE : i download the test.wav in The audio codec es8316 can’t work on I2S0 for Xaiver NX - #20 by spujar, can play normally, it is a
    2 channels 16bit 48000 file.
    I test other 2 channels 16bit 48000 type wav file, also can be play normally. from the pic we can find that it get 16bit data once.

  2. for we use a wav file which is: mono, 48k
    codec vendor said, when play mono sound, L & R channel play the same data, so the SCLK should be: sample rate(4800) * bit width(16) * 2=1536000, but now the SCLK is 768000.

  3. the wav file is 16bit:mono:48000, when we check with oscilloscope, we found each time it is only to get 8bit data, the file inlucde normal 6 seconds audio, use aplay just 3 seconds noise ouput before the end.

4. so can you please tell me how to process the mono wav file??

THANKS!!

btw:
in tegra_machine_driver & tegera_codecs I set all aud_clk value to a fix value 1536000, this is the same with mclk-fs=<32>, because 1536000/48000=32

any more suggestion to test?

HI lishu2002

The I2S interface expects left and right channels in LRCK mode. Since you are using mono channel the clock is set accordingly.

Is it possible for you to pack your mono channel content into stereo content and then play as a stereo channel?

Alsa Opensrc Org - Independent ALSA and linux audio support site is one way to do this.
Please do check if this is something that works for you.

Thanks a lot for your help.

I can use some audio tool to convert mono file to stereo file before use it.

And I will check the url you provided.

Thanks again.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.