diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2012-07-02 22:32:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-07-09 16:36:21 -0400 |
commit | 8a279d5b4dc128a4fcc3f8c545603adbce59bcfa (patch) | |
tree | d7527ea95cda67b13b73ef30ae475c3eeae1da66 /drivers/net/wireless/mwifiex/cfg80211.c | |
parent | 83bfea42190b72acc1a1653bc10b21e741490087 (diff) |
mwifiex: add set_antenna handler support
This enables user to set mode of Tx/Rx path using "iw set antenna"
command. For non MIMO chips, the command will be used for selecting
specific antenna or configuring antenna diversity mode.
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/cfg80211.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 2aeb97428669..6c57e832ae83 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -941,6 +941,42 @@ static int mwifiex_cfg80211_change_beacon(struct wiphy *wiphy, | |||
941 | return 0; | 941 | return 0; |
942 | } | 942 | } |
943 | 943 | ||
944 | static int | ||
945 | mwifiex_cfg80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) | ||
946 | { | ||
947 | struct mwifiex_adapter *adapter = mwifiex_cfg80211_get_adapter(wiphy); | ||
948 | struct mwifiex_private *priv = mwifiex_get_priv(adapter, | ||
949 | MWIFIEX_BSS_ROLE_ANY); | ||
950 | struct mwifiex_ds_ant_cfg ant_cfg; | ||
951 | |||
952 | if (!tx_ant || !rx_ant) | ||
953 | return -EOPNOTSUPP; | ||
954 | |||
955 | if (adapter->hw_dev_mcs_support != HT_STREAM_2X2) { | ||
956 | /* Not a MIMO chip. User should provide specific antenna number | ||
957 | * for Tx/Rx path or enable all antennas for diversity | ||
958 | */ | ||
959 | if (tx_ant != rx_ant) | ||
960 | return -EOPNOTSUPP; | ||
961 | |||
962 | if ((tx_ant & (tx_ant - 1)) && | ||
963 | (tx_ant != BIT(adapter->number_of_antenna) - 1)) | ||
964 | return -EOPNOTSUPP; | ||
965 | |||
966 | if ((tx_ant == BIT(adapter->number_of_antenna) - 1) && | ||
967 | (priv->adapter->number_of_antenna > 1)) { | ||
968 | tx_ant = RF_ANTENNA_AUTO; | ||
969 | rx_ant = RF_ANTENNA_AUTO; | ||
970 | } | ||
971 | } | ||
972 | |||
973 | ant_cfg.tx_ant = tx_ant; | ||
974 | ant_cfg.rx_ant = rx_ant; | ||
975 | |||
976 | return mwifiex_send_cmd_sync(priv, HostCmd_CMD_RF_ANTENNA, | ||
977 | HostCmd_ACT_GEN_SET, 0, &ant_cfg); | ||
978 | } | ||
979 | |||
944 | /* cfg80211 operation handler for stop ap. | 980 | /* cfg80211 operation handler for stop ap. |
945 | * Function stops BSS running at uAP interface. | 981 | * Function stops BSS running at uAP interface. |
946 | */ | 982 | */ |
@@ -1726,6 +1762,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { | |||
1726 | .stop_ap = mwifiex_cfg80211_stop_ap, | 1762 | .stop_ap = mwifiex_cfg80211_stop_ap, |
1727 | .change_beacon = mwifiex_cfg80211_change_beacon, | 1763 | .change_beacon = mwifiex_cfg80211_change_beacon, |
1728 | .set_cqm_rssi_config = mwifiex_cfg80211_set_cqm_rssi_config, | 1764 | .set_cqm_rssi_config = mwifiex_cfg80211_set_cqm_rssi_config, |
1765 | .set_antenna = mwifiex_cfg80211_set_antenna, | ||
1729 | }; | 1766 | }; |
1730 | 1767 | ||
1731 | /* | 1768 | /* |
@@ -1778,6 +1815,9 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) | |||
1778 | wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | | 1815 | wiphy->probe_resp_offload = NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS | |
1779 | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2; | 1816 | NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2; |
1780 | 1817 | ||
1818 | wiphy->available_antennas_tx = BIT(adapter->number_of_antenna) - 1; | ||
1819 | wiphy->available_antennas_rx = BIT(adapter->number_of_antenna) - 1; | ||
1820 | |||
1781 | /* Reserve space for mwifiex specific private data for BSS */ | 1821 | /* Reserve space for mwifiex specific private data for BSS */ |
1782 | wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); | 1822 | wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); |
1783 | 1823 | ||