diff mbox

[v2,08/15] rtlwifi: btcoex: Add pre- and post- normal LPS function

Message ID 20180306012554.3108-9-pkshih@realtek.com (mailing list archive)
State Accepted
Commit c3468950ef802c659c0ac215e757163833bc563f
Delegated to: Kalle Valo
Headers show

Commit Message

Ping-Ke Shih March 6, 2018, 1:25 a.m. UTC
From: Ping-Ke Shih <pkshih@realtek.com>

Normal LPS is decomposed into pre- and post- parts, so we can issue H2C
with TDMA parameters in the "critical section" that dirver can't change
LPS state at the moment.

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

Comments

Larry Finger March 20, 2018, 4 a.m. UTC | #1
On 03/05/2018 07:25 PM, pkshih@realtek.com wrote:
> From: Ping-Ke Shih <pkshih@realtek.com>
> 
> Normal LPS is decomposed into pre- and post- parts, so we can issue H2C
> with TDMA parameters in the "critical section" that dirver can't change
> LPS state at the moment.
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

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

> ---
>   .../realtek/rtlwifi/btcoexist/halbtcoutsrc.c       | 22 ++++++++++++++++++++++
>   .../realtek/rtlwifi/btcoexist/halbtcoutsrc.h       |  2 ++
>   2 files changed, 24 insertions(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
> index bfb32d476a70..0f664a0490a7 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
> @@ -363,6 +363,22 @@ static void halbtc_normal_lps(struct btc_coexist *btcoexist)
>   	}
>   }
>   
> +static void halbtc_pre_normal_lps(struct btc_coexist *btcoexist)
> +{
> +	struct rtl_priv *rtlpriv = btcoexist->adapter;
> +
> +	if (btcoexist->bt_info.bt_ctrl_lps) {
> +		btcoexist->bt_info.bt_lps_on = false;
> +		rtl_lps_leave(rtlpriv->mac80211.hw);
> +	}
> +}
> +
> +static void halbtc_post_normal_lps(struct btc_coexist *btcoexist)
> +{
> +	if (btcoexist->bt_info.bt_ctrl_lps)
> +		btcoexist->bt_info.bt_ctrl_lps = false;
> +}
> +
>   static void halbtc_leave_low_power(struct btc_coexist *btcoexist)
>   {
>   }
> @@ -806,6 +822,12 @@ static bool halbtc_set(void *void_btcoexist, u8 set_type, void *in_buf)
>   	case BTC_SET_ACT_NORMAL_LPS:
>   		halbtc_normal_lps(btcoexist);
>   		break;
> +	case BTC_SET_ACT_PRE_NORMAL_LPS:
> +		halbtc_pre_normal_lps(btcoexist);
> +		break;
> +	case BTC_SET_ACT_POST_NORMAL_LPS:
> +		halbtc_post_normal_lps(btcoexist);
> +		break;
>   	case BTC_SET_ACT_DISABLE_LOW_POWER:
>   		halbtc_disable_low_power(btcoexist, *bool_tmp);
>   		break;
> diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
> index 1f12449363c2..ad80ec05975e 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
> +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
> @@ -349,6 +349,8 @@ enum btc_set_type {
>   	BTC_SET_ACT_LEAVE_LPS,
>   	BTC_SET_ACT_ENTER_LPS,
>   	BTC_SET_ACT_NORMAL_LPS,
> +	BTC_SET_ACT_PRE_NORMAL_LPS,
> +	BTC_SET_ACT_POST_NORMAL_LPS,
>   	BTC_SET_ACT_INC_FORCE_EXEC_PWR_CMD_CNT,
>   	BTC_SET_ACT_DISABLE_LOW_POWER,
>   	BTC_SET_ACT_UPDATE_RAMASK,
>
diff mbox

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index bfb32d476a70..0f664a0490a7 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -363,6 +363,22 @@  static void halbtc_normal_lps(struct btc_coexist *btcoexist)
 	}
 }
 
+static void halbtc_pre_normal_lps(struct btc_coexist *btcoexist)
+{
+	struct rtl_priv *rtlpriv = btcoexist->adapter;
+
+	if (btcoexist->bt_info.bt_ctrl_lps) {
+		btcoexist->bt_info.bt_lps_on = false;
+		rtl_lps_leave(rtlpriv->mac80211.hw);
+	}
+}
+
+static void halbtc_post_normal_lps(struct btc_coexist *btcoexist)
+{
+	if (btcoexist->bt_info.bt_ctrl_lps)
+		btcoexist->bt_info.bt_ctrl_lps = false;
+}
+
 static void halbtc_leave_low_power(struct btc_coexist *btcoexist)
 {
 }
@@ -806,6 +822,12 @@  static bool halbtc_set(void *void_btcoexist, u8 set_type, void *in_buf)
 	case BTC_SET_ACT_NORMAL_LPS:
 		halbtc_normal_lps(btcoexist);
 		break;
+	case BTC_SET_ACT_PRE_NORMAL_LPS:
+		halbtc_pre_normal_lps(btcoexist);
+		break;
+	case BTC_SET_ACT_POST_NORMAL_LPS:
+		halbtc_post_normal_lps(btcoexist);
+		break;
 	case BTC_SET_ACT_DISABLE_LOW_POWER:
 		halbtc_disable_low_power(btcoexist, *bool_tmp);
 		break;
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
index 1f12449363c2..ad80ec05975e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.h
@@ -349,6 +349,8 @@  enum btc_set_type {
 	BTC_SET_ACT_LEAVE_LPS,
 	BTC_SET_ACT_ENTER_LPS,
 	BTC_SET_ACT_NORMAL_LPS,
+	BTC_SET_ACT_PRE_NORMAL_LPS,
+	BTC_SET_ACT_POST_NORMAL_LPS,
 	BTC_SET_ACT_INC_FORCE_EXEC_PWR_CMD_CNT,
 	BTC_SET_ACT_DISABLE_LOW_POWER,
 	BTC_SET_ACT_UPDATE_RAMASK,