2012-06-27 01:10:18 +00:00
|
|
|
--- a/drivers/net/wireless/ath/ath9k/main.c
|
|
|
|
+++ b/drivers/net/wireless/ath/ath9k/main.c
|
2012-06-27 01:29:56 +00:00
|
|
|
@@ -1929,12 +1929,29 @@ static u32 fill_chainmask(u32 cap, u32 n
|
2012-06-27 01:10:18 +00:00
|
|
|
return filled;
|
|
|
|
}
|
|
|
|
|
2012-06-27 01:23:17 +00:00
|
|
|
+static bool validate_antenna_mask(struct ath_hw *ah, u32 val)
|
2012-06-27 01:10:18 +00:00
|
|
|
+{
|
2012-06-27 01:23:17 +00:00
|
|
|
+ switch (val & ah->caps.rx_chainmask) {
|
2012-06-27 01:10:18 +00:00
|
|
|
+ case 0x1:
|
|
|
|
+ case 0x3:
|
|
|
|
+ case 0x7:
|
|
|
|
+ return true;
|
2012-06-27 01:23:17 +00:00
|
|
|
+ case 0x2:
|
|
|
|
+ return (ah->caps.rx_chainmask == 1);
|
2012-06-27 01:10:18 +00:00
|
|
|
+ default:
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static int ath9k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
|
|
|
|
{
|
|
|
|
struct ath_softc *sc = hw->priv;
|
|
|
|
struct ath_hw *ah = sc->sc_ah;
|
|
|
|
|
|
|
|
- if (!rx_ant || !tx_ant)
|
2012-06-27 01:29:56 +00:00
|
|
|
+ if (ah->caps.rx_chainmask != 1)
|
|
|
|
+ rx_ant |= tx_ant;
|
|
|
|
+
|
2012-06-27 01:23:17 +00:00
|
|
|
+ if (!validate_antenna_mask(ah, rx_ant) || !tx_ant)
|
2012-06-27 01:10:18 +00:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
sc->ant_rx = rx_ant;
|