From: Bruno Randolf <br1@einfach.org>
To: johannes@sipsolutions.net, linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org, lrodriguez@atheros.com
Subject: [PATCH v4 3/3] ath5k: Add support for antenna configuration
Date: Tue, 27 Jul 2010 18:48:10 +0900 [thread overview]
Message-ID: <20100727094810.27186.52753.stgit@tt-desk> (raw)
In-Reply-To: <20100727094732.27186.30900.stgit@tt-desk>
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>
---
drivers/net/wireless/ath/ath5k/base.c | 34 +++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 0d5de25..9150d1a 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -256,6 +256,8 @@ static void ath5k_sw_scan_start(struct ieee80211_hw *hw);
static void ath5k_sw_scan_complete(struct ieee80211_hw *hw);
static void ath5k_set_coverage_class(struct ieee80211_hw *hw,
u8 coverage_class);
+static int ath5k_set_antenna(struct ieee80211_hw *hw, u8 tx_ant, u8 rx_ant);
+static int ath5k_get_antenna(struct ieee80211_hw *hw, u8 *tx_ant, u8 *rx_ant);
static const struct ieee80211_ops ath5k_hw_ops = {
.tx = ath5k_tx,
@@ -277,6 +279,8 @@ static const struct ieee80211_ops ath5k_hw_ops = {
.sw_scan_start = ath5k_sw_scan_start,
.sw_scan_complete = ath5k_sw_scan_complete,
.set_coverage_class = ath5k_set_coverage_class,
+ .set_antenna = ath5k_set_antenna,
+ .get_antenna = ath5k_get_antenna,
};
/*
@@ -3526,3 +3530,33 @@ static void ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class)
ath5k_hw_set_coverage_class(sc->ah, coverage_class);
mutex_unlock(&sc->lock);
}
+
+static int ath5k_set_antenna(struct ieee80211_hw *hw, u8 tx_ant, u8 rx_ant)
+{
+ struct ath5k_softc *sc = hw->priv;
+
+ if (tx_ant == 1 && rx_ant == 1)
+ ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A);
+ else if (tx_ant == 2 && rx_ant == 2)
+ ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B);
+ else if (tx_ant == 0 && (rx_ant & 3) == 3)
+ ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT);
+ else
+ return -EINVAL;
+ return 0;
+}
+
+static int ath5k_get_antenna(struct ieee80211_hw *hw, u8 *tx_ant, u8 *rx_ant)
+{
+ struct ath5k_softc *sc = hw->priv;
+
+ switch (sc->ah->ah_ant_mode) {
+ case AR5K_ANTMODE_FIXED_A:
+ *tx_ant = 1; *rx_ant = 1; break;
+ case AR5K_ANTMODE_FIXED_B:
+ *tx_ant = 2; *rx_ant = 2; break;
+ case AR5K_ANTMODE_DEFAULT:
+ *tx_ant = 0; *rx_ant = 3; break;
+ }
+ return 0;
+}
prev parent reply other threads:[~2010-07-27 9:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 9:47 [PATCH v4 0/3] Antenna configuration Bruno Randolf
2010-07-27 9:48 ` [PATCH v4 1/3] cfg80211: Add nl80211 antenna configuration Bruno Randolf
2010-07-27 10:05 ` Johannes Berg
2010-07-28 2:03 ` Bruno Randolf
2010-07-27 16:19 ` Luis R. Rodriguez
2010-07-27 16:39 ` Felix Fietkau
2010-07-27 16:47 ` Luis R. Rodriguez
2010-07-28 2:06 ` Bruno Randolf
2010-07-28 17:24 ` Luis R. Rodriguez
2010-07-28 17:50 ` Felix Fietkau
2010-07-28 21:15 ` Luis R. Rodriguez
2010-07-28 21:26 ` Felix Fietkau
2010-07-28 21:39 ` Luis R. Rodriguez
2010-07-28 22:05 ` Felix Fietkau
2010-07-28 22:14 ` Luis R. Rodriguez
2010-07-29 0:10 ` Luis R. Rodriguez
2010-07-29 2:11 ` Bruno Randolf
2010-07-29 15:09 ` Luis R. Rodriguez
2010-08-02 3:59 ` Bruno Randolf
2010-08-02 5:31 ` Luis R. Rodriguez
2010-07-27 9:48 ` [PATCH v4 2/3] mac80211: Add " Bruno Randolf
2010-07-27 9:48 ` Bruno Randolf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100727094810.27186.52753.stgit@tt-desk \
--to=br1@einfach.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=lrodriguez@atheros.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).