The aud_mclk clock cannot output normally in r36.4.2(jp6.2)

Orin Nano 211pin (AUD-MCLK) is connected to the MCLK pin of RT5640 and continuously pulled high using an oscilloscope.

In the device tree:
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>;

Clock for i2S2 in clk_summary under cat sys file system
i2s2_sync_input 0 0 0 1411200 0 0 50000 Y
i2s2_sync_clk 0 0 0 0 0 0 50000 Y
i2s2 0 0 0 1411199 0 0 50000 Y

Clock for soc_gpio59_pac6(soc aud_mclk pin) in pinconf-groups under cat sys file system
161 (soc_gpio59_pac6):
pull=0
tristate=0
enable-input=0
open-drain=0
io-reset=0
rcv-sel=0
io-hv=0
schmitt=0
pull-down-strength=31
pull-up-strength=31
drive-type=0
gpio-mode=1
function=aud

Except for mclk not having normal waveform output,
I2S2 has normal waveform output,
May I ask how to solve this problem ?

Additional explanation:
There is no waveform on SCLK either

141 (soc_gpio41_ph7):
pull=0
tristate=0
enable-input=1
open-drain=1
io-reset=1
rcv-sel=1
io-hv=1
schmitt=1
pull-down-strength=31
pull-up-strength=31
drive-type=0
gpio-mode=1
function=i2s2

see if this link helps:

amixer -c APE cset name=“I2S2 Mux” “ADMAIF1”
amixer -c APE cset name=“I2S2 codec frame mode” “dsp-a”

aplay -D hw:APE,0 in.wav

The command already has a waveform, but rt5640 still doesn’t produce any sound

There are lot of things to be set right before you get sound!
like AUD_MCLK, Volume unmuted etc

Search in this forum for audio related threads and it helps to fix the issue.

example:

Both AUD-MCLK and sclk pins have waveform outputs; However, I feel that RT5640 is not controlling it and I don’t know if it’s a routing issue

In the document, you can see:

AHUB Mixer Controls

amixer -c APE cset name=“I2S2 Mux” “ADMAIF1”
amixer -c APE cset name=“I2S2 codec frame mode” “dsp-a”

Codec RT5640 Mixer Controls (apply on Jetson AGX Orin)

---------------------------------------------------------------------

amixer -c APE cset name=“CVB-RT HP Playback Volume” 30
amixer -c APE cset name=“CVB-RT Stereo DAC MIXR DAC R1 Switch” “off”
amixer -c APE cset name=“CVB-RT Stereo DAC MIXL DAC L1 Switch” “on”
amixer -c APE cset name=“CVB-RT HP R Playback Switch” “off”
amixer -c APE cset name=“CVB-RT HP L Playback Switch” “on”

Start playback

$ aplay -D hw:APE,0 <in_wav>

I encountered an error while executing the following command:
amixer -c APE cset name=“CVB-RT HP Playback Volume” 30
Command return:
amixer: Cannot find the given element from control sysdefault:1

cat /proc/asound/card1/pcm0p/sub0/hw_params
access: RW_INTERLEAVED
format: S16_LE
subformat: STD
channels: 2
rate: 44100 (44100/1)
period_size: 1024
buffer_size: 8192

What IC do we use:
alc5640 reltek

Please make sure all the required DT changes made for RT5640 codec integration as mentioned here, Audio Setup and Development — NVIDIA Jetson Linux Developer Guide

If still facing issue, please provide the details asked here, Audio Setup and Development — NVIDIA Jetson Linux Developer Guide

Repeated debugging is not normal

codec_regdump.txt (2.9 KB)
dt.log (315.8 KB)
kernel_log.txt (60.5 KB)
pinmux.txt (31.5 KB)
clock.txt (40.5 KB)

settings.txt (324.7 KB)
reg_dump.txt (585 Bytes)

Please add below properties as well,

nvidia-audio-card,dai-link@77 {
    link-name = "rt5640-playback";
.......
};

