Blob Blame History Raw
From 5b5ab4cb5cda824ef59e0511ac5d585f35f1a1a6 Mon Sep 17 00:00:00 2001
From: Larry Finger <Larry.Finger@lwfinger.net>
Date: Thu, 17 Aug 2017 12:46:51 -0500
Subject: [PATCH] staging: r8822be: Add Makefiles and Kconfig for new driver
Git-commit: 5b5ab4cb5cda824ef59e0511ac5d585f35f1a1a6
Patch-mainline: v4.14-rc1
References: FATE#326887

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

This commit enables building of the new driver. For this version, all
routines are built into a single module r8822be. When this driver is
moved to the wireless tree, halmac, phydm, and rtl8822be will become
new modules.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/staging/Kconfig                       |   2 +
 drivers/staging/Makefile                      |   1 +
 drivers/staging/rtlwifi/Kconfig               |  22 ++
 drivers/staging/rtlwifi/Makefile              |  70 +++++
 drivers/staging/rtlwifi/TODO                  |  11 +
 drivers/staging/rtlwifi/btcoexist/Makefile    |   8 +
 .../staging/rtlwifi/btcoexist/halbt_precomp.h |   5 -
 .../staging/rtlwifi/btcoexist/halbtcoutsrc.c  | 257 ++----------------
 drivers/staging/rtlwifi/rtl8822be/Makefile    |   7 +
 9 files changed, 137 insertions(+), 246 deletions(-)
 create mode 100644 drivers/staging/rtlwifi/Kconfig
 create mode 100644 drivers/staging/rtlwifi/Makefile
 create mode 100644 drivers/staging/rtlwifi/TODO
 create mode 100644 drivers/staging/rtlwifi/btcoexist/Makefile
 create mode 100644 drivers/staging/rtlwifi/rtl8822be/Makefile

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index e97d72e3bc40..1b0a1bed8e11 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -40,6 +40,8 @@ source "drivers/staging/rtl8712/Kconfig"
 
 source "drivers/staging/rtl8188eu/Kconfig"
 
+source "drivers/staging/rtlwifi/Kconfig"
+
 source "drivers/staging/rts5208/Kconfig"
 
 source "drivers/staging/octeon/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 993ed0c1556c..2b61cbd44d13 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_RTL8192E)		+= rtl8192e/
 obj-$(CONFIG_RTL8723BS)		+= rtl8723bs/
 obj-$(CONFIG_R8712U)		+= rtl8712/
 obj-$(CONFIG_R8188EU)		+= rtl8188eu/
+obj-$(CONFIG_R8822BE)		+= rtlwifi/
 obj-$(CONFIG_RTS5208)		+= rts5208/
 obj-$(CONFIG_NETLOGIC_XLR_NET)	+= netlogic/
 obj-$(CONFIG_OCTEON_ETHERNET)	+= octeon/
