2/01/2013

How to support dual-edge triggering GPIO interrupt in MSM?

Generally, dual-edge triggering for GPIO interrupt is not supported in HW except in recent chipset such as MSM8974. If there is a need to trigger the IRQ on both rising and falling edges of a GPIO signal, this needs to be implemented in software. It can be done as follows.

Use the following steps to enable the GPIO IRQ.

(1) Configure GPIO as a general purpose input pin.
(2) Read out the current state of GPIO.
(3) If the GPIO state is HIGH, register an ISR and set the trigger type to FALLING.
(4) If the GPIO state is LOW, register an ISR and set the trigger type of RISING.

Inside the GPIO ISR, do the same steps (1)-(4) to register the ISR again. This way, GPIO interrupt will be triggered on both rising and falling edges.

No comments:

Post a Comment