From patchwork Mon Sep 4 17:51:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9937497 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E44A26035F for ; Mon, 4 Sep 2017 17:52:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5F9528796 for ; Mon, 4 Sep 2017 17:52:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CADA0287EF; Mon, 4 Sep 2017 17:52:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E78728796 for ; Mon, 4 Sep 2017 17:52:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754019AbdIDRwG (ORCPT ); Mon, 4 Sep 2017 13:52:06 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:32963 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753997AbdIDRvx (ORCPT ); Mon, 4 Sep 2017 13:51:53 -0400 Received: by mail-oi0-f65.google.com with SMTP id k191so846334oih.0; Mon, 04 Sep 2017 10:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=WY+p3iF6tezGRhLNcOC2Ywr7wsbpljw0PctvoYYEoto=; b=AG47Nid8kFWfhexFQf6pOV4ZttuZHJemYCNfBbzOm5r+vjFmIRPxK1cS3QD2oYiQkX Q1hInQi+IoXY+4b6jZeSiZlSe+JmnQFkJRfWDwSwZTl4qY+rkx812EsfvAVN1lIiNSyp ejt9EzMdDN+lpEoDZVQNovdNIto0mIkc550WEgLhXa+TzwV0tO6Ouj/OZ5R03EJ3mrV+ a9tKna/9v0yywbDYHhOYhQYqnpJbnqjW1Dw/JBcxS9TkL+2VwI1n5cjAqy/aaFakT3SC lCPlxXyW1NnTLnvoNpRhJFW6gtWFwrI+44Gx7qUWYitJDwanArlYXRGi8sTu/ewl2mIC EKsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=WY+p3iF6tezGRhLNcOC2Ywr7wsbpljw0PctvoYYEoto=; b=C/8TpsEwyTzubgD3cyDi1C0Uh1/22Fk4YZyjV3lOQuiHUKjCgf7n4CYpSoFwCjrD9d jVbfzHJpkZ74+yuewXFgCoCkr3cB0Lm0RfTtYgb6OLvkFbqmRWvdOMKvMZjaA+5N4ZFV 3t2NxG8+5BXwuNFebXsYkBv90g2l42DLl/1LNh4LS7zyjWW59RMnXFoLq3N78i8SGWQb 1pdBW0pbyiLuPOqLyDzqh5SS9Q95dOkvo/MKwNyHJd2oTpSn6ewxD5x7OcOdajKG6JL0 3Yva9YndFO/UzltK1AUs8UFA3dSzWkLGVZNouTqICfNEeVnzGglQ81l04EGz8d7cMO0q TPcA== X-Gm-Message-State: AHPjjUjv9tNpTdJbuQAHW/MRyKiM7WcIWYe1u5EAZMazFiiob45Rv5KQ DupeUnZopE2U2rxi X-Google-Smtp-Source: ADKCNb4YGG1nf/F0Nioo4jNOCE3Ki4ovkVuXgcAzDbq5tVmoq+P0p44OXIuW7EqDkeIShxaCUmBdnw== X-Received: by 10.202.78.70 with SMTP id c67mr1246183oib.248.1504547513152; Mon, 04 Sep 2017 10:51:53 -0700 (PDT) Received: from linux-4v1g.suse (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id e184sm10514531oih.35.2017.09.04.10.51.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Sep 2017 10:51:52 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Larry Finger , Ping-Ke Shih , Yan-Hsuan Chuang , Birming Chiu , Shaofu , Steven Ting , Stable Subject: [PATCH 2/2] rtlwifi: btcoexist: Fix antenna selection code Date: Mon, 4 Sep 2017 12:51:34 -0500 Message-Id: <20170904175134.8331-3-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170904175134.8331-1-Larry.Finger@lwfinger.net> References: <20170904175134.8331-1-Larry.Finger@lwfinger.net> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In commit 87d8a9f35202 ("rtlwifi: btcoex: call bind to setup btcoex"), the code turns on a call to exhalbtc_bind_bt_coex_withadapter(). This routine contains a bug that causes incorrect antenna selection for those HP laptops with only one antenna and an incorrectly programmed EFUSE. These boxes are the ones that need the ant_sel module parameter. Fixes: 87d8a9f35202 ("rtlwifi: btcoex: call bind to setup btcoex") Signed-off-by: Larry Finger Cc: Ping-Ke Shih Cc: Yan-Hsuan Chuang Cc: Birming Chiu Cc: Shaofu Cc: Steven Ting Cc: Stable # 4.13+ --- Kalle, This patch is intended for kernel 4.14. Thanks, Larry --- .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c index c1eacd8352a2..b5e9877d935c 100644 --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c @@ -173,6 +173,16 @@ static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist) u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv) { + struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params; + + /* 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); + + rtlpriv->btcoexist.btc_info.single_ant_path = + (mod_params->ant_sel == 1 ? 0 : 1); + } return rtlpriv->btcoexist.btc_info.single_ant_path; } @@ -183,6 +193,7 @@ u8 rtl_get_hwpg_bt_type(struct rtl_priv *rtlpriv) u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv) { + struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params; u8 num; if (rtlpriv->btcoexist.btc_info.ant_num == ANT_X2) @@ -190,6 +201,10 @@ u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv) else num = 1; + /* override ant_num / ant_path */ + if (mod_params->ant_sel) + num = (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1) + 1; + return num; } @@ -876,7 +891,7 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter) { struct btc_coexist *btcoexist = &gl_bt_coexist; struct rtl_priv *rtlpriv = adapter; - u8 ant_num = 2, chip_type, single_ant_path = 0; + u8 ant_num = 2, chip_type; if (btcoexist->binded) return false; @@ -911,12 +926,6 @@ bool exhalbtc_bind_bt_coex_withadapter(void *adapter) ant_num = rtl_get_hwpg_ant_num(rtlpriv); exhalbtc_set_ant_num(rtlpriv, BT_COEX_ANT_TYPE_PG, ant_num); - /* set default antenna position to main port */ - btcoexist->board_info.btdm_ant_pos = BTC_ANTENNA_AT_MAIN_PORT; - - single_ant_path = rtl_get_hwpg_single_ant_path(rtlpriv); - exhalbtc_set_single_ant_path(single_ant_path); - if (rtl_get_hwpg_package_type(rtlpriv) == 0) btcoexist->board_info.tfbga_package = false; else if (rtl_get_hwpg_package_type(rtlpriv) == 1)