GPIO Interrupts on TX2

https://devtalk.nvidia.com/default/topic/1009932/jetson-tx1/gpio-interrupts/?offset=11#5245753

I follow the above link on external interrupt.

I try to use “GPIO8_ALS_PROX_INT” (on developer kit J21, pin 37) as an external interrupt. I followed the Derekmolloy tutorial which is a great tutorial and helps a lot.

Now I want to synchronize the time of interrupt in the user space, i.e. to notify application (C/C++ code) when external interrupt happens and being handled in the kernel space. I don’t want to use poll method, better interrupt. How can I generate an interrupt from kernel space to user space?

I have another concern is writing of kobject, because of more restriction of new kernel, writing of kobject seems not possible, any solution for this situation?

I also would like to add the module into kernel in application (C/C++ code) without doing it manually as “$sudo insmod button.ko”, any clue to do this?

hello tao.wang,

please check the VI driver,
there’s wait for interrupt function for your reference,
thanks

r28.1_sources/kernel/kernel-4.4/drivers/media/platform/tegra/camera/vi/vi4_fops.c

wait_event_interruptible(chan->start_wait,
                                          !list_empty(&chan->capture) ||
                                          kthread_should_stop());

Thanks JerryChang,

So this a poll and waiting for thread for the interrupt, which is as my searching. So as it is firmware, not hardware, so poll and separate thread “full time” waiting is required.