Audio codec RT5659 on Jetson Nano eMMC with custom carrier board

Hi all,

We are developing AI box using Jetson nano eMMC card and customize carrier board but the audio is not working. Our design and configuration is described below:

We have modified some dts files. However there are some problems with I2C and I2S configuration.

tegra210-porg-super-module-e2614.dtsi

	e2614_rt5658_a00: rt5659.1-001a@1a {
		compatible = "realtek,rt5658";
		reg = <0x1a>;
		status = "okay";

		/ gpio for jack detection /
		gpios = <&gpio TEGRA_GPIO(B, 6) 0>;

		/ refer include/sound/rt5659.h for the values to be used /
		realtek,jd-src = <1>; / RT5659_JD3 /
		realtek,dmic1-data-pin = <2>; / RT5659_DMIC1_DATA_GPIO5 /
	};

tegra210-porg-p3448-common.dtsi

tegra_sound: sound {
	status = "okay";
	compatible = "nvidia,tegra-audio-t210ref-mobile-rt565x";
	nvidia,model = "tegra-snd-t210ref-mobile-rt565x";

	clocks = <&tegra_car TEGRA210_CLK_PLL_A>,
		 <&tegra_car TEGRA210_CLK_PLL_A_OUT0>,
		 <&tegra_car TEGRA210_CLK_EXTERN1>;
	clock-names = "pll_a", "pll_a_out0", "extern1";
	assigned-clocks = <&tegra_car TEGRA210_CLK_EXTERN1>;
	assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>;

	nvidia,num-codec-link = <4>;

	nvidia,audio-routing =
		"x Headphone",	"x OUT",
		"x IN",		"x Mic",
		"y Headphone",	"y OUT",
		"y IN",		"y Mic",
		"a IN",		"a Mic",
		"b IN",		"b Mic";

	nvidia,xbar = <&tegra_axbar>;
	mclk-fs = <256>;

	hdr40_snd_link_i2s: i2s_dai_link1: nvidia,dai-link-1 {
		link-name = "spdif-dit-0";
		cpu-dai = <&tegra_i2s4>;
		codec-dai = <&spdif_dit0>;
		cpu-dai-name = "I2S4";
		codec-dai-name = "rt5659-aif1";
		format = "i2s";
		bitclock-slave;
		frame-slave;
		bitclock-noninversion;
		frame-noninversion;
		bit-format = "s16_le";
		srate = <48000>;
		num-channel = <2>;
		ignore_suspend;
		name-prefix = "x";
		status = "okay";
	};

tegra-platforms-audio-dai-links.dtsi

tegra_sound: sound {
	status = "okay";
	nvidia,num-codec-link = <12>;
	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 /

	nvidia,xbar = <&tegra_axbar>;

	nvidia,dai-link-1 {
		link-name = "spdif-dit-0";
		cpu-dai = <&tegra_i2s1>;
		codec-dai = <&spdif_dit0>;
		cpu-dai-name = "I2S4";
		codec-dai-name = "rt5659-aif1";
		format = "i2s";
		bit-format = "s16_le";
		srate = <48000>;
		num-channel = <2>;
		ignore_suspend;
		name-prefix = "x";
		status = "okay";
	};

tegra210-porg-pinmux-p3448-0002-b00.dtsi

	gen3_i2c_scl_pf0 {
		nvidia,pins = "gen3_i2c_scl_pf0";
		nvidia,function = "i2c3";
		nvidia,pull = <TEGRA_PIN_PULL_NONE>;
		nvidia,tristate = <TEGRA_PIN_DISABLE>;
		nvidia,enable-input = <TEGRA_PIN_ENABLE>;
		nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
	};

	gen3_i2c_sda_pf1 {
		nvidia,pins = "gen3_i2c_sda_pf1";
		nvidia,function = "i2c3";
		nvidia,pull = <TEGRA_PIN_PULL_NONE>;
		nvidia,tristate = <TEGRA_PIN_DISABLE>;
		nvidia,enable-input = <TEGRA_PIN_ENABLE>;
		nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
	};

	dap4_din_pj5 {
		nvidia,pins = "dap4_din_pj5";
		nvidia,function = "i2s4b";
		nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
		nvidia,tristate = <TEGRA_PIN_DISABLE>;
		nvidia,enable-input = <TEGRA_PIN_ENABLE>;
	};

	dap4_dout_pj6 {
		nvidia,pins = "dap4_dout_pj6";
		nvidia,function = "i2s4b";
		nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
		nvidia,tristate = <TEGRA_PIN_DISABLE>;
		nvidia,enable-input = <TEGRA_PIN_ENABLE>;
	};

	dap4_fs_pj4 {
		nvidia,pins = "dap4_fs_pj4";
		nvidia,function = "i2s4b";
		nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
		nvidia,tristate = <TEGRA_PIN_DISABLE>;
		nvidia,enable-input = <TEGRA_PIN_ENABLE>;
	};

	dap4_sclk_pj7 {
		nvidia,pins = "dap4_sclk_pj7";
		nvidia,function = "i2s4b";
		nvidia,pull = <TEGRA_PIN_PULL_DOWN>;
		nvidia,tristate = <TEGRA_PIN_DISABLE>;
		nvidia,enable-input = <TEGRA_PIN_ENABLE>;
	};

Boot up log:

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.140-tegra (buildbrain@mobile-u64-4263) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05) ) #1 SM0
[    0.000000] Boot CPU: AArch64 Processor [411fd071]
[    0.000000] OF: fdt:memory scan node memory@80000000, reg size 48,
[    0.000000] OF: fdt: - 80000000 ,  7ee00000
[    0.000000] OF: fdt: - 100000000 ,  7f200000
[    0.000000] Found tegra_fbmem: 00800000@92cb4000
[    0.000000] earlycon: uart8250 at MMIO32 0x0000000070006000 (options '')
[    0.000000] bootconsole [uart8250] enabled
[    1.099380] tegradc tegradc.1: dpd enable lookup fail:-19
[    1.119968] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.126443] tegradc tegradc.1: dp: Failed for I2C write addr:80, size:1, stat:0x10000100
[    1.147514] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.153824] tegradc tegradc.1: dp: Failed to write DPCD data. CMD 0x600, Status 0x10000100
[    1.167158] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.173446] tegradc tegradc.1: dp: Failed to write DPCD data. CMD 0x600, Status 0x10000100
[    1.186777] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.193067] tegradc tegradc.1: dp: Failed to write DPCD data. CMD 0x600, Status 0x10000100
[    1.206416] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.212705] tegradc tegradc.1: dp: Failed to write DPCD data. CMD 0x600, Status 0x10000100
[    1.221003] tegradc tegradc.1: dp: failed to exit panel power save mode (0xfffffff2)
[    1.262583] imx219 7-0010: imx219_board_setup: error during i2c read probe (-121)
[    1.262611] imx219 7-0010: board setup failed
[    1.286405] imx219 8-0010: imx219_board_setup: error during i2c read probe (-121)
[    1.286435] imx219 8-0010: board setup failed
[    1.342820] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.342823] tegradc tegradc.1: dp: Failed to write DPCD data. CMD 0x600, Status 0x10000100
[    1.347841] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.347844] tegradc tegradc.1: dp: Failed to write DPCD data. CMD 0x600, Status 0x10000100
[    1.357674] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.357677] tegradc tegradc.1: dp: Failed to write DPCD data. CMD 0x600, Status 0x10000100
[    1.362703] tegradc tegradc.1: dp: aux write got error (0x10000100)
[    1.362706] tegradc tegradc.1: dp: Failed to write DPCD data. CMD 0x600, Status 0x10000100
[    1.362709] tegradc tegradc.1: dp: failed to exit panel power save mode (0xfffffff2)
[    1.362713] hpd: edid read prepare failed
[    1.672460] rt5659 1-001a: Device with ID register ffffff80 is not rt5659
[    1.699746] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[    1.706633] tegra-asoc: sound: snd_soc_register_card failed (-517)
[    1.741467] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[    1.748478] tegra-asoc: sound: snd_soc_register_card failed (-517)
[    1.756870] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[    1.763752] tegra-asoc: sound: snd_soc_register_card failed (-517)
[    1.794773] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[    1.801658] tegra-asoc: sound: snd_soc_register_card failed (-517)
[    2.275373] cgroup: cgroup2: unknown option "nsdelegate"
[    2.445031] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[    2.451945] tegra-asoc: sound: snd_soc_register_card failed (-517)
[    2.487899] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[    2.494781] tegra-asoc: sound: snd_soc_register_card failed (-517)
[    2.655152] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[    2.662505] tegra-asoc: sound: snd_soc_register_card failed (-517)
[    2.672876] tegra-asoc: sound: ASoC: CODEC DAI rt5659-aif1 not registered
[    2.679795] tegra-asoc: sound: snd_soc_register_card failed (-517)
[    3.520456] using random self ethernet address
[    3.550005] using random host ethernet address
[    4.024798] random: crng init done
[    4.028230] random: 7 urandom warning(s) missed due to ratelimiting
[    4.341936] using random self ethernet address
[    4.349612] using random host ethernet address

