TLV320aic32x4 audio codec is not detecting for tx2i

Hello Jonathanh,

Could you please attached complete source code tegra186-quill-common.dtsi.txt (33.1 KB) tegra_machine_driver_mobile.c.txt (23.7 KB) .
tlv320aic32x4.c

diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 28fdfc5ec544..5dfef68dc9ae 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -252,6 +252,8 @@ static const struct snd_kcontrol_new in3l_to_rmixer_controls[] = {
 
 static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
        SND_SOC_DAPM_DAC("Left DAC", "Left Playback", AIC32X4_DACSETUP, 7, 0),
+       //SND_SOC_DAPM_DAC("Left DAC", "Playback", AIC32X4_DACSETUP, 7, 0),
+
        SND_SOC_DAPM_MIXER("HPL Output Mixer", SND_SOC_NOPM, 0, 0,
                           &hpl_output_mixer_controls[0],
                           ARRAY_SIZE(hpl_output_mixer_controls)),
@@ -263,6 +265,8 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
        SND_SOC_DAPM_PGA("LOL Power", AIC32X4_OUTPWRCTL, 3, 0, NULL, 0),
 
        SND_SOC_DAPM_DAC("Right DAC", "Right Playback", AIC32X4_DACSETUP, 6, 0),
+       //SND_SOC_DAPM_DAC("Right DAC", "Playback", AIC32X4_DACSETUP, 6, 0),
+
        SND_SOC_DAPM_MIXER("HPR Output Mixer", SND_SOC_NOPM, 0, 0,
                           &hpr_output_mixer_controls[0],
                           ARRAY_SIZE(hpr_output_mixer_controls)),

tegra_machine_driver_mobile.c

diff --git a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
index fbca4699d..67b563cac 100644
--- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
+++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c
@@ -30,6 +30,7 @@
 #include <dt-bindings/sound/tas2552.h>
 #include "rt5659.h"
 #include "sgtl5000.h"
+#include "tlv320aic32x4.h"
 #include "tegra_asoc_machine_alt.h"
 #include "tegra210_xbar_alt.h"
 
@@ -282,10 +283,11 @@ static int tegra_machine_set_params(struct snd_soc_card *card,
 }
 
 static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
-				  unsigned int rate, unsigned int channels,
-				  u64 formats)
+				  int rate, unsigned int channels,
+				  u64 formats, bool is_palyback)
 {
 	struct snd_soc_card *card = runtime->card;
+	//struct snd_soc_card *card = rtd->card;
 	struct tegra_machine *machine = snd_soc_card_get_drvdata(card);
 	struct snd_soc_pcm_stream *dai_params;
 	unsigned int aud_mclk, srate;
@@ -310,7 +312,6 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
 	err = tegra_machine_set_params(card, machine, rate, channels, formats);
 	if (err < 0)
 		return err;
-
 	rtd = snd_soc_get_pcm_runtime(card, "rt565x-playback");
 	if (rtd) {
 		dai_params =
@@ -327,6 +328,20 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
 			return err;
 		}
 	}
+//Added TLV320AIC32X4
+	rtd = snd_soc_get_pcm_runtime(card, "ti-capture");
+        if (rtd) {
+                dai_params =
+                (struct snd_soc_pcm_stream *)rtd->dai_link->params;
+                dai_params->rate_min = srate;
+		 dai_params->channels_min = channels;
+        	dai_params->formats = formats;
+                if (err < 0) {
+                        dev_err(card->dev, "codec_dai clock not parashuram set\n");
+                        return err;
+                }
+        }
+//Ended
 
 	rtd = snd_soc_get_pcm_runtime(card, "rt565x-codec-sysclk-bclk1");
 	if (rtd) {
@@ -440,10 +455,17 @@ static int tegra_machine_pcm_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_card *card = rtd->card;
 	int err;
+	bool is_playback;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		is_playback = true;
+	else
+		is_playback = false;
 
 	err = tegra_machine_dai_init(rtd, params_rate(params),
 				     params_channels(params),
-				     1ULL << params_format(params));
+				     (1ULL << (params_format(params))),
+			is_playback);
 	if (err < 0) {
 		dev_err(card->dev, "Failed dai init\n");
 		return err;
@@ -593,7 +615,22 @@ static int tegra_machine_rt565x_init(struct snd_soc_pcm_runtime *rtd)
 
 	return 0;
 }
