From patchwork Tue Jun 20 00:32:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9798291 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 7681960328 for ; Tue, 20 Jun 2017 00:32:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6988926E51 for ; Tue, 20 Jun 2017 00:32:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E220274D0; Tue, 20 Jun 2017 00:32:33 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 0135426E51 for ; Tue, 20 Jun 2017 00:32:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752677AbdFTAcb (ORCPT ); Mon, 19 Jun 2017 20:32:31 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:35201 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752475AbdFTAc1 (ORCPT ); Mon, 19 Jun 2017 20:32:27 -0400 Received: by mail-ot0-f193.google.com with SMTP id z48so13333843otz.2 for ; Mon, 19 Jun 2017 17:32:27 -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=01BlA16ocoFHe4Iuw/im0dC3ckg8f2NAZnwyEyT3VPs=; b=TE33SMe3OncQt1ZNuQtSHLBUReYH0AT7OWSv7gng2p/aEp+1QyHHFEW2ph/BpPxVRD DJAANHVkNQ2+UV+GLnzCEv4QFzUM5jfZi1Cmuge+iDM3klNwVYYY8n2VD7x3POv+z/am jJDFAlggZmN9YvwJnjMnQQRcmVQv54Y+TCFZeDtgfvnV8k00sTi5vhgo1Fy9jZlOIm4+ G1nrAmWXD0YGB9pyxmGy7uOhU/4XPv/DYMbuO2V2uHpxzsxHf6WUKZ8pVpfBVJGj6b7Z XfAwBLv+6oWAHVL5S6VqI9shy2APHLRKpM3Uq/fIAlwWKMubB27myQ0TulSm97BfEv3n jdVA== 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=01BlA16ocoFHe4Iuw/im0dC3ckg8f2NAZnwyEyT3VPs=; b=mIQOcbEFxLW0hteGRRYNQghbUvmx2vfqbRZCDhhaQR5M7n+bru0CboTi+4+vMyVr2i gM94YK6GTNHv4Jdi5KgMz25PUlaxxTK/NdqmD2Smo+Umew5cKlPtvkJXquyMcYuE+gqe NVnoL+ewtBoHGyG3n0yL28J1MqirUxbV9TL5jAkNR4cCay1WWOgIxRz0Qfz5rOXTRiUV rSju/vMU+ZQNmkVt3418TbatSDkRy5D/pjehMRhnTnPDdSherICnSLWiE6jdiTXxC4EE 6y/nYiCC2JSbeayYUjOoGZwk/VGkCCNf61de1H5DPT8+trYM1Ms1EY+SI0A2JKVj/v2D +TFw== X-Gm-Message-State: AKS2vOzdzrAnbVkxYFW9RvDzk4pnxOvU+mXpDkSelKcySCGQHSrnO/RF O6x9qqARW/OUPJb9 X-Received: by 10.157.40.238 with SMTP id s101mr16812695ota.88.1497918746993; Mon, 19 Jun 2017 17:32:26 -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 198sm5841023oii.16.2017.06.19.17.32.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jun 2017 17:32:26 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Ping-Ke Shih , Larry Finger , Yan-Hsuan Chuang , Birming Chiu , Shaofu , Steven Ting Subject: [PATCH 02/10] rtlwifi: Do IQK only once to reduce wifi occupy antenna Date: Mon, 19 Jun 2017 19:32:10 -0500 Message-Id: <20170620003218.17010-3-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170620003218.17010-1-Larry.Finger@lwfinger.net> References: <20170620003218.17010-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 From: Ping-Ke Shih Modify 8723be and 8192e only. 8812/8821 do IQK in DM, so we may do it later. Signed-off-by: Ping-Ke Shih Signed-off-by: Larry Finger Cc: Yan-Hsuan Chuang Cc: Birming Chiu Cc: Shaofu Cc: Steven Ting --- drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c | 3 ++- drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c | 7 +++++-- drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c index 11d97fa0e921..d84ac7adfd82 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c @@ -1670,7 +1670,8 @@ void rtl92ee_card_disable(struct ieee80211_hw *hw) _rtl92ee_poweroff_adapter(hw); /* after power off we should do iqk again */ - rtlpriv->phy.iqk_initialized = false; + if (!rtlpriv->cfg->ops->get_btc_status()) + rtlpriv->phy.iqk_initialized = false; } void rtl92ee_interrupt_recognized(struct ieee80211_hw *hw, diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c index 0ce2900722f4..2a7ad5ffe997 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c @@ -1443,7 +1443,9 @@ int rtl8723be_hw_init(struct ieee80211_hw *hw) */ if (rtlpriv->btcoexist.btc_info.ant_num == ANT_X2 || !rtlpriv->cfg->ops->get_btc_status()) { - rtl8723be_phy_iq_calibrate(hw, false); + rtl8723be_phy_iq_calibrate(hw, + (rtlphy->iqk_initialized ? + true : false)); rtlphy->iqk_initialized = true; } rtl8723be_dm_check_txpower_tracking(hw); @@ -1677,7 +1679,8 @@ void rtl8723be_card_disable(struct ieee80211_hw *hw) _rtl8723be_poweroff_adapter(hw); /* after power off we should do iqk again */ - rtlpriv->phy.iqk_initialized = false; + if (!rtlpriv->cfg->ops->get_btc_status()) + rtlpriv->phy.iqk_initialized = false; } void rtl8723be_interrupt_recognized(struct ieee80211_hw *hw, diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c index ab0f39e46e1b..9752175cc466 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/phy.c @@ -2352,7 +2352,7 @@ void rtl8723be_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery) if (b_recovery) { rtl8723_phy_reload_adda_registers(hw, iqk_bb_reg, rtlphy->iqk_bb_backup, 9); - return; + goto label_done; } /* Save RF Path */ path_sel_bb = rtl_get_bbreg(hw, 0x948, MASKDWORD); @@ -2460,6 +2460,7 @@ void rtl8723be_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery) rtl_set_bbreg(hw, 0x948, MASKDWORD, path_sel_bb); /* rtl_set_rfreg(hw, RF90_PATH_A, 0xb0, 0xfffff, path_sel_rf); */ +label_done: spin_lock(&rtlpriv->locks.iqk_lock); rtlphy->lck_inprogress = false; spin_unlock(&rtlpriv->locks.iqk_lock);