GPIO Input

This has gotten the better of me. What am I missing?
I have a button I want to read from GPIO. Here’s the schematic:

The 3.3V is coming from J21 Pin 1.
The GND is coming from J21 Pin 6
The GPIO is J21 Pin 13.

The Jetson TX1 Developer Kit Carrier Board Specification, Table 16 Lists Pin # 13:
Signal Name: AUDIO_CDC_IRQ
Jetson TX1 Pin Name: GPIO_PE6
Description: Audio Codec Interrupt
Type/Direction: Bidir

The Jetson TX1 Generic Customer Pinmux Spreadsheet:
Device Tree Pin Name: pe6
Customer Usage: AUD_INT

From the Kernel Sources:
#define TEGRA_PIN_PE6 _GPIO(38)

So it looks like in sysfs terms it’s gpio38. When used as in Output attached to an LED, the regular sysfs calls operate correctly.
However, when used as an Input (commands performed as super user)

$ echo 38 > /sys/class/gpio/export
$ echo in > /sys/class/gpio/gpio38/direction
$ cat /sys/class/gpio/gpio38/value

Returns 0

Pressing the push button, then executing:

$ cat /sys/class/gpio/gpio38/value

Returns 1 as expected.
However, releasing the push button and then executing:

$ cat /sys/class/gpio/gpio38/value

Returns 1
My expectation is that the value should come back as 0. Sometimes the value goes back low after around 45 seconds, other times it just stays high. Looking at the TX1 schematic, it looks as if this line goes through a level shifter then to CVM 1.0.

So what am I missing or bungling? Does there need to be a dtb overlay for using the GPIO like this?

try change R1 to 1KΩ,R2 to 100Ω

By default an audio i2s controller uses this GPIO. I see your steps for exporting the pin or changing the mode, but did you disable audio output in pinmux?

This works! Thank you yermin, now I can sleep at night.
What was the thinking behind choosing 1KΩ ? Did I miss something in the documentation, or was it an experience thing?

According to the TXB0108’s manual, each port is connected with a 4K resistor, which must be calculated when the TXB0108 is driven.
Using 10K+1K resistor, low voltage can only go to 3.3V* (11/15) =2.42V
Using 1K+100 resistor, low voltage can be 3.3V* (1.1/5.1) =0.71V

Thank you yermin.
I never even thought about looking at the level shifter, they had always been my friend before.

If I read the spreadsheet correctly (and that’s a big if), the “pin is muxed” as a GPIO. SFI00, SFI01, SFI02, SF03 are all blank. I am under the impression that the signal has to be muxed to one of the SFIXX for it to be actually used for something like audio output. Is that incorrect?
Another impression that I have is that names on the GPIO signals that are not being used are placeholders for how people may actually use them, not how they are currently hooked up.
If this is not the case, it’s not clear to me how the pinmux needs to be changed to make a pin a general GPIO again.

Here’s an article about sysfs GPIO mappings to the J21 Header that I have written along with a demo, take a look: