TLV320AIC32x4 evaluation board with TX2

Hello,

I am trying to connect the TLV320AIC32x4 evaluation board to the TX2 board.
I understand that the device tree has to be modified prior to activating the physical CODEC. The linux kernel does include the driver for the device.
It is required to add the following buses: I2C and I2S - I intend to utilize the interface provided by the J21 connector on board the TX2.
Though I have some ambiguity regarding the way the device tree has to be configured:

  1. I think that I need to add (per https://devtalk.nvidia.com/default/topic/960938/jetson-tx1/configure-tegra-asoc-driver-for-custom-hardware-with-ti-audio-codec/2)
i2c@xxxxxx {
  aic32x4: tlv320aic32x4.0-0018@18 {
  compatible = "ti,tlv320aic32x4";
  reg = <0x18>;
  };
};

but on which bus? is there some list that provides the correlation between the i2c aliases (in the device tree) to the HW ports (output from the TX2 or the evaluation board)?

  1. What is the difference between the sound node and the sound_ref node (which is disabled on my device tree)? should I enable the sound_ref and insert there the above configuration?

  2. Should I configure the I2S or is already pre-configured by the L4T 28.1? and how should I add it? There are already 13 dai-link-x configured, how should I select one of them?

Thanks,

Igal

Anyone?

  1. J21 have two i2c bus pin as below.
I2C0 = "i2c@3160000"
I2C_GP1_CLK	A21	GEN1_I2C_SCL	F32	G32	unused_GEN1_I2C_SCL		I2C1_CLK
I2C_GP1_DAT	A20	GEN1_I2C_SDA	F33	D33	unused_GEN1_I2C_SDA		I2C1_DAT

I2C1 = "i2c@c240000"
I2C_GP0_CLK	E15	GPIO_SEN8	C29	D26	unused_GPIO_SEN8			I2C2_CLK
I2C_GP0_DAT	D15	GPIO_SEN9	F26	C26	unused_GPIO_SEN9			I2C2_DAT
  1. I think they are the same.

3.No need config for r28.1

ShaneCCC,

thanks for the reply.

So I shall add as follows:

ahub {
   ...
};

i2c0 {
  aic32x4: tlv320aic32x4.0-0018@18 {
  compatible = "ti,tlv320aic32x4";
  reg = <0x18>;
  };
};

Regarding the sound token should I remove the one already in my Device-Tree? and then replacing it by the following one?
Original:

sound {
		compatible = "nvidia,tegra-audio-t186ref-mobile-rt565x";
		clock-names = "pll_p_out1", "pll_a", "pll_a_out0", "ahub", "clk_m", "extern1";
		reset-names = "extern1_rst";
		nvidia,model = "tegra-snd-t186ref-mobile-rt565x";
		nvidia,xbar = <0xce>;
		clocks = <0xd 0x10d 0xd 0x10f 0xd 0xf6 0xd 0x57 0xd 0x261 0xd 0x7c>;
		nvidia,audio-routing = "x Headphone", "x OUT", "x IN", "x Mic", "y Headphone", "y OUT", "y IN", "y Mic", "z IN", "z OUT", "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", "e Headphone", "e OUT", "e IN", "e Mic", "d1 Headphone", "d1 OUT", "d2 Headphone", "d2 OUT";
		resets = <0xd 0x92>;
		status = "okay";
		phandle = <0x77>;
		#stream-id-cells = <0x1>;
		nvidia,num-codec-link = <0xd>;
		linux,phandle = <0x77>;
		nvidia,clk-rates = <0x10266000 0xac4400 0x2b11000 0x2b11000 0xea60000 0xbb8000 0x2ee0000 0x2ee0000>;
		nvidia,num-clk = <0x8>;

		nvidia,dai-link-10 {
			cpu-dai = <0xe1>;
			bit-format = "s16_le";
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			name-prefix = [64 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xe2>;
			link-name = "spdif-dit-10";
			cpu-dai-name = "DMIC4";
		};

		nvidia,dai-link-11 {
			cpu-dai = <0xe3>;
			bit-format = "s16_le";
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			name-prefix = [65 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xe4>;
			link-name = "spdif-playback";
			cpu-dai-name = "SPDIF1-1";
		};

		nvidia,dai-link-12 {
			cpu-dai = <0xe5>;
			bit-format = "s16_le";
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			name-prefix = "d1";
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xe6>;
			link-name = "dspk-playback-r";
			phandle = <0x121>;
			cpu-dai-name = "DSPK1";
			linux,phandle = <0x121>;
		};

		nvidia,dai-link-13 {
			cpu-dai = <0xe7>;
			bit-format = "s16_le";
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			name-prefix = "d2";
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xe8>;
			link-name = "dspk-playback-l";
			phandle = <0x123>;
			cpu-dai-name = "DSPK2";
			linux,phandle = <0x123>;
		};

		nvidia,dai-link-1 {
			bitclock-noninversion;
			cpu-dai = <0xcf>;
			bit-format = "s16_le";
			frame-slave;
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			bitclock-slave;
			name-prefix = [78 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xd0>;
			link-name = "rt565x-playback";
			bclk_ratio = <0x0>;
			phandle = <0x120>;
			cpu-dai-name = "I2S1";
			frame-noninversion;
			linux,phandle = <0x120>;
		};

		nvidia,dai-link-2 {
			bitclock-noninversion;
			cpu-dai = <0xd1>;
			bit-format = "s16_le";
			frame-slave;
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			bitclock-slave;
			name-prefix = [79 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xd2>;
			link-name = "spdif-dit-1";
			bclk_ratio = <0x1>;
			cpu-dai-name = "I2S2";
			frame-noninversion;
		};

		nvidia,dai-link-3 {
			bitclock-noninversion;
			cpu-dai = <0xd3>;
			bit-format = "s16_le";
			frame-slave;
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			bitclock-slave;
			name-prefix = [7a 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xd4>;
			link-name = "spdif-dit-2";
			bclk_ratio = <0x1>;
			cpu-dai-name = "I2S3";
			frame-noninversion;
		};

		nvidia,dai-link-4 {
			bitclock-noninversion;
			cpu-dai = <0xd5>;
			bit-format = "s16_le";
			frame-slave;
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			bitclock-slave;
			name-prefix = [6d 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xd6>;
			link-name = "spdif-dit-3";
			bclk_ratio = <0x1>;
			cpu-dai-name = "I2S4";
			frame-noninversion;
		};

		nvidia,dai-link-5 {
			bitclock-noninversion;
			cpu-dai = <0xd7>;
			bit-format = "s16_le";
			frame-slave;
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			bitclock-slave;
			name-prefix = [6e 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xd8>;
			link-name = "spdif-dit-4";
			bclk_ratio = <0x1>;
			cpu-dai-name = "I2S5";
			frame-noninversion;
		};

		nvidia,dai-link-6 {
			cpu-dai = <0xd9>;
			bit-format = "s16_le";
			frame-slave;
			bitclock-inversion;
			srate = <0x1f40>;
			rx-mask = <0xff>;
			ignore_suspend;
			num-channel = <0x1>;
			bitclock-slave;
			name-prefix = [6f 00];
			format = "dsp_a";
			tx-mask = <0xff>;
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xda>;
			link-name = "spdif-dit-6";
			frame-inversion;
			bclk_ratio = <0x4>;
			cpu-dai-name = "I2S6";
		};

		nvidia,dai-link-7 {
			cpu-dai = <0xdb>;
			bit-format = "s16_le";
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			name-prefix = [61 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xdc>;
			link-name = "spdif-dit-7";
			cpu-dai-name = "DMIC1";
		};

		nvidia,dai-link-8 {
			cpu-dai = <0xdd>;
			bit-format = "s16_le";
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			name-prefix = [62 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xde>;
			link-name = "spdif-dit-8";
			cpu-dai-name = "DMIC2";
		};

		nvidia,dai-link-9 {
			cpu-dai = <0xdf>;
			bit-format = "s16_le";
			srate = <0xbb80>;
			ignore_suspend;
			num-channel = <0x2>;
			name-prefix = [63 00];
			format = "i2s";
			codec-dai-name = "dit-hifi";
			status = "okay";
			codec-dai = <0xe0>;
			link-name = "spdif-dit-9";
			cpu-dai-name = "DMIC3";
		};
	};

New https://devtalk.nvidia.com/default/topic/960938/jetson-tx1/configure-tegra-asoc-driver-for-custom-hardware-with-ti-audio-codec/1:

sound {
                compatible = "nvidia,tegra-audio-t210ref";
                nvidia,model = "tegra-snd-t210ref";
                nvidia,num-codec-link = <1>;

                nvidia,audio-routing =
                        "Headphone-z",  "HPL",
                        "Headphone-z",  "HPR",
                        "IN1_L",        "LineIn-z",
                        "IN1_R",        "LineIn-z";

                nvidia,xbar = <&tegra_axbar>;

                nvidia,dai-link-1 {
                        link-name = "ti-playback-z";
                        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-slave;
                        frame-slave;
                        bitclock-noninversion;
                        frame-noninversion;
                        bit-format = "s16_le";
                        bclk_ratio = <0>;
                        srate = <48000>;
                        num-channel = <2>;  /* max 2 input/output */
                };
        };

I have read the Tegra ASoC Driver and could not conclude the correct values per field.

Thanks,

Igal

  1. Should be like this.
i2c@3160000 {
  aic32x4: tlv320aic32x4.0-0018@18 {
  1. Yes

Finally, I have prepared the DT file after a few compilation cycles:
because the i2c@3160000 was already defined I had to add at the end of i2c@3160000:

i2c@3160000 {
		reg = <0x0 0x3160000 0x0 0x100>;
		dmas = <0x19 0x15 0x19 0x15>;
		interrupts = <0x0 0x19 0x4>;
		compatible = "nvidia,tegra186-i2c";
		clock-names = "div-clk", "parent", "slow-clk";
		reset-names = "i2c";
		clock-frequency = <0x61a80>;
		scl-gpio = <0x12 0x15 0x0>;
		sda-gpio = <0x12 0x16 0x0>;
		clocks = <0xd 0x2f 0xd 0x10d 0xd 0x5c>;
		resets = <0xd 0x13>;
		status = "okay";
		#address-cells = <0x1>;
		phandle = <0x8a>;
		#stream-id-cells = <0x1>;
		#size-cells = <0x0>;
		dma-names = "rx", "tx";
		linux,phandle = <0x8a>;

		prod-settings {

			prod_c_fmplus {
				prod = <0x6c 0xffff0000 0x100000 0x94 0x3f00 0x200>;
			};

			prod_c_fm {
				prod = <0x6c 0xffff0000 0x190000 0x94 0x3f00 0x200>;
			};

			prod_c_hs {
				prod = <0x6c 0xffff 0x2 0x9c 0x3f00 0x300>;
			};

			prod_c_sm {
				prod = <0x6c 0xffff0000 0x160000 0x94 0x3f00 0x300>;
			};
		};

		lp8557-backlight-s-wuxga-8-0@2c {
			reg = <0x2c>;
			pwms = <0x1b 0x0 0x9ce1>;
			compatible = "ti,lp8557";
			disable-on-kernel-charging;
			bl-measured = <0x0 0x1 0x2 0x3 0x4 0x5 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xb 0xc 0xd 0xe 0xf 0xf 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x25 0x26 0x27 0x28 0x29 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x36 0x37 0x38 0x39 0x3a 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a 0x4b 0x4b 0x4c 0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b 0x5c 0x5d 0x5e 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65 0x66 0x68 0x69 0x6a 0x6b 0x6c 0x6d 0x6e 0x6f 0x70 0x71 0x72 0x73 0x74 0x75 0x76 0x77 0x78 0x79 0x7a 0x7b 0x7d 0x7e 0x7f 0x80 0x81 0x82 0x83 0x84 0x85 0x86 0x87 0x88 0x89 0x8a 0x8b 0x8c 0x8d 0x8e 0x8f 0x90 0x92 0x93 0x94 0x95 0x96 0x97 0x98 0x99 0x9a 0x9b 0x9c 0x9d 0x9e 0x9f 0xa0 0xa1 0xa2 0xa3 0xa4 0xa5 0xa7 0xa8 0xa9 0xaa 0xab 0xac 0xad 0xae 0xaf 0xb0 0xb2 0xb3 0xb4 0xb5 0xb6 0xb7 0xb8 0xb9 0xba 0xbb 0xbc 0xbd 0xbe 0xbf 0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc7 0xc8 0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf 0xd0 0xd2 0xd3 0xd4 0xd5 0xd6 0xd7 0xd8 0xd9 0xdb 0xdc 0xdd 0xde 0xdf 0xe1 0xe2 0xe3 0xe4 0xe5 0xe6 0xe7 0xe9 0xea 0xeb 0xec 0xed 0xee 0xef 0xf0 0xf1 0xf2 0xf4 0xf5 0xf6 0xf7 0xf8 0xf9 0xfa 0xfb 0xfd 0xfe 0xff>;
			pwm-period = <0x9ce1>;
			bl-curve = <0x0 0x1 0x1 0x2 0x2 0x3 0x3 0x4 0x4 0x5 0x5 0x6 0x7 0x7 0x8 0x8 0x9 0x9 0xa 0xa 0xb 0xb 0xc 0xc 0xd 0xe 0xe 0xf 0xf 0x10 0x10 0x11 0x11 0x12 0x12 0x13 0x14 0x14 0x15 0x15 0x16 0x16 0x17 0x17 0x18 0x18 0x19 0x19 0x1a 0x1b 0x1b 0x1c 0x1c 0x1d 0x1d 0x1e 0x1e 0x1f 0x1f 0x20 0x21 0x21 0x22 0x22 0x23 0x23 0x24 0x24 0x25 0x25 0x26 0x26 0x27 0x28 0x28 0x29 0x29 0x2a 0x2a 0x2b 0x2b 0x2c 0x2c 0x2d 0x2e 0x2e 0x2f 0x2f 0x30 0x30 0x31 0x31 0x32 0x32 0x33 0x34 0x34 0x35 0x35 0x36 0x36 0x37 0x37 0x38 0x38 0x39 0x39 0x3a 0x3b 0x3b 0x3c 0x3c 0x3d 0x3d 0x3e 0x3e 0x3f 0x3f 0x40 0x41 0x41 0x42 0x42 0x43 0x43 0x44 0x44 0x45 0x45 0x46 0x46 0x47 0x48 0x48 0x49 0x49 0x4a 0x4a 0x4b 0x4b 0x4c 0x4c 0x4d 0x4e 0x4e 0x4f 0x4f 0x50 0x50 0x51 0x51 0x52 0x52 0x53 0x53 0x54 0x55 0x55 0x56 0x56 0x57 0x57 0x58 0x58 0x59 0x59 0x5a 0x5c 0x5e 0x60 0x61 0x63 0x65 0x67 0x69 0x6b 0x6d 0x6e 0x70 0x72 0x74 0x76 0x78 0x7a 0x7b 0x7d 0x7f 0x81 0x83 0x85 0x86 0x88 0x8a 0x8c 0x8e 0x90 0x92 0x93 0x95 0x97 0x99 0x9b 0x9d 0x9f 0xa0 0xa2 0xa4 0xa6 0xa8 0xaa 0xac 0xad 0xaf 0xb1 0xb3 0xb5 0xb7 0xb9 0xba 0xbc 0xbe 0xc0 0xc2 0xc4 0xc6 0xc7 0xc9 0xcb 0xcd 0xcf 0xd1 0xd3 0xd4 0xd6 0xd8 0xda 0xdc 0xde 0xdf 0xe1 0xe3 0xe5 0xe7 0xe9 0xeb 0xec 0xee 0xf0 0xf2 0xf4 0xf6 0xf8 0xf9 0xfb 0xfd 0xff>;
			dev-ctrl = [80];
			status = "disabled";
			pwm-names = "lp8557";
			bl-name = "pwm-backlight";
			init-brt = [ff];
			power-supply = <0x1a>;

			rom_11h {
				rom-val = [05];
				rom-addr = [11];
			};

			rom_13h {
				rom-val = [01];
				rom-addr = [13];
			};

			rom_14h {
				rom-val = [9f];
				rom-addr = [14];
			};
		};

		gpio@21 {
			reg = <0x21>;
			#gpio-cells = <0x2>;
			compatible = "ti,tca6408";
			status = "disabled";
			vcc-supply = <0x1a>;
			phandle = <0x33>;
			gpio-controller;
			linux,phandle = <0x33>;

			vpp-vmm-rails {
				gpios = <0x2 0x0 0x3 0x0>;
				label = "vmm-en-rail", "vmm-en-rail";
				output-high;
				gpio-hog;
			};
		};

		gpio@74 {
			reg = <0x74>;
			#gpio-cells = <0x2>;
			compatible = "ti,tca9539";
			vcc-supply = <0x1a>;
			phandle = <0x107>;
			gpio-controller;
			linux,phandle = <0x107>;

			touch-rails {
				gpios = <0x1 0x0 0x2 0x0>;
				label = "touch-rail-1", "touch-rail-2";
				output-high;
				gpio-hog;
			};
		};

		gpio@77 {
			reg = <0x77>;
			#gpio-cells = <0x2>;
			compatible = "ti,tca9539";
			vcc-supply = <0x1a>;
			phandle = <0xc4>;
			gpio-controller;
			linux,phandle = <0xc4>;

			lcd-bias-rails {
				gpios = <0x4 0x0>;
				label = "lcd-bias-en-rail";
				output-high;
				gpio-hog;
			};
		};

		ina3221x@40 {
			reg = <0x40>;
			ti,continuous-config = <0x7c07>;
			compatible = "ti,ina3221x";
			ti,trigger-config = <0x7003>;
			ti,enable-forced-continuous;
			#address-cells = <0x1>;
			phandle = <0x114>;
			#size-cells = <0x0>;
			linux,phandle = <0x114>;

			channel@0 {
				reg = <0x0>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_SYS_GPU";
			};

			channel@1 {
				reg = <0x1>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_SYS_SOC";
			};

			channel@2 {
				reg = <0x2>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_4V0_WIFI";
			};
		};

		ina3221x@41 {
			reg = <0x41>;
			ti,continuous-config = <0x7c07>;
			compatible = "ti,ina3221x";
			ti,trigger-config = <0x7003>;
			ti,enable-forced-continuous;
			#address-cells = <0x1>;
			phandle = <0x115>;
			#size-cells = <0x0>;
			linux,phandle = <0x115>;

			channel@0 {
				reg = <0x0>;
				ti,shunt-resistor-mohm = <0x14>;
				ti,rail-name = "VDD_IN";
			};

			channel@1 {
				reg = <0x1>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_SYS_CPU";
			};

			channel@2 {
				reg = <0x2>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_SYS_DDR";
			};
		};

		ina3221x@42 {
			reg = <0x42>;
			ti,continuous-config = <0x7c07>;
			compatible = "ti,ina3221x";
			ti,trigger-config = <0x7003>;
			ti,enable-forced-continuous;
			#address-cells = <0x1>;
			#size-cells = <0x0>;

			channel@0 {
				reg = <0x0>;
				ti,shunt-resistor-mohm = <0x14>;
				ti,rail-name = "VDD_MUX";
			};

			channel@1 {
				reg = <0x1>;
				ti,shunt-resistor-mohm = <0x5>;
				ti,rail-name = "VDD_5V0_IO_SYS";
			};

			channel@2 {
				reg = <0x2>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_3V3_SYS";
			};
		};

		ina3221x@43 {
			reg = <0x43>;
			ti,continuous-config = <0x7c07>;
			compatible = "ti,ina3221x";
			ti,trigger-config = <0x7003>;
			ti,enable-forced-continuous;
			#address-cells = <0x1>;
			#size-cells = <0x0>;

			channel@0 {
				reg = <0x0>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_3V3_IO_SLP";
			};

			channel@1 {
				reg = <0x1>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_1V8_IO";
			};

			channel@2 {
				reg = <0x2>;
				ti,shunt-resistor-mohm = <0xa>;
				ti,rail-name = "VDD_3V3_SYS_M2";
			};
		};

		tps65132@3e {
			reg = <0x3e>;
			compatible = "ti,tps65132";
			status = "disabled";
			phandle = <0x127>;
			linux,phandle = <0x127>;

			outn {
				regulator-name = "outn";
				enable-active-high;
				regulator-min-microvolt = <0x3d0900>;
				ti,disable-active-discharge;
				regulator-max-microvolt = <0x5b8d80>;
				phandle = <0xc0>;
				linux,phandle = <0xc0>;
			};

			outp {
				regulator-name = "outp";
				enable-active-high;
				regulator-min-microvolt = <0x3d0900>;
				regulator-max-microvolt = <0x5b8d80>;
				phandle = <0xbf>;
				linux,phandle = <0xbf>;
			};
		};
		
		aic32x4: tlv320aic32x4.0-0018@18 {
			compatible = "ti,tlv320aic32x4";
			reg = <0x18>;
		};
	};

Then I have added “my” sound token configuration, which had to be modified to point to an “handle” of the axbar, and the cpu_dai handle which supposed to point to the I2S1 handle, and include another dai for recording audio:

sound {
		compatible = "nvidia,tegra-audio-t210ref";
		nvidia,model = "tegra-snd-t210ref";
		
		nvidia,num-codec-link = <2>;

		nvidia,audio-routing =
                        "Headphone-z",  "HPL",
                        "Headphone-z",  "HPR",
                        "IN1_L",        "LineIn-z",
                        "IN1_R",        "LineIn-z";

		//nvidia,xbar = <&tegra_axbar>;
		nvidia,xbar = <0xce>;
		nvidia,dai-link-1 {
            link-name = "ti-capture-z";
            cpu-dai = <0xcf>;
            codec-dai = <&aic32x4>;
            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 = <2>;
            srate = <44100>;
            num-channel = <2>;
            ignore_suspend;
            name-prefix = "z";
        };
        
		nvidia,dai-link-2 {
			link-name = "ti-playback-x";
			cpu-dai = <0xcf>;
     		codec-dai = <&aic32x4>;
          	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 = <2>;
         	srate = <44100>;
         	num-channel = <2>;
        	ignore_suspend;
            name-prefix = "x";
		};
	};

The I2S handle was taken from the ahub:

ahub {
		reg = <0x0 0x2900800 0x0 0x800>;
		compatible = "nvidia,tegra210-axbar";
		clock-names = "ahub", "pll_a_out0", "apb2ape", "xbar.ape";
		clocks = <0xd 0x57 0xd 0xf6 0xd 0x68 0xd 0x69>;
		power-domains = <0x34>;
		ranges = <0x2900000 0x0 0x2900000 0x20000>;
		status = "okay";
		#address-cells = <0x1>;
		phandle = <0xce>;
		#size-cells = <0x1>;
		linux,phandle = <0xce>;
		wakeup-disable;

		i2s@2901000 {
			reg = <0x2901000 0x100>;
			pinctrl-0;
			pinctrl-1;
			compatible = "nvidia,tegra210-i2s";
			clock-names = "i2s1", "pll_a_out0", "ext_audio_sync", "audio_sync";
			fsync-width = <0x1f>;
			clocks = <0xd 0x4f 0xd 0xf6 0xd 0x269 0xd 0xf7>;
			nvidia,ahub-i2s-id = <0x0>;
			status = "okay";
			phandle = <0xcf>;
			pinctrl-names = "dap_active", "dap_inactive";
			linux,phandle = <0xcf>;
		};
...
};

programmed the DT realizing the following from the log file:

...
[    0.174932] Tegra reboot handler registered.
[    0.175957] Registering Tegra186 clocks (this may take a while)...done
[    0.177268] arm-smmu 12000000.iommu: probing hardware configuration...
[    0.177284] arm-smmu 12000000.iommu: SMMUv2 with:
[    0.177296] arm-smmu 12000000.iommu:         stage 1 translation
[    0.177309] arm-smmu 12000000.iommu:         stage 2 translation
[    0.177319] arm-smmu 12000000.iommu:         nested translation
[    0.177333] arm-smmu 12000000.iommu:         stream matching with 128 register groups, mask 0x7f80
[    0.177351] arm-smmu 12000000.iommu: SMMU address space size (0x800000) differs from mapped region size (0x1000000)!
[    0.177370] arm-smmu 12000000.iommu:         64 context banks (0 stage-2 only)
[    0.177383] arm-smmu 12000000.iommu:         Stage-1: 39-bit VA -> 48-bit IPA
[    0.177395] arm-smmu 12000000.iommu:         Stage-2: 39-bit IPA -> 48-bit PA
[    0.207927] /iommu@12000000: could not get #stream-id-cells for /i2c@3160000/tlv320aic32x4.0-0018@18
[    0.207946] arm-smmu 12000000.iommu: registered 38 master devices
[    0.210111] mc: mapped MMIO address: 0xffffff8000540000 -> 0x2c10000
[    0.210134] mc: mapped MMIO address: 0xffffff8000560000 -> 0x2c20000
[    0.210154] mc: mapped MMIO address: 0xffffff8000640000 -> 0x2c30000
[    0.210173] mc: mapped MMIO address: 0xffffff8000660000 -> 0x2c40000
[    0.210191] mc: mapped MMIO address: 0xffffff8000fa0000 -> 0x2c50000
...

What is the meaning of this failure?

Igal

Could it be name of tlv320aic32x4.0-0018@18 problem? Would you try tlv320aic32x4@18

could not get #stream-id-cells for /i2c@3160000/tlv320aic32x4.0-0018@18

I have changed the following:

i2c@3160000 {
...
		
		aic32x4: tlv320aic32x4@18 {
			compatible = "ti,tlv320aic32x4";
			reg = <0x18>;
		};
	};

and received:

...
could not get #stream-id-cells for /i2c@3160000/tlv320aic32x4@18
...

Any other suggestions?

Thanks,

Igal

You may need to add #stream-id-cells = <1>;

Could you please elaborate where should I add it?

in the meanwhile…

I have added #stream-id-cells token to the sound token. But it was not enough (I guess) I noticed that the #stream-id-cells field is supposed to be combined with the following tokens:

phandle = <0x77>;
#stream-id-cells = <0x1>;
linux,phandle = <0x77>;

the handle index was taken from the original sound token. I am not sure if it is legal. Is it?
Moreover there are some override tokens way down the DT which override whatever defined within the sound token (I guess).

So I saw on another dts file that the sound_ref token was utilized so I have enabled it. Enabled the original sound token. Added all “my” sound to the sound_ref token - it already had the handles and the requested #stream-id-cells token, as follows:

sound_ref {
		status = "okay";
		phandle = <0x78>;
		#stream-id-cells = <0x1>;
		linux,phandle = <0x78>;
		
		
		compatible = "nvidia,tegra-audio-t210ref";
		nvidia,model = "tegra-snd-t210ref";
		
		nvidia,num-codec-link = <0x2>;

		nvidia,audio-routing =
                        "Headphone-z",  "HPL",
                        "Headphone-z",  "HPR",
                        "IN1_L",        "LineIn-z",
                        "IN1_R",        "LineIn-z";

		nvidia,xbar = <0xce>;
		
		nvidia,dai-link-1 {
            link-name = "ti-capture-z";
            cpu-dai = <0xcf>;
            codec-dai = <&aic32x4>;
            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 = <2>;
            srate = <44100>;
            num-channel = <2>;
            ignore_suspend;
            name-prefix = "z";
        };
        
		nvidia,dai-link-2 {
			link-name = "ti-playback-x";
			cpu-dai = <0xcf>;
     		codec-dai = <&aic32x4>;
          	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 = <2>;
         	srate = <44100>;
         	num-channel = <2>;
        	ignore_suspend;
            name-prefix = "x";
		};
	};

and added the status token to the codec tree:

i2c@3160000 {
...
		
		aic32x4: tlv320aic32x4@18 {
			compatible = "ti,tlv320aic32x4";
			reg = <0x18>;
                        status = "okay"
		};
	};

I have also verified that the device on address 0x18 exists:

i2cdetect -r 1

The previous error went away!!!

But… I cannot find any indication that the tlv320aic32x4 device was probed.

I get the following on the terminal:

[    0.293058] iommu: Adding device <b>sound_ref</b>
 to group 38
...
[    3.719713] tegra210_adsp_audio_platform_probe: platform probe started
[    3.720269] tegra210-adsp adsp_audio: Default param-type to BYTE for mp3-dec1
[    3.720497] tegra210-adsp adsp_audio: Default param-type to BYTE for spkprot
[    3.720817] tegra210-adsp adsp_audio: Default param-type to BYTE for src
[    3.721069] tegra210-adsp adsp_audio: Default param-type to BYTE for aac-dec1
[    3.724888] tegra210-adsp adsp_audio: Default param-type to BYTE for aec
[    3.724893] tegra210-adsp adsp_audio: adma channel page address dt entry not found
[    3.724895] tegra210-adsp adsp_audio: using adma channel page 0
[    3.729749] tegra210_adsp_audio_platform_probe probe successfull.
[    3.729749] OPE platform probe
[    3.729837] OPE platform probe successful
[    3.731854] input: tegra-hda HDMI/DP,pcm=3 as /devices/3510000.hda/sound/card0/input0
[    3.731977] input: tegra-hda HDMI/DP,pcm=7 as /devices/3510000.hda/sound/card0/input1
[    3.740611] mmc1: SDHCI controller on 3440000.sdhci [3440000.sdhci] using ADMA 64-bit with 64 bit addr
[    3.740955] sdhci-tegra 3460000.sdhci: Parent select= pll_p rate=408000000
[    3.741169] sdhci-tegra 3460000.sdhci: Parent select= pll_c4_out0 rate=196249804
[    3.741609] sdhci-tegra 3460000.sdhci: Client registration for eMC Successful
[    3.742796] tegra-snd-t186ref-mobile-rt565x sound: Failed to get HP Det GPIO, should be handled by codec
[    3.773084] mmc1: queuing unknown CIS tuple 0x80 (5 bytes)
[    3.776624] mmc2: SDHCI controller on 3460000.sdhci [3460000.sdhci] using ADMA 64-bit with 64 bit addr
[    3.803685] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF1 <-> ADMAIF1 mapping ok
[    3.803825] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF2 <-> ADMAIF2 mapping ok
[    3.803940] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF3 <-> ADMAIF3 mapping ok
[    3.804031] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF4 <-> ADMAIF4 mapping ok
[    3.804124] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF5 <-> ADMAIF5 mapping ok
[    3.804211] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF6 <-> ADMAIF6 mapping ok
[    3.804329] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF7 <-> ADMAIF7 mapping ok
[    3.804425] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF8 <-> ADMAIF8 mapping ok
[    3.804512] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF9 <-> ADMAIF9 mapping ok
[    3.804645] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF10 <-> ADMAIF10 mapping ok
[    3.804738] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF11 <-> ADMAIF11 mapping ok
[    3.804850] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF12 <-> ADMAIF12 mapping ok
[    3.804937] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF13 <-> ADMAIF13 mapping ok
[    3.805026] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF14 <-> ADMAIF14 mapping ok
[    3.805115] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF15 <-> ADMAIF15 mapping ok
[    3.805227] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF16 <-> ADMAIF16 mapping ok
[    3.805324] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF17 <-> ADMAIF17 mapping ok
[    3.805429] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF18 <-> ADMAIF18 mapping ok
[    3.805530] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF19 <-> ADMAIF19 mapping ok
[    3.805617] tegra-snd-t186ref-mobile-rt565x sound: ADMAIF20 <-> ADMAIF20 mapping ok
[    3.809693] tegra-snd-t186ref-mobile-rt565x sound: ADSP-FE1 <-> ADSP PCM1 mapping ok
[    3.809788] tegra-snd-t186ref-mobile-rt565x sound: ADSP-FE2 <-> ADSP PCM2 mapping ok
[    3.809817] compress asoc: ADSP-FE3 <-> ADSP COMPR1 mapping ok
[    3.809844] compress asoc: ADSP-FE4 <-> ADSP COMPR2 mapping ok
[    3.847648] input: tegra-snd-t186ref-mobile-rt565x Headphone Jack as /devices/sound/sound/card1/input2
[    3.848302] tegra-snd-t186ref-mobile-rt565x sound: codec-dai "dit-hifi" registered
[    3.848305] tegra-snd-t186ref-mobile-rt565x sound: <b>This is a dummy codec</b>

Any suggestions?

Igal

AS I do not understand at the moment the difference between the sound and the sound_ref tokens I have removed the sound token which was defining the tegra-snd-t186ref-mobile-rt565x “audio card” and renamed the tegra-snd-t210ref “audio card” sound_ref token to sound token, leaving in the DT a single sound token. and the error returned:

[    0.207927] /iommu@12000000: could not get #stream-id-cells for /i2c@3160000/tlv320aic32x4.0-0018@18

or

[    0.207927] /iommu@12000000: could not get #stream-id-cells for /i2c@3160000/tlv320aic32x4@18

Again: the I2C communication is available, because when I remove the power from the CODEC chip the i2cdetect tool does not detect it.

Any suggestions?

Thanks.

Anyone?

  1. I added the following:
i2c@3160000 {
...
		
		aic32x4: tlv320aic32x4@18 {
			compatible = "ti,tlv320aic32x4";
			reg = <0x18>;
                        <b>#stream-id-cells = <0x1>;</b>
		};
	};

The error went away. not sure if this is the correct way to solve the issue.

  1. Moreover, it looks like the I2C probe function from within the tlc320aic32x4-i2c is never invoked?
    Is there anything that I’m missing?

Thanks.

Some more information:

cat /sys/bus/i2c/devices/0-0018/name

printed out

tlv320aic32x4

anyone?

Hello,

BTW, is there any driver that has to be enabled in the kernel configuration to be invoked by the tegra-audio-t210ref in the device tree?
I have noticed that the file sound/soc/tegra-alt/tegra_t210ref_alt.c was not compiled how should I set the kernel configuration so this file will be compiled. I think that this file has to be compiled because it includes the compatibility to

nvidia,tegra-audio-t210ref

I think that the configuration which enables the compilation is SoC Audio support for T210Ref but it is not available in the kernel configuration although the search finds this node. I think that the Tegra21x family SOC has to be enabled to make the SoC Audio support for T210Ref enabled.

Can anyone support me on this one?

Thanks.

I am starting to understand with the assistance of https://devtalk.nvidia.com/default/topic/1022143/connecting-tx2-with-external-codec-through-i2s-in-tdm-mode/.

TX2 is Tegra-186, while TX1 is Tegra-210. This means that I need to provide in the DT under the sound token instead of compatible = “nvidia,tegra-audio-t210ref”; the following compatibility compatible = “nvidia,tegra-audio-t186ref”;.

The driver that actually supports this compatibility is in kernel/t18x/sound/soc/tegra-alt/tegra_t186ref_alt.c, but the problem is that although I make the kernel, this file is never compiled (there is no tegra_t186ref_alt.o upon compilation).
I have tried to set the kernel configuration, without any success.

So I looked into the Makefile.t18x and found that in order to compile the file CONFIG_SND_SOC_TEGRA_T186REF_FPGA_ALT has to be defined. I grepped it in /usr/src and found it only in the Makefile.t18x file.

Is there anyone in NVidia that can solve the mystery?

Thanks.

I am starting to understand with the assistance of https://devtalk.nvidia.com/default/topic/1022143/connecting-tx2-with-external-codec-through-i2s-in-tdm-mode/.

TX2 is Tegra-186, while TX1 is Tegra-210. This means that I need to provide in the DT under the sound token instead of compatible = “nvidia,tegra-audio-t210ref”; the following compatibility compatible = “nvidia,tegra-audio-t186ref”;.

The driver that actually supports this compatibility is in kernel/t18x/sound/soc/tegra-alt/tegra_t186ref_alt.c, but the problem is that although I make the kernel, this file is never compiled (there is no tegra_t186ref_alt.o upon compilation).
I have tried to set the kernel configuration, without any success.

So I looked into the Makefile.t18x and found that in order to compile the file CONFIG_SND_SOC_TEGRA_T186REF_FPGA_ALT has to be defined. I grepped it in /usr/src and found it only in the Makefile.t18x file.

Is there anyone in NVidia that can solve the mystery?

Thanks.

Hi Igal,

Yes there are different driver files for TX1 and TX2. The default driver that we use for testing purposes with TX2 is kernel/t18x/sound/soc/tegra-alt/tegra_t186ref_mobile_rt565x.c and I recommend that you start with this. This driver is selected by the CONFIG_SND_SOC_TEGRA_T186REF_MOBILE_ALT kconfig. The compatible string in the DT files you need to look for is ‘nvidia,tegra-audio-t186ref-mobile-rt565x’ and you should find this in a file called “tegra186-quill-common.dtsi”.

BTW, I don’t think that you need to add the ‘stream-id-cells’ property as this is for the IOMMU and we should not need this for audio purposes.

Regards,
Jon

Hi,

It seems like there was a problem with the way that I compile the device tree. I saw somewhere that the device tree has to be de-compiled and then the dts file is to be used as a basis for changes. This method imposes some problems with the DT, i.e., it includes numeric handles instead of aliases which are much more convenient. Moreover when I was trying to compile aliases on the single de-compiled file, the aliases were not recognized by the compiler.
So the method I was using is (and it is an incorrect one!!!):

  1. de-compiling the dtb file and getting dts file
  2. copying the dts file to a remote machine
  3. modifying the dts file
  4. compiling the dts file producing dtb file
  5. flashing the dtb file to the target machine

The good practice is (AFAIK)

  1. modifying the dts file on the target machine
  2. compiling the dts file producing dtb file
  3. copying the dtb file to a remote machine
  4. flashing the dtb file to the target machine

I have updated the device tree per https://devtalk.nvidia.com/default/topic/1028080/jetson-tx2/problematic-clock/1

But now I am getting the following errors:

...
[    3.640078] tegra-snd-t186ref-mobile-rt565x sound: Failed to get HP Det GPIO, should be handled by codec
[    3.641621] tegra-snd-t186ref-mobile-rt565x sound: ASoC: <b>CODEC DAI tlv320aic32x4-hifi not registered</b>
[    3.641625] tegra-snd-t186ref-mobile-rt565x sound: snd_soc_register_card failed (-517)
...
[    3.680763] tegra-snd-t186ref-mobile-rt565x: probe of sound failed with error -16
....
[   13.186301] tlv320aic32x4 1-0018: Failed getting the mclk. // this is a warning during registration

although the tlv320aic32x4-hifi is not registered (per above statement), when I apply the following, upon boot completion:

cat /sys/kernel/debug/asoc/codecs
tlv320aic32x4 1-0018
.... 
cat /sys/kernel/debug/asoc/dais
tlv320aic32x4-hifi
....

I do see the CODEC and the DAI.

any suggestions?

Hi Igal,

I am not concerned about the error …

tegra-snd-t186ref-mobile-rt565x sound: snd_soc_register_card failed (-517)

… as this just means that the codec is not registered yet but -517 is a probe deferral and means we will retry again later.

However, I am more concerned about …

tegra-snd-t186ref-mobile-rt565x: probe of sound failed with error -16

Looking at tegra_t186ref_mobile_rt565x.c in the tegra_t186ref_driver_probe() function we have …

ret = snd_soc_register_card(card);
	if (ret) {
		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
			ret);
		goto err_fini_utils;
	}
        
        ...

err_fini_utils:
	tegra_alt_asoc_utils_fini(&machine->audio_clock);
err_alloc_dai_link:
	tegra_machine_remove_dai_link();
	tegra_machine_remove_codec_conf();
err:

	return ret;
}

So it should be returning -517 and not -16. Do you have any local changes that you have made to this file that would be causing it to return -16 and not -517? If it returns -517 then it will retry the probe again later, which is what we want.

Jon