PCA9698 IO expander - Interrupt support with pca953x linux driver

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

PCA9698 IO expander - Interrupt support with pca953x linux driver

跳至解决方案
1,373 次查看
JonahW
Contributor II

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?

JonahW_0-1654861587451.png

Thanks for any help you can provide in advance,

Jonah

0 项奖励
1 解答
1,360 次查看
diazmarin09
NXP TechSupport
NXP TechSupport

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.

 

diazmarin09_0-1654894356756.png

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

在原帖中查看解决方案

3 回复数
1,361 次查看
diazmarin09
NXP TechSupport
NXP TechSupport

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.

 

diazmarin09_0-1654894356756.png

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

1,304 次查看
JonahW
Contributor II

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. 

JonahW_0-1656334151397.png

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

0 项奖励
1,338 次查看
JonahW
Contributor II

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

 

0 项奖励