diff options
author | Bruno Randolf <br1@einfach.org> | 2010-11-09 22:51:01 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-16 16:37:05 -0500 |
commit | 72a801103f07182c0a4f3a761caa62b4ab8eb4e5 (patch) | |
tree | ab8f95e6f530d8f27bd0bbabb2005266449985b3 /drivers/net/wireless/ath/ath5k | |
parent | 15d967532148a5fcda075282b82a271b6595a386 (diff) |
ath5k: Add support for antenna configuration
Support setting the antenna configuration via cfg/mac80211. At the moment only
allow the simple pre-defined configurations we already have (fixed antenna A/B
or diversity), but more advanced settings are possible to implement.
Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index b9f93fbd9728..fe116de41361 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -3413,6 +3413,36 @@ static int ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3413 | return ret; | 3413 | return ret; |
3414 | } | 3414 | } |
3415 | 3415 | ||
3416 | static int ath5k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) | ||
3417 | { | ||
3418 | struct ath5k_softc *sc = hw->priv; | ||
3419 | |||
3420 | if (tx_ant == 1 && rx_ant == 1) | ||
3421 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A); | ||
3422 | else if (tx_ant == 2 && rx_ant == 2) | ||
3423 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B); | ||
3424 | else if ((tx_ant & 3) == 3 && (rx_ant & 3) == 3) | ||
3425 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT); | ||
3426 | else | ||
3427 | return -EINVAL; | ||
3428 | return 0; | ||
3429 | } | ||
3430 | |||
3431 | static int ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) | ||
3432 | { | ||
3433 | struct ath5k_softc *sc = hw->priv; | ||
3434 | |||
3435 | switch (sc->ah->ah_ant_mode) { | ||
3436 | case AR5K_ANTMODE_FIXED_A: | ||
3437 | *tx_ant = 1; *rx_ant = 1; break; | ||
3438 | case AR5K_ANTMODE_FIXED_B: | ||
3439 | *tx_ant = 2; *rx_ant = 2; break; | ||
3440 | case AR5K_ANTMODE_DEFAULT: | ||
3441 | *tx_ant = 3; *rx_ant = 3; break; | ||
3442 | } | ||
3443 | return 0; | ||
3444 | } | ||
3445 | |||
3416 | static const struct ieee80211_ops ath5k_hw_ops = { | 3446 | static const struct ieee80211_ops ath5k_hw_ops = { |
3417 | .tx = ath5k_tx, | 3447 | .tx = ath5k_tx, |
3418 | .start = ath5k_start, | 3448 | .start = ath5k_start, |
@@ -3433,6 +3463,8 @@ static const struct ieee80211_ops ath5k_hw_ops = { | |||
3433 | .sw_scan_start = ath5k_sw_scan_start, | 3463 | .sw_scan_start = ath5k_sw_scan_start, |
3434 | .sw_scan_complete = ath5k_sw_scan_complete, | 3464 | .sw_scan_complete = ath5k_sw_scan_complete, |
3435 | .set_coverage_class = ath5k_set_coverage_class, | 3465 | .set_coverage_class = ath5k_set_coverage_class, |
3466 | .set_antenna = ath5k_set_antenna, | ||
3467 | .get_antenna = ath5k_get_antenna, | ||
3436 | }; | 3468 | }; |
3437 | 3469 | ||
3438 | /********************\ | 3470 | /********************\ |