net: smsc911x: add wake-up event interrupt support

The SMSC911x have a line out of the chip called "PME",
Power Management Event. When connected to an asynchronous
interrupt controller this is able to wake the system up
from sleep in response to certain network events.

This is the first attempt to support this in the Linux
driver: the Qualcomm APQ8060 Dragonboard has this line
routed to a GPIO line on the primary SoC padring, and as
such it can be armed as a wakeup interrupt.

The patch is inspired by the wakeup code in the RTC

The code looks for an additional interrupt - apart from the
ordinary device interrupt - and in case that is present,
we register an interrupt handler to respons to this,
and flag the device and this interrupt as a wakeup.

Cc: Sudeep Holla <>
Cc: Florian Fainelli <>
Cc: Jeremy Linton <>
Acked-by: Tony Lindgren <>
Signed-off-by: Linus Walleij <>
ChangeLog v3->v4:
- Rebased on changes from upstream dealing with IRQs in
  .open() rather than .probe()
ChangeLog v2->v3:
- Fix up the removal and error paths so as to free up the
  PME IRQ properly.
ChangeLog v1->v2:
- Call pm_wakeup_event() in the wakeup IRQ thread to
  account for the wakeup event.
- Drop the enable/disable_irq_wake() calls from suspend/resume:
  this is handled from the irq core when you call
  dev_pm_set_wake_irq() as we do.
1 file changed