Skip to content

Commit 099fb8a

Browse files
lwfingerlinvjw
authored andcommitted
rtlwifi: rtl8192c-common: rtl8192ce: Fix for HT40 regression
The changes that were made to rtl8192ce when rtl8192cu was added broke HT40. The errors included a typo in rtlwifi, a missing routine in rtl8192ce and a missing callback of that routine in rtl8192c-common. This patch fixes the regression reported in Bug #35082. Signed-off-by: Larry Finger <[email protected]> Cc: [email protected] Signed-off-by: John W. Linville <[email protected]>
1 parent 349eb8c commit 099fb8a

File tree

5 files changed

+73
-2
lines changed

5 files changed

+73
-2
lines changed

drivers/net/wireless/rtlwifi/ps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw)
190190

191191
ppsc->swrf_processing = true;
192192

193-
if (ppsc->inactive_pwrstate == ERFOFF &&
193+
if (ppsc->inactive_pwrstate == ERFON &&
194194
rtlhal->interface == INTF_PCI) {
195195
if ((ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM) &&
196196
RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM) &&

drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
728728
return;
729729
rtlphy->set_bwmode_inprogress = true;
730730
if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) {
731-
rtlphy->set_bwmode_inprogress = false;
731+
rtlpriv->cfg->ops->phy_set_bw_mode_callback(hw);
732732
} else {
733733
RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
734734
("FALSE driver sleep or unload\n"));

drivers/net/wireless/rtlwifi/rtl8192ce/phy.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,75 @@ bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
366366
return true;
367367
}
368368

369+
void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
370+
{
371+
struct rtl_priv *rtlpriv = rtl_priv(hw);
372+
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
373+
struct rtl_phy *rtlphy = &(rtlpriv->phy);
374+
struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
375+
u8 reg_bw_opmode;
376+
u8 reg_prsr_rsc;
377+
378+
RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE,
379+
("Switch to %s bandwidth\n",
380+
rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
381+
"20MHz" : "40MHz"))
382+
383+
if (is_hal_stop(rtlhal)) {
384+
rtlphy->set_bwmode_inprogress = false;
385+
return;
386+
}
387+
388+
reg_bw_opmode = rtl_read_byte(rtlpriv, REG_BWOPMODE);
389+
reg_prsr_rsc = rtl_read_byte(rtlpriv, REG_RRSR + 2);
390+
391+
switch (rtlphy->current_chan_bw) {
392+
case HT_CHANNEL_WIDTH_20:
393+
reg_bw_opmode |= BW_OPMODE_20MHZ;
394+
rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode);
395+
break;
396+
case HT_CHANNEL_WIDTH_20_40:
397+
reg_bw_opmode &= ~BW_OPMODE_20MHZ;
398+
rtl_write_byte(rtlpriv, REG_BWOPMODE, reg_bw_opmode);
399+
reg_prsr_rsc =
400+
(reg_prsr_rsc & 0x90) | (mac->cur_40_prime_sc << 5);
401+
rtl_write_byte(rtlpriv, REG_RRSR + 2, reg_prsr_rsc);
402+
break;
403+
default:
404+
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
405+
("unknown bandwidth: %#X\n", rtlphy->current_chan_bw));
406+
break;
407+
}
408+
409+
switch (rtlphy->current_chan_bw) {
410+
case HT_CHANNEL_WIDTH_20:
411+
rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x0);
412+
rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x0);
413+
rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 1);
414+
break;
415+
case HT_CHANNEL_WIDTH_20_40:
416+
rtl_set_bbreg(hw, RFPGA0_RFMOD, BRFMOD, 0x1);
417+
rtl_set_bbreg(hw, RFPGA1_RFMOD, BRFMOD, 0x1);
418+
419+
rtl_set_bbreg(hw, RCCK0_SYSTEM, BCCK_SIDEBAND,
420+
(mac->cur_40_prime_sc >> 1));
421+
rtl_set_bbreg(hw, ROFDM1_LSTF, 0xC00, mac->cur_40_prime_sc);
422+
rtl_set_bbreg(hw, RFPGA0_ANALOGPARAMETER2, BIT(10), 0);
423+
424+
rtl_set_bbreg(hw, 0x818, (BIT(26) | BIT(27)),
425+
(mac->cur_40_prime_sc ==
426+
HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1);
427+
break;
428+
default:
429+
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
430+
("unknown bandwidth: %#X\n", rtlphy->current_chan_bw));
431+
break;
432+
}
433+
rtl92ce_phy_rf6052_set_bandwidth(hw, rtlphy->current_chan_bw);
434+
rtlphy->set_bwmode_inprogress = false;
435+
RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n"));
436+
}
437+
369438
void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t)
370439
{
371440
u8 tmpreg;

drivers/net/wireless/rtlwifi/rtl8192ce/phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,5 +257,6 @@ bool _rtl92ce_phy_config_bb_with_headerfile(struct ieee80211_hw *hw,
257257
u8 configtype);
258258
bool _rtl92ce_phy_config_bb_with_pgheaderfile(struct ieee80211_hw *hw,
259259
u8 configtype);
260+
void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
260261

261262
#endif

drivers/net/wireless/rtlwifi/rtl8192ce/sw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ static struct rtl_hal_ops rtl8192ce_hal_ops = {
232232
.config_bb_with_headerfile = _rtl92ce_phy_config_bb_with_headerfile,
233233
.config_bb_with_pgheaderfile = _rtl92ce_phy_config_bb_with_pgheaderfile,
234234
.phy_lc_calibrate = _rtl92ce_phy_lc_calibrate,
235+
.phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback,
235236
.dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower,
236237
};
237238

0 commit comments

Comments
 (0)