+//Added tlv320aic32x4
+static int tegra_machine_aic32x4_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct device *dev = rtd->card->dev;
+   	int err;
+
+	err = snd_soc_dai_set_sysclk(rtd->codec_dai, AIC32X4_FREQ_12000000, 12000000,
+                        SND_SOC_CLOCK_IN);
+    if (err) {
+        dev_err(dev, "failed to set aic32x4 sysclk!\n");
+        return err;
+    }
 
+    return 0;
+}
+//Ended
 static int codec_init(struct tegra_machine *machine)
 {
 	struct snd_soc_dai_link *dai_links = machine->asoc->dai_links;
@@ -611,6 +648,8 @@ static int codec_init(struct tegra_machine *machine)
 			dai_links[i].init = tegra_machine_rt565x_init;
 		else if (strstr(dai_links[i].name, "fe-pi-audio-z-v2"))
 			dai_links[i].init = tegra_machine_fepi_init;
+		 else if (strstr(dai_links[i].name, "ti-capture"))
+                        dai_links[i].init = tegra_machine_aic32x4_init;
 	}
 
 	return 0;

Device tree changes

diff --git a/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi b/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
old mode 100644
new mode 100755
index 9416a21..331befc
--- a/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
+++ b/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
@@ -166,6 +166,16 @@
 				rom-val = /bits/ 8 <0x05>;
 			};
 		};
