Dac conected on I2S4 doesnt work

I am little bit confused with few things

mux pins (I2S0_ DIN DOUT CLK FS on SOM ) which is pins for I2S4 (PJ05,PJ06,PJ04,PJ07)
i am not able prove if it is GPIO or I2S4B

because if i

cat /sys/kernel/debug/tegra_gpio | grep J
 J: 2:1 f0 00 00 00 00 00 000000

f0 mean thaht upper 4 bits of port are GPIO which is P04-P07

but in dts i has

dap4_din_pj5 {
				nvidia,pins = "dap4_din_pj5";
				nvidia,function = "i2s4b";          //miro change rsvd1 to i2s4b
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;  //miro set NONE instead DOWN
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			dap4_dout_pj6 {
				nvidia,pins = "dap4_dout_pj6";
				nvidia,function = "i2s4b";               //miro change rsvd1 to i2s4b
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;    //miro set NONE instead DOWN
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
				nvidia,open-drain = <TEGRA_PIN_DISABLE>; // miro add this
			};

			dap4_fs_pj4 {
				nvidia,pins = "dap4_fs_pj4";
				nvidia,function = "i2s4b";               //miro change rsvd1 to i2s4b
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;     //miro set NONE instead DOWN
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
				nvidia,open-drain = <TEGRA_PIN_DISABLE>; // miro add this
			};

			dap4_sclk_pj7 {
				nvidia,pins = "dap4_sclk_pj7";
				nvidia,function = "i2s4b";               //miro change rsvd1 to i2s4b
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;     //miro set NONE instead DOWN
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
				nvidia,open-drain = <TEGRA_PIN_DISABLE>; // miro add this
			};

which is correct

and if i try

grep dap4 /sys/kernel/debug/tegra_pinctrl_reg
Bank: 1 Reg: 0x70003144 Val: 0x00000040 -> dap4_fs_pj4
Bank: 1 Reg: 0x70003148 Val: 0x00000040 -> dap4_din_pj5
Bank: 1 Reg: 0x7000314c Val: 0x00000040 -> dap4_dout_pj6
Bank: 1 Reg: 0x70003150 Val: 0x00000040 -> dap4_sclk_pj7

and

cat /sys/kernel/debug/pinctrl/700008d4.pinmux/pinconf-groups | grep dap4
92 (dap4_fs_pj4): 
93 (dap4_din_pj5): 
94 (dap4_dout_pj6): 
95 (dap4_sclk_pj7): 

so where is the problem

What’s the status of below in device tree?

                e2614-rt5658-audio {
                        gpios = <0x4c 0x0 0x4d 0x0 0x4e 0x0 0x4f 0x0 0xd8 0x0 0x95 0x0>;
                        gpio-hog;
                        status = "disabled";
                        label = "I2S4_LRCLK", "I2S4_SDIN", "I2S4_SDOUT", "I2S4_CLK", "AUDIO_MCLK", "AUD_RST";
                        phandle = <0xc4>;
                        function;
                        linux,phandle = <0xc4>;
                };


status was disabled

i try to set okay but nothing happend

and pins is still gpio instead sfio

cat /sys/kernel/debug/tegra_gpio | grep J
 J: 2:1 f0 00 00 00 00 00 000000

stil f0

i read manual about pinmux that i must change U boot (rebuild it) using pinmux crazy excel
but i haven’t MS Windows and in libreoffice macros doesnt work .
I compile kernel many times but U boot never.

or it is possible change pinmux without rebuild u boot ? change other dts ? or what
i was read doc but don’t understand it

Could you try r32.7.3

nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/tegra_gpio | grep J
[sudo] password for nvidia:
 J: 2:1 00 00 00 00 00 00 000000
nvidia@tegra-ubuntu:~$ cat /etc/nv_tegra_release
# R32 (release), REVISION: 7.3, GCID: 31982016, BOARD: t210ref, EABI: aarch64, DATE: Tue Nov 22 17:30:08 UTC 2022
nvidia@tegra-ubuntu:~$

results

cat /sys/kernel/debug/tegra_gpio | grep J
 J: 2:1 f0 00 00 00 00 00 000000
cat /etc/nv_tegra_release
# R32 (release), REVISION: 7.4, GCID: 33514132, BOARD: t210ref, EABI: aarch64, DATE: Fri Jun  9 04:25:08 UTC 2023

Dump the device tree to check.

sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

extracted_proc.dts.txt (323.4 KB)

Remove all of the TEGRA_GPIO(j,*) in the device tree.

        gpio: gpio@6000d000 {
                gpio-init-names = "default";
                gpio-init-0 = <&gpio_default>;

                gpio_default: default {
                        gpio-input = <
                                TEGRA_GPIO(BB, 0)
                                TEGRA_GPIO(B, 4)
                                TEGRA_GPIO(B, 5)
                                TEGRA_GPIO(B, 6)
                                TEGRA_GPIO(B, 7)
                                TEGRA_GPIO(DD, 0)
                                TEGRA_GPIO(E, 6)
                                TEGRA_GPIO(S, 5)
                                TEGRA_GPIO(A, 5)
                                TEGRA_GPIO(X, 4)
                                TEGRA_GPIO(X, 5)
                                TEGRA_GPIO(X, 6)
                                TEGRA_GPIO(Y, 1)
                                TEGRA_GPIO(Y, 2)
                                TEGRA_GPIO(V, 0)
                                TEGRA_GPIO(Z, 0)
                                TEGRA_GPIO(Z, 2)
                                TEGRA_GPIO(J, 5)
                                TEGRA_GPIO(J, 6)
                                TEGRA_GPIO(J, 4)
                                TEGRA_GPIO(J, 7)
                                TEGRA_GPIO(G, 2)
                                TEGRA_GPIO(G, 3)
                                TEGRA_GPIO(C, 0)
                                TEGRA_GPIO(C, 1)
                                TEGRA_GPIO(C, 2)
                                TEGRA_GPIO(C, 3)
                                TEGRA_GPIO(C, 4)
                                TEGRA_GPIO(H, 2)
                                TEGRA_GPIO(H, 5)
                                TEGRA_GPIO(H, 6)
                                TEGRA_GPIO(I, 1)
                                TEGRA_GPIO(CC, 4)
                                >;
                        gpio-output-low = <
                                TEGRA_GPIO(S, 7)
                                TEGRA_GPIO(T, 0)
                                TEGRA_GPIO(Z, 3)
                                TEGRA_GPIO(H, 0)
                                TEGRA_GPIO(H, 3)
                                TEGRA_GPIO(H, 4)
                                TEGRA_GPIO(H, 7)
                                TEGRA_GPIO(I, 0)
                                TEGRA_GPIO(I, 2)
                                >;
                        gpio-output-high = <
                                TEGRA_GPIO(A, 6)
                                TEGRA_GPIO(X, 3)
                                TEGRA_GPIO(CC, 7)
                                >;
                };

its already done

so in decompiled dts u cant see J6, j4, j7 which is 0x4e, 0x4c, 0x4f in gpio (in decompiled dts which i sent in previous reply)

my original dts is


gpio: gpio@6000d000 {
		gpio-init-names = "default";
		gpio-init-0 = <&gpio_default>;

		gpio_default: default {
			gpio-input = <
				TEGRA_GPIO(BB, 0)
				TEGRA_GPIO(B, 4)
				TEGRA_GPIO(B, 5)
				TEGRA_GPIO(B, 6)
				TEGRA_GPIO(B, 7)
				TEGRA_GPIO(DD, 0)
				TEGRA_GPIO(E, 6)
				TEGRA_GPIO(S, 5)
				TEGRA_GPIO(A, 5)
				TEGRA_GPIO(X, 4)
				TEGRA_GPIO(X, 5)
				TEGRA_GPIO(X, 6)
				TEGRA_GPIO(Y, 1)
				TEGRA_GPIO(Y, 2)
				TEGRA_GPIO(V, 0)
				TEGRA_GPIO(Z, 0)

				TEGRA_GPIO(J, 5)
				/*  // miro coment it because its SFIO not GPIO
				
				TEGRA_GPIO(J, 6)
				TEGRA_GPIO(J, 4)
				TEGRA_GPIO(J, 7)
				*/
				TEGRA_GPIO(G, 2)
				TEGRA_GPIO(G, 3)
				TEGRA_GPIO(C, 0)
				TEGRA_GPIO(C, 1)
				TEGRA_GPIO(C, 2)
				TEGRA_GPIO(C, 3)
				TEGRA_GPIO(C, 4)
				TEGRA_GPIO(H, 2)
				TEGRA_GPIO(H, 5)
				TEGRA_GPIO(H, 6)
				TEGRA_GPIO(I, 1)
				
				>;
			gpio-output-low = <
				TEGRA_GPIO(S, 7)
				TEGRA_GPIO(T, 0)
				TEGRA_GPIO(Z, 3)
				TEGRA_GPIO(H, 0)
				TEGRA_GPIO(H, 3)
				TEGRA_GPIO(H, 4)
				TEGRA_GPIO(H, 7)
				TEGRA_GPIO(I, 0)
				TEGRA_GPIO(I, 2)
				
				TEGRA_GPIO(Z, 2) /* miro meve it here */
				
				>;
			gpio-output-high = <
				TEGRA_GPIO(A, 6)
				TEGRA_GPIO(X, 3)
				TEGRA_GPIO(CC, 7)
				TEGRA_GPIO(CC, 4) /* miro move it here */
				
				>;
		};
	};

so its already done before this thread starts,

Modify the status to okay.
And apply the patch from below link.

               e2614-rt5658-audio {
                        gpios = <0x4c 0x0 0x4d 0x0 0x4e 0x0 0x4f 0x0 0xd8 0x0 0x95 0x0>;
                        gpio-hog;
                        status = "disabled";
                        label = "I2S4_LRCLK", "I2S4_SDIN", "I2S4_SDOUT", "I2S4_CLK", "AUDIO_MCLK", "AUD_RST";
                        phandle = <0xc4>;
                        function;
                        linux,phandle = <0xc4>;
                };

ok i applied patch and set okay to e2614-rt5658-audio

now i see J pins az SFIO

cat /sys/kernel/debug/tegra_gpio | grep J
 J: 2:1 00 00 00 00 00 00 000000

but dac is silent if i try

amixer -c tegrasndt210ref  cset name="I2S4 Mux" "ADMAIF1"

speaker-test -r 48000 -F S16_LE -c 2 -twav -D plughw:CARD=tegrasndt210ref,DEV=0

Hi again, how can I apply this patch please ? I can’t find drivers/gpio/gpio_tegra.c
Do I need u-boot for this?

Hi
this file is part of kernel sources , so i applied patch manually (edit file and add lines +) , compile kernel and install it

The file in the 
/kernel/kernel-4.9/driver/gpio/

Thanks Miro and Shane, found it and modified it.

To apply the patch I’m following this procedure and am currently compiling the kernel which takes a long time.

Last question : do applying a patch reset the board (delete data, board configuration
) ? or is it safe ?

It’s safe.

1 Like

I followed instructions to apply the patch :

$ sudo apt install build-essential bc
$ TEGRA_KERNEL_OUT="compiled_kernel"
$ cd "[...]/kernel-4.9"
$ mkdir -p $TEGRA_KERNEL_OUT
$ make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig
$ make ARCH=arm64 O=$TEGRA_KERNEL_OUT
  1. Replace <release_packagep>/Linux_for_Tegra/kernel/Image with a copy of:
    $TEGRA_KERNEL_OUT/arch/arm64/boot/Image
  2. Replace the contents of Linux_for_Tegra/kernel/dtb/ with the contents of:
    $TEGRA_KERNEL_OUT/arch/arm64/boot/dts/
$ sudo make ARCH=arm64 O=$TEGRA_KERNEL_OUT modules_install \
    INSTALL_MOD_PATH=<top>/Linux_for_Tegra/rootfs/

but got an error when trying to use the “apply_binaries.sh” :

user@user-desktop:~/Documents/Linux_for_Tegra$ sudo ./apply_binaries.sh
Using rootfs directory of: /home/user/Documents/Linux_for_Tegra/rootfs
find: ‘/home/user/Documents/Linux_for_Tegra/rootfs/etc/passwd’: No such file or directory
||||||||||||||||||||||| ERROR |||||||||||||||||||||||
-----------------------------------------------------
1. The root filesystem, provided with this package,
   has to be extracted to this directory:
   /home/user/Documents/Linux_for_Tegra/rootfs
-----------------------------------------------------
2. The root filesystem, provided with this package,
   has to be extracted with 'sudo' to this directory:
   /home/user/Documents/Linux_for_Tegra/rootfs
-----------------------------------------------------
Consult the Development Guide for instructions on
extracting and flashing your device.
|||||||||||||||||||||||||||||||||||||||||||||||||||||

I saw that MIro managed to apply the patch 20 min after you sent your reply, but the process I followed took several hours, and doesn’t work in the end.

Can you tell me how should I apply the patch step by step please ?
Or if these instructions are correct, what did I do wrong to get this error ?

Thanks in advance

Up; should I recreate a topic for this issue ?

Please file new topic for new problem.

Thanks