Nano audio codec not detected

Hi John,

The above mixer settings should be set by default for Nano (in /usr/share/alsa/init/postinit/00-tegra.conf). It is not necessary to set the other I2S mixer controls (for channels, sample-rate, etc) as these should be configured when capture/playback start depending on the PCM format being used. These are only to override the PCM format for some more complex use-cases.

To check if the audio path is good try …

$ echo 0 | sudo tee /sys/kernel/debug/tracing/trace
$ echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
$ echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
$ echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
$ speaker-test -D hw:tegrasndt210ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500 -l 1
$ sudo cat /sys/kernel/debug/tracing/trace

Regards,
Jon

Here are the results to the trace:

Hi John,

Looks like a problem with the configuration of the audio route. Can you try the following and verify that you see some output from the trace …

$ echo 0 | sudo tee /sys/kernel/debug/tracing/trace
$ echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
$ echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
$ echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
$ amixer -c 1 sset "ADMAIF1 Mux" ADMAIF1
$ speaker-test -D hw:1,0 -c 2 -r 48000 -F S16_LE -t sine -f 500 -l 1
$ sudo cat /sys/kernel/debug/tracing/trace

This effectively does a simple audio loopback.

Regards,
Jon

Hi Jon,

Here is the result from the audio loopback:

Hi John,

Can you revert the ADMAIF1 Mux changes so you have …

$ amixer -c 1 cset name='I2S4 Mux' 'ADMAIF1' 
$ amixer -c 1 cset name='ADMAIF1 Mux' 'I2S4'

Can you run the following script and send me the output?

#!/bin/bash

set -e
set -u

outfile="${HOME}/tegra-audio-debug.txt"

if [ -f "${outfile}" ]; then
    rm "${outfile}"
fi

alsactl store -f "${outfile}"

dapm_dirs=$(sudo find /sys/kernel/debug/asoc -type d -name dapm)

for dir in ${dapm_dirs}; do
    sudo find ${dir} -type f -exec echo {} \; -exec cat {} \; >> "${outfile}"
done

echo "Tegra audio debug info written to ${outfile}"

Please can you attach the output file because it is quite long.

Thanks
Jon

Sure thing, attached is the resulting debug information. Thank you again for the help with this!

tegra-audio-debug.log (316.4 KB)

Hi John,

I don’t see a route between the I2S and the codec, can you try adding the routes …

	nvidia,audio-routing =
		"x Headphone",	"x HPLOUT",
		"x Left Playback",	"x Playback",
		"x Right Playback", "x Playback",
		"x MIC3L",		"x Mic",
		"x Capture",		"x Left Capture",
		"x Capture",		"x Right Capture",
		"y Headphone",	"y HPROUT",
		"y MIC3R",		"y Mic",
		"a LINE1L",		"a Line In",
		"b LINE1R",		"b Line In";

This time when you run the trace can you also add …

$ echo 0 | sudo tee /sys/kernel/debug/tracing/trace
$ echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
$ echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
$ echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_path/enable
$ echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
$ aplay ...
$ sudo cat /sys/kernel/debug/tracing/trace

Regards,
Jon

I got a few errors in dmesg after updating the audio-routing as you suggested:

[    4.007615] tegra-asoc: sound: ASoC: no sink widget found for x Left Playback
[    4.007619] tegra-asoc: sound: ASoC: Failed to add route x Playback -> direct -> x Left Playback
[    4.007646] tegra-asoc: sound: ASoC: no sink widget found for x Right Playback
[    4.007648] tegra-asoc: sound: ASoC: Failed to add route x Playback -> direct -> x Right Playback
[    4.007687] tegra-asoc: sound: ASoC: no source widget found for X Left Capture
[    4.007690] tegra-asoc: sound: ASoC: Failed to add route X Left Capture -> direct -> x Capture
[    4.007716] tegra-asoc: sound: ASoC: no source widget found for x Right Capture
[    4.007719] tegra-asoc: sound: ASoC: Failed to add route x Right Capture -> direct -> x Capture
[    4.007771] tegra-asoc: sound: ASoC: no source widget found for x Line In
[    4.007773] tegra-asoc: sound: ASoC: Failed to add route x Line In -> direct -> x LINE1L
[    4.007799] tegra-asoc: sound: ASoC: no source widget found for x Line In
[    4.007801] tegra-asoc: sound: ASoC: Failed to add route x Line In -> direct -> x LINE1R

And here is the trace result:

nano@nano:~$ sudo cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 2/2   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
 alsa-sink-ADMAI-6254  [000] ....   377.059722: snd_soc_dapm_path: *ADMAIF1 Receive <- (direct) <- Playback 1
 alsa-sink-ADMAI-6254  [000] ....   377.059726: snd_soc_dapm_path: *ADMAIF1 Receive <- (direct) <- ADMAIF1 CIF Receive-ADMAIF1 Receive

Hi John,

Yes, that won’t work. Can you try …

	nvidia,audio-routing =
		"x Headphone",	"x HPLOUT",
		"x Left DAC",	"x Playback",
		"x Right DAC", "x Playback",
		"x MIC3L",		"x Mic",
		"x Capture",		"x Left ADC",
		"x Capture",		"x Right ADC",
		"y Headphone",	"y HPROUT",
		"y MIC3R",		"y Mic",
		"a LINE1L",		"a Line In",
		"b LINE1R",		"b Line In";

Sorry it is a bit trial and error.

Regards,
Jon

Hi john.c

Have you tried with previous suggestions? Any result can be shared? Thanks

Hello,

I am trying to connect the pcm3010 audio codec to our custom carrier board.
Can you tell me what process is required?

First of all, you only need to do up to ① of the contents mentioned.

Hello,

Your writing is very helpful.
Where can I find tegra210-porg-p3448-common.dtsi?

Thank you.

Hello,

sudo /opt/nvidia/jetson-io/jetson-io.py What is the difference between using this tool and modifying tegra210-porg-p3448-common.dtsi directly?

Thank you.

Hello!

The process is described here …

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fasoc_driver.18.2.html%23wwpID0E0WT0HA

Regards,
Jon

1 Like

Hello,

In which file should the codec node be located?

Thank you.

Hello!

The jetson-io tool is used for configuring the pinmux of the 40-pin header and also includes some DT overlays for some off the shelf modules such as the FE-PI Audio Z V2 board [0]. So this avoids having to modify the DT source directly for using certain modules. If you have experience at modifying DT and have a good understanding of the Linux audio framework then you can always customise the DT and kernel as necessary for your audio codec. However, this is not a simple task and not recommended for people just getting started with the Linux kernel.

Regards,
Jon

[0] https://fe-pi.com/products/fe-pi-audio-z-v2

1 Like

This has already been answered here: About Audio codec for jetson nano

Jon

1 Like

Hello,

Jetson Nano:

hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi

Is that right?

Thank you .

Hello,

I know that using the jetson-io.py tool will result in DT overlays files.
Where should the DT overlays files be placed?

Thank you.

The jetson-io tool can generate DTBs or DTBOs. If you want to create a custom overlay please refer to the documentation.

Jon

1 Like