How to use S2 button as an user-defind button?

I am trying to read the signal from S2 button. I figure out its gpio number, but it is occupied by the kernel to control volume down, I think. So how can I unconfigure this original function and read the signal from the button?

Thanks in advance

hello chengp,

you may access TX2 Product Design Guide and check [Table 5. Power & System Pin Descriptions].
please also download Pinmux spreadsheets and refer to Pinmux Changes session to have customization.

You need to remove the volume_down key from your dts file, rebuild it, and load it to your device. Here is what you are looking for to remove:

volume_down {
        label = "Volume Down";
        gpios = <&tegra_aon_gpio TEGRA_AON_GPIO(FF, 2) GPIO_ACTIVE_LOW>;
        linux,code = <KEY_VOLUMEDOWN>;

If you remove that from your DTS/DTSI file you should be able to use the GPIO however you like in your design.

1 Like

Thanks for reply. Will check.

Thanks. Got it! Trying to find it.