2016-10-11 22:55:49

by Yang Li

[permalink] [raw]
Subject: pca953x interrupt missing

Hi Marc,

You added the edge interrupt support to the pca953x driver with commit
(89ea8bbe9c). But recently I'm getting interrupt missing problem when
using the pca9555 as an interrupt controller. After some research of
the PCA9555 data sheet, it seems to me that the hardware is not
capable of catching all edge changes without missing interrupt except
for the PCAL9555a variant with the latching support. Quoted from the
pca9555 data sheet:

"The open-drain interrupt output is activated when one of the port
pins changes state and
the pin is configured as an input. The interrupt is deactivated when
the input returns to its
previous state or the Input Port register is read."

There is no latch register to record which pin has just changed. So
if one of the input pin changes two times quickly before the read of
the Input Port register which is even more likely to happen as the
interrupt handling is delayed to work queue, we can not figure out
which pin has just changed by reading the Input Port register and
invoke the correct interrupt service routine. However, I think it
would be possible to support level-sensitive interrupt input, as we
can get the current level through the Input Port register and figure
out which interrupt service routine to invoke.

I think we should remove the support for edge based interrupts for the
chips without the latching capability and add level based interrupt
support. I'd like to have your thought on this.

Regards,
Leo