Do people have any suggestion for us ??

Hi Quang Vin,
I have the same problem as you. Does anyone help us? ???

Hello!

The above error message indicates that the rt5658 codec is not detected on the I2C bus. Which I2C interface are you using for the codec? You need to ensure that the codec is added to the appropriate I2C interface in device-tree.

Regards,
Jon

hi Jonathanh,

We are using module PIN name I2C2_SCL and I2C2_SDA as I2C interface for the codec. We dont understand about the relationship, convention or mapping between I2C name of SoC described in aliases with I2C output of the card. Could you explain to us please ?

	aliases {
		sdhci0 = "/sdhci@700b0000";
		sdhci1 = "/sdhci@700b0200";
		sdhci2 = "/sdhci@700b0400";
		sdhci3 = "/sdhci@700b0600";
		i2c0 = "/i2c@7000c000";
		i2c1 = "/i2c@7000c400";
		i2c2 = "/i2c@7000c500";
		i2c3 = "/i2c@7000c700";
		i2c4 = "/i2c@7000d000";
		i2c5 = "/i2c@7000d100";
		i2c6 = "/host1x/i2c@546c0000";
		spi0 = "/spi@7000d400";
		spi1 = "/spi@7000d600";
		spi2 = "/spi@7000d800";
		spi3 = "/spi@7000da00";
		qspi6 = "/spi@70410000";
		serial0 = "/serial@70006000";
		serial1 = "/serial@70006040";
		serial2 = "/serial@70006200";
		serial3 = "/serial@70006300";
		rtc0 = "/i2c@7000d000/max77620@3c";
		rtc1 = "/rtc";
	};

