[ath9k-devel] [PATCH 2/2] ath9k: Run the LNA combining algorithm properly

2013-08-07 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

The LNA combining algorithm has to be run for cards
that support the required diversity features, make
sure that that correct conditions are met before
enabing this algorithm.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/recv.c | 46 ++-
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/recv.c 
b/drivers/net/wireless/ath/ath9k/recv.c
index 865e043..e359557 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -1156,7 +1156,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool 
hp)
struct ath_buf *bf;
struct sk_buff *skb = NULL, *requeue_skb, *hdr_skb;
struct ieee80211_rx_status *rxs;
-   struct ath_hw *ah = sc-sc_ah;
+   struct ath_hw *ah = sc-sc_ah
+;  struct ath9k_hw_capabilities *pCap = ah-caps;
struct ath_common *common = ath9k_hw_common(ah);
struct ieee80211_hw *hw = sc-hw;
struct ieee80211_hdr *hdr;
@@ -1328,11 +1329,30 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, 
bool hp)
skb = hdr_skb;
}
 
+   if (rxs-flag  RX_FLAG_MMIC_STRIPPED)
+   skb_trim(skb, skb-len - 8);
 
-   if (ah-caps.hw_caps  ATH9K_HW_CAP_ANT_DIV_COMB) {
+   spin_lock_irqsave(sc-sc_pm_lock, flags);
+   if ((sc-ps_flags  (PS_WAIT_FOR_BEACON |
+PS_WAIT_FOR_CAB |
+PS_WAIT_FOR_PSPOLL_DATA)) ||
+   ath9k_check_auto_sleep(sc))
+   ath_rx_ps(sc, skb, rs.is_mybeacon);
+   spin_unlock_irqrestore(sc-sc_pm_lock, flags);
 
+   /*
+* Run the LNA combining algorithm only in these cases:
+*
+* Standalone WLAN cards with both LNA/Antenna diversity
+* enabled in the EEPROM.
+*
+* WLAN+BT cards which are in the supported card list
+* in ath_pci_id_table and the user has loaded the
+* driver with bt_ant_diversity set to true.
+*/
+   if (ah-caps.hw_caps  ATH9K_HW_CAP_ANT_DIV_COMB) {
/*
-* change the default rx antenna if rx diversity
+* Change the default rx antenna if rx diversity
 * chooses the other antenna 3 times in a row.
 */
if (sc-rx.defant != rs.rs_antenna) {
@@ -1342,22 +1362,14 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, 
bool hp)
sc-rx.rxotherant = 0;
}
 
+   if (pCap-hw_caps  ATH9K_HW_CAP_BT_ANT_DIV) {
+   if (common-bt_ant_diversity)
+   ath_ant_comb_scan(sc, rs);
+   } else {
+   ath_ant_comb_scan(sc, rs);
+   }
}
 
-   if (rxs-flag  RX_FLAG_MMIC_STRIPPED)
-   skb_trim(skb, skb-len - 8);
-
-   spin_lock_irqsave(sc-sc_pm_lock, flags);
-   if ((sc-ps_flags  (PS_WAIT_FOR_BEACON |
-PS_WAIT_FOR_CAB |
-PS_WAIT_FOR_PSPOLL_DATA)) ||
-   ath9k_check_auto_sleep(sc))
-   ath_rx_ps(sc, skb, rs.is_mybeacon);
-   spin_unlock_irqrestore(sc-sc_pm_lock, flags);
-
-   if ((ah-caps.hw_caps  ATH9K_HW_CAP_ANT_DIV_COMB)  
sc-ant_rx == 3)
-   ath_ant_comb_scan(sc, rs);
-
ath9k_apply_ampdu_details(sc, rs, rxs);
 
ieee80211_rx(hw, skb);
-- 
1.8.3.4

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 0/2] Antenna diversity fixes

2013-08-07 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

Hi,

