Orin NX with codec NAU88C22 no output

Hi, support team:
we developed our custom carrier port NAU88C22 driver using the Orin NX 8GB module, we encountered audio codec driver issues. We use the the jetpack R35.4.1 development kit.
we use two ECM microphones, and two speakers.

The schematic diagram of the hardware we use is shown below:
codec:


I2S:

and the GPIO09 output the audio mclk,pin 211.
I2C:

DTS:
hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb/tegra234-p3767-common-audio.dtsi

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Common Audio DT bindings
 *
 * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 *
 */

#include <audio/tegra-platforms-audio-dai-links.dtsi>
#include <audio/tegra186-audio-dai-links.dtsi>
#include <audio/tegra186-audio-graph.dtsi>

/ {
	hdr40_i2c1: i2c@c250000 { };
	
	//&i2c0
	i2c@3160000{
		fsync-width = <0>;
		
		nau8822:nau8822.0-001a@1a{
			compatible = "nuvoton,nau8822";
			status = "okay";
			reg = <0x1a>;

			clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
			//clocks = <&tegra_car TEGRA186_CLK_AUD_MCLK>; 
			clock-names = "mclk";

			#sound-dai-cells = <1>;
			sound-name-prefix = "nau";
		
		};
	};

	clocks {
		nau8822_mclk: nau8822_mclk {
			compatible = "fixed-clock";
			#clock-cells = <0>;
			clock-frequency = <12288000>;
			clock-output-names = "nau8822-mclk";
			status = "okay";
		};
	};
	
 	aconnect@2a41000 {
		agic-controller@2a41000 {
			status = "okay";
		};

		adsp@2993000 {
			status = "okay";
		};
	};

	hda@3510000 {
		nvidia,model = "NVIDIA Jetson AGX Orin HDA";
 		status = "okay";
 		};
 		

	i2s@2901100{
		status = "okay";
		bit-format = "s16_le";
		bclk_ratio = <1>;
		srate = <48000>;
		num-channel = <2>;
		ignore_suspend;
		link-name = "nau-capture";
		bitclock-master;
		frame-master;	
		codec {
			sound-dai = <&nau8822 0>;
			prefix = "nau";
			};
		};
	

	tegra_sound: sound {
		compatible = "nvidia,tegra186-ape";
		nvidia-audio-card,name = "NVIDIA Jetson Orin NX APE";
		clocks = <&bpmp_clks TEGRA234_CLK_PLLA>,
			 <&bpmp_clks TEGRA234_CLK_PLLA_OUT0>,
			 <&bpmp_clks TEGRA234_CLK_AUD_MCLK>;
		clock-names = "pll_a", "pll_a_out0", "extern1";
		assigned-clocks = <&bpmp_clks TEGRA234_CLK_PLLA_OUT0>,
				  <&bpmp_clks TEGRA234_CLK_AUD_MCLK>;
		assigned-clock-parents = <&bpmp_clks TEGRA234_CLK_PLLA>,
					 <&bpmp_clks TEGRA234_CLK_PLLA_OUT0>;
		
		nvidia-audio-card,widgets = 
			"Microphone",		"nau Mic",
			"Headphone",		"nau Headphone",
			"Line",		"nau Line In",
			"Line",		"nau Line Out";
		nvidia-audio-card,routing =
			"nau Headphone",	"nau LHP",
			"nau Headphone",	"nau RHP",
			"nau LHP",		"nau Left Headphone Out",
			"nau RHP",		"nau Right Headphone Out",
			"nau Left Input Mixer",      	"nau Mic",
			"nau Right Input Mixer",     	"nau Mic",
			"nau MICBIAS",      	"nau Mic",
			"nau Capture",		"nau ADC";
		nvidia-audio-card,mclk-fs = <256>;
		status = "okay";
	};

	tegra_sound_graph: sound_graph {
		compatible = "nvidia,tegra186-audio-graph-card";
		status = "disabled";
	};
	

};

