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,
	Yan-Hsuan Chuang <yhchuang@realtek.com>,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Pkshih <pkshih@realtek.com>, Birming Chiu <birming@realtek.com>,
	Shaofu <shaofu@realtek.com>, Steven Ting <steventing@realtek.com>
Subject: [PATCH v3 10/12] rtlwifi: btcoex: 23b 2ant: finer bt power adjustment
Date: Mon,  3 Apr 2017 13:41:40 -0500	[thread overview]
Message-ID: <20170403184147.18409-10-Larry.Finger@lwfinger.net> (raw)
In-Reply-To: <20170331164742.22374-1-Larry.Finger@lwfinger.net>

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

The bt can specify a power level to decrease. Rather than decreasing by a
fixed value (usually 2), this change makes the driver fit to the
environment more quickly.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
---
v2 - No changes.
v3 - No changes.
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c    | 52 ++++++++++------------
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.h    |  4 +-
 2 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index e72baa00b42f..b1a4c8466bc6 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -660,44 +660,40 @@ static void btc8723b2ant_set_fw_dac_swing_level(struct btc_coexist *btcoexist,
 }
 
 static void btc8723b2ant_set_fw_dec_bt_pwr(struct btc_coexist *btcoexist,
-					   bool dec_bt_pwr)
+					   u8 dec_bt_pwr_lvl)
 {
 	struct rtl_priv *rtlpriv = btcoexist->adapter;
 	u8 h2c_parameter[1] = {0};
 
-	h2c_parameter[0] = 0;
-
-	if (dec_bt_pwr)
-		h2c_parameter[0] |= BIT1;
+	h2c_parameter[0] = dec_bt_pwr_lvl;
 
 	RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-		 "[BTCoex], decrease Bt Power : %s, FW write 0x62=0x%x\n",
-		    (dec_bt_pwr ? "Yes!!" : "No!!"), h2c_parameter[0]);
+		 "[BTCoex], decrease Bt Power Level : %u\n", dec_bt_pwr_lvl);
 
 	btcoexist->btc_fill_h2c(btcoexist, 0x62, 1, h2c_parameter);
 }
 
 static void btc8723b2ant_dec_bt_pwr(struct btc_coexist *btcoexist,
-				    bool force_exec, bool dec_bt_pwr)
+				    bool force_exec, u8 dec_bt_pwr_lvl)
 {
 	struct rtl_priv *rtlpriv = btcoexist->adapter;
 
 	RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-		 "[BTCoex], %s Dec BT power = %s\n",
-		    force_exec ? "force to" : "", dec_bt_pwr ? "ON" : "OFF");
-	coex_dm->cur_dec_bt_pwr = dec_bt_pwr;
+		 "[BTCoex], Dec BT power level = %u\n", dec_bt_pwr_lvl);
+	coex_dm->cur_dec_bt_pwr_lvl = dec_bt_pwr_lvl;
 
 	if (!force_exec) {
 		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-			 "[BTCoex], bPreDecBtPwr=%d, bCurDecBtPwr=%d\n",
-			    coex_dm->pre_dec_bt_pwr, coex_dm->cur_dec_bt_pwr);
+			 "[BTCoex], PreDecBtPwrLvl=%d, CurDecBtPwrLvl=%d\n",
+			    coex_dm->pre_dec_bt_pwr_lvl,
+			    coex_dm->cur_dec_bt_pwr_lvl);
 
-		if (coex_dm->pre_dec_bt_pwr == coex_dm->cur_dec_bt_pwr)
+		if (coex_dm->pre_dec_bt_pwr_lvl == coex_dm->cur_dec_bt_pwr_lvl)
 			return;
 	}
-	btc8723b2ant_set_fw_dec_bt_pwr(btcoexist, coex_dm->cur_dec_bt_pwr);
+	btc8723b2ant_set_fw_dec_bt_pwr(btcoexist, coex_dm->cur_dec_bt_pwr_lvl);
 
-	coex_dm->pre_dec_bt_pwr = coex_dm->cur_dec_bt_pwr;
+	coex_dm->pre_dec_bt_pwr_lvl = coex_dm->cur_dec_bt_pwr_lvl;
 }
 
 static void btc8723b2ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist,
@@ -1340,7 +1336,7 @@ static void btc8723b2ant_coex_alloff(struct btc_coexist *btcoexist)
 	/* fw all off */
 	btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
 	btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
-	btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+	btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 	/* sw all off */
 	btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
@@ -1356,7 +1352,7 @@ static void btc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist)
 
 	btc8723b2ant_ps_tdma(btcoexist, FORCE_EXEC, false, 1);
 	btc8723b2ant_fw_dac_swing_lvl(btcoexist, FORCE_EXEC, 6);
