issue in I2C IO expander interrupt handling in linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

issue in I2C IO expander interrupt handling in linux

979 Views
rajesh_koodal28
Contributor I

Hi, I am using one of the I2C IO expander supported by the linux driver gpio-pca953x.c. I have connected this io expander interrupt line to the gpio and this gpio interrupt line is connected to gic. The gpio-pca953x.c driver interrupt handler, runs only in threaded irq, as it has to communicate over i2c. Now, when the input of this expander is triggered, the interrupt finally is generated at the interrupt controller and my GPIO pin handler is called in the hwirq context. The GPIO pin handler is a chained irq handler which is chained to the threadedirq handler of gpio-pca953x.c. While at the GPIO pin handler, the irq are disabled and then this handler further wakes up the threaded irq handler of the io expander and after this while returning the irq at GPIO pin are again enabled. But the problem here is, until, we acknowledge the io expander, the output interrupt pin of the io expander will still be high. Because of this, the GPIO pin handler is again triggered and this continues to happen in hwirq context without the threaded irq handler of gpio-pca953x.c getting a chance to run and clear the output interrupt. If i need to handle this issue, then i need to disable the GPIO pin interrupt in my GPIO pin handler and exit the hwirq, then, when the threaded irq of io expander runs, once it clears its output interrupt, it would have to then enable the GPIO pin interrupt. To achieve this the gpio-pca953x.c doesn't provide a standard framework. In general how are these situations handled in linux while dealing with io expander's output interrupt either connected to interrupt controller via a GPIO pin or directly to it. please provide your inputs

Tags (1)
0 Kudos
0 Replies