hdr40_snd_link_i2s: &i2s2_to_codec { };

/* Audio graph related bindings */
hdr40_snd_i2s_dap_ep: &i2s2_dap_ep { };

the driver use the default kernel sources, the path kernel/kernel-5.10/sound/soc/codecs/nau8822.c
the log:
Kconfig:
image
I2C detect and cards:

my question

  1. Do I need to add the tegra_nau8822.c in the path: /sound/soc/tegra/? just like the tegra_sgtl5000.c
  2. is there any errors in DTS file?

when i change the I2S2 GPIO setting in bootloader/t186ref/BCT/tegra234-mb1-bct-pinmux-p3767-dp-a03.dtsi
I got the following log:

nvidia@ubuntu:~$ sudo dmesg |grep asoc
[sudo] password for nvidia:
[   11.851199] tegra-asoc: sound: Adding to iommu group 56
[   12.167614] tegra-asoc: sound: ASoC: no source widget found for nau LHP
[   12.174420] tegra-asoc: sound: ASoC: Failed to add route nau LHP -> direct -> nau Headphone
[   12.183037] tegra-asoc: sound: ASoC: no source widget found for nau RHP
[   12.189853] tegra-asoc: sound: ASoC: Failed to add route nau RHP -> direct -> nau Headphone
[   12.198464] tegra-asoc: sound: ASoC: no source widget found for nau Left Headphone Out
[   12.206616] tegra-asoc: sound: ASoC: Failed to add route nau Left Headphone Out -> direct -> nau LHP
[   12.216050] tegra-asoc: sound: ASoC: no source widget found for nau Right Headphone Out
[   12.224288] tegra-asoc: sound: ASoC: Failed to add route nau Right Headphone Out -> direct -> nau RHP
[   12.236554] tegra-asoc: sound: ASoC: no sink widget found for nau Left Input Mixer
[   12.246720] tegra-asoc: sound: ASoC: Failed to add route nau Mic -> direct -> nau Left Input Mixer
[   12.255964] tegra-asoc: sound: ASoC: no sink widget found for nau Right Input Mixer
[   12.263845] tegra-asoc: sound: ASoC: Failed to add route nau Mic -> direct -> nau Right Input Mixer
[   12.273191] tegra-asoc: sound: ASoC: no sink widget found for nau MICBIAS
[   12.280181] tegra-asoc: sound: ASoC: Failed to add route nau Mic -> direct -> nau MICBIAS
[   12.288641] tegra-asoc: sound: ASoC: no source widget found for nau ADC
[   12.295458] tegra-asoc: sound: ASoC: Failed to add route nau ADC -> direct -> nau Capture
[   12.302504] tegra-asoc: sound: snd_soc_register_card failed (-19)
nvidia@ubuntu:~$

widget and route problem in DTS file?

Hi legendflying

Are you sure you got these errors when GPIO setting is changed? Looks unlikely to me.
The error points that there are no codec widgets found. For example see this pring:
[ 12.167614] tegra-asoc: sound: ASoC: no source widget found for nau LHP

  1. Can you confirm if your NAU codec is registered fine?
  2. give dump of following:
    cat /sys/kernel/debug/asoc/components
  3. Share complete boot log

hi spujar:
I have compile the Kconfig/Makefile in driver/soc/codec file. and the defconfig.
compontents.txt (880 Bytes)
dmesg.txt (75.0 KB)
the two logs.

Hi legendflying

Your DT change looks incomplete.
Can you try if below works for you?

diff --git a/cvb/tegra234-p3767-common-audio.dtsi b/cvb/tegra234-p3767-common-audio.dtsi
index cc11635..95d1e69 100644
--- a/cvb/tegra234-p3767-common-audio.dtsi
+++ b/cvb/tegra234-p3767-common-audio.dtsi
@@ -183,7 +183,13 @@
        };
 };

