diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/d3.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/d3.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index c72d2e98c3f1..176556ea63cb 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c | |||
@@ -1048,6 +1048,8 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
1048 | mvm, wowlan, wowlan->nd_config ?: mvm->nd_config, vif); | 1048 | mvm, wowlan, wowlan->nd_config ?: mvm->nd_config, vif); |
1049 | if (ret) | 1049 | if (ret) |
1050 | goto out; | 1050 | goto out; |
1051 | |||
1052 | mvm->net_detect = true; | ||
1051 | } else { | 1053 | } else { |
1052 | struct iwl_wowlan_config_cmd_v3 wowlan_config_cmd = {}; | 1054 | struct iwl_wowlan_config_cmd_v3 wowlan_config_cmd = {}; |
1053 | 1055 | ||
@@ -1067,6 +1069,8 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw, | |||
1067 | vif, mvmvif, ap_sta); | 1069 | vif, mvmvif, ap_sta); |
1068 | if (ret) | 1070 | if (ret) |
1069 | goto out; | 1071 | goto out; |
1072 | |||
1073 | mvm->net_detect = false; | ||
1070 | } | 1074 | } |
1071 | 1075 | ||
1072 | ret = iwl_mvm_power_update_device(mvm); | 1076 | ret = iwl_mvm_power_update_device(mvm); |
@@ -1621,6 +1625,32 @@ out_unlock: | |||
1621 | return false; | 1625 | return false; |
1622 | } | 1626 | } |
1623 | 1627 | ||
1628 | static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, | ||
1629 | struct ieee80211_vif *vif) | ||
1630 | { | ||
1631 | struct cfg80211_wowlan_wakeup wakeup = { | ||
1632 | .pattern_idx = -1, | ||
1633 | }; | ||
1634 | struct cfg80211_wowlan_wakeup *wakeup_report = &wakeup; | ||
1635 | struct iwl_wowlan_status *fw_status; | ||
1636 | u32 reasons = 0; | ||
1637 | |||
1638 | fw_status = iwl_mvm_get_wakeup_status(mvm, vif); | ||
1639 | if (!IS_ERR_OR_NULL(fw_status)) | ||
1640 | reasons = le32_to_cpu(fw_status->wakeup_reasons); | ||
1641 | |||
1642 | if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED) | ||
1643 | wakeup.rfkill_release = true; | ||
1644 | |||
1645 | if (reasons == IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS) { | ||
1646 | /* TODO: read and check if it was netdetect */ | ||
1647 | wakeup_report = NULL; | ||
1648 | } | ||
1649 | |||
1650 | mutex_unlock(&mvm->mutex); | ||
1651 | ieee80211_report_wowlan_wakeup(vif, wakeup_report, GFP_KERNEL); | ||
1652 | } | ||
1653 | |||
1624 | static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm) | 1654 | static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm) |
1625 | { | 1655 | { |
1626 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1656 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
@@ -1678,11 +1708,15 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) | |||
1678 | /* query SRAM first in case we want event logging */ | 1708 | /* query SRAM first in case we want event logging */ |
1679 | iwl_mvm_read_d3_sram(mvm); | 1709 | iwl_mvm_read_d3_sram(mvm); |
1680 | 1710 | ||
1681 | keep = iwl_mvm_query_wakeup_reasons(mvm, vif); | 1711 | if (mvm->net_detect) { |
1712 | iwl_mvm_query_netdetect_reasons(mvm, vif); | ||
1713 | } else { | ||
1714 | keep = iwl_mvm_query_wakeup_reasons(mvm, vif); | ||
1682 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1715 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1683 | if (keep) | 1716 | if (keep) |
1684 | mvm->keep_vif = vif; | 1717 | mvm->keep_vif = vif; |
1685 | #endif | 1718 | #endif |
1719 | } | ||
1686 | /* has unlocked the mutex, so skip that */ | 1720 | /* has unlocked the mutex, so skip that */ |
1687 | goto out; | 1721 | goto out; |
1688 | 1722 | ||