ath9k_hw: Handle MCI power state using a helper
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Wed, 22 Feb 2012 07:11:01 +0000 (12:41 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 27 Feb 2012 19:06:36 +0000 (14:06 -0500)
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ar9003_mci.c
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/hw.h

index 1a01788ec103cec9dc3deb504f170a136dc0f3f7..a87d4ca1b54770cb0a09e99d89b087c98da1ebbf 100644 (file)
@@ -365,6 +365,23 @@ static void ar9003_mci_prep_interface(struct ath_hw *ah)
        REG_WRITE(ah, AR_MCI_INTERRUPT_EN, saved_mci_int_en);
 }
 
+void ar9003_mci_set_full_sleep(struct ath_hw *ah)
+{
+       struct ath_common *common = ath9k_hw_common(ah);
+       struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
+
+       if (ar9003_mci_state(ah, MCI_STATE_ENABLE, NULL) &&
+           (mci->bt_state != MCI_BT_SLEEP) &&
+           !mci->halted_bt_gpm) {
+               ath_dbg(common, MCI,
+                       "MCI halt BT GPM (full_sleep)\n");
+               ar9003_mci_send_coex_halt_bt_gpm(ah, true, true);
+       }
+
+       mci->ready = false;
+       REG_WRITE(ah, AR_RTC_KEEP_AWAKE, 0x2);
+}
+
 void ar9003_mci_disable_interrupt(struct ath_hw *ah)
 {
        if (!ATH9K_HW_CAP_MCI)
index f4b121f33132feabaf0da5e6fd9c8f48d6338fcd..406ffd06b6db2fb7bd1fb52dc0cc3dae84255e3f 100644 (file)
@@ -2076,7 +2076,6 @@ static bool ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip)
 bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
 {
        struct ath_common *common = ath9k_hw_common(ah);
-       struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci;
        int status = true, setChip = true;
        static const char *modes[] = {
                "AWAKE",
@@ -2100,20 +2099,8 @@ bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
 
                break;
        case ATH9K_PM_FULL_SLEEP:
-
-               if (ah->caps.hw_caps & ATH9K_HW_CAP_MCI) {
-                       if (ar9003_mci_state(ah, MCI_STATE_ENABLE, NULL) &&
-                               (mci->bt_state != MCI_BT_SLEEP) &&
-                               !mci->halted_bt_gpm) {
-                               ath_dbg(common, MCI,
-                                       "MCI halt BT GPM (full_sleep)\n");
-                               ar9003_mci_send_coex_halt_bt_gpm(ah,
-                                                                true, true);
-                       }
-
-                       mci->ready = false;
-                       REG_WRITE(ah, AR_RTC_KEEP_AWAKE, 0x2);
-               }
+               if (ah->caps.hw_caps & ATH9K_HW_CAP_MCI)
+                       ar9003_mci_set_full_sleep(ah);
 
                ath9k_set_power_sleep(ah, setChip);
                ah->chip_fullsleep = true;
index ebc32d00fecc1d739d1e0f55b1caa33ba476400e..07dd53e059fb410eb9928cd9bc0be81668e51d96 100644 (file)
@@ -1219,6 +1219,7 @@ void ar9003_mci_send_coex_halt_bt_gpm(struct ath_hw *ah, bool halt,
 u32 ar9003_mci_wait_for_gpm(struct ath_hw *ah, u8 gpm_type,
                            u8 gpm_opcode, int time_out);
 void ar9003_mci_2g5g_changed(struct ath_hw *ah, bool is_2g);
+void ar9003_mci_set_full_sleep(struct ath_hw *ah);
 void ar9003_mci_disable_interrupt(struct ath_hw *ah);
 void ar9003_mci_enable_interrupt(struct ath_hw *ah);
 void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool wait_done);