sound {
    nvidia-audio-card,mclk-fs = <256>;
.....
};
            hdr40_snd_link_i2s: nvidia-audio-card,dai-link@77 {
    bitclock-master;
    bit-format = "s16_le";
    frame-master;
    codec {
            sound-dai = <&rt5640 0>;
            prefix = "CVB-RT";
    };

};

no way?

I added it, but it doesn’t work. Also, I opened the CONFIG_SND_SOC_TEGRA_MACHINE_DRV macro, and it seems that i2s is not working properly

What exactly is not working?
Also, did you set the required codec controls before starting playback?
as mentioned in For stereo playback to both playback ports: heading here : Audio Setup and Development — NVIDIA Jetson Linux Developer Guide

On other note, can you please remove bitclock-master; and frame-master; and run the usecase with tegra I2S as Master.

When it was normal before, there was no configuration for bitclock-master and frame-master

Excuse me, is CONFIG_SND_SOC_TEGRA_MACHINE_DRV macro mandatory?

The required macros will be already enabled in the package being used. No need to enable anything explicitly except the codec (i.e. rt5640 in your usecase) related macros.

After removing the macro CONFIG_SND_SOC_TEGRA_MACHINE_DRV , the feedback of the amixer command is:
amixer -c APE cset name=“CVB-RT Speaker L Playback” “on”
amixer: Cannot find the given element from control sysdefault:1

kernel log:
sudo dmesg |grep ASoC

[ 11.532234] tegra-asoc: sound: ASoC: no source widget found for CVB-RT HPOL
[ 11.532244] tegra-asoc: sound: ASoC: Failed to add route CVB-RT HPOL → direct → CVB-RT Headphone Jack
[ 11.532272] tegra-asoc: sound: ASoC: no source widget found for CVB-RT HPOR
[ 11.532273] tegra-asoc: sound: ASoC: Failed to add route CVB-RT HPOR → direct → CVB-RT Headphone Jack
[ 11.532296] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT IN1P
[ 11.532298] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic Jack → direct → CVB-RT IN1P
[ 11.532320] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT IN2P
[ 11.532322] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic Jack → direct → CVB-RT IN2P
[ 11.532345] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT IN2N
[ 11.532346] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic Jack → direct → CVB-RT IN2N
[ 11.532368] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT IN3P
[ 11.532369] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Mic Jack → direct → CVB-RT IN3P
[ 11.532389] tegra-asoc: sound: ASoC: no source widget found for CVB-RT SPOLP
[ 11.532391] tegra-asoc: sound: ASoC: Failed to add route CVB-RT SPOLP → direct → CVB-RT Int Spk
[ 11.532410] tegra-asoc: sound: ASoC: no source widget found for CVB-RT SPORP
[ 11.532412] tegra-asoc: sound: ASoC: Failed to add route CVB-RT SPORP → direct → CVB-RT Int Spk
[ 11.532431] tegra-asoc: sound: ASoC: no source widget found for CVB-RT LOUTL
[ 11.532433] tegra-asoc: sound: ASoC: Failed to add route CVB-RT LOUTL → direct → CVB-RT Int Spk
[ 11.532454] tegra-asoc: sound: ASoC: no source widget found for CVB-RT LOUTR
[ 11.532455] tegra-asoc: sound: ASoC: Failed to add route CVB-RT LOUTR → direct → CVB-RT Int Spk
[ 11.532477] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT DMIC1
[ 11.532478] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Int Mic → direct → CVB-RT DMIC1
[ 11.532498] tegra-asoc: sound: ASoC: no sink widget found for CVB-RT DMIC2
[ 11.532499] tegra-asoc: sound: ASoC: Failed to add route CVB-RT Int Mic → direct → CVB-RT DMIC2

It’s not recommended to make any driver changes for RT5640.
Only DT and Pinmux changes are required.

If any issue still persists, please share the issue details along with logs.

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