# Wake up from suspend mode on GPIO interrupt

**URL:** <https://forum.legato.io/t/wake-up-from-suspend-mode-on-gpio-interrupt/2605>\
**Category:** Legato Application Framework\
**Created:** [August 16, 2017, 7:04am UTC](https://forum.legato.io/t/wake-up-from-suspend-mode-on-gpio-interrupt/2605 "2017-08-16T07:04:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raf](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@raf](https://forum.legato.io/u/raf)\
**Post date:** [August 16, 2017, 7:04am UTC](https://forum.legato.io/t/wake-up-from-suspend-mode-on-gpio-interrupt/2605/1 "2017-08-16T07:04:02Z")

</div>

Hi,

I’d like to wake the modem up from suspend mode from a GPIO edge-triggered event. I’m trying to implement a software-driven ‘power button’ to safely shutdown the system when a button is pressed.

My current setup is as follows.  
Module: WP8548  
Legato: 16.10.3\_4886ffbf7109055d3448bdff81805ff7\_modified

The WP8548 technical specification states that a number of pins can be used to wake the device from USB-SS mode:

- GPIO2
- GPIO21
- GPIO36
- GPIO38
- GPIO39
- GPIO42

My application configures GPIO21 as an input with a rising-edge sense using the GPIO API. And this works great provided the system hasn’t already suspended.

If I set GPIO21 to a logic 1 while the system is suspended it doesn’t wake up. Here’s the system log retrieved once it resumed from suspend mode (timer-driven) - it appears to be detecting _something_ (wake-n\_gpio77) while suspended but doesn’t wake up.

```auto
[49.837692] Suspending console(s) (use no_console_suspend to debug)
[49.852189] PM: suspend of devices complete after 6.592 msecs
[49.854173] PM: late suspend of devices complete after 1.983 msecs
[49.855974] PM: noirq suspend of devices complete after 1.800 msecs
[49.856218] msm_pm_enter
[49.856218] msm_pm_enter: power collapse
[49.856218] msm_mpm_irqs_detectable: cannot monitor 000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000
[49.856218] msm_pm_enter: return
[49.857805] PM: noirq resume of devices complete after 1.251 msecs
[49.859850] PM: early resume of devices complete after 1.556 msecs
[49.863818] PM: resume of devices complete after 3.937 msecs
[49.924462] Restarting tasks ...
[49.933801] mbim_read: Requests list is empty. Wait.
[49.943598] done.
[50.002105] mmc0: Re-init card rc = -110 (retries = 5)
[50.111002] qup_i2c qup_i2c.0: QUP: I2C status flags :0x1300c8, irq:187
[50.116740] qup_i2c qup_i2c.0: I2C slave addr:0x3a not connected
[50.127819] gpio_check_and_wake: wake-n_gpio77 STATE=WAKEUP
[50.139996] pm_set_mcu_ulpm_enable: ext pin wu fail 4
[50.159926] gpio_check_and_wake: wake-n_gpio77 STATE=SLEEP
[50.167037] gpio_check_and_wake: wake-n_gpio77 STATE=WAKEUP
[50.174942] enable_store: invalid input 1 ret -5
[50.179978] pm_set_mcu_ulpm_enable: no wake sources set
[50.185411] enable_store: invalid input 1 ret -1
[50.190599] pm_set_mcu_ulpm_enable: no wake sources set
[50.195452] enable_store: invalid input 1 ret -1
[50.200549] pm_set_mcu_ulpm_enable: no wake sources set
[50.209705] enable_store: invalid input 1 ret -1
[50.217152] pm_set_mcu_ulpm_enable: no wake sources set
[50.221516] enable_store: invalid input 1 ret -1
[50.226705] gpio_check_and_wake: wake-n_gpio77 STATE=SLEEP
[52.881733] PM: Syncing filesystems ... done.
[52.995086] Freezing user space processes ...
[53.000488] mbim_read: Waiting failed
[53.004120] PM: Wakeup pending, aborting suspend
[53.007935] active wakeup source: UNIX
[53.011628] active wakeup source: UNIX
[53.015687] active wakeup source: UNIX
[53.019105] active wakeup source: UNIX
[53.022920] active wakeup source: UNIX
[53.026552] active wakeup source: UNIX
[53.030306] active wakeup source: UNIX
[53.034243] active wakeup source: [signalfd]
[53.038303]
[53.039768] Freezing of tasks aborted after 0.039 seconds (89 tasks refusing to freeze, wq_busy=0):
[53.048893]
[53.050267] Restarting tasks ...
[53.059209] mbim_read: Requests list is empty. Wait.
[53.076392] done.
[58.038058] gpio_sync_ri: RI owner is Modem
[58.041324] gpio_map_name_to_num: gpioRI is not supported
[58.958461] msm_serial_hs: Rx break
[118.604120] NOHZ: local_softirq_pending 08
[118.684236] NOHZ: local_softirq_pending 08
[127.107034] PM: Syncing filesystems ... done.
[127.221303] Freezing user space processes ...
[127.227376] mbim_read: Waiting failed
[127.231832] (elapsed 0.006 seconds) done.
[127.234793] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[127.242697] Suspending console(s) (use no_console_suspend to debug)

```

Can the system resume on a GPIO interrupt?

---

<div class="post-metadata">

**Author:** ![muralinagraj](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@muralinagraj](https://forum.legato.io/u/muralinagraj)\
**Post date:** [February 21, 2018, 7:21am UTC](https://forum.legato.io/t/wake-up-from-suspend-mode-on-gpio-interrupt/2605/2 "2018-02-21T07:21:08Z")

</div>

Hi @raf,  
How you are making the modem to go into suspended mode ? By removing the USB cable connected to the device(modem)?

Regards,  
Muralidhara N.
