ath9k: Add a module parameter to enable diversity
authorSujith Manoharan <c_manoha@qualcomm.com>
Sun, 16 Sep 2012 02:36:56 +0000 (08:06 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 24 Sep 2012 18:59:11 +0000 (14:59 -0400)
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath.h
drivers/net/wireless/ath/ath9k/antenna.c
drivers/net/wireless/ath/ath9k/init.c

index 6169fbd23ed10a527e26973c2e00f2bfe6bd82af..4521342c62cc37654ee1889b9ee177e395706f27 100644 (file)
@@ -159,6 +159,7 @@ struct ath_common {
 
        bool btcoex_enabled;
        bool disable_ani;
+       bool antenna_diversity;
 };
 
 struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
index 8eb274f168610cde81aaba7805590ed246afc866..664844c5d3d51ae8752514bb3976fa2074ba0afe 100644 (file)
@@ -776,6 +776,7 @@ div_comb_done:
 void ath_ant_comb_update(struct ath_softc *sc)
 {
        struct ath_hw *ah = sc->sc_ah;
+       struct ath_common *common = ath9k_hw_common(ah);
        struct ath_hw_antcomb_conf div_ant_conf;
        u8 lna_conf;
 
@@ -790,4 +791,7 @@ void ath_ant_comb_update(struct ath_softc *sc)
        div_ant_conf.alt_lna_conf = lna_conf;
 
        ath9k_hw_antdiv_comb_conf_set(ah, &div_ant_conf);
+
+       if (common->antenna_diversity)
+               ath9k_hw_antctrl_shared_chain_lnadiv(ah, true);
 }
index 7062552225987dd0194d59f2132a5c9014e659d7..fad3ccd5cd91aa8ab5b96603701275303a3f6392 100644 (file)
@@ -46,6 +46,10 @@ static int ath9k_btcoex_enable;
 module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444);
 MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence");
 
+static int ath9k_enable_diversity;
+module_param_named(enable_diversity, ath9k_enable_diversity, int, 0444);
+MODULE_PARM_DESC(enable_diversity, "Enable Antenna diversity for AR9565");
+
 bool is_ath9k_unloaded;
 /* We use the hw_value as an index into our private channel structure */
 
@@ -546,6 +550,14 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
        common->debug_mask = ath9k_debug;
        common->btcoex_enabled = ath9k_btcoex_enable == 1;
        common->disable_ani = false;
+
+       /*
+        * Enable Antenna diversity only when BTCOEX is disabled
+        * and the user manually requests the feature.
+        */
+       if (!common->btcoex_enabled && ath9k_enable_diversity)
+               common->antenna_diversity = 1;
+
        spin_lock_init(&common->cc_lock);
 
        spin_lock_init(&sc->sc_serial_rw);