From patchwork Wed Jun 28 15:12:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 9814591 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 C9B98603F2 for ; Wed, 28 Jun 2017 15:13:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAD49285E0 for ; Wed, 28 Jun 2017 15:13:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF434285F9; Wed, 28 Jun 2017 15:13: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.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 7431A2860C for ; Wed, 28 Jun 2017 15:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752838AbdF1PNX (ORCPT ); Wed, 28 Jun 2017 11:13:23 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:35487 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752759AbdF1PMo (ORCPT ); Wed, 28 Jun 2017 11:12:44 -0400 Received: by mail-oi0-f65.google.com with SMTP id l130so5799588oib.2 for ; Wed, 28 Jun 2017 08:12:44 -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=snEgOK9B3rtzsCzWt5diONv01BahzDCQjlvBtMUCjYU=; b=kbp206vuMl0ciDzX9PD8KU+8T9Bqg7hV73ML3rmQ7BG3P9xIwLe3Fk77vWtgu9elez 7JL7f9iIKDFQc8vU8a1Q6N/O8qHmlRNNh8JEOSLHPJVx8vrR1ca/SuJLVgKFn503YQIL yYT0L5AwG49dDqYBJuAE4Q7ozdXUEwnIj6k8yds8ruk7C5QbGqjGDDRPls6LEZxlLtlf WIsjB2nkSgoM/lvlClflOnf38XtEpBbyfFSVyvAP8nOjDIMc0LlHZKvVVsSSXgDH7sjc Qm/Uko4IUH3QSMvyGnyi8nGw+Tfrw3BCzgQQYm+DZzPxlz3veWhx03vMO6Z8O8g3/3FZ yckw== 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=snEgOK9B3rtzsCzWt5diONv01BahzDCQjlvBtMUCjYU=; b=GCYDT8W636sIfPKe6j4W7kqFQSU/xpE2q/Q/N1vPl1dVGtjaU3XCosBIHGciIDV+dP rPPCe8zjIvt4ek/jhdjpSEUnbEvV6aR9SKIyQ9MiDq/0bQguzOmUBFGGNW7nMbDMoshW hDZlaj1D5Rbquqz1BkGKVt722UMtGrX8gvBacKs6xQV32Uojjr7TBdAxVT54B3GRAbS1 izeLkEHipSKtA9+9iYzmsrgClwBOz+mFNoGjie3ujLqZZyY3L7ZRFsFJZJ5hP6IIdZTY G0Vm3aLqPtLd7U8xBEf4iT+9KPPJOtnpPZJThx8JsCkWIU0taRpSnb+SZgWzo7yN/eCv eAEQ== X-Gm-Message-State: AKS2vOwDRzBMEynpr2ttgdgFvQ+WcMrImYAi5afEmM8yro2jgIc1H6Oo iVFdIGONyfnhB4VC X-Received: by 10.202.106.79 with SMTP id f76mr5853545oic.16.1498662758407; Wed, 28 Jun 2017 08:12:38 -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 x74sm3805951oia.23.2017.06.28.08.12.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Jun 2017 08:12:37 -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 v3 04/10] rtlwifi: add amplifier type for 8812ae Date: Wed, 28 Jun 2017 10:12:19 -0500 Message-Id: <20170628151225.22190-5-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170628151225.22190-1-Larry.Finger@lwfinger.net> References: <20170628151225.22190-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 With correct amplifier_type, the phy praser can choose correct parameters. Signed-off-by: Ping-Ke Shih Signed-off-by: Larry Finger Cc: Yan-Hsuan Chuang Cc: Birming Chiu Cc: Shaofu Cc: Steven Ting --- v2 - no changes v3 - no changes --- .../net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 41 +++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c index 2bc6bace069c..8f4abb3d7669 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c @@ -2966,6 +2966,44 @@ static void _rtl8812ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo, } } +static void _rtl8812ae_read_amplifier_type(struct ieee80211_hw *hw, u8 *hwinfo, + bool autoload_fail) +{ + struct rtl_priv *rtlpriv = rtl_priv(hw); + struct rtl_hal *rtlhal = rtl_hal(rtlpriv); + + u8 ext_type_pa_2g_a = (hwinfo[0xBD] & BIT(2)) >> 2; /* 0xBD[2] */ + u8 ext_type_pa_2g_b = (hwinfo[0xBD] & BIT(6)) >> 6; /* 0xBD[6] */ + u8 ext_type_pa_5g_a = (hwinfo[0xBF] & BIT(2)) >> 2; /* 0xBF[2] */ + u8 ext_type_pa_5g_b = (hwinfo[0xBF] & BIT(6)) >> 6; /* 0xBF[6] */ + /* 0xBD[1:0] */ + u8 ext_type_lna_2g_a = (hwinfo[0xBD] & (BIT(1) | BIT(0))) >> 0; + /* 0xBD[5:4] */ + u8 ext_type_lna_2g_b = (hwinfo[0xBD] & (BIT(5) | BIT(4))) >> 4; + /* 0xBF[1:0] */ + u8 ext_type_lna_5g_a = (hwinfo[0xBF] & (BIT(1) | BIT(0))) >> 0; + /* 0xBF[5:4] */ + u8 ext_type_lna_5g_b = (hwinfo[0xBF] & (BIT(5) | BIT(4))) >> 4; + + _rtl8812ae_read_pa_type(hw, hwinfo, autoload_fail); + + /* [2.4G] Path A and B are both extPA */ + if ((rtlhal->pa_type_2g & (BIT(5) | BIT(4))) == (BIT(5) | BIT(4))) + rtlhal->type_gpa = ext_type_pa_2g_b << 2 | ext_type_pa_2g_a; + + /* [5G] Path A and B are both extPA */ + if ((rtlhal->pa_type_5g & (BIT(1) | BIT(0))) == (BIT(1) | BIT(0))) + rtlhal->type_apa = ext_type_pa_5g_b << 2 | ext_type_pa_5g_a; + + /* [2.4G] Path A and B are both extLNA */ + if ((rtlhal->lna_type_2g & (BIT(7) | BIT(3))) == (BIT(7) | BIT(3))) + rtlhal->type_glna = ext_type_lna_2g_b << 2 | ext_type_lna_2g_a; + + /* [5G] Path A and B are both extLNA */ + if ((rtlhal->lna_type_5g & (BIT(7) | BIT(3))) == (BIT(7) | BIT(3))) + rtlhal->type_alna = ext_type_lna_5g_b << 2 | ext_type_lna_5g_a; +} + static void _rtl8821ae_read_pa_type(struct ieee80211_hw *hw, u8 *hwinfo, bool autoload_fail) { @@ -3114,7 +3152,8 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ hwinfo); if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { - _rtl8812ae_read_pa_type(hw, hwinfo, rtlefuse->autoload_failflag); + _rtl8812ae_read_amplifier_type(hw, hwinfo, + rtlefuse->autoload_failflag); _rtl8812ae_read_bt_coexist_info_from_hwpg(hw, rtlefuse->autoload_failflag, hwinfo); } else {