From patchwork Wed Mar 16 18:33:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 8603231 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 848D0C0553 for ; Wed, 16 Mar 2016 18:34:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96A3C202E6 for ; Wed, 16 Mar 2016 18:34:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 725F62026C for ; Wed, 16 Mar 2016 18:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935245AbcCPSeF (ORCPT ); Wed, 16 Mar 2016 14:34:05 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:33529 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935207AbcCPSeB (ORCPT ); Wed, 16 Mar 2016 14:34:01 -0400 Received: by mail-oi0-f68.google.com with SMTP id c203so3054493oia.0; Wed, 16 Mar 2016 11:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=OI0+wKhszJhJdxUx+BNR2X5YIJNI/1BnlWQuxe5pv4E=; b=rcsJjgglX1xRPp9b/LPG4ODWimjzYMrJ/xeIR8LV/4eYSdQC2OKtnLKR1HftL/F8T8 TWVtM+vNVF5z9ZwO7Q/94sggTMnND3iy2IJBxyCOxwlBYOjgyjHb77NMLVzeGbI0/R0I GJw/PExOMz09ShWrozK+xQkAKsY2SJOa5Ic+eGtILWjiA3MsnIcFSbcrfrI9jzqoFB6Z Xiumc0aKiCpqcgpm8IoxM8CLQqIIN3DMksgmYGhUWMaY1kMAVZ606Ji8uPmTZNSYbBxO rLJUeIoxIczpcQZgT64Oqj7RhHyidlJOaTkr6dmql137EmTvx1Xn3mkgjzOWONEjmzx8 29Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=OI0+wKhszJhJdxUx+BNR2X5YIJNI/1BnlWQuxe5pv4E=; b=cYXnB7lT08xDMf6i9PBhSe2jTJVd5W8DGXc5pRcukgC+7mcIyEq5YI7qypwgD+bpwd QBfPx3ROPJGPQnqMCNibw/3QrRp6rXzh3v4gqqIVXrySCH2kTDSQr+3Ai9fQN3tHPz24 AxHEaeEFWlx4r2iWXp7b69SXEBZOokVTRZZORMTimTzdk9SGjPnTAy9G+y1ryM/yY6ki roknWLbCTPOAj4nAKE2Tnmplo76NH9QxYEeC4eGpYTexG90TE9HG4p+IRnU40AHrZ4YN A2BJR+nCarF/UhC+Z/vLCgH0AZgifxe1mAUE6jSmftL3+JQ58jr+nbG0bS41CXiXEu1Y U8ug== X-Gm-Message-State: AD7BkJItYz/JrTBWQa69Zf852mQ5tgroU8AJF6R/2A1ofwloW+GoGJqHCi2x8KbE1tAeBw== X-Received: by 10.202.182.11 with SMTP id g11mr3237010oif.133.1458153240042; Wed, 16 Mar 2016 11:34:00 -0700 (PDT) Received: from linux.site (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id t194sm1938404oie.18.2016.03.16.11.33.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Mar 2016 11:33:59 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org, Larry Finger , Stable Subject: [PATCH 1/2] rtlwifi: rtl8723be: Add antenna select module parameter Date: Wed, 16 Mar 2016 13:33:34 -0500 Message-Id: <1458153215-25602-2-git-send-email-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458153215-25602-1-git-send-email-Larry.Finger@lwfinger.net> References: <1458153215-25602-1-git-send-email-Larry.Finger@lwfinger.net> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Stable [V4.0+] --- drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 5 +++++ drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 3 +++ drivers/net/wireless/realtek/rtlwifi/wifi.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c index c983d2f..5a3df91 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c @@ -2684,6 +2684,7 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, bool auto_load_fail, u8 *hwinfo) { struct rtl_priv *rtlpriv = rtl_priv(hw); + struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params; u8 value; u32 tmpu_32; @@ -2702,6 +2703,10 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, rtlpriv->btcoexist.btc_info.ant_num = ANT_X2; } + /* override ant_num / ant_path */ + if (mod_params->ant_sel) + rtlpriv->btcoexist.btc_info.ant_num = + (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1); } void rtl8723be_bt_reg_init(struct ieee80211_hw *hw) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c index a78eaed..2101793 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c @@ -273,6 +273,7 @@ static struct rtl_mod_params rtl8723be_mod_params = { .msi_support = false, .disable_watchdog = false, .debug = DBG_EMERG, + .ant_sel = 0, }; static struct rtl_hal_cfg rtl8723be_hal_cfg = { @@ -394,6 +395,7 @@ module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444); module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog, bool, 0444); +module_param_named(ant_sel, rtl8723be_mod_params.ant_sel, int, 0444); MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); MODULE_PARM_DESC(ips, "Set to 0 to not use link power save (default 1)\n"); 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"); MODULE_PARM_DESC(debug, "Set debug level (0-5) (default 0)"); MODULE_PARM_DESC(disable_watchdog, "Set to 1 to disable the watchdog (default 0)\n"); +MODULE_PARM_DESC(ant_sel, "Set to 1 or 2 to force antenna number (default 0)\n"); static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index 554d814..93bd7fc 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -2246,6 +2246,9 @@ struct rtl_mod_params { /* default 0: 1 means do not disable interrupts */ bool int_clear; + + /* select antenna */ + int ant_sel; }; struct rtl_hal_usbint_cfg {