From patchwork Sat Aug 8 16:53:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 6975601 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9E9AB9F402 for ; Sat, 8 Aug 2015 16:53:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60F2C203B0 for ; Sat, 8 Aug 2015 16:53:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F426205B7 for ; Sat, 8 Aug 2015 16:53:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992534AbbHHQxu (ORCPT ); Sat, 8 Aug 2015 12:53:50 -0400 Received: from mail-oi0-f49.google.com ([209.85.218.49]:36355 "EHLO mail-oi0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992459AbbHHQxs (ORCPT ); Sat, 8 Aug 2015 12:53:48 -0400 Received: by oiev193 with SMTP id v193so39427621oie.3 for ; Sat, 08 Aug 2015 09:53:48 -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=q28cfKIvWxzz4aIbhKIqhbey7mkJ3MdvW3YCTbJXXS0=; b=A2jWo2dngjHsIorIrIcymfmGh6SK3+NctCf65ekAA4l738zi3XtCVl7M+Du7UGmQUa Ou0SRY4Gspzy251jhWNr+aOVKLtRF0zmWBKhMBxgFhwRCA98LE7DjqaB+XjVaWmixoBC HtC5sWyQorFl0aVeKaropDbn3xvPRm0Y4gnJVDUMW6u3QPb9KrOCM1yxRYBYHDSTdXWZ RUQ70iCBNZ5Mf7Sd3gF1AQIT/l7yI/SKzkctLvxkMaxWYLLaGeCv6PFUgx+wfK8+pr7D yJx2O/r3qUxo50G2wsCcj6FNar4i2Qm+bEo/A+gVQwP1+ssdj5QPO9dQzqNss9VMLzGy yrqw== X-Received: by 10.202.221.86 with SMTP id u83mr11819753oig.129.1439052828051; Sat, 08 Aug 2015 09:53:48 -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 g10sm8561173obw.2.2015.08.08.09.53.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 08 Aug 2015 09:53:46 -0700 (PDT) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, timlee , shaofu , Larry Finger Subject: [PATCH V3 NEXT 1/7] rtlwifi: rtl8821ae: Remove unsupported 5G channels Date: Sat, 8 Aug 2015 11:53:33 -0500 Message-Id: <1439052819-30196-2-git-send-email-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439052819-30196-1-git-send-email-Larry.Finger@lwfinger.net> References: <1439052819-30196-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=-7.2 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 From: timlee The 5G channel list contains channels that are not supported. Previously there were two copies of the 5G channel arrays, one in hw.c and one in phy.c. These have been renamed to prevent namespace pollution, and made global. Now any further changes will only need to be in a single location. Signed-off-by: timlee Signed-off-by: shaofu Signed-off-by: Larry Finger --- V2 - unchanged V3 - One such channel list was missed in V1. In addition, the 5G channel arrays are renames, made global, and combined so that only a single copy is needed. --- drivers/net/wireless/rtlwifi/rtl8821ae/hw.c | 25 +++++++++++++------------ drivers/net/wireless/rtlwifi/rtl8821ae/phy.c | 22 +++++++--------------- drivers/net/wireless/rtlwifi/rtl8821ae/phy.h | 3 +++ 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c index b7f18e21..54ab4fd 100644 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/hw.c @@ -43,6 +43,17 @@ #define LLT_CONFIG 5 +u8 rtl_channel5g[CHANNEL_MAX_NUMBER_5G] = { + 36, 38, 40, 42, 44, 46, 48, /* Band 1 */ + 52, 54, 56, 58, 60, 62, 64, /* Band 2 */ + 100, 102, 104, 106, 108, 110, 112, /* Band 3 */ + 116, 118, 120, 122, 124, 126, 128, /* Band 3 */ + 132, 134, 136, 138, 140, 142, 144, /* Band 3 */ + 149, 151, 153, 155, 157, 159, 161, /* Band 4 */ + 165, 167, 169, 171, 173, 175, 177}; /* Band 4 */ +u8 rtl_channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = { + 42, 58, 106, 122, 138, 155, 171}; + static void _rtl8821ae_return_beacon_queue_skb(struct ieee80211_hw *hw) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -2855,16 +2866,6 @@ static void _rtl8821ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); struct txpower_info_2g pwrinfo24g; struct txpower_info_5g pwrinfo5g; - u8 channel5g[CHANNEL_MAX_NUMBER_5G] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, - 56, 58, 60, 62, 64, 100, 102, 104, 106, - 108, 110, 112, 114, 116, 118, 120, 122, - 124, 126, 128, 130, 132, 134, 136, 138, - 140, 142, 144, 149, 151, 153, 155, 157, - 159, 161, 163, 165, 167, 168, 169, 171, - 173, 175, 177}; - u8 channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = { - 42, 58, 106, 122, 138, 155, 171}; u8 rf_path, index; u8 i; @@ -2889,13 +2890,13 @@ static void _rtl8821ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, } for (i = 0; i < CHANNEL_MAX_NUMBER_5G; i++) { - index = _rtl8821ae_get_chnl_group(channel5g[i]); + index = _rtl8821ae_get_chnl_group(rtl_channel5g[i]); rtlefuse->txpwr_5g_bw40base[rf_path][i] = pwrinfo5g.index_bw40_base[rf_path][index]; } for (i = 0; i < CHANNEL_MAX_NUMBER_5G_80M; i++) { u8 upper, lower; - index = _rtl8821ae_get_chnl_group(channel5g_80m[i]); + index = _rtl8821ae_get_chnl_group(rtl_channel5g_80m[i]); upper = pwrinfo5g.index_bw40_base[rf_path][index]; lower = pwrinfo5g.index_bw40_base[rf_path][index + 1]; diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c index 9b4d8a6..b4ad455 100644 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c @@ -1472,18 +1472,13 @@ static char _rtl8812ae_phy_get_chnl_idx_of_txpwr_lmt(struct ieee80211_hw *hw, { struct rtl_priv *rtlpriv = rtl_priv(hw); char channel_index = -1; - u8 channel_5g[CHANNEL_MAX_NUMBER_5G] = { - 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, - 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, - 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 149, - 151, 153, 155, 157, 159, 161, 163, 165, 167, 168, 169, 171, - 173, 175, 177}; u8 i = 0; + if (band == BAND_ON_2_4G) channel_index = channel - 1; else if (band == BAND_ON_5G) { - for (i = 0; i < sizeof(channel_5g)/sizeof(u8); ++i) { - if (channel_5g[i] == channel) + for (i = 0; i < sizeof(rtl_channel5g)/sizeof(u8); ++i) { + if (rtl_channel5g[i] == channel) channel_index = i; } } else @@ -2240,7 +2235,7 @@ void rtl8821ae_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel) static bool _rtl8821ae_phy_get_chnl_index(u8 channel, u8 *chnl_index) { - u8 channel_5g[CHANNEL_MAX_NUMBER_5G] = { + u8 rtl_channel5g[CHANNEL_MAX_NUMBER_5G] = { 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, @@ -2257,7 +2252,7 @@ static bool _rtl8821ae_phy_get_chnl_index(u8 channel, u8 *chnl_index) in_24g = false; for (i = 0; i < CHANNEL_MAX_NUMBER_5G; ++i) { - if (channel_5g[i] == channel) { + if (rtl_channel5g[i] == channel) { *chnl_index = i; return in_24g; } @@ -2728,13 +2723,10 @@ static u8 _rtl8821ae_get_txpower_index(struct ieee80211_hw *hw, u8 path, rate <= DESC_RATEVHT2SS_MCS9)) txpower += rtlefuse->txpwr_5g_bw40diff[path][TX_2S]; } else if (bandwidth == HT_CHANNEL_WIDTH_80) { - u8 channel_5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = { - 42, 58, 106, 122, 138, 155, 171 - }; u8 i; - for (i = 0; i < sizeof(channel_5g_80m) / sizeof(u8); ++i) - if (channel_5g_80m[i] == channel) + for (i = 0; i < sizeof(rtl_channel5g_80m) / sizeof(u8); ++i) + if (rtl_channel5g_80m[i] == channel) index = i; if ((DESC_RATEMCS0 <= rate && rate <= DESC_RATEMCS15) || diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/phy.h b/drivers/net/wireless/rtlwifi/rtl8821ae/phy.h index c411f0a..d4f53ea 100644 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/phy.h +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/phy.h @@ -205,6 +205,9 @@ enum _ANT_DIV_TYPE { }; +extern u8 rtl_channel5g[CHANNEL_MAX_NUMBER_5G]; +extern u8 rtl_channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M]; + u32 rtl8821ae_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); void rtl8821ae_phy_set_bb_reg(struct ieee80211_hw *hw,