Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Userspace GPIO Interrupts using sysfs

I would like to use interrupts with GPIO on userspace using sysfs. I use these commands :

[root@at91]:gpio109 > echo 109 > export
[root@at91]:gpio109 > cd gpio109/
[root@at91]:gpio109 > ll
-rw-r--r--    1 root     0            4096 Jan  1 00:17 direction
drwxr-xr-x    2 root     0               0 Jan  1 00:17 power
lrwxrwxrwx    1 root     0               0 Jan  1 00:17 subsystem -> ../../gpio
-rw-r--r--    1 root     0            4096 Jan  1 00:17 uevent
-rw-r--r--    1 root     0            4096 Jan  1 00:17 value

The gpio works well but I can't use interrupts. I read everywhere i must have an edge file to poll this file. But on my system this file doesn't exist. I made a lot of tries to find a solution but remain unsuccessfull.

My target is an AT91SAM9263 on linux kernel 2.6.30.

At the boot of my board I got this message on interrupts :

AT91: 160 gpio irqs in 5 banks

which show that the function at91_gpio_irq_setup() is well executed.

Have you any idea ?

like image 242
lgm42 Avatar asked Feb 21 '23 23:02

lgm42


1 Answers

The "edge" file only exists if that GPIO pin can be configured as a an interrupt generting pin. See: http://www.mjmwired.net/kernel/Documentation/gpio.txt#634.

Since you don't see it, it means the driver and possibly the hardware do not support using that GPIO pin for interrupt source.

like image 135
gby Avatar answered Mar 05 '23 17:03

gby