Hi,
I'm currently working on integrating a number of PCA9698 gpio expanders into an embedded Linux system and wanted to make use of the interrupt functionality that these chips have.
I've been able to configure the device tree to recognise these and can read the IO on a polling basis, but it seems like the driver does not set up interrupts for these devices.
I noticed that in the pca953x driver, the PCA_INT bit is not set in the device id struct for the 9698 (screenshot below, driver code found here), does this mean that the driver currently does not support interrupt functionality for this particular IO expander?
Thanks for any help you can provide in advance,
Jonah
Solved! Go to Solution.
Hello Jonah,
I hope this response finds you well.
Are you planning to use the interrupt pin (open-drain active LOW)? This pin will be activated when one of the port pins changes state and the port pin is configured as an input and the interrupt on it is not masked.
I assume that the driver is not masking the interrupts. In this case, you must set up the MSK0 to MSK4 registers. The interrupts are not generated by default.
So, I do recommend to review the source code and make sure it is setting up the MSK registers.
You may find further information at the chapter 7.4.5 from datasheet.
I hope this information will be useful for you.
Regards,
David
Hello Jonah,
I hope this response finds you well.
Are you planning to use the interrupt pin (open-drain active LOW)? This pin will be activated when one of the port pins changes state and the port pin is configured as an input and the interrupt on it is not masked.
I assume that the driver is not masking the interrupts. In this case, you must set up the MSK0 to MSK4 registers. The interrupts are not generated by default.
So, I do recommend to review the source code and make sure it is setting up the MSK registers.
You may find further information at the chapter 7.4.5 from datasheet.
I hope this information will be useful for you.
Regards,
David
Hi,
We are using PCA9698 connecting I2C over IMX8qm at out project. We connect 3 leds and 3 button to PCA6968. I can control led on linux bash as on/off but I didnt control button interrupt. I add the buttons into DTS gpio-keys. What can I do for solving this interrupt problem ? Can you share the source code of pc9698 that you are sure. ?
Hi David,
Just an update on this in case anyone ever has a similar problem,
I added the MSK registers to the regmap that the driver configures, and then created a separate pca9698_init function specifically for the 9698 chip that is called in the probe function (mainly copying the existing init function for the PCA957x that was already there). In this new init function I set all of the MSK registers to 0 to configure all inputs to trigger interrupts.
I also added a simple I2C write to this init function to set the mode register (0x2A) to 0x12, which enables SmBus Alert functionality.
With these changes to the driver I can now query address 0x0C on the i2c bus and the 9698 that pulled the interrupt line low will reply with its address successfully.
Thanks,
Jonah
Hi David,
Thanks for your quick response
Yes I was planning on using the interrupt pin, and I think you're right that setting of the MSK registers might not be happening in the driver code.
Something else I've realised since Friday is that the driver has no way of handling the SMbus Alert functionality that I was planning on using, so I will have to write some new code for this.
Thanks,
Jonah