[Kernel Compilation] Assign GPIO to PPS

I am currently looking to add a PPS input signal to Jetson TX2 for clock synchronization and I am not able to map it to a specific IO.

I have followed the steps about kernel customization on the documentation, and I’ve enabled the pps support on the compilation options (.config) by looking for the following chunk and changing it to:

#
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set

#
# PPS clients support
#
CONFIG_PPS_CLIENT_KTIMER=y
CONFIG_PPS_CLIENT_LDISC=y
CONFIG_PPS_CLIENT_GPIO=y

After enabling the PPS feature I need to map an external IO as a source for PPS, so I have changed the following file:

~/nvidia/nvidia_sdk/JetPack_4.3_Linux_JETSON_TX2/Linux_for_Tegra/sources/hardware/nvidia/soc/t18x/kernel-dts/tegra186-soc/tegra186-soc-base.dtsi

adding:

pps {
    gpios = <&gpio TEGRA_MAIN_GPIO(TEGRA_MAIN_GPIO_PORT_J, 5) GPIO_ACTIVE_HIGH>;
    compatible = "pps-gpio";
    status = "okay";
};

This is currently throwing “syntax error” on the “gpios” line.

Setup Information:
Board: NVIDIA Jetson TX2
Jetpack version: 4.3
Source checkout tag: tegra-l4t-r32.3.1
PPS pin: J5 on the J21 header

Just found the solution, the correct sintax is:

pps {
    gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(TEGRA_MAIN_GPIO_PORT_J, 5) GPIO_ACTIVE_HIGH>;
    compatible = "pps-gpio";
    status = "okay";
};
1 Like