diff --git a/drivers/staging/rtlwifi/Kconfig b/drivers/staging/rtlwifi/Kconfig
new file mode 100644
index 000000000000..fc482b49f9aa
--- /dev/null
+++ b/drivers/staging/rtlwifi/Kconfig
@@ -0,0 +1,22 @@
+config R8822BE
+	tristate "Realtek RTL8822BE Wireless Network Adapter"
+	depends on PCI && m
+	select FW_LOADER
+	---help---
+	This is the staging driver for Realtek RTL8822BE 802.11ac PCIe
+	wireless network adapters.
+
+config RTLHALMAC_ST
+	tristate
+	depends on R8822BE
+	default m
+
+config RTLPHYDM_ST
+	tristate
+	depends on R8822BE
+	default m
+
+config RTLWIFI_DEBUG_ST
+	boolean
+	depends on R8822BE
+	default y
diff --git a/drivers/staging/rtlwifi/Makefile b/drivers/staging/rtlwifi/Makefile
new file mode 100644
index 000000000000..0d738c18b29c
--- /dev/null
+++ b/drivers/staging/rtlwifi/Makefile
@@ -0,0 +1,70 @@
+obj-$(CONFIG_R8822BE) 		+= r8822be.o
+
+r8822be-objs	:=		\
+		base.o		\
+		cam.o		\
+		core.o		\
+		debug.o		\
+		efuse.o		\
+		ps.o		\
+		rc.o		\
+		regd.o		\
+		stats.o		\
+		pci.o		\
+		rtl8822be/fw.o	\
+		rtl8822be/hw.o	\
+		rtl8822be/led.o	\
+		rtl8822be/phy.o	\
+		rtl8822be/sw.o	\
+		rtl8822be/trx.o	\
+		btcoexist/halbtc8822b2ant.o	\
+		btcoexist/halbtc8822b1ant.o	\
+		btcoexist/halbtc8822bwifionly.o	\
+		btcoexist/halbtcoutsrc.o	\
+		btcoexist/rtl_btc.o		\
+		halmac/halmac_api.o	\
+		halmac/halmac_88xx/halmac_api_88xx_usb.o	\
+	        halmac/halmac_88xx/halmac_api_88xx_sdio.o	\
+	        halmac/halmac_88xx/halmac_api_88xx.o	\
+	        halmac/halmac_88xx/halmac_api_88xx_pcie.o	\
+	        halmac/halmac_88xx/halmac_func_88xx.o	\
+	        halmac/halmac_88xx/halmac_8822b/halmac_api_8822b_pcie.o	\
+	        halmac/halmac_88xx/halmac_8822b/halmac_func_8822b.o	\
+	        halmac/halmac_88xx/halmac_8822b/halmac_api_8822b_sdio.o	\
+	        halmac/halmac_88xx/halmac_8822b/halmac_api_8822b.o	\
+	        halmac/halmac_88xx/halmac_8822b/halmac_8822b_phy.o	\
+	        halmac/halmac_88xx/halmac_8822b/halmac_8822b_pwr_seq.o	\
+	        halmac/halmac_88xx/halmac_8822b/halmac_api_8822b_usb.o	\
+	        halmac/rtl_halmac.o					\
+		phydm/phydm_debug.o	\
+		phydm/phydm_antdiv.o\
+		phydm/phydm_interface.o\
+		phydm/phydm_hwconfig.o\
+		phydm/phydm.o\
+		phydm/halphyrf_ce.o\
+		phydm/phydm_edcaturbocheck.o\
+		phydm/phydm_dig.o\
+		phydm/phydm_rainfo.o\
+		phydm/phydm_dynamicbbpowersaving.o\
+		phydm/phydm_powertracking_ce.o\
+		phydm/phydm_dynamictxpower.o\
+		phydm/phydm_adaptivity.o\
+		phydm/phydm_cfotracking.o\
+		phydm/phydm_noisemonitor.o\
+		phydm/phydm_acs.o\
+		phydm/phydm_psd.o\
+		phydm/phydm_adc_sampling.o\
+		phydm/phydm_kfree.o\
+		phydm/phydm_ccx.o		\
+		phydm/rtl8822b/halhwimg8822b_bb.o\
+		phydm/rtl8822b/halhwimg8822b_mac.o\
+		phydm/rtl8822b/halhwimg8822b_rf.o\
+		phydm/rtl8822b/halphyrf_8822b.o\
+		phydm/rtl8822b/phydm_hal_api8822b.o\
+		phydm/rtl8822b/phydm_iqk_8822b.o\
+		phydm/rtl8822b/phydm_regconfig8822b.o\
+		phydm/rtl8822b/phydm_rtl8822b.o	\
+		phydm/rtl_phydm.o
+
+
+obj-$(CONFIG_R8822BE)			+= rtl8822be/
diff --git a/drivers/staging/rtlwifi/TODO b/drivers/staging/rtlwifi/TODO
new file mode 100644
index 000000000000..52a85cdf453c
--- /dev/null
+++ b/drivers/staging/rtlwifi/TODO
@@ -0,0 +1,11 @@
+TODO:
+- checkpatch.pl fixes - most of the remaining ones are lines too long. Many
+  of them will require refactoring
+- merge Realtek's bugfixes and new features into the driver
+- find and remove code blocks guarded by never set CONFIG_FOO defines
+- convert any remaining unusual variable types
+- find codes that can use %pM and %Nph formatting
+- fix any reviewer's comments regarding movin the driver to drivers/net/wireless
+
+Please send any patches to Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
+and Larry Finger <Larry.Finger@lwfinger.net>.
diff --git a/drivers/staging/rtlwifi/btcoexist/Makefile b/drivers/staging/rtlwifi/btcoexist/Makefile
new file mode 100644
index 000000000000..f600bcc38a15
--- /dev/null
+++ b/drivers/staging/rtlwifi/btcoexist/Makefile
@@ -0,0 +1,8 @@
+btcoexist-objs :=				\
+			halbtc8822b1ant.o	\
+			halbtc8822b2ant.o	\
+			halbtc8822bwifionly.o	\
+			halbtcoutsrc.o		\
+			rtl_btc.o
+
+obj-$(CONFIG_RTLBTCOEXIST) += btcoexist.o
diff --git a/drivers/staging/rtlwifi/btcoexist/halbt_precomp.h b/drivers/staging/rtlwifi/btcoexist/halbt_precomp.h
index 1cd3ce54b6a2..d78cd9394373 100644
--- a/drivers/staging/rtlwifi/btcoexist/halbt_precomp.h
+++ b/drivers/staging/rtlwifi/btcoexist/halbt_precomp.h
@@ -43,11 +43,6 @@
 #define RT_SDIO_INTERFACE	3
 #define DEV_BUS_TYPE		RT_PCI_INTERFACE
 
-#include "halbtc8192e2ant.h"
-#include "halbtc8723b1ant.h"
-#include "halbtc8723b2ant.h"
-#include "halbtc8821a2ant.h"
-#include "halbtc8821a1ant.h"
 #include "halbtc8822b1ant.h"
 #include "halbtc8822b2ant.h"
 #include "halbtc8822bwifionly.h"
diff --git a/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
index e5c25c0babfb..39229cdb8045 100644
--- a/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -1075,24 +1075,6 @@ static u32 halbtc_get_bt_reg(void *btc_context, u8 reg_type, u32 offset)
 	return 0;
 }
 
-static bool halbtc_under_ips(struct btc_coexist *btcoexist)
-{
-	struct rtl_priv *rtlpriv = btcoexist->adapter;
-	struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv);
-	enum rf_pwrstate rtstate;
-
-	if (ppsc->inactiveps) {
-		rtstate = ppsc->rfpwr_state;
-
-		if (rtstate != ERFON &&
-		    ppsc->rfoff_reason == RF_CHANGE_BY_IPS) {
-			return true;
-		}
-	}
-
-	return false;
-}
-
 static
 u32 halbtc_get_phydm_version(void *btc_context)
 {
@@ -1389,12 +1371,7 @@ void exhalbtc_power_on_setting(struct btc_coexist *btcoexist)
 
 	btcoexist->statistics.cnt_power_on++;
 
-	if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_power_on_setting(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_power_on_setting(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_power_on_setting(btcoexist);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1409,10 +1386,7 @@ void exhalbtc_pre_load_firmware(struct btc_coexist *btcoexist)
 
 	btcoexist->statistics.cnt_pre_load_firmware++;
 
-	if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_pre_load_firmware(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_pre_load_firmware(btcoexist);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1427,22 +1401,7 @@ void exhalbtc_init_hw_config(struct btc_coexist *btcoexist, bool wifi_only)
 
 	btcoexist->statistics.cnt_init_hw_config++;
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_init_hwconfig(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_init_hwconfig(btcoexist, wifi_only);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_init_hwconfig(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_init_hwconfig(btcoexist, wifi_only);
-	} else if (IS_HARDWARE_TYPE_8723A(btcoexist->adapter)) {
-		/* 8723A has no this function */
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_init_hwconfig(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_init_hw_config(btcoexist, wifi_only);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1466,20 +1425,7 @@ void exhalbtc_init_coex_dm(struct btc_coexist *btcoexist)
 
 	btcoexist->statistics.cnt_init_coex_dm++;
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_init_coex_dm(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_init_coex_dm(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_init_coex_dm(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_init_coex_dm(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_init_coex_dm(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_init_coex_dm(btcoexist);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1506,20 +1452,7 @@ void exhalbtc_ips_notify(struct btc_coexist *btcoexist, u8 type)
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_ips_notify(btcoexist, ips_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_ips_notify(btcoexist, ips_type);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_ips_notify(btcoexist, ips_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_ips_notify(btcoexist, ips_type);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_ips_notify(btcoexist, ips_type);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_ips_notify(btcoexist, ips_type);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1544,20 +1477,7 @@ void exhalbtc_lps_notify(struct btc_coexist *btcoexist, u8 type)
 	else
 		lps_type = BTC_LPS_ENABLE;
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_lps_notify(btcoexist, lps_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_lps_notify(btcoexist, lps_type);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_lps_notify(btcoexist, lps_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_lps_notify(btcoexist, lps_type);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_lps_notify(btcoexist, lps_type);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_lps_notify(btcoexist, lps_type);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1582,20 +1502,7 @@ void exhalbtc_scan_notify(struct btc_coexist *btcoexist, u8 type)
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_scan_notify(btcoexist, scan_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_scan_notify(btcoexist, scan_type);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_scan_notify(btcoexist, scan_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_scan_notify(btcoexist, scan_type);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_scan_notify(btcoexist, scan_type);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_scan_notify(btcoexist, scan_type);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1629,20 +1536,7 @@ void exhalbtc_connect_notify(struct btc_coexist *btcoexist, u8 action)
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_connect_notify(btcoexist, asso_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_connect_notify(btcoexist, asso_type);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_connect_notify(btcoexist, asso_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_connect_notify(btcoexist, asso_type);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_connect_notify(btcoexist, asso_type);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_connect_notify(btcoexist, asso_type);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1670,20 +1564,7 @@ void exhalbtc_mediastatus_notify(struct btc_coexist *btcoexist,
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_media_status_notify(btcoexist, status);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_media_status_notify(btcoexist, status);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_media_status_notify(btcoexist, status);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_media_status_notify(btcoexist, status);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_media_status_notify(btcoexist, status);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_media_status_notify(btcoexist, status);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1716,25 +1597,7 @@ void exhalbtc_special_packet_notify(struct btc_coexist *btcoexist, u8 pkt_type)
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_special_packet_notify(btcoexist,
-							      packet_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_special_packet_notify(btcoexist,
-							      packet_type);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_special_packet_notify(btcoexist,
-							      packet_type);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_special_packet_notify(btcoexist,
-							      packet_type);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_special_packet_notify(btcoexist,
-							      packet_type);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_specific_packet_notify(btcoexist,
 							       packet_type);
@@ -1755,25 +1618,7 @@ void exhalbtc_bt_info_notify(struct btc_coexist *btcoexist,
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_bt_info_notify(btcoexist, tmp_buf,
-						       length);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_bt_info_notify(btcoexist, tmp_buf,
-						       length);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_bt_info_notify(btcoexist, tmp_buf,
-						       length);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_bt_info_notify(btcoexist, tmp_buf,
-						       length);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_bt_info_notify(btcoexist, tmp_buf,
-						       length);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_bt_info_notify(btcoexist, tmp_buf,
 						       length);
@@ -1790,12 +1635,7 @@ void exhalbtc_rf_status_notify(struct btc_coexist *btcoexist, u8 type)
 	if (!halbtc_is_bt_coexist_available(btcoexist))
 		return;
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_rf_status_notify(btcoexist, type);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_rf_status_notify(btcoexist, type);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1832,20 +1672,7 @@ void exhalbtc_halt_notify(struct btc_coexist *btcoexist)
 	if (!halbtc_is_bt_coexist_available(btcoexist))
 		return;
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_halt_notify(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_halt_notify(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_halt_notify(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_halt_notify(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_halt_notify(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_halt_notify(btcoexist);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1865,18 +1692,7 @@ void exhalbtc_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
 	 * we can sleep normally.
 	 */
 
-	if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_pnp_notify(btcoexist, pnp_state);
-		else if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_pnp_notify(btcoexist, pnp_state);
-	} else if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_pnp_notify(btcoexist, pnp_state);
-		else if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_pnp_notify(btcoexist, pnp_state);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_pnp_notify(btcoexist, pnp_state);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -1886,26 +1702,12 @@ void exhalbtc_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
 
 void exhalbtc_coex_dm_switch(struct btc_coexist *btcoexist)
 {
-	struct rtl_priv *rtlpriv = btcoexist->adapter;
-
 	if (!halbtc_is_bt_coexist_available(btcoexist))
 		return;
 	btcoexist->statistics.cnt_coex_dm_switch++;
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 1) {
-			btcoexist->stop_coex_dm = true;
-			ex_btc8723b1ant_coex_dm_reset(btcoexist);
-			exhalbtc_set_ant_num(rtlpriv,
-					     BT_COEX_ANT_TYPE_DETECTED, 2);
-			ex_btc8723b2ant_init_hwconfig(btcoexist);
-			ex_btc8723b2ant_init_coex_dm(btcoexist);
-			btcoexist->stop_coex_dm = false;
-		}
-	}
-
 	halbtc_normal_low_power(btcoexist);
 }
 
@@ -1917,21 +1719,7 @@ void exhalbtc_periodical(struct btc_coexist *btcoexist)
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_periodical(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			if (!halbtc_under_ips(btcoexist))
-				ex_btc8821a1ant_periodical(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_periodical(btcoexist);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_periodical(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_periodical(btcoexist);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_periodical(btcoexist);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
@@ -2056,20 +1844,7 @@ void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,
 
 	halbtc_leave_low_power(btcoexist);
 
-	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8821a2ant_display_coex_info(btcoexist, m);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8821a1ant_display_coex_info(btcoexist, m);
-	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8723b2ant_display_coex_info(btcoexist, m);
-		else if (btcoexist->board_info.btdm_ant_num == 1)
-			ex_btc8723b1ant_display_coex_info(btcoexist, m);
-	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
-		if (btcoexist->board_info.btdm_ant_num == 2)
-			ex_btc8192e2ant_display_coex_info(btcoexist, m);
-	} else if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
+	if (IS_HARDWARE_TYPE_8822B(btcoexist->adapter)) {
 		if (btcoexist->board_info.btdm_ant_num == 1)
 			ex_btc8822b1ant_display_coex_info(btcoexist, m);
 		else if (btcoexist->board_info.btdm_ant_num == 2)
diff --git a/drivers/staging/rtlwifi/rtl8822be/Makefile b/drivers/staging/rtlwifi/rtl8822be/Makefile
new file mode 100644
index 000000000000..d535ff8febf1
--- /dev/null
+++ b/drivers/staging/rtlwifi/rtl8822be/Makefile
@@ -0,0 +1,7 @@
+rtl8822be-objs :=		\
+		fw.o		\
+		hw.o		\
+		led.o		\
+		phy.o		\
+		sw.o		\
+		trx.o
-- 
2.19.1