Bluetooth: btmrvl: wake system up when receives a wake irq
authorJeffy Chen <jeffy.chen@rock-chips.com>
Fri, 24 Feb 2017 06:24:30 +0000 (14:24 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 12 Apr 2017 20:02:38 +0000 (22:02 +0200)
Currrently we are disabling this wake irq after receiving it. If this
happens before we finish suspend and the pm event check is disabled,
the system will continue suspending, and this irq would not work again.

We may need to abort system suspend to avoid that.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btmrvl_sdio.c

index 7d052ce2052b4449268dd7a199f08fc1fc4192c6..e65ca19970eaf3875f2a47128536e434710755ee 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/firmware.h>
 #include <linux/slab.h>
+#include <linux/suspend.h>
 
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/sdio_func.h>
@@ -60,7 +61,8 @@ static const struct of_device_id btmrvl_sdio_of_match_table[] = {
 
 static irqreturn_t btmrvl_wake_irq_bt(int irq, void *priv)
 {
-       struct btmrvl_plt_wake_cfg *cfg = priv;
+       struct btmrvl_sdio_card *card = priv;
+       struct btmrvl_plt_wake_cfg *cfg = card->plt_wake_cfg;
 
        if (cfg->irq_bt >= 0) {
                pr_info("%s: wake by bt", __func__);
@@ -68,6 +70,9 @@ static irqreturn_t btmrvl_wake_irq_bt(int irq, void *priv)
                disable_irq_nosync(irq);
        }
 
+       pm_wakeup_event(&card->func->dev, 0);
+       pm_system_wakeup();
+
        return IRQ_HANDLED;
 }
 
@@ -101,7 +106,7 @@ static int btmrvl_sdio_probe_of(struct device *dev,
                } else {
                        ret = devm_request_irq(dev, cfg->irq_bt,
                                               btmrvl_wake_irq_bt,
-                                              0, "bt_wake", cfg);
+                                              0, "bt_wake", card);
                        if (ret) {
                                dev_err(dev,
                                        "Failed to request irq_bt %d (%d)\n",