Userspace interrupt for gpio pins that don't have edge sysfs

687 views Asked by At

In my platform, there is a PCA9555 CMOS device which has 16 GPIO pins and a separate INT pin for interrupts. So long, my application was periodically reading a particular gpio pin. I need to change it to an interrupt driven way. From the spec : It has an open-drain interrupt pin which is activated when one of the 16 port pins changes state and the pin is configured as an input. A pin configured as an output cannot cause an interrupt.

None of the 16 pins have interrupt support themselves and I don't see edge sysfs in /sys/class/gpio/gpio/[pin_no]. So poll() on value file is not blocking. And I infer from the spec that an interrupt would be triggered to CPU if state of any of the input pins change. How do I catch this interrupt in userspace?

I see in gpiolib-cdev.c about line events. static irqreturn_t lineevent_irq_handler(int irq, void *p)

Can I use /dev/gpiochip<n> character device and poll() for interrupts? or is this only supported for a gpio pin that supports interrupt?

0

There are 0 answers