linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <pkshih@realtek.com>
To: <kvalo@codeaurora.org>
Cc: <Larry.Finger@lwfinger.net>, <linux-wireless@vger.kernel.org>
Subject: [PATCH 01/10] rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M
Date: Fri, 19 Jan 2018 14:45:42 +0800	[thread overview]
Message-ID: <20180119064551.10084-2-pkshih@realtek.com> (raw)
In-Reply-To: <20180119064551.10084-1-pkshih@realtek.com>

From: Ping-Ke Shih <pkshih@realtek.com>

The rtlwifi newer ICs support 80M bandwidth in 5G band, so extend
get_wifi_bw() to know bandwidth 80M that helps btcoex to make correct
decisions.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c       | 37 +++++++++-------------
 .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h       |  1 +
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index af8f3778dc91..c335f06eb13b 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -95,21 +95,6 @@ static bool is_any_client_connect_to_ap(struct btc_coexist *btcoexist)
 		return false;
 }
 
-static bool halbtc_is_bt40(struct rtl_priv *adapter)
-{
-	struct rtl_priv *rtlpriv = adapter;
-	struct rtl_phy *rtlphy = &(rtlpriv->phy);
-	bool is_ht40 = true;
-	enum ht_channel_width bw = rtlphy->current_chan_bw;
-
-	if (bw == HT_CHANNEL_WIDTH_20)
-		is_ht40 = false;
-	else if (bw == HT_CHANNEL_WIDTH_20_40)
-		is_ht40 = true;
-
-	return is_ht40;
-}
-
 static bool halbtc_legacy(struct rtl_priv *adapter)
 {
 	struct rtl_priv *rtlpriv = adapter;
@@ -135,18 +120,26 @@ bool halbtc_is_wifi_uplink(struct rtl_priv *adapter)
 
 static u32 halbtc_get_wifi_bw(struct btc_coexist *btcoexist)
 {
-	struct rtl_priv *rtlpriv =
-		(struct rtl_priv *)btcoexist->adapter;
+	struct rtl_priv *rtlpriv = btcoexist->adapter;
+	struct rtl_phy *rtlphy = &rtlpriv->phy;
 	u32 wifi_bw = BTC_WIFI_BW_HT20;
 
-	if (halbtc_is_bt40(rtlpriv)) {
-		wifi_bw = BTC_WIFI_BW_HT40;
+	if (halbtc_legacy(rtlpriv)) {
+		wifi_bw = BTC_WIFI_BW_LEGACY;
 	} else {
-		if (halbtc_legacy(rtlpriv))
-			wifi_bw = BTC_WIFI_BW_LEGACY;
-		else
+		switch (rtlphy->current_chan_bw) {
+		case HT_CHANNEL_WIDTH_20:
 			wifi_bw = BTC_WIFI_BW_HT20;
+			break;
+		case HT_CHANNEL_WIDTH_20_40:
+			wifi_bw = BTC_WIFI_BW_HT40;
+			break;
+		case HT_CHANNEL_WIDTH_80:
+			wifi_bw = BTC_WIFI_BW_HT80;
+			break;
+		}
 	}
+
 	return wifi_bw;
 }
 
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
index 57caaf130a46..bc854ff2ab8a 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
@@ -190,6 +190,7 @@ enum btc_wifi_bw_mode {
 	BTC_WIFI_BW_LEGACY = 0x0,
 	BTC_WIFI_BW_HT20 = 0x1,
 	BTC_WIFI_BW_HT40 = 0x2,
+	BTC_WIFI_BW_HT80 = 0x3,
 	BTC_WIFI_BW_MAX
 };
 
-- 
2.15.1

  reply	other threads:[~2018-01-19  6:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19  6:45 [PATCH 00/10] rtlwifi: add btcoex materials for 8822be pkshih
2018-01-19  6:45 ` pkshih [this message]
2018-01-19 22:52   ` [PATCH 01/10] rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M Larry Finger
2018-01-24 15:41   ` [01/10] " Kalle Valo
2018-01-19  6:45 ` [PATCH 02/10] rtlwifi: btcoex: Add switch band notify for btc pkshih
2018-01-22 19:12   ` Larry Finger
2018-01-19  6:45 ` [PATCH 03/10] rtlwifi: btcoex: Add variable ant_div_cfg to support antenna diversity pkshih
2018-01-22 18:56   ` Larry Finger
2018-01-19  6:45 ` [PATCH 04/10] rtlwifi: btcoex: add scan_notify within ips_notify if RFON pkshih
2018-01-22 19:00   ` Larry Finger
2018-01-19  6:45 ` [PATCH 05/10] rtlwifi: btcoex: Add wifi_only series ops to control solo card pkshih
2018-01-22 19:11   ` Larry Finger
2018-01-19  6:45 ` [PATCH 06/10] rtlwifi: btcoex: add boolean variables dbg_mode pkshih
2018-01-19 22:47   ` Larry Finger
2018-01-19  6:45 ` [PATCH 07/10] rtlwifi: btcoex: Fix some static warnings from Sparse pkshih
2018-01-19 22:46   ` Larry Finger
2018-01-22  0:53     ` Pkshih
2018-01-24 15:38   ` [07/10] " Kalle Valo
2018-01-19  6:45 ` [PATCH 08/10] rtlwifi: 8822be has to report vht capability to mac80211 pkshih
2018-01-19 22:41   ` Larry Finger
2018-01-19  6:45 ` [PATCH 09/10] rtlwifi: Add ratr_table for newer IC pkshih
2018-01-22 19:07   ` Larry Finger
2018-01-19  6:45 ` [PATCH 10/10] rtlwifi: Add spec_ver to check whether use new rate-id or not pkshih
2018-01-22 19:10   ` Larry Finger
2018-01-23  0:41     ` Pkshih
2018-01-24 15:44       ` Kalle Valo

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=20180119064551.10084-2-pkshih@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).