ath10k: configure and enable the wakeup capability
authorRyan Hsu <ryanhsu@qti.qualcomm.com>
Thu, 31 Aug 2017 12:36:16 +0000 (15:36 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 31 Aug 2017 18:17:04 +0000 (21:17 +0300)
ACPI will rely on device driver to tell it if the device could support
wakeup function when system in D3 state.

This has caused some platform can't support remote wakeup correctly,
because the ACPI wakeup GPE is not enabled, hence registers the .set_wakeup
callback to handle it if device supports wakeup.

Tested with QCA6174 hw3.0, firmware ('WLAN.RM.4.4.1-00008-QCARMSWP-1')

Signed-off-by: Ryan Hsu <ryanhsu@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath10k/wow.c
drivers/net/wireless/ath/ath10k/wow.h

index 523a5490dece46969171e3aa956b18ba843a52a8..5683f1a5330eedae677aad5bf2621a6232781346 100644 (file)
@@ -7644,6 +7644,7 @@ static const struct ieee80211_ops ath10k_ops = {
 #ifdef CONFIG_PM
        .suspend                        = ath10k_wow_op_suspend,
        .resume                         = ath10k_wow_op_resume,
+       .set_wakeup                     = ath10k_wow_op_set_wakeup,
 #endif
 #ifdef CONFIG_MAC80211_DEBUGFS
        .sta_add_debugfs                = ath10k_sta_add_debugfs,
index 77100d42f401f16c37a46afcf70e71007f5c7a11..0d46d6dc7578591a67b8fc3cf2e1a3b044d19da2 100644 (file)
@@ -277,6 +277,18 @@ exit:
        return ret ? 1 : 0;
 }
 
+void ath10k_wow_op_set_wakeup(struct ieee80211_hw *hw, bool enabled)
+{
+       struct ath10k *ar = hw->priv;
+
+       mutex_lock(&ar->conf_mutex);
+       if (test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT,
+                    ar->running_fw->fw_file.fw_features)) {
+               device_set_wakeup_enable(ar->dev, enabled);
+       }
+       mutex_unlock(&ar->conf_mutex);
+}
+
 int ath10k_wow_op_resume(struct ieee80211_hw *hw)
 {
        struct ath10k *ar = hw->priv;
@@ -336,5 +348,7 @@ int ath10k_wow_init(struct ath10k *ar)
        ar->wow.wowlan_support.n_patterns = ar->wow.max_num_patterns;
        ar->hw->wiphy->wowlan = &ar->wow.wowlan_support;
 
+       device_set_wakeup_capable(ar->dev, true);
+
        return 0;
 }
index abbb04b6d1bd9a2174f8fce1cb3b84975ce8df86..9745b9ddc7f53e9de853a63ffa364a10fc11e27a 100644 (file)
@@ -28,6 +28,7 @@ int ath10k_wow_init(struct ath10k *ar);
 int ath10k_wow_op_suspend(struct ieee80211_hw *hw,
                          struct cfg80211_wowlan *wowlan);
 int ath10k_wow_op_resume(struct ieee80211_hw *hw);
+void ath10k_wow_op_set_wakeup(struct ieee80211_hw *hw, bool enabled);
 
 #else