diff mbox

[01/10] rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M

Message ID 20180119064551.10084-2-pkshih@realtek.com (mailing list archive)
State Accepted
Commit 66d0f9deba362c7da333e6a5caec754d834513ce
Delegated to: Kalle Valo
Headers show

Commit Message

Ping-Ke Shih Jan. 19, 2018, 6:45 a.m. UTC
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(-)

Comments

Larry Finger Jan. 19, 2018, 10:52 p.m. UTC | #1
On 01/19/2018 12:45 AM, pkshih@realtek.com wrote:
> 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(-)

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

> 
> 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
>   };
>   
>
Kalle Valo Jan. 24, 2018, 3:41 p.m. UTC | #2
Ping-Ke Shih <pkshih@realtek.com> wrote:

> 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>
> Acked-by: Larry Finger <Larry.Finger@lwfinger.net>

9 patches applied to wireless-drivers-next.git, thanks.

66d0f9deba36 rtlwifi: btcoex: extend get_wifi_bw to support bandwidth 80M
17bf85101181 rtlwifi: btcoex: Add switch band notify for btc
f243bca13893 rtlwifi: btcoex: Add variable ant_div_cfg to support antenna diversity
ee373844849c rtlwifi: btcoex: add scan_notify within ips_notify if RFON
9177c3363994 rtlwifi: btcoex: Add wifi_only series ops to control solo card
8d73e53e8a87 rtlwifi: btcoex: add boolean variables dbg_mode
ba3cca4d0c3e rtlwifi: 8822be has to report vht capability to mac80211
be98db155646 rtlwifi: Add ratr_table for newer IC
a75f3eebfa3d rtlwifi: Add spec_ver to check whether use new rate-id or not
diff mbox

Patch

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
 };