I am trying to use the standby / Wait For Interrupt mode on the i.MX28, but I am having problems waking from this state by using a standard GPIO.
First, I did it the ugly way by editing arch/arm/mach-mx28/pm.c to manually enable the interrupt I wanted (as in, direct write to the register rather than request the interrupt the Lunux way). This allowed me to exit the WFI mode, but once the board resumed, my driver that used that GPIO pin no longer worked.
Then I found the "enable_irq_wake(irq_num)" function call, and I used that in my driver. But for some reason my board will not wake when I toggle the GPIO (I removed the custom hack described in the previous paragraph). I am confident that I am using the correct irq number because it is the same number I used when I did the "request_irq()" call which worked fine.
Am I missing something? It seems like this should be pretty straight forward, but I can't seem to find a good example.
Thanks
- Matt
Hi,
I'm trying to wake my imx28 board with a GPIO interrupt but it doesn't work.
Can you give me an example of code that works for you ?
Thank you, that worked!
If your regular IRQ handler is working, just to add IRQF_NO_SUSPEND flag on request_irq(). It will wake up the Kernel from suspend.
If you will use GPIO group 0 (GPIO0-31), don't forget to apply kernel patch 0581. Unpached Kernel 2.6.35 will immediately locks up when you put GPIO group 0 IRQ (vector=127).
The Freescale BSP Power SW wakeup implementation is rather ugly, indeed. It uses regular request_irq() without IRQF_NO_SUSPEND flag, but unmask Power SW interrupt directly writing to IRQ enable register just before the CPU actually enter to suspend state, in arch/arm/mach-mx28/pm.c.
__raw_writel(BM_POWER_CTRL_ENIRQ_PSWITCH,
REGS_POWER_BASE + HW_POWER_CTRL_SET);
I don't think this is right thing to do ;-)