Antenna diversity support for WLAN/BT combo cards WB195 and WB225
is fairly complete. WB335, which is based on AR9565 requires more
fixes.

More information is here:
http://wireless.kernel.org/en/users/Drivers/ath9k/antennadiversity

Sujith

Sujith Manoharan (2):
  ath9k: Fix BTCOEX usage for RX diversity
  ath9k: Run the LNA combining algorithm properly

 drivers/net/wireless/ath/ath9k/init.c |  4 +--
 drivers/net/wireless/ath/ath9k/recv.c | 46 ++-
 2 files changed, 31 insertions(+), 19 deletions(-)

-- 
1.8.3.4

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH 1/2] ath9k: Fix BTCOEX usage for RX diversity

2013-08-07 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

BTCOEX has to be *disabled* for WLAN RX diversity to
work on combo cards.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
 drivers/net/wireless/ath/ath9k/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c 
b/drivers/net/wireless/ath/ath9k/init.c
index 4afe30e..3b56c2e 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -645,11 +645,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc 
*sc,
/*
 * Enable WLAN/BT RX Antenna diversity only when:
 *
-* - BTCOEX is enabled
+* - BTCOEX is disabled.
 * - the user manually requests the feature.
 * - the HW cap is set using the platform data.
 */
-   if (common-btcoex_enabled  ath9k_bt_ant_diversity 
+   if (!common-btcoex_enabled  ath9k_bt_ant_diversity 
(pCap-hw_caps  ATH9K_HW_CAP_BT_ANT_DIV))
common-bt_ant_diversity = 1;
 
-- 
1.8.3.4

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 2/2] ath9k: Run the LNA combining algorithm properly

2013-08-07 Thread Felix Fietkau
On 2013-08-07 8:59 AM, Sujith Manoharan wrote:
 From: Sujith Manoharan c_man...@qca.qualcomm.com
 
 The LNA combining algorithm has to be run for cards
 that support the required diversity features, make
 sure that that correct conditions are met before
 enabing this algorithm.
 
 Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
 ---
  drivers/net/wireless/ath/ath9k/recv.c | 46 
 ++-
  1 file changed, 29 insertions(+), 17 deletions(-)
 
 diff --git a/drivers/net/wireless/ath/ath9k/recv.c 
 b/drivers/net/wireless/ath/ath9k/recv.c
 index 865e043..e359557 100644
 --- a/drivers/net/wireless/ath/ath9k/recv.c
 +++ b/drivers/net/wireless/ath/ath9k/recv.c
 @@ -1156,7 +1156,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, 
 bool hp)
   struct ath_buf *bf;
   struct sk_buff *skb = NULL, *requeue_skb, *hdr_skb;
   struct ieee80211_rx_status *rxs;
 - struct ath_hw *ah = sc-sc_ah;
 + struct ath_hw *ah = sc-sc_ah
 +;struct ath9k_hw_capabilities *pCap = ah-caps;
   struct ath_common *common = ath9k_hw_common(ah);
   struct ieee80211_hw *hw = sc-hw;
   struct ieee80211_hdr *hdr;
Misplaced semicolon
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


Re: [ath9k-devel] [PATCH 2/2] ath9k: Run the LNA combining algorithm properly

2013-08-07 Thread Sujith Manoharan
Felix Fietkau wrote:
  -   struct ath_hw *ah = sc-sc_ah;
  +   struct ath_hw *ah = sc-sc_ah
  +;  struct ath9k_hw_capabilities *pCap = ah-caps;
  struct ath_common *common = ath9k_hw_common(ah);
  struct ieee80211_hw *hw = sc-hw;
  struct ieee80211_hdr *hdr;
 Misplaced semicolon

Thanks, I'll send v2.

Sujith
___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel


[ath9k-devel] [PATCH v2 2/2] ath9k: Run the LNA combining algorithm properly

2013-08-07 Thread Sujith Manoharan
From: Sujith Manoharan c_man...@qca.qualcomm.com