-	btc8723b2ant_dec_bt_pwr(btcoexist, FORCE_EXEC, false);
+	btc8723b2ant_dec_bt_pwr(btcoexist, FORCE_EXEC, 0);
 
 	btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
 
@@ -1381,7 +1377,7 @@ static void btc8723b2ant_action_bt_inquiry(struct btc_coexist *btcoexist)
 		btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
 	}
 	btc8723b2ant_fw_dac_swing_lvl(btcoexist, FORCE_EXEC, 6);
-	btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+	btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 	btc8723b2ant_sw_mechanism(btcoexist, false, false, false, false);
 }
@@ -1413,7 +1409,7 @@ static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
 		btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0);
 		btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
 		btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6);
-		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 		btc8723b2ant_sw_mechanism(btcoexist, false, false, false,
 					  false);
@@ -1439,8 +1435,7 @@ static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
 			btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
 			btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC,
 						      0xb);
-			btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC,
-						false);
+			btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 			btc8723b2ant_sw_mechanism(btcoexist, false, false,
 						  false, false);
@@ -1467,8 +1462,7 @@ static bool btc8723b2ant_is_common_action(struct btc_coexist *btcoexist)
 			btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
 			btc8723b2ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC,
 						      0xb);
-			btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC,
-						false);
+			btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 			btc8723b2ant_sw_mechanism(btcoexist, true, false,
 						  false, false);
@@ -1988,7 +1982,7 @@ static void btc8723b2ant_action_pan_hs(struct btc_coexist *btcoexist)
 	    (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH))
 		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, true);
 	else
-		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 	btc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 7);
 	btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1);
@@ -2033,7 +2027,7 @@ static void btc8723b2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist)
 	if (BTC_RSSI_HIGH(bt_rssi_state))
 		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2);
 	else
-		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
 
@@ -2088,7 +2082,7 @@ static void btc8723b2ant_action_pan_edr_hid(struct btc_coexist *btcoexist)
 	if (BTC_RSSI_HIGH(bt_rssi_state))
 		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2);
 	else
-		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 	if ((bt_rssi_state == BTC_RSSI_STATE_HIGH) ||
 	    (bt_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
@@ -2156,7 +2150,7 @@ static void btc8723b2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist)
 	if (BTC_RSSI_HIGH(bt_rssi_state))
 		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 2);
 	else
-		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false);
+		btc8723b2ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, 0);
 
 	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
 
@@ -2541,7 +2535,7 @@ void ex_btc8723b2ant_display_coex_info(struct btc_coexist *btcoexist)
 		 ps_tdma_case, coex_dm->auto_tdma_adjust);
 
 	RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, "\r\n %-35s = %d/ %d ",
