Xavier audio playback is not normal

Hi,

I transplanted the audio driver of tlv320aic3254 on the xavier platform, the system version is jetpack4.3. Found that the playback function is not normal.The recording is normal.
Playing a piece of music is like speeding up.
What is the difference between the audio parts of jetpack4.3 and jetpack4.2.2?
Prompt error message “underrun!!!” when recording and playing at the same time.

tegra194-audio-p2822-0000.dtsi

/ {
aconnect@2a41000 {
	status = "okay";

	agic-controller@2a41000 {
		status = "okay";
	};

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

/* Default for all I2S is long fsync width(31) */
aconnect@2a41000 {
	ahub {
		status = "okay";
		/* I2S1 in Short frame sync for BT SCO */
		i2s@2901000 {
			status = "okay";
			//fsync-width = <0>;
			//bclk-ratio = <4>;
		};
		i2s@2901100 {
			status = "okay";
		};
	};
};

hda@3510000 {
	status = "okay";
};

i2c@3180000 {
	status = "okay";
	aic32x4_out: tlv320aic32x4-0018@18{
		compatible = "ti,tlv320aic32x4";
		status = "okay";
		reg = <0x18>;
		clocks = <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
		clock-names = "mclk";
	};
};
i2c@c240000 {
	status = "okay";
	aic32x4_in: tlv320aic32x4-0018@18{
		compatible = "ti,tlv320aic32x4";
		status = "okay";
		reg = <0x18>;
		clocks = <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
		clock-names = "mclk";
	};
};

tegra_sound: sound {
	status = "okay";
	compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
	nvidia,model = "tegra-snd-t19x-mobile-rt565x";
	nvidia,num-codec-link = <2>;
	nvidia.num-clk = <8>;
	nvidia,clk-rates = < 270950400	/* PLLA_x11025_RATE */
			     11289600	/* AUD_MCLK_x11025_RATE */
			     45158400	/* PLLA_OUT0_x11025_RATE */
			     45158400	/* AHUB_x11025_RATE */
			     245760000  /* PLLA_x8000_RATE */
			     12288000	/* AUD_MCLK_x8000_RATE */
			     49152000	/* PLLA_OUT0_x8000_RATE */
			     49152000 >;/* AHUB_x8000_RATE */
	clocks = <&bpmp_clks TEGRA194_CLK_PLLA>,
		 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
		 <&bpmp_clks TEGRA194_CLK_AHUB>,
		 <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
	clock-names = "pll_a", "pll_a_out0", "ahub", "extern1";

	assigned-clocks = <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
			  <&bpmp_clks TEGRA194_CLK_AHUB>,
			  <&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
	assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLA>,
				 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
				 <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>;

	status = "okay";
	nvidia,audio-routing =
		"x IN2_R",		"x IN",
		"x IN2_L",	    "x IN",
		"x OUT",        "x LOR",/*playback*/
		"x OUT",        "x LOL",
		"y IN2_R",		"y Mic",/*record*/
		"y IN2_L",		"y Mic",
		"y Headphone",  "y LOR",
		"y Headphone",  "y LOL";

	nvidia,xbar = <&tegra_axbar>;

	mclk-fs = <256>;
	rt565x_dai_link: nvidia,dai-link-1 {
	    link-name = "playback-i2s2";
		cpu-dai = <&tegra_i2s2>;
		codec-dai = <&aic32x4_out>;
		cpu-dai-name = "I2S2";
		codec-dai-name = "tlv320aic32x4-hifi";
		tx-mask = <0xFF>;
		rx-mask = <0xFF>;
		format = "i2s";
		bitclock-slave;
		frame-slave;
		bitclock-noninversion;
		frame-noninversion;
		bit-format = "s16_le";
		bclk_ratio = <0>;
		srate = <48000>;
		num-channel = <1>;
		ignore_suspend;
		name-prefix = "x";
		status = "okay";
	};
	
	nvidia,dai-link-2 {
	    link-name = "record-i2s1";
		cpu-dai = <&tegra_i2s1>;
		codec-dai = <&aic32x4_in>;
		cpu-dai-name = "I2S1";
		codec-dai-name = "tlv320aic32x4-hifi";
		tx-mask = <0xFF>;
		rx-mask = <0xFF>;
		format = "i2s";
		bitclock-slave;
		frame-slave;
		bitclock-noninversion;
		frame-noninversion;
		bit-format = "s16_le";
		bclk_ratio = <0>;
		srate = <48000>;
		num-channel = <1>;
		ignore_suspend;
		name-prefix = "y";
		status = "okay";
	};
};

};

Play.sh

#!/bin/bash
amixer -c tegrasndt19xmob cset name='I2S2 Channels' 2
amixer -c tegrasndt19xmob cset name='I2S2 Playback stereo to mono conv' CH0
amixer -c tegrasndt19xmob sset 'ADMAIF2 Mux' 'I2S2'
amixer -c tegrasndt19xmob sset 'I2S2 Mux' 'ADMAIF2'
amixer -c tegrasndt19xmob cset name='x Auto-mute Switch' 0
amixer -c tegrasndt19xmob cset name='x LO DAC Playback Switch' 1
amixer -c tegrasndt19xmob cset name='x LO Driver Gain Volume' 70
amixer -c tegrasndt19xmob cset name='x LOL Output Mixer L_DAC Switch' 1
amixer -c tegrasndt19xmob cset name='x LOR Output Mixer R_DAC Switch' 1
amixer -c tegrasndt19xmob cset name='x PCM Playback Volume' 30
amixer -c tegrasndt19xmob cset name='x PGA Level Volume' 90
amixer -c tegrasndt19xmob cset name='x ADCFGA Left Mute Switch' 0
amixer -c tegrasndt19xmob cset name='x ADCFGA Right Mute Switch' 0
aplay -D hw:tegrasndt19xmob,1 /home/nvidia/audio/shapeofyou.wav

Run the Play.sh script.

    nvidia@xavier:~/audio$ ./Play.sh 
numid=856,iface=MIXER,name='I2S2 Channels'
  ; type=INTEGER,access=rw------,values=1,min=0,max=16,step=0
  : values=2
numid=860,iface=MIXER,name='I2S2 Playback stereo to mono conv'
  ; type=ENUMERATED,access=rw------,values=1,items=4
  ; Item #0 'None'
  ; Item #1 'CH0'
  ; Item #2 'CH1'
  ; Item #3 'AVG'
  : values=1
Simple mixer control 'ADMAIF2 Mux',0
  Capabilities: enum
  Items: 'None' 'ADMAIF1' 'ADMAIF2' 'ADMAIF3' 'ADMAIF4' 'ADMAIF5' 'ADMAIF6' 'ADMAIF7' 'ADMAIF8' 'ADMAIF9' 'ADMAIF10' 'ADMAIF11' 'ADMAIF12' 'ADMAIF13' 'ADMAIF14' 'ADMAIF15' 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-2' 'DMIC1' 'DMIC2' 'DMIC3' 'DMIC4' 'ADX1-1' 'ADX1-2' 'ADX1-3' 'ADX1-4' 'ADX2-1' 'ADX2-2' 'ADX2-3' 'ADX2-4' 'ADX3-1' 'ADX3-2' 'ADX3-3' 'ADX3-4' 'ADX4-1' 'ADX4-2' 'ADX4-3' 'ADX4-4' 'ADMAIF17' 'ADMAIF18' 'ADMAIF19' 'ADMAIF20' 'ASRC1-1' 'ASRC1-2' 'ASRC1-3' 'ASRC1-4' 'ASRC1-5' 'ASRC1-6'
  Item0: 'ADMAIF2'
numid=873,iface=MIXER,name='x Auto-mute Switch'
  ; type=INTEGER,access=rw------,values=1,min=0,max=7,step=0
  : values=0
numid=866,iface=MIXER,name='x HP DAC Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=off,off
numid=864,iface=MIXER,name='x HP Driver Gain Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=35,step=0
  : values=0,0
  | dBscale-min=-6.00dB,step=1.00dB,mute=0
numid=1053,iface=MIXER,name='x HPL Output Mixer IN1_L Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=1056,iface=MIXER,name='x HPR Output Mixer IN1_R Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=1052,iface=MIXER,name='x HPL Output Mixer L_DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=1055,iface=MIXER,name='x HPR Output Mixer R_DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=867,iface=MIXER,name='x LO DAC Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=on,on
numid=865,iface=MIXER,name='x LO Driver Gain Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=35,step=0
  : values=35,35
  | dBscale-min=-6.00dB,step=1.00dB,mute=0
numid=1054,iface=MIXER,name='x LOL Output Mixer L_DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=1057,iface=MIXER,name='x LOR Output Mixer R_DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=863,iface=MIXER,name='x PCM Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=175,step=0
  : values=30,30
  | dBscale-min=-63.50dB,step=0.50dB,mute=0
numid=872,iface=MIXER,name='x PGA Level Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=95,step=0
  : values=90,90
  | dBscale-min=0.00dB,step=0.50dB,mute=0
numid=869,iface=MIXER,name='x ADCFGA Left Mute Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
numid=870,iface=MIXER,name='x ADCFGA Right Mute Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=off
Playing WAVE '/home/nvidia/audio/shapeofyou.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono
^CAborted by signal Interrupt...

Thanks & Best Regards

Hello!

The main difference that I am aware of is the addition of the ‘mclk-fs’ property in device-tree, but I see that you have that and so the MCLK for the codec should be operated as 256 x FS. It appears that the codec is the BCLK and FSYNC slave and so you are most likely using the AUD_MCLK to drive the codecs MCLK.

You may wish to dump the I2S, codec, etc registers while playback active to compare between 4.2.2 and 4.3 and see if there are any differences. The registers can be dumped via the debugfs regmap entry. You should see the various devices list under …

$ sudo ls /sys/kernel/debug/regmap/

Each entry should have a ‘registers’ node and you should be able to cat this file to dump the registers.

Otherwise, it is also worth comparing the clock settings to see if something change there …

$ sudo cat /sys/kernel/debug/clk/clk_summary

Regards,
Jon

1 Like