The LNA combining algorithm has to be run for cards
that support the required diversity features, make
sure that that correct conditions are met before
enabing this algorithm.

Signed-off-by: Sujith Manoharan c_man...@qca.qualcomm.com
---
v2 : Fix a misplaced semicolon

 drivers/net/wireless/ath/ath9k/recv.c | 44 ++-
 1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/recv.c 
b/drivers/net/wireless/ath/ath9k/recv.c
index 865e043..62dff97 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -1157,6 +1157,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool 
hp)
struct sk_buff *skb = NULL, *requeue_skb, *hdr_skb;
struct ieee80211_rx_status *rxs;
struct ath_hw *ah = sc-sc_ah;
+   struct ath9k_hw_capabilities *pCap = ah-caps;
struct ath_common *common = ath9k_hw_common(ah);
struct ieee80211_hw *hw = sc-hw;
struct ieee80211_hdr *hdr;
@@ -1328,11 +1329,30 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, 
bool hp)
skb = hdr_skb;
}
 
+   if (rxs-flag  RX_FLAG_MMIC_STRIPPED)
+   skb_trim(skb, skb-len - 8);
 
-   if (ah-caps.hw_caps  ATH9K_HW_CAP_ANT_DIV_COMB) {
+   spin_lock_irqsave(sc-sc_pm_lock, flags);
+   if ((sc-ps_flags  (PS_WAIT_FOR_BEACON |
+PS_WAIT_FOR_CAB |
+PS_WAIT_FOR_PSPOLL_DATA)) ||
+   ath9k_check_auto_sleep(sc))
+   ath_rx_ps(sc, skb, rs.is_mybeacon);
+   spin_unlock_irqrestore(sc-sc_pm_lock, flags);
 
+   /*
+* Run the LNA combining algorithm only in these cases:
+*
+* Standalone WLAN cards with both LNA/Antenna diversity
+* enabled in the EEPROM.
+*
+* WLAN+BT cards which are in the supported card list
+* in ath_pci_id_table and the user has loaded the
+* driver with bt_ant_diversity set to true.
+*/
+   if (ah-caps.hw_caps  ATH9K_HW_CAP_ANT_DIV_COMB) {
/*
-* change the default rx antenna if rx diversity
+* Change the default rx antenna if rx diversity
 * chooses the other antenna 3 times in a row.
 */
if (sc-rx.defant != rs.rs_antenna) {
@@ -1342,22 +1362,14 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, 
bool hp)
sc-rx.rxotherant = 0;
}
 
+   if (pCap-hw_caps  ATH9K_HW_CAP_BT_ANT_DIV) {
+   if (common-bt_ant_diversity)
+   ath_ant_comb_scan(sc, rs);
+   } else {
+   ath_ant_comb_scan(sc, rs);
+   }
}
 
-   if (rxs-flag  RX_FLAG_MMIC_STRIPPED)
-   skb_trim(skb, skb-len - 8);
-
-   spin_lock_irqsave(sc-sc_pm_lock, flags);
-   if ((sc-ps_flags  (PS_WAIT_FOR_BEACON |
-PS_WAIT_FOR_CAB |
-PS_WAIT_FOR_PSPOLL_DATA)) ||
-   ath9k_check_auto_sleep(sc))
-   ath_rx_ps(sc, skb, rs.is_mybeacon);
-   spin_unlock_irqrestore(sc-sc_pm_lock, flags);
-
-   if ((ah-caps.hw_caps  ATH9K_HW_CAP_ANT_DIV_COMB)  
sc-ant_rx == 3)
-   ath_ant_comb_scan(sc, rs);
-
ath9k_apply_ampdu_details(sc, rs, rxs);
 
ieee80211_rx(hw, skb);
-- 
1.8.3.4

___
ath9k-devel mailing list
ath9k-devel@lists.ath9k.org
https://lists.ath9k.org/mailman/listinfo/ath9k-devel