diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-09-02 19:40:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-14 13:56:22 -0400 |
commit | 43c3528430bd29f5e52438cad7cf7c0c62bf4583 (patch) | |
tree | b84845c758b2a4dba66403f6e6a6801d5e2574af /drivers/net/wireless/ath/ath9k/init.c | |
parent | 9adcf440dcc886a950a6049f928ab679912d99f4 (diff) |
ath9k: implement .get_antenna and .set_antenna
On MIMO chips this can be used to enable/disable hardware chains, ensuring
that the MCS information is updated accordingly.
On non-MIMO chips with rx diversity (e.g. 9285), this configures the rx
input antenna.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index be302fbdc3dc..9b34c4bab937 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -653,9 +653,22 @@ static void ath9k_init_txpower_limits(struct ath_softc *sc) | |||
653 | ah->curchan = curchan; | 653 | ah->curchan = curchan; |
654 | } | 654 | } |
655 | 655 | ||
656 | void ath9k_reload_chainmask_settings(struct ath_softc *sc) | ||
657 | { | ||
658 | if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)) | ||
659 | return; | ||
660 | |||
661 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) | ||
662 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); | ||
663 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) | ||
664 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); | ||
665 | } | ||
666 | |||
667 | |||
656 | void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | 668 | void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) |
657 | { | 669 | { |
658 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 670 | struct ath_hw *ah = sc->sc_ah; |
671 | struct ath_common *common = ath9k_hw_common(ah); | ||
659 | 672 | ||
660 | hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | | 673 | hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | |
661 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | | 674 | IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | |
@@ -693,6 +706,16 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
693 | hw->sta_data_size = sizeof(struct ath_node); | 706 | hw->sta_data_size = sizeof(struct ath_node); |
694 | hw->vif_data_size = sizeof(struct ath_vif); | 707 | hw->vif_data_size = sizeof(struct ath_vif); |
695 | 708 | ||
709 | hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1; | ||
710 | hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1; | ||
711 | |||
712 | /* single chain devices with rx diversity */ | ||
713 | if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) | ||
714 | hw->wiphy->available_antennas_rx = BIT(0) | BIT(1); | ||
715 | |||
716 | sc->ant_rx = hw->wiphy->available_antennas_rx; | ||
717 | sc->ant_tx = hw->wiphy->available_antennas_tx; | ||
718 | |||
696 | #ifdef CONFIG_ATH9K_RATE_CONTROL | 719 | #ifdef CONFIG_ATH9K_RATE_CONTROL |
697 | hw->rate_control_algorithm = "ath9k_rate_control"; | 720 | hw->rate_control_algorithm = "ath9k_rate_control"; |
698 | #endif | 721 | #endif |
@@ -704,12 +727,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
704 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 727 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
705 | &sc->sbands[IEEE80211_BAND_5GHZ]; | 728 | &sc->sbands[IEEE80211_BAND_5GHZ]; |
706 | 729 | ||
707 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { | 730 | ath9k_reload_chainmask_settings(sc); |
708 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) | ||
709 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); | ||
710 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) | ||
711 | setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); | ||
712 | } | ||
713 | 731 | ||
714 | SET_IEEE80211_PERM_ADDR(hw, common->macaddr); | 732 | SET_IEEE80211_PERM_ADDR(hw, common->macaddr); |
715 | } | 733 | } |