GPIO Interrupt question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am new to the mailing list and I have a question related to gpio interrupt support in linux.

In my system, I have a shared IRQ which could be indicative of a GPIO interrupt among other things (I2C events for example).
The GPIO interrupt is a power down event triggered by a push button. Once linux gets notice of that interrupt (via ACPI) it will interact with acpid program to handle it accordingly.
So I would like to support that ACPI event handling in my gpio driver. I could call acpi_gpiochip_request_interrupts(gpiochip) from my probe but the issue is that I need a "first" 
handler before actually executing the handler. That first handler would help determine if that's a GPIO interrupt.

acpi_gpiochip_request_interrupts eventually calls:
ret = request_threaded_irq(event->irq, NULL, event->handler, event->irqflags, "ACPI:Event", event);

So a trivial solution would be to pass my "first" handler instead of NULL here. But that would be very messy and would change too many lines of codes.

I looked at other drivers like gpio-stmpe.c which does the following from the probe:

ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
                               stmpe_gpio_irq, IRQF_ONESHOT,
                               "stmpe-gpio", stmpe_gpio);
        
ret =  gpiochip_irqchip_add_nested(&stmpe_gpio->chip,
                                                 &stmpe_gpio_irq_chip,
                                                 0,
                                                 handle_simple_irq,
                                                 IRQ_TYPE_NONE);
        

gpiochip_set_nested_irqchip(&stmpe_gpio->chip,&stmpe_gpio_irq_chip,irq);

But I am not sure if it does what I want it to do since it does not create that dependency of second handler on first handler.

Your input would greatly be appreciated.

Thank you.
Asmaa Mnebhi




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux