ath9k: Check MCI PowerSave state
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Thu, 5 Feb 2015 04:52:41 +0000 (10:22 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 26 Feb 2015 12:58:39 +0000 (14:58 +0200)
The power save state of MCI has to be disabled
when enabling WoW sleep, check this properly.
ar9003_mci_state() doesn't handle MCI_STATE_GET_WLAN_PS_STATE
right now, but this will be done later when proper
support for MCI/PS is added.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath9k/ar9003_mci.h
drivers/net/wireless/ath/ath9k/ar9003_wow.c

index 19800afb5e9ff0a1269c139199b4e56e39be30d0..cef20103fc86f2901f1112e7de925dd5ee9fd4bf 100644 (file)
@@ -188,6 +188,13 @@ enum mci_bt_state {
        MCI_BT_CAL
 };
 
+enum mci_ps_state {
+       MCI_PS_DISABLE,
+       MCI_PS_ENABLE,
+       MCI_PS_ENABLE_OFF,
+       MCI_PS_ENABLE_ON
+};
+
 /* Type of state query */
 enum mci_state_type {
        MCI_STATE_ENABLE,
index 721caf36ce834a426a8bb679089e3d688f5b2309..bf3378f03b9a962e68efce88995cfb92f3e1196e 100644 (file)
 #include "reg_wow.h"
 #include "hw-ops.h"
 
+static void ath9k_hw_set_sta_powersave(struct ath_hw *ah)
+{
+       if (!ath9k_hw_mci_is_enabled(ah))
+               goto set;
+       /*
+        * If MCI is being used, set PWR_SAV only when MCI's
+        * PS state is disabled.
+        */
+       if (ar9003_mci_state(ah, MCI_STATE_GET_WLAN_PS_STATE) != MCI_PS_DISABLE)
+               return;
+set:
+       REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV);
+}
+
 static void ath9k_hw_set_powermode_wow_sleep(struct ath_hw *ah)
 {
        struct ath_common *common = ath9k_hw_common(ah);
 
-       REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV);
+       ath9k_hw_set_sta_powersave(ah);
 
        /* set rx disable bit */
        REG_WRITE(ah, AR_CR, AR_CR_RXD);