mwifiex: report wakeup for wowlan
authorRajat Jain <rajatja@google.com>
Tue, 4 Oct 2016 20:37:42 +0000 (13:37 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 17 Nov 2016 06:40:57 +0000 (08:40 +0200)
Register the WLAN device as a wakeup source since it can
wake the system via wake-on-wireless-lan. In an actual wowlan
event, notify the PM core that we are the current wakeup source.
This allows the PM core to update the wakeup attributes in /sys.

This was causing wakeup issues on chromeos as the system was
apparently confused about the wakeup source.

Signed-off-by: Wei-Ning Huang <wnhuang@google.com>
Signed-off-by: Rajat Jain <rajatja@google.com>
Tested-by: Wei-Ning Huang <wnhuang@chromium.org>
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Acked-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/sdio.c
drivers/net/wireless/marvell/mwifiex/sdio.h

index 8718950004f3f6e5bda50b38c9fbf42d7cf474a6..807af13f9b41c00b9f714c7fed460b03d69b18db 100644 (file)
@@ -89,6 +89,9 @@ static irqreturn_t mwifiex_wake_irq_wifi(int irq, void *priv)
                disable_irq_nosync(irq);
        }
 
+       /* Notify PM core we are wakeup source */
+       pm_wakeup_event(cfg->dev, 0);
+
        return IRQ_HANDLED;
 }
 
@@ -112,6 +115,7 @@ static int mwifiex_sdio_probe_of(struct device *dev, struct sdio_mmc_card *card)
                                          GFP_KERNEL);
        cfg = card->plt_wake_cfg;
        if (cfg && card->plt_of_node) {
+               cfg->dev = dev;
                cfg->irq_wifi = irq_of_parse_and_map(card->plt_of_node, 0);
                if (!cfg->irq_wifi) {
                        dev_dbg(dev,
@@ -132,6 +136,10 @@ static int mwifiex_sdio_probe_of(struct device *dev, struct sdio_mmc_card *card)
                }
        }
 
+       ret = device_init_wakeup(dev, true);
+       if (ret)
+               dev_err(dev, "fail to init wakeup for mwifiex");
+
        return 0;
 }
 
index db837f12c547946d1f76310e9b4c4377052eb904..07cdd2371eb5ac2c85e43ec4bd7714b3f6c36611 100644 (file)
 } while (0)
 
 struct mwifiex_plt_wake_cfg {
+       struct device *dev;
        int irq_wifi;
        bool wake_by_wifi;
 };