rtlwifi: rtl8192ce: Update rate setting routines

These changes were found in the latest vendor driver.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Larry Finger 2014-12-18 03:05:29 -06:00 committed by Kalle Valo
parent 9d62c5531b
commit ff6ee6b0ce

View File

@ -1168,7 +1168,6 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw,
switch (type) { switch (type) {
case NL80211_IFTYPE_UNSPECIFIED: case NL80211_IFTYPE_UNSPECIFIED:
mode = MSR_NOLINK; mode = MSR_NOLINK;
ledaction = LED_CTL_LINK;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"Set Network type to NO LINK!\n"); "Set Network type to NO LINK!\n");
break; break;
@ -1184,7 +1183,8 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw,
"Set Network type to STA!\n"); "Set Network type to STA!\n");
break; break;
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
bt_msr |= MSR_AP; mode = MSR_AP;
ledaction = LED_CTL_LINK;
RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
"Set Network type to AP!\n"); "Set Network type to AP!\n");
break; break;
@ -1222,7 +1222,7 @@ static int _rtl92ce_set_media_status(struct ieee80211_hw *hw,
"Set HW_VAR_MEDIA_STATUS: No such media status(%x).\n", "Set HW_VAR_MEDIA_STATUS: No such media status(%x).\n",
mode); mode);
} }
rtl_write_byte(rtlpriv, (MSR), bt_msr | mode); rtl_write_byte(rtlpriv, MSR, bt_msr | mode);
rtlpriv->cfg->ops->led_control(hw, ledaction); rtlpriv->cfg->ops->led_control(hw, ledaction);
if (mode == MSR_AP) if (mode == MSR_AP)
@ -1849,7 +1849,6 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw,
u32 ratr_value; u32 ratr_value;
u8 ratr_index = 0; u8 ratr_index = 0;
u8 nmode = mac->ht_enable; u8 nmode = mac->ht_enable;
u8 mimo_ps = IEEE80211_SMPS_OFF;
u16 shortgi_rate; u16 shortgi_rate;
u32 tmp_ratr_value; u32 tmp_ratr_value;
u8 curtxbw_40mhz = mac->bw_40; u8 curtxbw_40mhz = mac->bw_40;
@ -1858,6 +1857,7 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw,
u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ?
1 : 0; 1 : 0;
enum wireless_mode wirelessmode = mac->mode; enum wireless_mode wirelessmode = mac->mode;
u32 ratr_mask;
if (rtlhal->current_bandtype == BAND_ON_5G) if (rtlhal->current_bandtype == BAND_ON_5G)
ratr_value = sta->supp_rates[1] << 4; ratr_value = sta->supp_rates[1] << 4;
@ -1881,19 +1881,13 @@ static void rtl92ce_update_hal_rate_table(struct ieee80211_hw *hw,
case WIRELESS_MODE_N_24G: case WIRELESS_MODE_N_24G:
case WIRELESS_MODE_N_5G: case WIRELESS_MODE_N_5G:
nmode = 1; nmode = 1;
if (mimo_ps == IEEE80211_SMPS_STATIC) { if (get_rf_type(rtlphy) == RF_1T2R ||
ratr_value &= 0x0007F005; get_rf_type(rtlphy) == RF_1T1R)
} else { ratr_mask = 0x000ff005;
u32 ratr_mask; else
ratr_mask = 0x0f0ff005;
if (get_rf_type(rtlphy) == RF_1T2R || ratr_value &= ratr_mask;
get_rf_type(rtlphy) == RF_1T1R)
ratr_mask = 0x000ff005;
else
ratr_mask = 0x0f0ff005;
ratr_value &= ratr_mask;
}
break; break;
default: default:
if (rtlphy->rf_type == RF_1T2R) if (rtlphy->rf_type == RF_1T2R)
@ -1946,17 +1940,16 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
struct rtl_sta_info *sta_entry = NULL; struct rtl_sta_info *sta_entry = NULL;
u32 ratr_bitmap; u32 ratr_bitmap;
u8 ratr_index; u8 ratr_index;
u8 curtxbw_40mhz = (sta->bandwidth >= IEEE80211_STA_RX_BW_40) ? 1 : 0; u8 curtxbw_40mhz = (sta->ht_cap.cap &
u8 curshortgi_40mhz = curtxbw_40mhz && IEEE80211_HT_CAP_SUP_WIDTH_20_40) ? 1 : 0;
(sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? u8 curshortgi_40mhz = (sta->ht_cap.cap &
1 : 0; IEEE80211_HT_CAP_SGI_40) ? 1 : 0;
u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? u8 curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ?
1 : 0; 1 : 0;
enum wireless_mode wirelessmode = 0; enum wireless_mode wirelessmode = 0;
bool shortgi = false; bool shortgi = false;
u8 rate_mask[5]; u8 rate_mask[5];
u8 macid = 0; u8 macid = 0;
u8 mimo_ps = IEEE80211_SMPS_OFF;
sta_entry = (struct rtl_sta_info *) sta->drv_priv; sta_entry = (struct rtl_sta_info *) sta->drv_priv;
wirelessmode = sta_entry->wireless_mode; wirelessmode = sta_entry->wireless_mode;
@ -2001,47 +1994,38 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
case WIRELESS_MODE_N_5G: case WIRELESS_MODE_N_5G:
ratr_index = RATR_INX_WIRELESS_NGB; ratr_index = RATR_INX_WIRELESS_NGB;
if (mimo_ps == IEEE80211_SMPS_STATIC) { if (rtlphy->rf_type == RF_1T2R ||
if (rssi_level == 1) rtlphy->rf_type == RF_1T1R) {
ratr_bitmap &= 0x00070000; if (curtxbw_40mhz) {
else if (rssi_level == 2) if (rssi_level == 1)
ratr_bitmap &= 0x0007f000; ratr_bitmap &= 0x000f0000;
else else if (rssi_level == 2)
ratr_bitmap &= 0x0007f005; ratr_bitmap &= 0x000ff000;
} else { else
if (rtlphy->rf_type == RF_1T2R || ratr_bitmap &= 0x000ff015;
rtlphy->rf_type == RF_1T1R) {
if (curtxbw_40mhz) {
if (rssi_level == 1)
ratr_bitmap &= 0x000f0000;
else if (rssi_level == 2)
ratr_bitmap &= 0x000ff000;
else
ratr_bitmap &= 0x000ff015;
} else {
if (rssi_level == 1)
ratr_bitmap &= 0x000f0000;
else if (rssi_level == 2)
ratr_bitmap &= 0x000ff000;
else
ratr_bitmap &= 0x000ff005;
}
} else { } else {
if (curtxbw_40mhz) { if (rssi_level == 1)
if (rssi_level == 1) ratr_bitmap &= 0x000f0000;
ratr_bitmap &= 0x0f0f0000; else if (rssi_level == 2)
else if (rssi_level == 2) ratr_bitmap &= 0x000ff000;
ratr_bitmap &= 0x0f0ff000; else
else ratr_bitmap &= 0x000ff005;
ratr_bitmap &= 0x0f0ff015; }
} else { } else {
if (rssi_level == 1) if (curtxbw_40mhz) {
ratr_bitmap &= 0x0f0f0000; if (rssi_level == 1)
else if (rssi_level == 2) ratr_bitmap &= 0x0f0f0000;
ratr_bitmap &= 0x0f0ff000; else if (rssi_level == 2)
else ratr_bitmap &= 0x0f0ff000;
ratr_bitmap &= 0x0f0ff005; else
} ratr_bitmap &= 0x0f0ff015;
} else {
if (rssi_level == 1)
ratr_bitmap &= 0x0f0f0000;
else if (rssi_level == 2)
ratr_bitmap &= 0x0f0ff000;
else
ratr_bitmap &= 0x0f0ff005;
} }
} }
@ -2074,9 +2058,6 @@ static void rtl92ce_update_hal_rate_mask(struct ieee80211_hw *hw,
"Rate_index:%x, ratr_val:%x, %5phC\n", "Rate_index:%x, ratr_val:%x, %5phC\n",
ratr_index, ratr_bitmap, rate_mask); ratr_index, ratr_bitmap, rate_mask);
rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask); rtl92c_fill_h2c_cmd(hw, H2C_RA_MASK, 5, rate_mask);
if (macid != 0)
sta_entry->ratr_index = ratr_index;
} }
void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw, void rtl92ce_update_hal_rate_tbl(struct ieee80211_hw *hw,