+ 	aic32x4: tlv320aic32x4.1-0018@18 {
+                        compatible = "ti,tlv320aic32x4";
+                        status = "okay";
+                        reg = <0x18>;
+                        clocks = <&tegra_car TEGRA186_CLK_AUD_MCLK>;
+                        clock-names = "mclk";
+                        dv-supply = <&battery_reg>;
+                        av-supply = <&battery_reg>;
+                        iov-supply = <&battery_reg>;
+                };	
 	};
 
 	i2c@c240000 {
@@ -668,7 +678,8 @@
 #endif
 	ahub {
 		/* I2S6 */
-		i2s@2901500 {
+		i2s@2901100 {
+			status = "okay";
 			bclk-ratio = <4>;
 		};
 
@@ -695,60 +706,41 @@
 	tegra_sound: sound {
 		compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
 		nvidia,model = "tegra-snd-t186ref-mobile-rt565x";
-		nvidia,num-codec-link = <12>;
-		clocks = <&tegra_car TEGRA186_CLK_PLLA>,
-			 <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
-			 <&tegra_car TEGRA186_CLK_AUD_MCLK>;
-		clock-names = "pll_a", "pll_a_out0", "extern1";
-		assigned-clocks = <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
-				  <&tegra_car TEGRA186_CLK_AUD_MCLK>;
-		assigned-clock-parents = <&tegra_car TEGRA186_CLK_PLLA>,
-					 <&tegra_car TEGRA186_CLK_PLL_A_OUT0>;
-		resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
+		nvidia,num-codec-link = <13>;
+		 clocks = <&tegra_car TEGRA186_CLK_PLLA>,
+                        <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
+                        <&tegra_car TEGRA186_CLK_AHUB>,
+                        <&tegra_car TEGRA186_CLK_AUD_MCLK>;
+                clock-names = "pll_a", "pll_a_out0", "ahub", "extern1";
+                
+		/*assigned-clocks = <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
+                                  <&tegra_car TEGRA186_CLK_AHUB>,
+                                  <&tegra_car TEGRA186_CLK_AUD_MCLK>;
+                assigned-clock-parents = <&tegra_car TEGRA186_CLK_PLLA>,
+                                         <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
+                                        <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
+                                        <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
+               assigned-clock-rates = <0>, <0>, <12000000>;*/
+		assigned-clocks = <&tegra_car TEGRA186_CLK_PLL_A_OUT0>, <&tegra_car TEGRA186_CLK_AUD_MCLK>;
+                assigned-clock-parents = <&tegra_car TEGRA186_CLK_PLLA>, <&tegra_car TEGRA186_CLK_PLLP_OUT0>;
+                assigned-clock-rates = <0>, <12000000>;
+
+                resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
 		reset-names = "extern1_rst";
 
 		status = "okay";
 		nvidia,audio-routing =
-			"x Headphone",		"x OUT",
-			"x IN",			"x Mic",
-			"y Headphone",		"y OUT",
-			"y IN",			"y Mic",
-			"z Headphone",		"z OUT",
-			"z IN",			"z Mic",
-			"m Headphone",		"m OUT",
-			"m IN",			"m Mic",
-			"n Headphone",		"n OUT",
-			"n IN",			"n Mic",
-			"o Headphone",		"o OUT",
-			"o IN",			"o Mic",
-			"a IN",			"a Mic",
-			"b IN",			"b Mic",
-			"c IN",			"c Mic",
-			"d IN",			"d Mic",
-			"d1 Headphone",		"d1 OUT",
-			"d3 Headphone",		"d3 OUT";
-
+		"z Headphone", "z LOL",
+            	"z Headphone", "z LOR",
+            	"z IN1_L",     "z Mic",
+            	"z IN1_R",     "z Mic"; 
 		nvidia,xbar = <&tegra_axbar>;
-		mclk-fs = <256>;
+		//mclk-fs = <256>;
 
 		rt565x_dai_link: nvidia,dai-link-1 {
 			link-name = "spdif-dit-0";
-			cpu-dai = <&tegra_i2s1>;
-			codec-dai = <&spdif_dit0>;
-			cpu-dai-name = "I2S1";
-			codec-dai-name = "dit-hifi";
-			format = "i2s";
-			bit-format = "s16_le";
-			srate = <48000>;
-			num-channel = <2>;
-			ignore_suspend;
-			name-prefix = "x";
-			status = "okay";
-		};
-		nvidia,dai-link-2 {
-			link-name = "spdif-dit-1";
 			cpu-dai = <&tegra_i2s2>;
-			codec-dai = <&spdif_dit1>;
+			codec-dai = <&spdif_dit0>;
 			cpu-dai-name = "I2S2";
 			codec-dai-name = "dit-hifi";
 			format = "i2s";
@@ -756,7 +748,7 @@
 			srate = <48000>;
 			num-channel = <2>;
 			ignore_suspend;
-			name-prefix = "y";
+			name-prefix = "x";
 			status = "okay";
 		};
 		nvidia,dai-link-3 {
@@ -770,8 +762,8 @@
 			srate = <48000>;
 			num-channel = <2>;
 			ignore_suspend;
-			name-prefix = "z";
-			status = "okay";
+			name-prefix = "a";
+			status = "disabled";
 		};
 		nvidia,dai-link-4 {
 			link-name = "spdif-dit-3";
@@ -785,7 +777,7 @@
 			num-channel = <2>;
 			ignore_suspend;
 			name-prefix = "m";
-			status = "okay";
+			status = "disabled";
 		};
 		nvidia,dai-link-5 {
 			link-name = "spdif-dit-4";
@@ -799,7 +791,7 @@
 			num-channel = <2>;
 			ignore_suspend;
 			name-prefix = "n";
-			status = "okay";
+			status = "disabled";
 		};
 		nvidia,dai-link-6 {
 			link-name = "spdif-dit-6";
@@ -816,7 +808,7 @@
 			num-channel = <1>;
 			ignore_suspend;
 			name-prefix = "o";
-			status = "okay";
+			status = "disabled";
 		};
 		nvidia,dai-link-7 {
 			link-name = "spdif-dit-7";
@@ -830,7 +822,7 @@
 			ignore_suspend;
 			num-channel = <2>;
 			name-prefix = "a";
-			status = "okay";
+			status = "disabled";
 		};
 		nvidia,dai-link-8 {
 			link-name = "spdif-dit-8";
@@ -844,7 +836,7 @@
 			ignore_suspend;
 			num-channel = <2>;
 			name-prefix = "b";
-			status = "okay";
+			status = "disabled";
 		};
 		nvidia,dai-link-9 {
 			link-name = "spdif-dit-9";
@@ -858,7 +850,7 @@
 			ignore_suspend;
 			num-channel = <2>;
 			name-prefix = "c";
-			status = "okay";
+			status = "disabled";
 		};
 		nvidia,dai-link-10 {
 			link-name = "spdif-dit-10";
@@ -872,7 +864,7 @@
 			ignore_suspend;
 			num-channel = <2>;
 			name-prefix = "d";
-			status = "okay";
+			status = "disabled";
 		};
 		nvidia,dai-link-11 {
 			link-name = "dspk1-playback";
@@ -886,7 +878,7 @@
 			num-channel = <2>;
 			ignore_suspend;
 			name-prefix = "d3";
-			status = "okay";
+			status = "disabled";
 		};
 		dspk_1_dai_link: nvidia,dai-link-12 {
 			link-name = "dspk-playback-l";
@@ -914,10 +906,31 @@
 			num-channel = <2>;
 			ignore_suspend;
 			name-prefix = "d2";
-			status = "okay";
-                };
-	};
+			status = "disabled";
+		};
 
+		nvidia,dai-link-2 {
+            		link-name = "ti-capture";
+            		cpu-dai = <&tegra_i2s1>;
+            		codec-dai = <&aic32x4>;
+            		cpu-dai-name = "I2S1";
+            		codec-dai-name = "tlv320aic32x4-hifi";
+         		tx-mask = <0xFF>;
+          		rx-mask = <0xFF>;            
+            		format = "i2s";
+            		bitclock-master;
+		        frame-master;
+            		bitclock-noninversion;
+            		frame-noninversion;
+           		bit-format = "s16_le";
+            		bclk_ratio = <1>;
+            		srate = <44100>;
+            		num-channel = <2>;
+            		ignore_suspend;
+            		name-prefix = "z";
+			status = "okay"; 
+		};
+	};
 	backlight {
 		status = "okay";
 		panel-s-wuxga-8-0-bl {

I’m wondering why it’s not getting detected ti codec. could you please have look into my code and help me out.

Regards,
Parashuram

Hello!

You will not see the codec itself in the Ubuntu Sound Settings menu. The soundcard that the TI codec is associated with is the ‘Analog Output’ soundcard.

Regards,
Jon

Hello Jonathanh,

I am not able to hear the sound in speaker or headphone.
Is there anything to do to get the sound from Jetson?
what are these errors I’m not getting

   root@bnfs-desktop:~# dmesg | grep tlv
    [    2.504164] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_R
    [    2.504167] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_R -> 10 kOhm -> CM_R to Right Mixer Negative Resistor
    [    2.504189] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_R
    [    2.504191] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_R -> 20 kOhm -> CM_R to Right Mixer Negative Resistor
    [    2.504212] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_R
    [    2.504214] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_R -> 40 kOhm -> CM_R to Right Mixer Negative Resistor
    [    2.509483] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_L
    [    2.509485] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_L -> 10 kOhm -> CM_L to Left Mixer Negative Resistor
    [    2.509504] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_L
    [    2.509506] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_L -> 20 kOhm -> CM_L to Left Mixer Negative Resistor
    [    2.509524] tlv320aic32x4 0-0018: ASoC: no source widget found for CM_L
    [    2.509526] tlv320aic32x4 0-0018: ASoC: Failed to add route CM_L -> 40 kOhm -> CM_L to Left Mixer Negative Resistor
    [    2.535895] tlv320aic32x4 0-0018: ASoC: mux z CM_R to Right Mixer Negative Resistor has no paths
    [    2.536416] tlv320aic32x4 0-0018: ASoC: mux z CM_L to Left Mixer Negative Resistor has no paths

Regards,
Parashuram

Hello Jonathanh,

Awaiting for your reply.
could you please help me out?

Regards,
Parashuram

Hello Jonathanh,

We are waiting for your reply.
any help will be greatky appericiated.

Regards,
Parashuram

Hello!

Those errors are indicating that some routes are missing. However, I am not familiar enough with this codec to know if they are important or not and I cannot find any information about these inputs in the datasheet for the codec. Maybe TI would be able to tell you if that is required or not. However, it does appear that other people have problems with these as well. There is another thread where someone else was able to get this codec working here.

Please understand that we are not familiar with this specific codec and so we can only provide some guidance to get this working. Integrating audio codec with Linux does require knowledge of the audio codec and so this is not a trivial task and I see a lot of people struggle with this.

I recall that for this codec that are some additional routes that need to be added and so you can try adding the following …

nvidia,audio-routing =
                "z Headphone", "z LOL",
            	"z Headphone", "z LOR",
                "z Left DAC", "z Playback",
                "z Right DAC", "z Playback",
            	"z IN1_L", "z Mic",
            	"z IN1_R", "z Mic",
                "z Capture", "z Left ADC",
                "z Capture", "z Right ADC";

If this does not work, then please run the following script and attach 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 note that I am currenly out of the office on vacation and so response at this time is delayed.

Regards,
Jon

Hello Jonathanh,

Thanks for your reply,
I have made DT changes according to your reference.

+                "z Headphone", "z LOL",
+               "z Headphone", "z LOR",
+                "z Left DAC", "z Playback",
+                "z Right DAC", "z Playback",
+               "z IN1_L", "z Mic",
+               "z IN1_R", "z Mic",
+                "z Capture", "z Left ADC",
+                "z Capture", "z Right ADC";

Please find the attached output tegra-audio-debug.txt (556.5 KB)

Regards,
Parashuram

Hello!

Thanks. Can you try running the following …

amixer -c tegrasndt186ref cset name='z LO DAC Playback Switch' 1
amixer -c tegrasndt186ref cset name='z LOL Output Mixer L_DAC Switch' 1
amixer -c tegrasndt186ref cset name='z LOR Output Mixer R_DAC Switch' 1
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:tegrasndt186ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500 -l 2
sudo cat /sys/kernel/debug/tracing/trace

Thanks
Jon

Hello Jonathanh,

Please find the attached output results.output.txt (6.4 KB)

nfs@nfs-desktop:~$ amixer -c tegrasndt186ref cset name='z LO DAC Playback Switch' 1
numid=879,iface=MIXER,name='z LO DAC Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=on,on
nfs@nfs-desktop:~$ amixer -c tegrasndt186ref cset name='z LOL Output Mixer L_DAC Switch' 1
numid=1118,iface=MIXER,name='z LOL Output Mixer L_DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
nfs@nfs-desktop:~$ amixer -c tegrasndt186ref cset name='z LOR Output Mixer R_DAC Switch' 1
numid=1121,iface=MIXER,name='z LOR Output Mixer R_DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
nfs@nfs-desktop:~$ echo 0 | sudo tee /sys/kernel/debug/tracing/trace
[sudo] password for nfs: 
0
nfs@nfs-desktop:~$ echo 0 | sudo tee /sys/kernel/debug/tracing/events/enable
0
nfs@nfs-desktop:~$ echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
1
nfs@nfs-desktop:~$ echo 1 | sudo tee /sys/kernel/debug/tracing/events/asoc/snd_soc_dapm_widget_power/enable
1
nfs@nfs-desktop:~$ speaker-test -D hw:tegrasndt186ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500 -l 2

speaker-test 1.1.3

Playback device is hw:tegrasndt186ref,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Sine wave rate is 500.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 8192
Period size range from 32 to 4096
Using max buffer size 8192
Periods = 4
was set period_size = 2048
was set buffer_size = 8192
 0 - Front Left
 1 - Front Right
Time per period = 0.198871
 0 - Front Left
 1 - Front Right
Time per period = 0.202331
nfs@nfs-desktop:~$ sudo cat /sys/kernel/debug/tracing/trace
# tracer: nop
#
# entries-in-buffer/entries-written: 44/44   #P:4
#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
    speaker-test-9563  [000] ....   294.230940: snd_soc_dapm_widget_power: widget=Playback 1 val=1
    speaker-test-9563  [000] ....   294.230945: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=1
    speaker-test-9563  [000] ....   294.230947: snd_soc_dapm_widget_power: widget=ADMAIF1 RX val=1
    speaker-test-9563  [000] ....   294.230952: snd_soc_dapm_widget_power: widget=I2S1 Mux val=1
    speaker-test-9563  [000] ....   294.230954: snd_soc_dapm_widget_power: widget=I2S1 TX val=1
    speaker-test-9563  [000] ....   294.230955: snd_soc_dapm_widget_power: widget=I2S1 Transmit val=1
    speaker-test-9563  [000] ....   294.230956: snd_soc_dapm_widget_power: widget=I2S1 Transmit-I2S1 CIF Receive val=1
    speaker-test-9563  [000] ....   294.230957: snd_soc_dapm_widget_power: widget=I2S1 CIF Receive val=1
    speaker-test-9563  [000] ....   294.230957: snd_soc_dapm_widget_power: widget=I2S1 CIF RX val=1
    speaker-test-9563  [000] ....   294.230958: snd_soc_dapm_widget_power: widget=I2S1 DAP TX val=1
    speaker-test-9563  [000] ....   294.230959: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit val=1
    speaker-test-9563  [000] ....   294.230960: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit-z Playback val=1
    speaker-test-9563  [000] ....   294.230961: snd_soc_dapm_widget_power: widget=z Playback val=1
    speaker-test-9563  [000] ....   294.230962: snd_soc_dapm_widget_power: widget=z Right DAC val=1
    speaker-test-9563  [000] ....   294.230964: snd_soc_dapm_widget_power: widget=z Left DAC val=1
    speaker-test-9563  [000] ....   294.230965: snd_soc_dapm_widget_power: widget=z LOR Output Mixer val=1
    speaker-test-9563  [000] ....   294.230966: snd_soc_dapm_widget_power: widget=z LOL Output Mixer val=1
    speaker-test-9563  [000] ....   294.230966: snd_soc_dapm_widget_power: widget=z LOR Power val=1
    speaker-test-9563  [000] ....   294.230967: snd_soc_dapm_widget_power: widget=z LOL Power val=1
    speaker-test-9563  [000] ....   294.230968: snd_soc_dapm_widget_power: widget=z LOR val=1
    speaker-test-9563  [000] ....   294.230969: snd_soc_dapm_widget_power: widget=z LOL val=1
    speaker-test-9563  [000] ....   294.230970: snd_soc_dapm_widget_power: widget=z Headphone val=1
    speaker-test-9563  [000] ....   294.745285: snd_soc_dapm_widget_power: widget=Playback 1 val=0
    speaker-test-9563  [000] ....   294.745293: snd_soc_dapm_widget_power: widget=ADMAIF1 Receive val=0
    speaker-test-9563  [000] ....   294.745297: snd_soc_dapm_widget_power: widget=ADMAIF1 RX val=0
    speaker-test-9563  [000] ....   294.745306: snd_soc_dapm_widget_power: widget=I2S1 Mux val=0
    speaker-test-9563  [000] ....   294.745310: snd_soc_dapm_widget_power: widget=I2S1 TX val=0
    speaker-test-9563  [000] ....   294.745312: snd_soc_dapm_widget_power: widget=I2S1 Transmit val=0
    speaker-test-9563  [000] ....   294.745315: snd_soc_dapm_widget_power: widget=I2S1 Transmit-I2S1 CIF Receive val=0
    speaker-test-9563  [000] ....   294.745318: snd_soc_dapm_widget_power: widget=I2S1 CIF Receive val=0
    speaker-test-9563  [000] ....   294.745320: snd_soc_dapm_widget_power: widget=I2S1 CIF RX val=0
    speaker-test-9563  [000] ....   294.745322: snd_soc_dapm_widget_power: widget=I2S1 DAP TX val=0
    speaker-test-9563  [000] ....   294.745325: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit val=0
    speaker-test-9563  [000] ....   294.745327: snd_soc_dapm_widget_power: widget=I2S1 DAP Transmit-z Playback val=0
    speaker-test-9563  [000] ....   294.745330: snd_soc_dapm_widget_power: widget=z Playback val=0
    speaker-test-9563  [000] ....   294.745333: snd_soc_dapm_widget_power: widget=z Right DAC val=0
    speaker-test-9563  [000] ....   294.745336: snd_soc_dapm_widget_power: widget=z Left DAC val=0
    speaker-test-9563  [000] ....   294.745338: snd_soc_dapm_widget_power: widget=z LOR Output Mixer val=0
    speaker-test-9563  [000] ....   294.745340: snd_soc_dapm_widget_power: widget=z LOL Output Mixer val=0
    speaker-test-9563  [000] ....   294.745343: snd_soc_dapm_widget_power: widget=z LOR Power val=0
    speaker-test-9563  [000] ....   294.745345: snd_soc_dapm_widget_power: widget=z LOL Power val=0
    speaker-test-9563  [000] ....   294.745347: snd_soc_dapm_widget_power: widget=z LOR val=0
    speaker-test-9563  [000] ....   294.745348: snd_soc_dapm_widget_power: widget=z LOL val=0
    speaker-test-9563  [000] ....   294.745351: snd_soc_dapm_widget_power: widget=z Headphone val=0
nfs@nfs-desktop:~$ 

Regards,
Parashuram

Hello!

Do you hear anything on the line outputs? If not are you able to probe the I2S pins and see if there is any activity on the I2S signals?

Regards,
Jon

Hi,
We are trying to run the plaback script and probe the I2S lines. We are getting following error s while running playback.sh.

aplay: main:788: audio open error: Device or resource busy

Please find attached the log file. play.txt (3.9 KB)

Regards,
Parashuram

Hello!

Yes that can be normal is something else like pulseaudio is using the device. Can you try using the plughw as follows …

amixer -c tegrasndt186ref cset name='z LO DAC Playback Switch' 1
amixer -c tegrasndt186ref cset name='z LOL Output Mixer L_DAC Switch' 1
amixer -c tegrasndt186ref cset name='z LOR Output Mixer R_DAC Switch' 1
speaker-test -D plughw:tegrasndt186ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500

Jon

Hi,

Please find the attached output results.

ubuntu@ubuntu-desktop:~$ amixer -c tegrasndt186ref cset name='z LO DAC Playback Switch' 1
numid=879,iface=MIXER,name='z LO DAC Playback Switch'
  ; type=BOOLEAN,access=rw------,values=2
  : values=on,on
ubuntu@ubuntu-desktop:~$ amixer -c tegrasndt186ref cset name='z LOL Output Mixer L_DAC Switch' 1
numid=1118,iface=MIXER,name='z LOL Output Mixer L_DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
ubuntu@ubuntu-desktop:~$ amixer -c tegrasndt186ref cset name='z LOR Output Mixer R_DAC Switch' 1
numid=1121,iface=MIXER,name='z LOR Output Mixer R_DAC Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on

Speakar log speakar_test.txt (100.6 KB)

Regards,
Parashuram

Hello!

Do you hear anything? If not do you see any activity of the I2S signals? Do you have an oscilloscope to probe the I2S signals?

Regards,
Jon

Hi,

we are able to see a transaction in the pin of aud_mclk, lrck and sclk data transaction is happening but there is no data transaction for SDATA_IN and SDATA_OUT pins.

These are my Pinmux configuration changes could you please let me know the Pinmux changes are proper.

pinmux.0x02431040 = 0x00000400; # dap1_sclk_pj0: i2s1, tristate-disable, input-disable, lpdr-disable
pinmux.0x02431038 = 0x00000400; # dap1_dout_pj1: i2s1, tristate-disable, input-disable, lpdr-disable
pinmux.0x02431030 = 0x00000458; # dap1_din_pj2: i2s1, pull-up, tristate-enable, input-enable, lpdr-disable
pinmux.0x02431028 = 0x00000400; # dap1_fs_pj3: i2s1, tristate-disable, input-disable, lpdr-disable
pinmux.0x02431020 = 0x00000400; # aud_mclk_pj4: aud, tristate-disable, input-disable, lpdr-disable

Regards,
Parashuram

Hello!

The pin settings look fine. What are the frequencies of the MCLK, SCLK and LRCK? The MCLK should be 12MHz, the LRCK should be the sample rate (eg. 44.1KHz, 48KHz, etc depending on the PCM sample rate) and the SCLK should be fsnum-channelsbits-per-channel.

Regards,
Jon

Hi Jon,
Below is the status of each pin :
MCLK : 12MHz
SCLK: 12MHz
LRCK: 93.7kHz
SDIN: No transaction.
SDOUT: No transaction.
Do we need to change anything tlvai320aicc32x4.c file so that transaction on SDIN and SDOUT gets enabled.

Regards
Parshuram

Hello!

What sample-rate are you using? If you are running the following command then the sample-rate should be 48kHz …

speaker-test -D plughw:tegrasndt186ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500

In this case I would expect the LRCK to be 48kHz and not ~94kHz. Furthermore, I would expect the SCLK to be 2 * 16 * 48000 = 1.536MHz and not 12MHz. So the clock frequencies here do not look correct. When you run the above command can you …

speaker-test -D plughw:tegrasndt186ref,0 -c 2 -r 48000 -F S16_LE -t sine -f 500 &
sudo grep "aud_mclk\|i2s1" /sys/kernel/debug/clk/clk_summary
sudo cat /sys/kernel/debug/regmap/tegra210-i2s.0/registers

There is nothing that needs to be changed in the codec driver as far as I know. At least the DOUT from Tegra should be just driven by Tegra for playback.

Are you probing the I2S pins on the 40-pin of the TX2i board? If so what pins are you probing?

Regards,
Jon

Hello,

Please find the attached sample rate output result speakar-TEST_11_01.txt (34.6 KB) .
speakar-TEST_500.txt (5.3 KB) aud_mclk.txt (572 Bytes) regmap.txt (670 Bytes)

We have a custom TX2i carrier board we are probing SDIN, SDOUT, LRCK,SCLK and MCLK on the PCB pads.

Regards,
Parashuram

Hello!

OK I can see a problem …

In the above I see the the codec is the bit clock and frame master. I believe originally, you had this configured as slave. Looking at Igal’s configuration he used slave and not master. If you want the codec to be the bit clock and frame master, then you need to enable the ‘input-enable’ for the dap1_fs_pj3 pin. Right now you have this disabled and so Tegra will not see the frame clock …

pinmux.0x02431028 = 0x00000400; # dap1_fs_pj3: i2s1, tristate-disable, input-disable, lpdr-disable

I am a bit concerned why the codec is generating the wrong frequencies for the SCLK and LRCK and so maybe there is something else you need to configure on the codec side. You would need to review the codec documentation to figure this out. Otherwise, you could make Tegra the bit clock and frame master instead because we know that Igal had this working.

Jon