-hdr40_snd_link_i2s: &i2s2_to_codec { };
+hdr40_snd_link_i2s: &i2s2_to_codec {
+       link-name = "nau-capture";
+       codec {
+               sound-dai = <&nau8822 0>;
+               prefix = "nau";
+       };
+};

 /* Audio graph related bindings */
 hdr40_snd_i2s_dap_ep: &i2s2_dap_ep { };

Since you added specific link-name as “nau-capture”, did you make relevant driver change to apply any codec specific setting? You can refer existing examples and documentation on how this needs to be done if at all you need to apply some codec settings.

https://docs.nvidia.com/jetson/archives/r35.4.1/DeveloperGuide/text/SD/Communications/AudioSetupAndDevelopment.html
you can search for “link-name” and find relevant documentation.

ok, I change the DTSI as follows:
image

I modify the widgets and routing,add the hdr40_snd_link_i2s: &i2s2_to_codec.

now the audio card has been added successfully.

I measure the signal of I2S when i play the mp3 file, there no clock on the Audio_I2S_CLK and I2S0_SCLK.
when i do audio test in ubuntu desktop–>settings–>sound–>output–>test, no I2S signal output.

I repair the kernel_src/hardware/nvidia/platform/t23x/p3768/kernel-dts/tegra234-p3767-0000-common-hdr40.dtsi file as the picture shows:

image

now the GPIO09 MCLK can outputs 12.88MHz clocks, but no data,LRCLK signals. I use the aplay command:aplay -Dplughw:1,0 /home/nvidia/Music/3.wav

Good to see you can register the sound card.

Next, can you please attach dump of following?
amixer -c APE contents

contents0424.txt (792.2 KB)
I upload the log file.
Too much contents, I find the values=on numid as follows:
numid=162,iface=MIXER,name=‘ADSP init’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=1521,iface=MIXER,name=‘nau AUX1 Output Mixer RDAC Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=1526,iface=MIXER,name=‘nau AUX2 Output Mixer LDAC Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=470,iface=MIXER,name=‘nau AUXOUT Playback Switch’
; type=BOOLEAN,access=rw------,values=2
: values=on,on
numid=465,iface=MIXER,name=‘nau Headphone Playback Switch’
; type=BOOLEAN,access=rw------,values=2
: values=on,on
numid=443,iface=MIXER,name=‘nau High Pass Filter Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=1531,iface=MIXER,name=‘nau Left Input Mixer MicN Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=1532,iface=MIXER,name=‘nau Left Input Mixer MicP Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=1515,iface=MIXER,name=‘nau Left Output Mixer LDAC Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=1534,iface=MIXER,name=‘nau Right Input Mixer MicN Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=1535,iface=MIXER,name=‘nau Right Input Mixer MicP Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=1519,iface=MIXER,name=‘nau Right Output Mixer RDAC Switch’
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=468,iface=MIXER,name=‘nau Speaker Playback Switch’
; type=BOOLEAN,access=rw------,values=2
: values=on,on
I try to turn off the items which i think no need like:
/sys/devices/platform/sound/nau-capture$ amixer -c 1 cset numid=1521,iface=MIXER,name=‘nau AUX1 Output Mixer RDAC Switch’ 0
but no sound or noise.

contents0425.txt (793.3 KB)

update the latest log file
the result is no sound output from speaker.

change to dtsi file:

  1. #sound-dai-cells = <0>;
  2. delete i2s@2901100{};
  3. repare HDR40_SND_LINK_I2S contents:
    hdr40_snd_link_i2s: &i2s2_to_codec {
    link-name = “nau8822”;
    bit-format = “s16_le”;
    bclk_ratio = <1>;
    srate = <48000>;
    num-channel = <2>;
    ignore_suspend;
    bitclock-master;
    frame-master;
    status = “okay”;
    codec {
    sound-dai = <&nau8822>;
    prefix = “nau”;
    };
    };

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Is this still an issue to support? Any result can be shared?