I am going to use PCAL6524 at my system(Android)...
So I want to get PCAL6524 Driver, or a driver of a similar device(IO Expander) for reference.
Thanks for reading
Hi Adrian,
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
Hello Diego,
Thanks for your reply.
I am a novice for the linux device driver.
I have read the attached file, rt122285-drad-1_1.pdf.
This file referred to linux/drivers/gpio/pcal6524.c, device driver for PCAL6524.
How can I get this source code?
I could not fine this file at attached files.
I hope your reply.
Best regards,
Andy
Hello Andy,
Here you have the link for the git. Here, you could have all the needed information.
linux-upstream/scripts at emcraft · EmcraftSystems/linux-upstream · GitHub
Also, I attached you the pcal6524.c file.
I hope this information answers your question.
Best Regards,
Diego.