How to handle an interrupt from the GPIO Expander(PCA953X)

693 views Asked by At

I use a GPIO Expander like PCA9575. But I don't know how to handle an interrupt from the expander..

From the gpio-pca953x.c, the following code is the ISR for the expander.

static irqreturn_t pca953x_irq_handler(int irq, void *devid)
{
    struct pca953x_chip *chip = devid;
    uint16_t pending;
    uint16_t level;

    pending = pca953x_irq_pending(chip);

    if (!pending)
        return IRQ_HANDLED;

    do {
        level = __ffs(pending);
        handle_nested_irq(level + chip->irq_base);

        pending &= ~(1 << level);
    } while (pending);

    return IRQ_HANDLED;
}

If Interrupt is activated from GPIO(Input) pin 3 of expander, this routine jumps into the GPIO pin 3 service routine from this ISR. Isn't it right?

If so, I have the following question.. How to register the GPIO Pin 3 service routine??

If not, How to handle the the GPIO Pin 3 service routine??

Thanks for your reading.

0

There are 0 answers