GPIO Interrupt


I’m a beginner to jetson tx2. I am reading signal from GPIO pin to detect edges in signal. I want to go with interrupts but I do not have any idea to lead it with c language. can any on e help me to go with interrupt in GPIO?

hello sanjeewaapp,

you’re able to access the kernel sources via Jetson Download Center.

please check the tegra_gpio_readl() functions for more details.

Hi Jerry,

Thanks for your reply. I’ll refer it. Where is it located?

hello sanjeewaapp,

you could check below for example,

Hi Jerry,

I got. Can I use it directly?


Hi sanjeewaapp,

Have you tried the tegra_gpio_readl() function to get the result you want?
Any further support required?


Hi kayccc,

I could not be able to figure it out. still I am searching a way to do it. Now I am looking to develop kernel module that can be used to interface GPIO. can you help me to figure it out readl() function?


hello spke12,

you can refer to the tegra_gpio_readl() function to read the pin status, and implement your own interrupt function to handle that. thanks

hello Jerry,

You are saying that I have to implement my own kernel module aren’t you?


hello spke12,

yes, please refer to that function and implement your own interrupt function.

Hello JerryChang,

we want to use the gpio pin as interrupt, just like spke12’s case.

I had saw the source code:

And I also find some information in the /proc/interrupts.

256 tegra-gpio 125 Edge

I had read the sourcecode:

the cd detect pin is GPIO3_PP.05 and the device tree is
cd-gpios = <&tegra_main_gpio TEGRA_MAIN_GPIO(P,5) 0>

but in the sourcecode of sdhci-tegra.c

a.plat->cd_gpio = of_get_named_gpio(np, “cd-gpios”, 0);
c.tegra_host->cd_irq = gpio_to_irq(plat->cd_gpio);


then I try to find something like “request_irq or request_gpio_irq”

there is nothing here.

I don’t understand, how to bind the irq number to the interrupt respond server.


hello wuyankun1986,

I don’t understand, how to bind the irq number to the interrupt respond server.
please refer to this function for more details,


int gpiod_to_irq(const struct gpio_desc *desc)
         struct gpio_chip        *chip;
         int                     offset;

         if (!desc)
                 return -EINVAL;
         chip = desc->chip;
         offset = gpio_chip_hwgpio(desc);
         return chip->to_irq ? chip->to_irq(chip, offset) : -ENXIO;