-		 "DecBtPwr/ IgnWlanAct", coex_dm->cur_dec_bt_pwr,
+		 "DecBtPwr/ IgnWlanAct", coex_dm->cur_dec_bt_pwr_lvl,
 		 coex_dm->cur_ignore_wlan_act);
 
 	/* Hw setting */
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
index e36ab4205771..746930d0d244 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
@@ -75,8 +75,8 @@ enum BT_8723B_2ANT_COEX_ALGO {
 
 struct coex_dm_8723b_2ant {
 	/* fw mechanism */
-	bool pre_dec_bt_pwr;
-	bool cur_dec_bt_pwr;
+	bool pre_dec_bt_pwr_lvl;
+	bool cur_dec_bt_pwr_lvl;
 	u8 pre_fw_dac_swing_lvl;
 	u8 cur_fw_dac_swing_lvl;
 	bool cur_ignore_wlan_act;
-- 
2.12.0

  parent reply	other threads:[~2017-04-03 18:42 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  1:14 [PATCH v2 00/12] rtlwifi: btcoex: Improve Bluetooth coexistence Larry Finger
2017-03-31 16:47 ` [PATCH 01/12] rtlwifi: btcoex: remove unused functions Larry Finger
2017-04-02 14:00   ` kbuild test robot
2017-03-31 16:47 ` [PATCH 02/12] rtlwifi: btcoex: follow linux coding style Larry Finger
2017-03-31 16:47 ` [PATCH 03/12] rtlwifi: btcoex: 23b 2ant: add btc8723b2ant_limited_rx to reduce agg size Larry Finger
2017-03-31 16:47 ` [PATCH 04/12] rtlwifi: btcoex: 23b 2ant: detect if bt is slave, and modify tdma Larry Finger
2017-03-31 16:47 ` [PATCH 05/12] rtlwifi: btcoex: 23b 2ant: monitor wifi counter for allocate tdma time Larry Finger
2017-03-31 16:47 ` [PATCH 06/12] rtlwifi: btcoex: 23b 2ant: less sensitive to tx rate penalty Larry Finger
2017-03-31 16:47 ` [PATCH 07/12] rtlwifi: btcoex: 23b 2ant: adjust wifi duration for bt a2dp Larry Finger
2017-03-31 16:47 ` [PATCH 08/12] rtlwifi: btcoex: 23b 2ant: coex table fine tune Larry Finger
2017-03-31 16:47 ` [PATCH 09/12] rtlwifi: btcoex: 23b 2ant: remove redundant bt stack report Larry Finger
2017-03-31 16:47 ` [PATCH 10/12] rtlwifi: btcoex: 23b 2ant: finer bt power adjustment Larry Finger
2017-03-31 16:47 ` [PATCH 11/12] rtlwifi: btcoex: 23b 2ant: add comments to describe how duration adjusted Larry Finger
2017-03-31 16:47 ` [PATCH 12/12] rtlwifi: btcoex: 23b 2ant: new fw use h2c to control GNT_BT Larry Finger
2017-04-03  1:14 ` [PATCH v2 01/12] rtlwifi: btcoex: remove unused functions Larry Finger
2017-04-03  1:14 ` [PATCH v2 02/12] rtlwifi: btcoex: follow linux coding style Larry Finger
2017-04-03  1:14 ` [PATCH v2 03/12] rtlwifi: btcoex: 23b 2ant: add btc8723b2ant_limited_rx to reduce agg size Larry Finger
2017-04-03  1:14 ` [PATCH v2 04/12] rtlwifi: btcoex: 23b 2ant: detect if bt is slave, and modify tdma Larry Finger
2017-04-03  1:14 ` [PATCH v2 05/12] rtlwifi: btcoex: 23b 2ant: monitor wifi counter for allocate tdma time Larry Finger
2017-04-03  1:14 ` [PATCH v2 06/12] rtlwifi: btcoex: 23b 2ant: less sensitive to tx rate penalty Larry Finger
2017-04-03  1:14 ` [PATCH v2 07/12] rtlwifi: btcoex: 23b 2ant: adjust wifi duration for bt a2dp Larry Finger
2017-04-03 12:59   ` kbuild test robot
2017-04-03  1:14 ` [PATCH v2 08/12] rtlwifi: btcoex: 23b 2ant: coex table fine tune Larry Finger
2017-04-03  1:14 ` [PATCH v2 09/12] rtlwifi: btcoex: 23b 2ant: remove redundant bt stack report Larry Finger
2017-04-03  1:14 ` [PATCH v2 10/12] rtlwifi: btcoex: 23b 2ant: finer bt power adjustment Larry Finger
2017-04-03  1:14 ` [PATCH v2 11/12] rtlwifi: btcoex: 23b 2ant: add comments to describe how duration adjusted Larry Finger
2017-04-03  1:14 ` [PATCH v2 12/12] rtlwifi: btcoex: 23b 2ant: new fw use h2c to control GNT_BT Larry Finger
2017-04-03 18:41 ` [PATCH v3 01/12] rtlwifi: btcoex: remove unused functions Larry Finger
2017-04-05 12:54   ` [v3,01/12] " Kalle Valo
2017-04-03 18:41 ` [PATCH v3 02/12] rtlwifi: btcoex: follow linux coding style Larry Finger
2017-04-03 18:41 ` [PATCH v3 03/12] rtlwifi: btcoex: 23b 2ant: add btc8723b2ant_limited_rx to reduce agg size Larry Finger
2017-04-03 18:41 ` [PATCH v3 04/12] rtlwifi: btcoex: 23b 2ant: detect if bt is slave, and modify tdma Larry Finger
2017-04-03 18:41 ` [PATCH v3 05/12] rtlwifi: btcoex: 23b 2ant: monitor wifi counter for allocate tdma time Larry Finger
2017-04-03 18:41 ` [PATCH v3 06/12] rtlwifi: btcoex: 23b 2ant: less sensitive to tx rate penalty Larry Finger
2017-04-03 18:41 ` [PATCH v3 07/12] rtlwifi: btcoex: 23b 2ant: adjust wifi duration for bt a2dp Larry Finger
2017-04-03 18:41 ` [PATCH v3 08/12] rtlwifi: btcoex: 23b 2ant: coex table fine tune Larry Finger
2017-04-03 18:41 ` [PATCH v3 09/12] rtlwifi: btcoex: 23b 2ant: remove redundant bt stack report Larry Finger
2017-04-03 18:41 ` Larry Finger [this message]
2017-04-03 18:41 ` [PATCH v3 11/12] rtlwifi: btcoex: 23b 2ant: add comments to describe how duration adjusted Larry Finger
2017-04-03 18:41 ` [PATCH v3 12/12] rtlwifi: btcoex: 23b 2ant: new fw use h2c to control GNT_BT 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=20170403184147.18409-10-Larry.Finger@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=birming@realtek.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=shaofu@realtek.com \
    --cc=steventing@realtek.com \
    --cc=yhchuang@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.