Skip to contentSkip to conversation

rtw88: 8821c: coex: add functions and parameters

PATCH Superseded [email protected] 2 participants 3 messages Jul 20, 2020 Realtek wireless driver (rtw88)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rtw88: 8821c: coex: add functions and parameters

From: Ping-Cheng Chen <[email protected]>

Without this patch, RTL8821CE will not have coex support, and will crash the system because of the NULL pointers for the coex functions.

While RTL8822C series are WiFi + BT combo chips, it needs the co-existence mechanism for the device to work on both WiFi and BT without interfering each other. And the coex support has already been added before, most of the mechanisms are implemented. The driver should just add corresponding functions to operate on different types of chips and its coex parameters.

Fixes f745eb9ca5bf ("rtw88: 8821c: Add 8821CE to Kconfig and Makefile")
---
 drivers/net/wireless/realtek/rtw88/reg.h      |   1 +
 drivers/net/wireless/realtek/rtw88/rtw8821c.c | 403 ++++++++++++++++++
 drivers/net/wireless/realtek/rtw88/rtw8821c.h |  26 ++
 3 files changed, 430 insertions(+)
drivers/net/wireless/realtek/rtw88/reg.h +1 -0
index f1275757f6b4..8f468d6b5f78 100644
@@ -61,6 +61,7 @@
 #define BIT_FSPI_EN		BIT(19)
 #define BIT_EN_SIC		BIT(12)
 #define BIT_BT_AOD_GPIO3	BIT(9)
+#define BIT_PO_BT_PTA_PINS	BIT(9)
 #define BIT_BT_PTA_EN		BIT(5)
 #define BIT_WLRFE_4_5_EN	BIT(2)
 
drivers/net/wireless/realtek/rtw88/rtw8821c.c +403 -0

429 lines not on this page · raw message

drivers/net/wireless/realtek/rtw88/rtw8821c.h +26 -0
index 166bd0e9294e..bd01e82b6bcd 100644
@@ -160,6 +160,18 @@ _rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data)
 	le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(11, 8))
 #define GET_PHY_STAT_P1_HT_RXSC(phy_stat)                                      \
 	le32_get_bits(*((__le32 *)(phy_stat) + 0x01), GENMASK(15, 12))
+#define GET_PHY_STAT_P1_RXEVM_A(phy_stat)                                      \
+	le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(7, 0))
+#define GET_PHY_STAT_P1_RXEVM_B(phy_stat)                                      \
+	le32_get_bits(*((__le32 *)(phy_stat) + 0x04), GENMASK(15, 8))
+#define GET_PHY_STAT_P1_CFO_TAIL_A(phy_stat)                                 \
+	le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(7, 0))
+#define GET_PHY_STAT_P1_CFO_TAIL_B(phy_stat)                                 \
+	le32_get_bits(*((__le32 *)(phy_stat) + 0x05), GENMASK(15, 8))
+#define GET_PHY_STAT_P1_RXSNR_A(phy_stat)                                      \
+	le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(7, 0))
+#define GET_PHY_STAT_P1_RXSNR_B(phy_stat)                                      \
+	le32_get_bits(*((__le32 *)(phy_stat) + 0x06), GENMASK(15, 8))
 
 #define REG_INIRTS_RATE_SEL 0x0480
 #define REG_HTSTFWT	0x800
@@ -217,6 +229,20 @@ _rtw_write32s_mask(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 data)
 #define REG_CCA_CCK	0xfcc
 #define REG_ANTWT	0x1904
 #define REG_IQKFAILMSK	0x1bf0
+#define BIT_MASK_R_RFE_SEL_15	GENMASK(31, 28)
+#define BIT_SDIO_INT BIT(18)
+#define SAMPLE_RATE_MASK GENMASK(5, 0)
+#define SAMPLE_RATE	0x5
+#define BT_CNT_ENABLE	0x1
+#define BIT_BCN_QUEUE	BIT(3)
+#define BCN_PRI_EN	0x1
+#define PTA_CTRL_PIN	0x66
+#define DPDT_CTRL_PIN	0x77
+#define ANTDIC_CTRL_PIN	0x88
+#define REG_CTRL_TYPE	0x67
+#define BIT_CTRL_TYPE1	BIT(5)
+#define BIT_CTRL_TYPE2	BIT(4)
+#define CTRL_TYPE_MASK	GENMASK(15, 8)
 
 #define RF18_BAND_MASK		(BIT(16) | BIT(9) | BIT(8))
 #define RF18_BAND_2G		(0)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 14 lines · <[email protected]> writes:

From: Ping-Cheng Chen <[email protected]>

Without this patch, RTL8821CE will not have coex support, and will crash the system because of the NULL pointers for the coex functions.

While RTL8822C series are WiFi + BT combo chips, it needs the co-existence mechanism for the device to work on both WiFi and BT without interfering each other. And the coex support has already been added before, most of the mechanisms are implemented. The driver should just add corresponding functions to operate on different types of chips and its coex parameters.

Quoted 4 lines
Fixes f745eb9ca5bf ("rtw88: 8821c: Add 8821CE to Kconfig and Makefile")

What changed from v1?

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw
Quoted 16 lines
Quoted 14 lines · <[email protected]> writes:

From: Ping-Cheng Chen <[email protected]>

Without this patch, RTL8821CE will not have coex support, and will crash the system because of the NULL pointers for the coex functions.

While RTL8822C series are WiFi + BT combo chips, it needs the co-existence mechanism for the device to work on both WiFi and BT without interfering each other. And the coex support has already been added before, most of the mechanisms are implemented. The driver should just add corresponding functions to operate on different types of chips and its coex parameters.

Quoted 7 lines
Quoted 4 lines
Fixes f745eb9ca5bf ("rtw88: 8821c: Add 8821CE to Kconfig and Makefile")

What changed from v1?

Just the name of the author, nothing else :)

Yen-Hsuan