ath9k: Register private AIC ops
authorSujith Manoharan <c_manoha@qca.qualcomm.com>
Sat, 14 Mar 2015 05:57:48 +0000 (11:27 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 20 Mar 2015 06:27:17 +0000 (08:27 +0200)
AIC can be disabled or enabled on a per-card
basis using MCI configuration, so register a function
to check its status.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath9k/Makefile
drivers/net/wireless/ath/ath9k/ar9003_aic.c [new file with mode: 0644]
drivers/net/wireless/ath/ath9k/ar9003_hw.c
drivers/net/wireless/ath/ath9k/hw-ops.h
drivers/net/wireless/ath/ath9k/hw.h

index 473972288a84a901a69cc555802b2d8228e274f7..ecda613c2d547d4278ac0665c8c0eeaaf594c66a 100644 (file)
@@ -46,7 +46,8 @@ ath9k_hw-y:=  \
 ath9k_hw-$(CONFIG_ATH9K_WOW) += ar9003_wow.o
 
 ath9k_hw-$(CONFIG_ATH9K_BTCOEX_SUPPORT) += btcoex.o \
-                                          ar9003_mci.o
+                                          ar9003_mci.o \
+                                          ar9003_aic.o
 
 ath9k_hw-$(CONFIG_ATH9K_PCOEM) += ar9003_rtt.o
 
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_aic.c b/drivers/net/wireless/ath/ath9k/ar9003_aic.c
new file mode 100644 (file)
index 0000000..0cd159d
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015 Qualcomm Atheros Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "hw.h"
+#include "hw-ops.h"
+#include "ar9003_mci.h"
+#include "ar9003_aic.h"
+
+static bool ar9003_hw_is_aic_enabled(struct ath_hw *ah)
+{
+       struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci;
+
+       if (mci_hw->config & ATH_MCI_CONFIG_DISABLE_AIC)
+               return false;
+
+       return true;
+}
+
+void ar9003_hw_attach_aic_ops(struct ath_hw *ah)
+{
+       struct ath_hw_private_ops *priv_ops = ath9k_hw_private_ops(ah);
+
+       priv_ops->is_aic_enabled = ar9003_hw_is_aic_enabled;
+}
index df176e6a30d1ff9bac3196f152b92e25f11a0af6..79fd3b2dcbdef9fc117b99177cb44fe46a581ae4 100644 (file)
@@ -1180,4 +1180,5 @@ void ar9003_hw_attach_ops(struct ath_hw *ah)
        ar9003_hw_attach_phy_ops(ah);
        ar9003_hw_attach_calib_ops(ah);
        ar9003_hw_attach_mac_ops(ah);
+       ar9003_hw_attach_aic_ops(ah);
 }
index 88769b64b20b29d9f9cb71c6ffbca27cc3d314d4..232339b0554020f0875b8bc4bb9d255b66413e61 100644 (file)
@@ -108,6 +108,14 @@ static inline void ath9k_hw_set_bt_ant_diversity(struct ath_hw *ah, bool enable)
                ath9k_hw_ops(ah)->set_bt_ant_diversity(ah, enable);
 }
 
+static inline bool ath9k_hw_is_aic_enabled(struct ath_hw *ah)
+{
+       if (ath9k_hw_private_ops(ah)->is_aic_enabled)
+               return ath9k_hw_private_ops(ah)->is_aic_enabled(ah);
+
+       return false;
+}
+
 #endif
 
 /* Private hardware call ops */
index 2067cb523ca8a4a637e1b1acdf731abed5c7f794..c22edd3ce7165cc1c8a643f415a74035c3e7efc2 100644 (file)
@@ -653,6 +653,10 @@ struct ath_hw_private_ops {
 
        /* ANI */
        void (*ani_cache_ini_regs)(struct ath_hw *ah);
+
+#ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
+       bool (*is_aic_enabled)(struct ath_hw *ah);
+#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */
 };
 
 /**
@@ -1113,6 +1117,8 @@ void ar9003_hw_attach_calib_ops(struct ath_hw *ah);
 int ar9002_hw_attach_ops(struct ath_hw *ah);
 void ar9003_hw_attach_ops(struct ath_hw *ah);
 
+void ar9003_hw_attach_aic_ops(struct ath_hw *ah);
+
 void ar9002_hw_load_ani_reg(struct ath_hw *ah, struct ath9k_channel *chan);
 
 void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning);