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>,
	Pkshih <pkshih@realtek.com>, Birming Chiu <birming@realtek.com>,
	Shaofu <shaofu@realtek.com>, Steven Ting <steventing@realtek.com>
Subject: [PATCH 05/13] rtlwifi: btcoex: 23b 2ant: fix PTA unstable problem when hw init
Date: Tue,  4 Apr 2017 11:49:58 -0500	[thread overview]
Message-ID: <20170404165006.14329-6-Larry.Finger@lwfinger.net> (raw)
In-Reply-To: <20170404165006.14329-1-Larry.Finger@lwfinger.net>

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

In the hardware initialisation stage, the PTA circuits may be unstable,
so we reset it after 6 secs to fix the problem.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
---
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c    | 41 ++++++++--------------
 .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.h    |  2 ++
 2 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 1f3c2bc..8d8425d 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -3282,12 +3282,14 @@ void ex_btc8723b2ant_init_hwconfig(struct btc_coexist *btcoexist)
 	/* Antenna config */
 	btc8723b2ant_set_ant_path(btcoexist, BTC_ANT_WIFI_AT_MAIN,
 				  true, false);
+	coex_sta->dis_ver_info_cnt = 0;
+
 	/* PTA parameter */
 	btc8723b2ant_coex_table_with_type(btcoexist, FORCE_EXEC, 0);
 
 	/* Enable counter statistics */
 	/* 0x76e[3] = 1, WLAN_ACT controlled by PTA */
-	btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc);
+	btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4);
 	btcoexist->btc_write_1byte(btcoexist, 0x778, 0x3);
 	btcoexist->btc_write_1byte_bitmask(btcoexist, 0x40, 0x20, 0x1);
 }
@@ -3827,36 +3829,21 @@ void ex_btc8723b2ant_halt_notify(struct btc_coexist *btcoexist)
 void ex_btc8723b2ant_periodical(struct btc_coexist *btcoexist)
 {
 	struct rtl_priv *rtlpriv = btcoexist->adapter;
-	struct btc_board_info *board_info = &btcoexist->board_info;
-	struct btc_stack_info *stack_info = &btcoexist->stack_info;
-	static u8 dis_ver_info_cnt;
-	u32 fw_ver = 0, bt_patch_ver = 0;
 
 	RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 		 "[BTCoex], ==========================Periodical===========================\n");
 
-	if (dis_ver_info_cnt <= 5) {
-		dis_ver_info_cnt += 1;
-		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-			 "[BTCoex], ****************************************************************\n");
-		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-			 "[BTCoex], Ant PG Num/ Ant Mech/ Ant Pos = %d/ %d/ %d\n",
-			      board_info->pg_ant_num,
-			      board_info->btdm_ant_num,
-			      board_info->btdm_ant_pos);
-		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-			 "[BTCoex], BT stack/ hci ext ver = %s / %d\n",
-			      stack_info->profile_notified ? "Yes" : "No",
-			      stack_info->hci_version);
-		btcoexist->btc_get(btcoexist, BTC_GET_U4_BT_PATCH_VER,
-				   &bt_patch_ver);
-		btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_FW_VER, &fw_ver);
-		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-			 "[BTCoex], CoexVer/ fw_ver/ PatchVer = %d_%x/ 0x%x/ 0x%x(%d)\n",
-			      glcoex_ver_date_8723b_2ant, glcoex_ver_8723b_2ant,
-			      fw_ver, bt_patch_ver, bt_patch_ver);
-		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
-			 "[BTCoex], ****************************************************************\n");
+	if (coex_sta->dis_ver_info_cnt <= 5) {
+		coex_sta->dis_ver_info_cnt += 1;
+		if (coex_sta->dis_ver_info_cnt == 3) {
+			/* Antenna config to set 0x765 = 0x0 (GNT_BT control by
+			 * PTA) after initial
+			 */
+			RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
+				 "[BTCoex], Set GNT_BT control by PTA\n");
+			btc8723b2ant_set_ant_path(
+				btcoexist, BTC_ANT_WIFI_AT_MAIN, false, false);
+		}
 	}
 
 #if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 0)
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
index 9f41206..57eac22 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.h
@@ -167,6 +167,8 @@ struct coex_sta_8723b_2ant {
 	u32 crc_err_11n_agg;
 	bool force_lps_on;
 
+	u8 dis_ver_info_cnt;
+
 	u8 a2dp_bit_pool;
 };
 
-- 
2.10.2

  parent reply	other threads:[~2017-04-04 16:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 16:49 [PATCH 00/13] rtlwifi: btcoex: More improvements to Bluetooth Coexistence for 23b Larry Finger
2017-04-04 16:49 ` [PATCH 01/13] rtlwifi: btcoex: 23b 2ant: check PS state before setting tdma duration Larry Finger
2017-04-13 14:09   ` [01/13] " Kalle Valo
2017-04-04 16:49 ` [PATCH 02/13] rtlwifi: btcoex: 23b 2ant: rename tdma_adj_type to ps_tdma_du_adj_type Larry Finger
2017-04-04 16:49 ` [PATCH 03/13] rtlwifi: btcoex: 23b 2ant: detect ap num and set GNT_BT properly Larry Finger
2017-04-04 16:49 ` [PATCH 04/13] rtlwifi: btcoex: 23b 2ant: more cases for adjusting tdma duration Larry Finger
2017-04-04 16:49 ` Larry Finger [this message]
2017-04-04 16:49 ` [PATCH 06/13] rtlwifi: btcoex: 23b 2ant: add pnp notidy to avoid LPS/IPS mismatch Larry Finger
2017-04-04 16:50 ` [PATCH 07/13] rtlwifi: btcoex: 23b 2ant: check more cases when bt is queuing Larry Finger
2017-04-04 16:50 ` [PATCH 08/13] rtlwifi: btcoex: 23b 2ant: workaround for bt a2dp and hid Larry Finger
2017-04-04 16:50 ` [PATCH 09/13] rtlwifi: btcoex: 23b 2ant: tell fw if external or internal switch is used Larry Finger
2017-04-04 16:50 ` [PATCH 10/13] rtlwifi: btcoex: 23b 2ant: let bt transmit when hw initialisation done Larry Finger
2017-04-04 16:50 ` [PATCH 11/13] rtlwifi: btcoex: 23b 2ant: turn off ps and tdma mechanism when in concurrent mode Larry Finger
2017-04-04 16:50 ` [PATCH 12/13] rtlwifi: btcoex: 23b 2ant: turn off antenna when rssi is too high/low Larry Finger
2017-04-04 16:50 ` [PATCH 13/13] rtlwifi: btcoex: 23b 2ant: set coex table when wifi is linking 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=20170404165006.14329-6-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.