Skip to content

Commit c18d8f5

Browse files
lwfingerKalle Valo
authored andcommitted
rtlwifi: rtl8723be: Add antenna select module parameter
A number of new laptops have been delivered with only a single antenna. In principle, this is OK; however, a problem arises when the on-board EEPROM is programmed to use the other antenna connection. The option of opening the computer and moving the connector is not always possible as it will void the warranty in some cases. In addition, this solution breaks the Windows driver when the box dual boots Linux and Windows. A fix involving a new module parameter has been developed. This commit adds the new parameter and implements the changes needed for the driver. Signed-off-by: Larry Finger <[email protected]> Cc: Stable <[email protected]> [V4.0+] Signed-off-by: Kalle Valo <[email protected]>
1 parent 0026b32 commit c18d8f5

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,6 +2684,7 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw,
26842684
bool auto_load_fail, u8 *hwinfo)
26852685
{
26862686
struct rtl_priv *rtlpriv = rtl_priv(hw);
2687+
struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
26872688
u8 value;
26882689
u32 tmpu_32;
26892690

@@ -2702,6 +2703,10 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw,
27022703
rtlpriv->btcoexist.btc_info.ant_num = ANT_X2;
27032704
}
27042705

2706+
/* override ant_num / ant_path */
2707+
if (mod_params->ant_sel)
2708+
rtlpriv->btcoexist.btc_info.ant_num =
2709+
(mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1);
27052710
}
27062711

27072712
void rtl8723be_bt_reg_init(struct ieee80211_hw *hw)

drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ static struct rtl_mod_params rtl8723be_mod_params = {
273273
.msi_support = false,
274274
.disable_watchdog = false,
275275
.debug = DBG_EMERG,
276+
.ant_sel = 0,
276277
};
277278

278279
static struct rtl_hal_cfg rtl8723be_hal_cfg = {
@@ -394,6 +395,7 @@ module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444);
394395
module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444);
395396
module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog,
396397
bool, 0444);
398+
module_param_named(ant_sel, rtl8723be_mod_params.ant_sel, int, 0444);
397399
MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n");
398400
MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n");
399401
MODULE_PARM_DESC(swlps, "Set to 1 to use SW control power save (default 0)\n");
@@ -402,6 +404,7 @@ MODULE_PARM_DESC(msi, "Set to 1 to use MSI interrupts mode (default 0)\n");
402404
MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)");
403405
MODULE_PARM_DESC(disable_watchdog,
404406
"Set to 1 to disable the watchdog (default 0)\n");
407+
MODULE_PARM_DESC(ant_sel, "Set to 1 or 2 to force antenna number (default 0)\n");
405408

406409
static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
407410

drivers/net/wireless/realtek/rtlwifi/wifi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,6 +2246,9 @@ struct rtl_mod_params {
22462246

22472247
/* default 0: 1 means do not disable interrupts */
22482248
bool int_clear;
2249+
2250+
/* select antenna */
2251+
int ant_sel;
22492252
};
22502253

22512254
struct rtl_hal_usbint_cfg {

0 commit comments

Comments
 (0)