All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org, timlee <timlee@realtek.com>,
	shaofu <shaofu@realtek.com>,
	Larry Finger <Larry.Finger@lwfinger.net>
Subject: [PATCH V3 NEXT 1/7] rtlwifi: rtl8821ae: Remove unsupported 5G channels
Date: Sat,  8 Aug 2015 11:53:33 -0500	[thread overview]
Message-ID: <1439052819-30196-2-git-send-email-Larry.Finger@lwfinger.net> (raw)
In-Reply-To: <1439052819-30196-1-git-send-email-Larry.Finger@lwfinger.net>

From: timlee <timlee@realtek.com>

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 <timlee@realtek.com>
Signed-off-by: shaofu <shaofu@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
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,
-- 
2.1.4


  reply	other threads:[~2015-08-08 16:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-08 16:53 [PATCH V3 NEXT 0/7] Make changes in rtlwifi and dependent drivers Larry Finger
2015-08-08 16:53 ` Larry Finger [this message]
2015-08-10 19:01   ` [PATCH V3 NEXT 1/7] rtlwifi: rtl8821ae: Remove unsupported 5G channels Kalle Valo
2015-08-11  2:44     ` Shaofu
2015-08-08 16:53 ` [PATCH V3 NEXT 2/7] rtlwifi: Fix programming of CAM content Larry Finger
2015-08-08 16:53 ` [PATCH V3 NEXT 3/7] rtlwifi: Make retry limits depend on vif type Larry Finger
2015-08-08 16:53 ` [PATCH V3 NEXT 4/7] rtlwifi: Force disable key to wait until TX acked Larry Finger
2015-08-08 16:53 ` [PATCH V3 NEXT 5/7] rtlwifi: rtl8192ee: Implement new rekey logic Larry Finger
2015-08-08 16:53 ` [PATCH V3 NEXT 6/7] rtlwifi: rtl8723be: " Larry Finger
2015-08-08 16:53 ` [PATCH V3 NEXT 7/7] rtlwifi: rtl8821ae: " Larry Finger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439052819-30196-2-git-send-email-Larry.Finger@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=shaofu@realtek.com \
    --cc=timlee@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.