Hello!

Yes this is not very clear indeed. Looking at the Tegra X1 TRM, then GEN3 I2C or I2C3 has register address 0x7000c500. So alias i2c2 is the one you want.

Regards,
Jon

Hi Jonathanh,
I agree with you, alias i2c2 = “/ i2c @ 7000c500”;
But under the Symbols section, I also see:

hdr40_i2c1 = “/ i2c @ 7000c400”;
i2c2 = “/ i2c @ 7000c400”;
i2c3 = “/ i2c @ 7000c500”;

So I have to assign gen3_i2c_scl_pf0 with function = i2c? to match?

Hello!

You should be able to simply add in directly under the i2c@7000c500 node …

i2c@7000c500 {
	e2614_rt5658_a00: rt5659.1-001a@1a {
		compatible = "realtek,rt5658";
		reg = <0x1a>;
		status = "okay";

		/ gpio for jack detection /
		gpios = <&gpio TEGRA_GPIO(B, 6) 0>;

		/ refer include/sound/rt5659.h for the values to be used /
		realtek,jd-src = <1>; / RT5659_JD3 /
		realtek,dmic1-data-pin = <2>; / RT5659_DMIC1_DATA_GPIO5 /
	};
};

You could also use the symbol name i2c3, but maybe it is clearer to be explicit in this case.

Regards
Jon

1 Like