ath10k: enable wow feature for sdio chip
authorWen Gong <wgong@codeaurora.org>
Wed, 27 Nov 2019 06:04:13 +0000 (06:04 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 29 Nov 2019 07:45:09 +0000 (09:45 +0200)
sdio does not support wow, this patch is to enable it. When system enter
sleep state, if wowlan is enabled, then sdio chip will keep power if
platform support keep power, after resume, it will not need to re-load
firmware again.

Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-00029.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath10k/sdio.c

index 2e155bb..b8e2499 100644 (file)
@@ -1859,7 +1859,7 @@ static void ath10k_sdio_hif_stop(struct ath10k *ar)
 
 static int ath10k_sdio_hif_suspend(struct ath10k *ar)
 {
-       return -EOPNOTSUPP;
+       return 0;
 }
 
 static int ath10k_sdio_hif_resume(struct ath10k *ar)
@@ -2009,7 +2009,26 @@ static const struct ath10k_hif_ops ath10k_sdio_hif_ops = {
  */
 static int ath10k_sdio_pm_suspend(struct device *device)
 {
-       return 0;
+       struct sdio_func *func = dev_to_sdio_func(device);
+       struct ath10k_sdio *ar_sdio = sdio_get_drvdata(func);
+       struct ath10k *ar = ar_sdio->ar;
+       mmc_pm_flag_t pm_flag, pm_caps;
+       int ret;
+
+       if (!device_may_wakeup(ar->dev))
+               return 0;
+
+       pm_flag = MMC_PM_KEEP_POWER;
+
+       ret = sdio_set_host_pm_flags(func, pm_flag);
+       if (ret) {
+               pm_caps = sdio_get_host_pm_caps(func);
+               ath10k_warn(ar, "failed to set sdio host pm flags (0x%x, 0x%x): %d\n",
+                           pm_flag, pm_caps, ret);
+               return ret;
+       }
+
+       return ret;
 }
 
 static int ath10k_sdio_pm_resume(struct device *device)