diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2014-02-25 08:48:52 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-02-28 14:33:13 -0500 |
commit | b60d105242ac457dab057f676c8aaa20d1821b10 (patch) | |
tree | ad597a468b33c5afe0f6866a7823200d04630c1f /drivers/net/wireless/ath/ath9k/common-init.c | |
parent | 31f023a1cb92678604d5a1427623348f5b896eab (diff) |
ath9k: move setup_ht_cap to common-init
and rename it to ath9k_cmn_setup_ht_cap
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/common-init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/common-init.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common-init.c b/drivers/net/wireless/ath/ath9k/common-init.c index 1fa30c3b7d53..8e2fa0385c58 100644 --- a/drivers/net/wireless/ath/ath9k/common-init.c +++ b/drivers/net/wireless/ath/ath9k/common-init.c | |||
@@ -168,3 +168,61 @@ int ath9k_cmn_init_channels_rates(struct ath_common *common) | |||
168 | return 0; | 168 | return 0; |
169 | } | 169 | } |
170 | EXPORT_SYMBOL(ath9k_cmn_init_channels_rates); | 170 | EXPORT_SYMBOL(ath9k_cmn_init_channels_rates); |
171 | |||
172 | void ath9k_cmn_setup_ht_cap(struct ath_hw *ah, | ||
173 | struct ieee80211_sta_ht_cap *ht_info) | ||
174 | { | ||
175 | struct ath_common *common = ath9k_hw_common(ah); | ||
176 | u8 tx_streams, rx_streams; | ||
177 | int i, max_streams; | ||
178 | |||
179 | ht_info->ht_supported = true; | ||
180 | ht_info->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | | ||
181 | IEEE80211_HT_CAP_SM_PS | | ||
182 | IEEE80211_HT_CAP_SGI_40 | | ||
183 | IEEE80211_HT_CAP_DSSSCCK40; | ||
184 | |||
185 | if (ah->caps.hw_caps & ATH9K_HW_CAP_LDPC) | ||
186 | ht_info->cap |= IEEE80211_HT_CAP_LDPC_CODING; | ||
187 | |||
188 | if (ah->caps.hw_caps & ATH9K_HW_CAP_SGI_20) | ||
189 | ht_info->cap |= IEEE80211_HT_CAP_SGI_20; | ||
190 | |||
191 | ht_info->ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; | ||
192 | ht_info->ampdu_density = IEEE80211_HT_MPDU_DENSITY_8; | ||
193 | |||
194 | if (AR_SREV_9330(ah) || AR_SREV_9485(ah) || AR_SREV_9565(ah)) | ||
195 | max_streams = 1; | ||
196 | else if (AR_SREV_9462(ah)) | ||
197 | max_streams = 2; | ||
198 | else if (AR_SREV_9300_20_OR_LATER(ah)) | ||
199 | max_streams = 3; | ||
200 | else | ||
201 | max_streams = 2; | ||
202 | |||
203 | if (AR_SREV_9280_20_OR_LATER(ah)) { | ||
204 | if (max_streams >= 2) | ||
205 | ht_info->cap |= IEEE80211_HT_CAP_TX_STBC; | ||
206 | ht_info->cap |= (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT); | ||
207 | } | ||
208 | |||
209 | /* set up supported mcs set */ | ||
210 | memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); | ||
211 | tx_streams = ath9k_cmn_count_streams(ah->txchainmask, max_streams); | ||
212 | rx_streams = ath9k_cmn_count_streams(ah->rxchainmask, max_streams); | ||
213 | |||
214 | ath_dbg(common, CONFIG, "TX streams %d, RX streams: %d\n", | ||
215 | tx_streams, rx_streams); | ||
216 | |||
217 | if (tx_streams != rx_streams) { | ||
218 | ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_RX_DIFF; | ||
219 | ht_info->mcs.tx_params |= ((tx_streams - 1) << | ||
220 | IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT); | ||
221 | } | ||
222 | |||
223 | for (i = 0; i < rx_streams; i++) | ||
224 | ht_info->mcs.rx_mask[i] = 0xff; | ||
225 | |||
226 | ht_info->mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; | ||
227 | } | ||
228 | EXPORT_SYMBOL(ath9k_cmn_setup_ht_cap); | ||