From patchwork Wed Jun 21 17:15:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9802333 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 BDE7960329 for ; Wed, 21 Jun 2017 17:15:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A10C7285E8 for ; Wed, 21 Jun 2017 17:15:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93EDD28610; Wed, 21 Jun 2017 17:15:50 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, URIBL_BLACK 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 2A906285E8 for ; Wed, 21 Jun 2017 17:15:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752462AbdFURPt (ORCPT ); Wed, 21 Jun 2017 13:15:49 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:35175 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116AbdFURPq (ORCPT ); Wed, 21 Jun 2017 13:15:46 -0400 Received: by mail-oi0-f67.google.com with SMTP id v74so16298305oie.2 for ; Wed, 21 Jun 2017 10:15:46 -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=ibQM0O1CGMBMuPsehT8PA7zEDlK7G50tJzc5RrLAFsC2hmGCebyqDSP2F/rsgJIGbG as2jTnSLvyXQye8H5WYSNLk6kKQJ0YAxGjdwqvHsIw2K0FZ+pIsudlr2WZ5AD4ui3Qzg tHLFeUFIfFB3ZF09B9mwN1LXmp3BzENMow/wumXibcumKYcRqpQphixHXqKPSz2+loLC iU/Bc4sy7YekuHpXDljSPde7aSnuGRYqFHf7IsjXVDyivg7keKjEZ/w/I8StYbdieYCl buCLNDrz1qXED/QhwjUtBT7CB751hbp6ZFgN5pkJQBRei7V8btMqMUSK8kbW82iARsOr rbiw== 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=PYcRwZJvSd0uDsUCdBzVh0nMrZbXM/yFrSLm/ZT3XN6+9ZPnDMwJBZd2NoboQ5GZGK CzBQxZfjkJm5eWMAfJc8kaDCHx4NsikbiQU5rpzvMkuGDzGTVp1I3zYwepR3TEcGJaeC NEfO8l9WGz3ft5HOUG/56RQBB0YwDx1PvmoDT5x4EOAeJMXjH9uNDAp6Bv98ZFvsvy/4 gBs1LnRoXjVvMFoM3oiz3TnxbU1LtTqEzp+McClzkIkYneuOowSa9cvy3JRsske0yipB /VUNr6ApZPvQqb93Ls9OLGoxUlpd53NH7f89d2cpCh9u4UsTplVKSAw3xXZfl8HyFqrC OPKQ== X-Gm-Message-State: AKS2vOzOjCNNhM9q3dclV7x27sjv+jXF4VDocaqqKLBpIfwwxRZVbnsG B7ASyfQpOX9shg== X-Received: by 10.202.56.195 with SMTP id f186mr1360198oia.202.1498065346110; Wed, 21 Jun 2017 10:15:46 -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 i38sm6785237ota.3.2017.06.21.10.15.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jun 2017 10:15:45 -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 v2 2/8] rtlwifi: Do IQK only once to reduce wifi occupy antenna Date: Wed, 21 Jun 2017 12:15:32 -0500 Message-Id: <20170621171538.4462-3-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170621171538.4462-1-Larry.Finger@lwfinger.net> References: <20170621171538.4462-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);