diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2009-10-22 14:21:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-06 16:54:38 -0500 |
commit | 08b063477e45cb366df7204cbcdc79ff86513ef9 (patch) | |
tree | 37839c036dcd785381624dbf8f4798555b17a0e1 /drivers/net/wireless/mwl8k.c | |
parent | 42fba21d56df644887488a29b158cc8916b9ba99 (diff) |
mwl8k: implement AP firmware antenna configuration
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwl8k.c')
-rw-r--r-- | drivers/net/wireless/mwl8k.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index 9b9ce7005da0..59219fdb342d 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -280,6 +280,7 @@ static const struct ieee80211_rate mwl8k_rates[] = { | |||
280 | #define MWL8K_CMD_GET_STAT 0x0014 | 280 | #define MWL8K_CMD_GET_STAT 0x0014 |
281 | #define MWL8K_CMD_RADIO_CONTROL 0x001c | 281 | #define MWL8K_CMD_RADIO_CONTROL 0x001c |
282 | #define MWL8K_CMD_RF_TX_POWER 0x001e | 282 | #define MWL8K_CMD_RF_TX_POWER 0x001e |
283 | #define MWL8K_CMD_RF_ANTENNA 0x0020 | ||
283 | #define MWL8K_CMD_SET_PRE_SCAN 0x0107 | 284 | #define MWL8K_CMD_SET_PRE_SCAN 0x0107 |
284 | #define MWL8K_CMD_SET_POST_SCAN 0x0108 | 285 | #define MWL8K_CMD_SET_POST_SCAN 0x0108 |
285 | #define MWL8K_CMD_SET_RF_CHANNEL 0x010a | 286 | #define MWL8K_CMD_SET_RF_CHANNEL 0x010a |
@@ -311,6 +312,7 @@ static const char *mwl8k_cmd_name(u16 cmd, char *buf, int bufsize) | |||
311 | MWL8K_CMDNAME(GET_STAT); | 312 | MWL8K_CMDNAME(GET_STAT); |
312 | MWL8K_CMDNAME(RADIO_CONTROL); | 313 | MWL8K_CMDNAME(RADIO_CONTROL); |
313 | MWL8K_CMDNAME(RF_TX_POWER); | 314 | MWL8K_CMDNAME(RF_TX_POWER); |
315 | MWL8K_CMDNAME(RF_ANTENNA); | ||
314 | MWL8K_CMDNAME(SET_PRE_SCAN); | 316 | MWL8K_CMDNAME(SET_PRE_SCAN); |
315 | MWL8K_CMDNAME(SET_POST_SCAN); | 317 | MWL8K_CMDNAME(SET_POST_SCAN); |
316 | MWL8K_CMDNAME(SET_RF_CHANNEL); | 318 | MWL8K_CMDNAME(SET_RF_CHANNEL); |
@@ -1919,6 +1921,39 @@ static int mwl8k_cmd_802_11_rf_tx_power(struct ieee80211_hw *hw, int dBm) | |||
1919 | } | 1921 | } |
1920 | 1922 | ||
1921 | /* | 1923 | /* |
1924 | * CMD_RF_ANTENNA. | ||
1925 | */ | ||
1926 | struct mwl8k_cmd_rf_antenna { | ||
1927 | struct mwl8k_cmd_pkt header; | ||
1928 | __le16 antenna; | ||
1929 | __le16 mode; | ||
1930 | } __attribute__((packed)); | ||
1931 | |||
1932 | #define MWL8K_RF_ANTENNA_RX 1 | ||
1933 | #define MWL8K_RF_ANTENNA_TX 2 | ||
1934 | |||
1935 | static int | ||
1936 | mwl8k_cmd_rf_antenna(struct ieee80211_hw *hw, int antenna, int mask) | ||
1937 | { | ||
1938 | struct mwl8k_cmd_rf_antenna *cmd; | ||
1939 | int rc; | ||
1940 | |||
1941 | cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); | ||
1942 | if (cmd == NULL) | ||
1943 | return -ENOMEM; | ||
1944 | |||
1945 | cmd->header.code = cpu_to_le16(MWL8K_CMD_RF_ANTENNA); | ||
1946 | cmd->header.length = cpu_to_le16(sizeof(*cmd)); | ||
1947 | cmd->antenna = cpu_to_le16(antenna); | ||
1948 | cmd->mode = cpu_to_le16(mask); | ||
1949 | |||
1950 | rc = mwl8k_post_cmd(hw, &cmd->header); | ||
1951 | kfree(cmd); | ||
1952 | |||
1953 | return rc; | ||
1954 | } | ||
1955 | |||
1956 | /* | ||
1922 | * CMD_SET_PRE_SCAN. | 1957 | * CMD_SET_PRE_SCAN. |
1923 | */ | 1958 | */ |
1924 | struct mwl8k_cmd_set_pre_scan { | 1959 | struct mwl8k_cmd_set_pre_scan { |
@@ -2832,8 +2867,13 @@ static int mwl8k_config(struct ieee80211_hw *hw, u32 changed) | |||
2832 | if (rc) | 2867 | if (rc) |
2833 | goto out; | 2868 | goto out; |
2834 | 2869 | ||
2835 | if (mwl8k_cmd_mimo_config(hw, 0x7, 0x7)) | 2870 | if (priv->ap_fw) { |
2836 | rc = -EINVAL; | 2871 | rc = mwl8k_cmd_rf_antenna(hw, MWL8K_RF_ANTENNA_RX, 0x7); |
2872 | if (!rc) | ||
2873 | rc = mwl8k_cmd_rf_antenna(hw, MWL8K_RF_ANTENNA_TX, 0x7); | ||
2874 | } else { | ||
2875 | rc = mwl8k_cmd_mimo_config(hw, 0x7, 0x7); | ||
2876 | } | ||
2837 | 2877 | ||
2838 | out: | 2878 | out: |
2839 | mwl8k_fw_unlock(hw); | 2879 | mwl8k_fw_unlock(hw); |