2/01/2013

How is APPS GPIO interrupt handled during APPS sleep or power collapse?

When APPS goes into sleep, Modem will take over all APPS GPIOs and any enabled APPS GPIO interrupts by calling tramp_gpio_switch_to_modem(). This API performs the following procedures:

1) It calls gpio_switch_gpio_int_to_modem() to switch all APPS GPIO ownership from PERIPHERAL (i.e. APPS) to MASTER (i.e. Modem). As a result of ownership switch, any APPS GPIOs whose interrupts are enabled before APPS sleep will now route their interrupts to Modem interrupt controller once triggered.

2) It checks all the APPS GPIOs to see whether they are enabled as an interrupt source. If yes, it assigns tramp_gpio_monitor_apps_isr as the isr, and marks in tramp_gpio.table that this is a proxy isr for APPS.

tramp_gpio.table[gpio].isr = tramp_gpio_monitor_apps_isr;
tramp_gpio.table[gpio].isr_param = gpio;
tramp_gpio.table[gpio].is_proxy = TRUE;

3) The API will also mark it as a wakeup source if the GPIO interrupt is a MAO interrupt.

Now, APPS is in sleep, and if one of APPS GPIO interrupt is triggered it will interrupt Modem processor. Then, Modem's tramp service calls tramp_gpio_monitor_apps_isr to notify DEM (Dynamic Environment Manager) module, which will wake up APPS from sleep by asserting an inter-processor interrupt. As part of wakeup process, Modem will also transfer the ownership of APPS GPIOs back to APPS. Once APPS finishes its wakeup process, it will free the IRQ and proceed to handle the GPIO interrupt by calling its real isr.

Note that this mechanism of Modem temporarily overseeing APPS GPIO interrupt during APPS sleep is transparent to APPS processor. If there is any suspicion that certain APPS GPIO interrupt does not work as expected during APPS sleep, this handoff process can be verified by setting breakpoints in tramp_gpio_switch_to_modem() or tramp_gpio_monitor_apps_isr().

No comments:

Post a Comment