diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-07-15 13:53:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-07-17 15:11:34 -0400 |
commit | 5d9c7e3c82aaf40b9192e6482968a39b87427bf7 (patch) | |
tree | 063eb81ecc5526049d75f7fd3ccda4a3cf6ce573 /drivers/net/wireless/ath/ath9k | |
parent | 01967360a20598f95947a86af26c930ab1b50205 (diff) |
ath9k: validate rx antenna settings
Many chips are not able to deal with non-consecutive rx antenna selections
and respond with calibration errors, reset errors, etc.
When an antenna is selected as a tx antenna, also flag it for rx to avoid
chip issues.
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')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 01a5f1814bc8..cb9a8c9ab441 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1923,12 +1923,29 @@ static u32 fill_chainmask(u32 cap, u32 new) | |||
1923 | return filled; | 1923 | return filled; |
1924 | } | 1924 | } |
1925 | 1925 | ||
1926 | static bool validate_antenna_mask(struct ath_hw *ah, u32 val) | ||
1927 | { | ||
1928 | switch (val & 0x7) { | ||
1929 | case 0x1: | ||
1930 | case 0x3: | ||
1931 | case 0x7: | ||
1932 | return true; | ||
1933 | case 0x2: | ||
1934 | return (ah->caps.rx_chainmask == 1); | ||
1935 | default: | ||
1936 | return false; | ||
1937 | } | ||
1938 | } | ||
1939 | |||
1926 | static int ath9k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) | 1940 | static int ath9k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) |
1927 | { | 1941 | { |
1928 | struct ath_softc *sc = hw->priv; | 1942 | struct ath_softc *sc = hw->priv; |
1929 | struct ath_hw *ah = sc->sc_ah; | 1943 | struct ath_hw *ah = sc->sc_ah; |
1930 | 1944 | ||
1931 | if (!rx_ant || !tx_ant) | 1945 | if (ah->caps.rx_chainmask != 1) |
1946 | rx_ant |= tx_ant; | ||
1947 | |||
1948 | if (!validate_antenna_mask(ah, rx_ant) || !tx_ant) | ||
1932 | return -EINVAL; | 1949 | return -EINVAL; |
1933 | 1950 | ||
1934 | sc->ant_rx = rx_ant; | 1951 | sc->ant_rx = rx_ant; |