xref: /linux/drivers/net/wireless/realtek/rtw89/rtw8852bt.c (revision 0b38e6277aed8a59ccb64fcc1172d962c1f11b4c)
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /* Copyright(c) 2024 Realtek Corporation
3  */
4 
5 #include "coex.h"
6 #include "fw.h"
7 #include "mac.h"
8 #include "phy.h"
9 #include "reg.h"
10 #include "rtw8852bt.h"
11 #include "rtw8852bt_rfk.h"
12 #include "rtw8852b_common.h"
13 
14 #define RTW8852BT_FW_FORMAT_MAX 0
15 #define RTW8852BT_FW_BASENAME "rtw89/rtw8852bt_fw"
16 #define RTW8852BT_MODULE_FIRMWARE \
17 	RTW8852BT_FW_BASENAME ".bin"
18 
19 static const struct rtw89_hfc_ch_cfg rtw8852bt_hfc_chcfg_pcie[] = {
20 	{16, 742, grp_0}, /* ACH 0 */
21 	{16, 742, grp_0}, /* ACH 1 */
22 	{16, 742, grp_0}, /* ACH 2 */
23 	{16, 742, grp_0}, /* ACH 3 */
24 	{0, 0, grp_0}, /* ACH 4 */
25 	{0, 0, grp_0}, /* ACH 5 */
26 	{0, 0, grp_0}, /* ACH 6 */
27 	{0, 0, grp_0}, /* ACH 7 */
28 	{15, 743, grp_0}, /* B0MGQ */
29 	{15, 743, grp_0}, /* B0HIQ */
30 	{0, 0, grp_0}, /* B1MGQ */
31 	{0, 0, grp_0}, /* B1HIQ */
32 	{40, 0, 0} /* FWCMDQ */
33 };
34 
35 static const struct rtw89_hfc_pub_cfg rtw8852bt_hfc_pubcfg_pcie = {
36 	958, /* Group 0 */
37 	0, /* Group 1 */
38 	958, /* Public Max */
39 	0 /* WP threshold */
40 };
41 
42 static const struct rtw89_hfc_param_ini rtw8852bt_hfc_param_ini_pcie[] = {
43 	[RTW89_QTA_SCC] = {rtw8852bt_hfc_chcfg_pcie, &rtw8852bt_hfc_pubcfg_pcie,
44 			   &rtw89_mac_size.hfc_preccfg_pcie, RTW89_HCIFC_POH},
45 	[RTW89_QTA_DLFW] = {NULL, NULL, &rtw89_mac_size.hfc_preccfg_pcie,
46 			    RTW89_HCIFC_POH},
47 	[RTW89_QTA_INVALID] = {NULL},
48 };
49 
50 static const struct rtw89_dle_mem rtw8852bt_dle_mem_pcie[] = {
51 	[RTW89_QTA_SCC] = {RTW89_QTA_SCC, &rtw89_mac_size.wde_size23,
52 			   &rtw89_mac_size.ple_size9, &rtw89_mac_size.wde_qt23,
53 			   &rtw89_mac_size.wde_qt23, &rtw89_mac_size.ple_qt57,
54 			   &rtw89_mac_size.ple_qt59},
55 	[RTW89_QTA_WOW] = {RTW89_QTA_WOW, &rtw89_mac_size.wde_size23,
56 			   &rtw89_mac_size.ple_size9, &rtw89_mac_size.wde_qt23,
57 			   &rtw89_mac_size.wde_qt23, &rtw89_mac_size.ple_qt57,
58 			   &rtw89_mac_size.ple_qt_52bt_wow},
59 	[RTW89_QTA_DLFW] = {RTW89_QTA_DLFW, &rtw89_mac_size.wde_size4,
60 			    &rtw89_mac_size.ple_size4, &rtw89_mac_size.wde_qt4,
61 			    &rtw89_mac_size.wde_qt4, &rtw89_mac_size.ple_qt13,
62 			    &rtw89_mac_size.ple_qt13},
63 	[RTW89_QTA_INVALID] = {RTW89_QTA_INVALID, NULL, NULL, NULL, NULL, NULL,
64 			       NULL},
65 };
66 
67 static const u32 rtw8852bt_h2c_regs[RTW89_H2CREG_MAX] = {
68 	R_AX_H2CREG_DATA0, R_AX_H2CREG_DATA1,  R_AX_H2CREG_DATA2,
69 	R_AX_H2CREG_DATA3
70 };
71 
72 static const u32 rtw8852bt_c2h_regs[RTW89_C2HREG_MAX] = {
73 	R_AX_C2HREG_DATA0, R_AX_C2HREG_DATA1, R_AX_C2HREG_DATA2,
74 	R_AX_C2HREG_DATA3
75 };
76 
77 static const u32 rtw8852bt_wow_wakeup_regs[RTW89_WOW_REASON_NUM] = {
78 	R_AX_C2HREG_DATA3 + 3, R_AX_C2HREG_DATA3 + 3,
79 };
80 
81 static const struct rtw89_page_regs rtw8852bt_page_regs = {
82 	.hci_fc_ctrl	= R_AX_HCI_FC_CTRL,
83 	.ch_page_ctrl	= R_AX_CH_PAGE_CTRL,
84 	.ach_page_ctrl	= R_AX_ACH0_PAGE_CTRL,
85 	.ach_page_info	= R_AX_ACH0_PAGE_INFO,
86 	.pub_page_info3	= R_AX_PUB_PAGE_INFO3,
87 	.pub_page_ctrl1	= R_AX_PUB_PAGE_CTRL1,
88 	.pub_page_ctrl2	= R_AX_PUB_PAGE_CTRL2,
89 	.pub_page_info1	= R_AX_PUB_PAGE_INFO1,
90 	.pub_page_info2 = R_AX_PUB_PAGE_INFO2,
91 	.wp_page_ctrl1	= R_AX_WP_PAGE_CTRL1,
92 	.wp_page_ctrl2	= R_AX_WP_PAGE_CTRL2,
93 	.wp_page_info1	= R_AX_WP_PAGE_INFO1,
94 };
95 
96 static const struct rtw89_reg_def rtw8852bt_dcfo_comp = {
97 	R_DCFO_COMP_S0, B_DCFO_COMP_S0_MSK
98 };
99 
100 static const struct rtw89_imr_info rtw8852bt_imr_info = {
101 	.wdrls_imr_set		= B_AX_WDRLS_IMR_SET,
102 	.wsec_imr_reg		= R_AX_SEC_DEBUG,
103 	.wsec_imr_set		= B_AX_IMR_ERROR,
104 	.mpdu_tx_imr_set	= 0,
105 	.mpdu_rx_imr_set	= 0,
106 	.sta_sch_imr_set	= B_AX_STA_SCHEDULER_IMR_SET,
107 	.txpktctl_imr_b0_reg	= R_AX_TXPKTCTL_ERR_IMR_ISR,
108 	.txpktctl_imr_b0_clr	= B_AX_TXPKTCTL_IMR_B0_CLR,
109 	.txpktctl_imr_b0_set	= B_AX_TXPKTCTL_IMR_B0_SET,
110 	.txpktctl_imr_b1_reg	= R_AX_TXPKTCTL_ERR_IMR_ISR_B1,
111 	.txpktctl_imr_b1_clr	= B_AX_TXPKTCTL_IMR_B1_CLR,
112 	.txpktctl_imr_b1_set	= B_AX_TXPKTCTL_IMR_B1_SET,
113 	.wde_imr_clr		= B_AX_WDE_IMR_CLR_V01,
114 	.wde_imr_set		= B_AX_WDE_IMR_SET_V01,
115 	.ple_imr_clr		= B_AX_PLE_IMR_CLR,
116 	.ple_imr_set		= B_AX_PLE_IMR_SET,
117 	.host_disp_imr_clr	= B_AX_HOST_DISP_IMR_CLR,
118 	.host_disp_imr_set	= B_AX_HOST_DISP_IMR_SET_V01,
119 	.cpu_disp_imr_clr	= B_AX_CPU_DISP_IMR_CLR,
120 	.cpu_disp_imr_set	= B_AX_CPU_DISP_IMR_SET,
121 	.other_disp_imr_clr	= B_AX_OTHER_DISP_IMR_CLR,
122 	.other_disp_imr_set	= 0,
123 	.bbrpt_com_err_imr_reg	= R_AX_BBRPT_COM_ERR_IMR_ISR,
124 	.bbrpt_chinfo_err_imr_reg = R_AX_BBRPT_CHINFO_ERR_IMR_ISR,
125 	.bbrpt_err_imr_set	= 0,
126 	.bbrpt_dfs_err_imr_reg	= R_AX_BBRPT_DFS_ERR_IMR_ISR,
127 	.ptcl_imr_clr		= B_AX_PTCL_IMR_CLR_ALL,
128 	.ptcl_imr_set		= B_AX_PTCL_IMR_SET,
129 	.cdma_imr_0_reg		= R_AX_DLE_CTRL,
130 	.cdma_imr_0_clr		= B_AX_DLE_IMR_CLR,
131 	.cdma_imr_0_set		= B_AX_DLE_IMR_SET,
132 	.cdma_imr_1_reg		= 0,
133 	.cdma_imr_1_clr		= 0,
134 	.cdma_imr_1_set		= 0,
135 	.phy_intf_imr_reg	= R_AX_PHYINFO_ERR_IMR,
136 	.phy_intf_imr_clr	= B_AX_PHYINFO_IMR_EN_ALL,
137 	.phy_intf_imr_set	= B_AX_PHYINFO_IMR_SET,
138 	.rmac_imr_reg		= R_AX_RMAC_ERR_ISR,
139 	.rmac_imr_clr		= B_AX_RMAC_IMR_CLR,
140 	.rmac_imr_set		= B_AX_RMAC_IMR_SET,
141 	.tmac_imr_reg		= R_AX_TMAC_ERR_IMR_ISR,
142 	.tmac_imr_clr		= B_AX_TMAC_IMR_CLR,
143 	.tmac_imr_set		= B_AX_TMAC_IMR_SET,
144 };
145 
146 static const struct rtw89_rrsr_cfgs rtw8852bt_rrsr_cfgs = {
147 	.ref_rate = {R_AX_TRXPTCL_RRSR_CTL_0, B_AX_WMAC_RESP_REF_RATE_SEL, 0},
148 	.rsc = {R_AX_TRXPTCL_RRSR_CTL_0, B_AX_WMAC_RESP_RSC_MASK, 2},
149 };
150 
151 static const struct rtw89_rfkill_regs rtw8852bt_rfkill_regs = {
152 	.pinmux = {R_AX_GPIO8_15_FUNC_SEL,
153 		   B_AX_PINMUX_GPIO9_FUNC_SEL_MASK,
154 		   0xf},
155 	.mode = {R_AX_GPIO_EXT_CTRL + 2,
156 		 (B_AX_GPIO_MOD_9 | B_AX_GPIO_IO_SEL_9) >> 16,
157 		 0x0},
158 };
159 
160 static const struct rtw89_dig_regs rtw8852bt_dig_regs = {
161 	.seg0_pd_reg = R_SEG0R_PD_V1,
162 	.pd_lower_bound_mask = B_SEG0R_PD_LOWER_BOUND_MSK,
163 	.pd_spatial_reuse_en = B_SEG0R_PD_SPATIAL_REUSE_EN_MSK_V1,
164 	.bmode_pd_reg = R_BMODE_PDTH_EN_V1,
165 	.bmode_cca_rssi_limit_en = B_BMODE_PDTH_LIMIT_EN_MSK_V1,
166 	.bmode_pd_lower_bound_reg = R_BMODE_PDTH_V1,
167 	.bmode_rssi_nocca_low_th_mask = B_BMODE_PDTH_LOWER_BOUND_MSK_V1,
168 	.p0_lna_init = {R_PATH0_LNA_INIT_V1, B_PATH0_LNA_INIT_IDX_MSK},
169 	.p1_lna_init = {R_PATH1_LNA_INIT_V1, B_PATH1_LNA_INIT_IDX_MSK},
170 	.p0_tia_init = {R_PATH0_TIA_INIT_V1, B_PATH0_TIA_INIT_IDX_MSK_V1},
171 	.p1_tia_init = {R_PATH1_TIA_INIT_V1, B_PATH1_TIA_INIT_IDX_MSK_V1},
172 	.p0_rxb_init = {R_PATH0_RXB_INIT_V1, B_PATH0_RXB_INIT_IDX_MSK_V1},
173 	.p1_rxb_init = {R_PATH1_RXB_INIT_V1, B_PATH1_RXB_INIT_IDX_MSK_V1},
174 	.p0_p20_pagcugc_en = {R_PATH0_P20_FOLLOW_BY_PAGCUGC_V2,
175 			      B_PATH0_P20_FOLLOW_BY_PAGCUGC_EN_MSK},
176 	.p0_s20_pagcugc_en = {R_PATH0_S20_FOLLOW_BY_PAGCUGC_V2,
177 			      B_PATH0_S20_FOLLOW_BY_PAGCUGC_EN_MSK},
178 	.p1_p20_pagcugc_en = {R_PATH1_P20_FOLLOW_BY_PAGCUGC_V2,
179 			      B_PATH1_P20_FOLLOW_BY_PAGCUGC_EN_MSK},
180 	.p1_s20_pagcugc_en = {R_PATH1_S20_FOLLOW_BY_PAGCUGC_V2,
181 			      B_PATH1_S20_FOLLOW_BY_PAGCUGC_EN_MSK},
182 };
183 
184 static const struct rtw89_edcca_regs rtw8852bt_edcca_regs = {
185 	.edcca_level			= R_SEG0R_EDCCA_LVL_V1,
186 	.edcca_mask			= B_EDCCA_LVL_MSK0,
187 	.edcca_p_mask			= B_EDCCA_LVL_MSK1,
188 	.ppdu_level			= R_SEG0R_EDCCA_LVL_V1,
189 	.ppdu_mask			= B_EDCCA_LVL_MSK3,
190 	.rpt_a				= R_EDCCA_RPT_A,
191 	.rpt_b				= R_EDCCA_RPT_B,
192 	.rpt_sel			= R_EDCCA_RPT_SEL,
193 	.rpt_sel_mask			= B_EDCCA_RPT_SEL_MSK,
194 	.tx_collision_t2r_st		= R_TX_COLLISION_T2R_ST,
195 	.tx_collision_t2r_st_mask	= B_TX_COLLISION_T2R_ST_M,
196 };
197 
198 static const struct rtw89_btc_rf_trx_para rtw89_btc_8852bt_rf_ul[] = {
199 	{255, 0, 0, 7}, /* 0 -> original */
200 	{255, 2, 0, 7}, /* 1 -> for BT-connected ACI issue && BTG co-rx */
201 	{255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
202 	{255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
203 	{255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
204 	{255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
205 	{6, 1, 0, 7},
206 	{13, 1, 0, 7},
207 	{13, 1, 0, 7}
208 };
209 
210 static const struct rtw89_btc_rf_trx_para rtw89_btc_8852bt_rf_dl[] = {
211 	{255, 0, 0, 7}, /* 0 -> original */
212 	{255, 2, 0, 7}, /* 1 -> reserved for shared-antenna */
213 	{255, 0, 0, 7}, /* 2 ->reserved for shared-antenna */
214 	{255, 0, 0, 7}, /* 3- >reserved for shared-antenna */
215 	{255, 0, 0, 7}, /* 4 ->reserved for shared-antenna */
216 	{255, 1, 0, 7}, /* the below id is for non-shared-antenna free-run */
217 	{255, 1, 0, 7},
218 	{255, 1, 0, 7},
219 	{255, 1, 0, 7}
220 };
221 
222 static const struct rtw89_btc_fbtc_mreg rtw89_btc_8852bt_mon_reg[] = {
223 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda24),
224 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda28),
225 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda2c),
226 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda30),
227 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda4c),
228 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda10),
229 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda20),
230 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xda34),
231 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xcef4),
232 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0x8424),
233 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd200),
234 	RTW89_DEF_FBTC_MREG(REG_MAC, 4, 0xd220),
235 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x980),
236 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4aa4),
237 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x4778),
238 	RTW89_DEF_FBTC_MREG(REG_BB, 4, 0x476c),
239 };
240 
241 static const u8 rtw89_btc_8852bt_wl_rssi_thres[BTC_WL_RSSI_THMAX] = {70, 60, 50, 40};
242 static const u8 rtw89_btc_8852bt_bt_rssi_thres[BTC_BT_RSSI_THMAX] = {50, 40, 30, 20};
243 
244 static int rtw8852bt_pwr_on_func(struct rtw89_dev *rtwdev)
245 {
246 	u32 val32;
247 	u32 ret;
248 
249 	rtw89_write32_set(rtwdev, R_AX_LDO_AON_CTRL0, B_AX_PD_REGU_L);
250 	rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_AFSM_WLSUS_EN |
251 						    B_AX_AFSM_PCIE_SUS_EN);
252 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_DIS_WLBT_PDNSUSEN_SOPC);
253 	rtw89_write32_set(rtwdev, R_AX_WLLPS_CTRL, B_AX_DIS_WLBT_LPSEN_LOPC);
254 	rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APDM_HPDN);
255 	rtw89_write32_clr(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_SWLPS);
256 	rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_OCP_L1_MASK, 7);
257 
258 	ret = read_poll_timeout(rtw89_read32, val32, val32 & B_AX_RDY_SYSPWR,
259 				1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
260 	if (ret)
261 		return ret;
262 
263 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_EN_WLON);
264 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFN_ONMAC);
265 
266 	ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_AX_APFN_ONMAC),
267 				1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
268 	if (ret)
269 		return ret;
270 
271 	rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
272 	rtw89_write8_clr(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
273 	rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
274 	rtw89_write8_clr(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
275 	rtw89_write8_set(rtwdev, R_AX_PLATFORM_ENABLE, B_AX_PLATFORM_EN);
276 	rtw89_write32_clr(rtwdev, R_AX_SYS_SDIO_CTRL, B_AX_PCIE_CALIB_EN_V1);
277 	rtw89_write32_set(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_PTA_1P3);
278 
279 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL,
280 				      XTAL_SI_GND_SHDN_WL, XTAL_SI_GND_SHDN_WL);
281 	if (ret)
282 		return ret;
283 
284 	rtw89_write32_set(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_RFC_1P3);
285 
286 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL,
287 				      XTAL_SI_SHDN_WL, XTAL_SI_SHDN_WL);
288 	if (ret)
289 		return ret;
290 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_OFF_WEI,
291 				      XTAL_SI_OFF_WEI);
292 	if (ret)
293 		return ret;
294 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_OFF_EI,
295 				      XTAL_SI_OFF_EI);
296 	if (ret)
297 		return ret;
298 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_RFC2RF);
299 	if (ret)
300 		return ret;
301 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_PON_WEI,
302 				      XTAL_SI_PON_WEI);
303 	if (ret)
304 		return ret;
305 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_PON_EI,
306 				      XTAL_SI_PON_EI);
307 	if (ret)
308 		return ret;
309 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_SRAM2RFC);
310 	if (ret)
311 		return ret;
312 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_SRAM_CTRL, 0, XTAL_SI_SRAM_DIS);
313 	if (ret)
314 		return ret;
315 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_2, 0, XTAL_SI_LDO_LPS);
316 	if (ret)
317 		return ret;
318 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_XTAL_XMD_4, 0, XTAL_SI_LPS_CAP);
319 	if (ret)
320 		return ret;
321 
322 	rtw89_write32_set(rtwdev, R_AX_PMC_DBG_CTRL2, B_AX_SYSON_DIS_PMCR_AX_WRMSK);
323 	rtw89_write32_set(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_ISO_EB2CORE);
324 	rtw89_write32_clr(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_PWC_EV2EF_B15);
325 
326 	fsleep(1000);
327 
328 	rtw89_write32_clr(rtwdev, R_AX_SYS_ISO_CTRL, B_AX_PWC_EV2EF_B14);
329 	rtw89_write32_clr(rtwdev, R_AX_PMC_DBG_CTRL2, B_AX_SYSON_DIS_PMCR_AX_WRMSK);
330 
331 	if (!rtwdev->efuse.valid || rtwdev->efuse.power_k_valid)
332 		goto func_en;
333 
334 	rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_VOL_L1_MASK, 0x9);
335 	rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_VREFPFM_L_MASK, 0xA);
336 
337 func_en:
338 	rtw89_write32_set(rtwdev, R_AX_DMAC_FUNC_EN,
339 			  B_AX_MAC_FUNC_EN | B_AX_DMAC_FUNC_EN | B_AX_MPDU_PROC_EN |
340 			  B_AX_WD_RLS_EN | B_AX_DLE_WDE_EN | B_AX_TXPKT_CTRL_EN |
341 			  B_AX_STA_SCH_EN | B_AX_DLE_PLE_EN | B_AX_PKT_BUF_EN |
342 			  B_AX_DMAC_TBL_EN | B_AX_PKT_IN_EN | B_AX_DLE_CPUIO_EN |
343 			  B_AX_DISPATCHER_EN | B_AX_BBRPT_EN | B_AX_MAC_SEC_EN |
344 			  B_AX_DMACREG_GCKEN);
345 	rtw89_write32_set(rtwdev, R_AX_CMAC_FUNC_EN,
346 			  B_AX_CMAC_EN | B_AX_CMAC_TXEN | B_AX_CMAC_RXEN |
347 			  B_AX_FORCE_CMACREG_GCKEN | B_AX_PHYINTF_EN | B_AX_CMAC_DMA_EN |
348 			  B_AX_PTCLTOP_EN | B_AX_SCHEDULER_EN | B_AX_TMAC_EN |
349 			  B_AX_RMAC_EN);
350 
351 	rtw89_write32_mask(rtwdev, R_AX_EECS_EESK_FUNC_SEL,
352 			   B_AX_PINMUX_EESK_FUNC_SEL_MASK, 0x1);
353 
354 	return 0;
355 }
356 
357 static int rtw8852bt_pwr_off_func(struct rtw89_dev *rtwdev)
358 {
359 	u32 val32;
360 	u32 ret;
361 
362 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_RFC2RF,
363 				      XTAL_SI_RFC2RF);
364 	if (ret)
365 		return ret;
366 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_OFF_EI);
367 	if (ret)
368 		return ret;
369 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_OFF_WEI);
370 	if (ret)
371 		return ret;
372 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_WL_RFC_S0, 0, XTAL_SI_RF00);
373 	if (ret)
374 		return ret;
375 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_WL_RFC_S1, 0, XTAL_SI_RF10);
376 	if (ret)
377 		return ret;
378 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, XTAL_SI_SRAM2RFC,
379 				      XTAL_SI_SRAM2RFC);
380 	if (ret)
381 		return ret;
382 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_PON_EI);
383 	if (ret)
384 		return ret;
385 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_PON_WEI);
386 	if (ret)
387 		return ret;
388 
389 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_EN_WLON);
390 	rtw89_write32_clr(rtwdev, R_AX_WLRF_CTRL, B_AX_AFC_AFEDIG);
391 	rtw89_write8_clr(rtwdev, R_AX_SYS_FUNC_EN, B_AX_FEN_BB_GLB_RSTN | B_AX_FEN_BBRSTB);
392 	rtw89_write32_clr(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_RFC_1P3);
393 
394 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_SHDN_WL);
395 	if (ret)
396 		return ret;
397 
398 	rtw89_write32_clr(rtwdev, R_AX_SYS_ADIE_PAD_PWR_CTRL, B_AX_SYM_PADPDN_WL_PTA_1P3);
399 
400 	ret = rtw89_mac_write_xtal_si(rtwdev, XTAL_SI_ANAPAR_WL, 0, XTAL_SI_GND_SHDN_WL);
401 	if (ret)
402 		return ret;
403 
404 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_OFFMAC);
405 
406 	ret = read_poll_timeout(rtw89_read32, val32, !(val32 & B_AX_APFM_OFFMAC),
407 				1000, 20000, false, rtwdev, R_AX_SYS_PW_CTRL);
408 	if (ret)
409 		return ret;
410 
411 	rtw89_write32(rtwdev, R_AX_WLLPS_CTRL, SW_LPS_OPTION);
412 	rtw89_write32_set(rtwdev, R_AX_SYS_SWR_CTRL1, B_AX_SYM_CTRL_SPS_PWMFREQ);
413 	rtw89_write32_mask(rtwdev, R_AX_SPS_DIG_ON_CTRL0, B_AX_REG_ZCDC_H_MASK, 0x3);
414 	rtw89_write32_set(rtwdev, R_AX_SYS_PW_CTRL, B_AX_APFM_SWLPS);
415 
416 	return 0;
417 }
418 
419 static void rtw8852bt_bb_reset_en(struct rtw89_dev *rtwdev, enum rtw89_band band,
420 				  enum rtw89_phy_idx phy_idx, bool en)
421 {
422 	if (en) {
423 		rtw89_phy_write32_idx(rtwdev, R_S0_HW_SI_DIS,
424 				      B_S0_HW_SI_DIS_W_R_TRIG, 0x0, phy_idx);
425 		rtw89_phy_write32_idx(rtwdev, R_S1_HW_SI_DIS,
426 				      B_S1_HW_SI_DIS_W_R_TRIG, 0x0, phy_idx);
427 		rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 1, phy_idx);
428 		if (band == RTW89_BAND_2G)
429 			rtw89_phy_write32_mask(rtwdev, R_RXCCA, B_RXCCA_DIS, 0x0);
430 		rtw89_phy_write32_mask(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0x0);
431 	} else {
432 		rtw89_phy_write32_mask(rtwdev, R_RXCCA, B_RXCCA_DIS, 0x1);
433 		rtw89_phy_write32_mask(rtwdev, R_PD_CTRL, B_PD_HIT_DIS, 0x1);
434 		rtw89_phy_write32_idx(rtwdev, R_S0_HW_SI_DIS,
435 				      B_S0_HW_SI_DIS_W_R_TRIG, 0x7, phy_idx);
436 		rtw89_phy_write32_idx(rtwdev, R_S1_HW_SI_DIS,
437 				      B_S1_HW_SI_DIS_W_R_TRIG, 0x7, phy_idx);
438 		fsleep(1);
439 		rtw89_phy_write32_idx(rtwdev, R_RSTB_ASYNC, B_RSTB_ASYNC_ALL, 0, phy_idx);
440 	}
441 }
442 
443 static void rtw8852bt_bb_reset(struct rtw89_dev *rtwdev,
444 			       enum rtw89_phy_idx phy_idx)
445 {
446 	rtw89_phy_write32_mask(rtwdev, R_P0_TXPW_RSTB,
447 			       B_P0_TXPW_RSTB_MANON | B_P0_TXPW_RSTB_TSSI, 0x1);
448 	rtw89_phy_write32_set(rtwdev, R_P0_TSSI_TRK, B_P0_TSSI_TRK_EN);
449 	rtw89_phy_write32_mask(rtwdev, R_P1_TXPW_RSTB,
450 			       B_P1_TXPW_RSTB_MANON | B_P1_TXPW_RSTB_TSSI, 0x1);
451 	rtw89_phy_write32_set(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_TRK_EN);
452 	rtw8852bx_bb_reset_all(rtwdev, phy_idx);
453 	rtw89_phy_write32_mask(rtwdev, R_P0_TXPW_RSTB,
454 			       B_P0_TXPW_RSTB_MANON | B_P0_TXPW_RSTB_TSSI, 3);
455 	rtw89_phy_write32_clr(rtwdev, R_P0_TSSI_TRK, B_P0_TSSI_TRK_EN);
456 	rtw89_phy_write32_mask(rtwdev, R_P1_TXPW_RSTB,
457 			       B_P1_TXPW_RSTB_MANON | B_P0_TXPW_RSTB_TSSI, 0x3);
458 	rtw89_phy_write32_clr(rtwdev, R_P1_TSSI_TRK, B_P1_TSSI_TRK_EN);
459 }
460 
461 static void rtw8852bt_set_channel(struct rtw89_dev *rtwdev,
462 				  const struct rtw89_chan *chan,
463 				  enum rtw89_mac_idx mac_idx,
464 				  enum rtw89_phy_idx phy_idx)
465 {
466 	rtw8852bx_set_channel_mac(rtwdev, chan, mac_idx);
467 	rtw8852bx_set_channel_bb(rtwdev, chan, phy_idx);
468 	rtw8852bt_set_channel_rf(rtwdev, chan, phy_idx);
469 }
470 
471 static void rtw8852bt_tssi_cont_en(struct rtw89_dev *rtwdev, bool en,
472 				   enum rtw89_rf_path path)
473 {
474 	static const u32 tssi_trk[2] = {R_P0_TSSI_TRK, R_P1_TSSI_TRK};
475 
476 	if (en)
477 		rtw89_phy_write32_mask(rtwdev, tssi_trk[path], B_P0_TSSI_TRK_EN, 0x0);
478 	else
479 		rtw89_phy_write32_mask(rtwdev, tssi_trk[path], B_P0_TSSI_TRK_EN, 0x1);
480 }
481 
482 static void rtw8852bt_tssi_cont_en_phyidx(struct rtw89_dev *rtwdev, bool en,
483 					  u8 phy_idx)
484 {
485 	if (!rtwdev->dbcc_en) {
486 		rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_A);
487 		rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_B);
488 		rtw8852bt_tssi_scan(rtwdev, phy_idx);
489 	} else {
490 		if (phy_idx == RTW89_PHY_0)
491 			rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_A);
492 		else
493 			rtw8852bt_tssi_cont_en(rtwdev, en, RF_PATH_B);
494 	}
495 }
496 
497 static void rtw8852bt_adc_en(struct rtw89_dev *rtwdev, bool en)
498 {
499 	if (en)
500 		rtw89_phy_write32_mask(rtwdev, R_ADC_FIFO, B_ADC_FIFO_RST, 0x0);
501 	else
502 		rtw89_phy_write32_mask(rtwdev, R_ADC_FIFO, B_ADC_FIFO_RST, 0xf);
503 }
504 
505 static void rtw8852bt_set_channel_help(struct rtw89_dev *rtwdev, bool enter,
506 				       struct rtw89_channel_help_params *p,
507 				       const struct rtw89_chan *chan,
508 				       enum rtw89_mac_idx mac_idx,
509 				       enum rtw89_phy_idx phy_idx)
510 {
511 	if (enter) {
512 		rtw89_chip_stop_sch_tx(rtwdev, RTW89_MAC_0, &p->tx_en, RTW89_SCH_TX_SEL_ALL);
513 		rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, false);
514 		rtw8852bt_tssi_cont_en_phyidx(rtwdev, false, RTW89_PHY_0);
515 		rtw8852bt_adc_en(rtwdev, false);
516 		fsleep(40);
517 		rtw8852bt_bb_reset_en(rtwdev, chan->band_type, phy_idx, false);
518 	} else {
519 		rtw89_mac_cfg_ppdu_status(rtwdev, RTW89_MAC_0, true);
520 		rtw8852bt_adc_en(rtwdev, true);
521 		rtw8852bt_tssi_cont_en_phyidx(rtwdev, true, RTW89_PHY_0);
522 		rtw8852bt_bb_reset_en(rtwdev, chan->band_type, phy_idx, true);
523 		rtw89_chip_resume_sch_tx(rtwdev, RTW89_MAC_0, p->tx_en);
524 	}
525 }
526 
527 static void rtw8852bt_rfk_init(struct rtw89_dev *rtwdev)
528 {
529 	rtwdev->is_tssi_mode[RF_PATH_A] = false;
530 	rtwdev->is_tssi_mode[RF_PATH_B] = false;
531 
532 	rtw8852bt_dpk_init(rtwdev);
533 	rtw8852bt_rck(rtwdev);
534 	rtw8852bt_dack(rtwdev);
535 	rtw8852bt_rx_dck(rtwdev, RTW89_PHY_0);
536 }
537 
538 static void rtw8852bt_rfk_channel(struct rtw89_dev *rtwdev)
539 {
540 	enum rtw89_phy_idx phy_idx = RTW89_PHY_0;
541 
542 	rtw8852bt_rx_dck(rtwdev, phy_idx);
543 	rtw8852bt_iqk(rtwdev, phy_idx);
544 	rtw8852bt_tssi(rtwdev, phy_idx, true);
545 	rtw8852bt_dpk(rtwdev, phy_idx);
546 }
547 
548 static void rtw8852bt_rfk_band_changed(struct rtw89_dev *rtwdev,
549 				       enum rtw89_phy_idx phy_idx)
550 {
551 	rtw8852bt_tssi_scan(rtwdev, phy_idx);
552 }
553 
554 static void rtw8852bt_rfk_scan(struct rtw89_dev *rtwdev, bool start)
555 {
556 	rtw8852bt_wifi_scan_notify(rtwdev, start, RTW89_PHY_0);
557 }
558 
559 static void rtw8852bt_rfk_track(struct rtw89_dev *rtwdev)
560 {
561 	rtw8852bt_dpk_track(rtwdev);
562 }
563 
564 static void rtw8852bt_btc_set_rfe(struct rtw89_dev *rtwdev)
565 {
566 	const struct rtw89_btc_ver *ver = rtwdev->btc.ver;
567 	union rtw89_btc_module_info *md = &rtwdev->btc.mdinfo;
568 
569 	if (ver->fcxinit == 7) {
570 		md->md_v7.rfe_type = rtwdev->efuse.rfe_type;
571 		md->md_v7.kt_ver = rtwdev->hal.cv;
572 		md->md_v7.kt_ver_adie = rtwdev->hal.acv;
573 		md->md_v7.bt_solo = 0;
574 		md->md_v7.bt_pos = BTC_BT_BTG;
575 		md->md_v7.switch_type = BTC_SWITCH_INTERNAL;
576 		md->md_v7.wa_type = 0;
577 
578 		md->md_v7.ant.type = BTC_ANT_SHARED;
579 		md->md_v7.ant.num = 2;
580 		md->md_v7.ant.isolation = 10;
581 		md->md_v7.ant.diversity = 0;
582 		/* WL 1-stream+1-Ant is located at 0:s0(path-A) or 1:s1(path-B) */
583 		md->md_v7.ant.single_pos = RF_PATH_A;
584 		md->md_v7.ant.btg_pos = RF_PATH_B;
585 
586 		if (md->md_v7.rfe_type == 0) {
587 			rtwdev->btc.dm.error.map.rfe_type0 = true;
588 			return;
589 		}
590 
591 		md->md_v7.ant.num = (md->md_v7.rfe_type % 2) ? 2 : 3;
592 		md->md_v7.ant.stream_cnt = 2;
593 		md->md_v7.wa_type |= BTC_WA_INIT_SCAN;
594 
595 		if (md->md_v7.ant.num == 2) {
596 			md->md_v7.ant.type = BTC_ANT_SHARED;
597 			md->md_v7.bt_pos = BTC_BT_BTG;
598 			md->md_v7.wa_type |= BTC_WA_HFP_LAG;
599 		} else {
600 			md->md_v7.ant.type = BTC_ANT_DEDICATED;
601 			md->md_v7.bt_pos = BTC_BT_ALONE;
602 		}
603 	} else {
604 		return;
605 	}
606 }
607 
608 static void
609 rtw8852bt_btc_set_wl_txpwr_ctrl(struct rtw89_dev *rtwdev, u32 txpwr_val)
610 {
611 	u16 ctrl_all_time = u32_get_bits(txpwr_val, GENMASK(15, 0));
612 	u16 ctrl_gnt_bt = u32_get_bits(txpwr_val, GENMASK(31, 16));
613 
614 	switch (ctrl_all_time) {
615 	case 0xffff:
616 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_RATE_CTRL,
617 					     B_AX_FORCE_PWR_BY_RATE_EN, 0x0);
618 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_RATE_CTRL,
619 					     B_AX_FORCE_PWR_BY_RATE_VALUE_MASK, 0x0);
620 		break;
621 	default:
622 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_RATE_CTRL,
623 					     B_AX_FORCE_PWR_BY_RATE_VALUE_MASK,
624 					     ctrl_all_time);
625 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_RATE_CTRL,
626 					     B_AX_FORCE_PWR_BY_RATE_EN, 0x1);
627 		break;
628 	}
629 
630 	switch (ctrl_gnt_bt) {
631 	case 0xffff:
632 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_COEXT_CTRL,
633 					     B_AX_TXAGC_BT_EN, 0x0);
634 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_COEXT_CTRL,
635 					     B_AX_TXAGC_BT_MASK, 0x0);
636 		break;
637 	default:
638 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_COEXT_CTRL,
639 					     B_AX_TXAGC_BT_MASK, ctrl_gnt_bt);
640 		rtw89_mac_txpwr_write32_mask(rtwdev, RTW89_PHY_0, R_AX_PWR_COEXT_CTRL,
641 					     B_AX_TXAGC_BT_EN, 0x1);
642 		break;
643 	}
644 }
645 
646 static const struct rtw89_chip_ops rtw8852bt_chip_ops = {
647 	.enable_bb_rf		= rtw8852bx_mac_enable_bb_rf,
648 	.disable_bb_rf		= rtw8852bx_mac_disable_bb_rf,
649 	.bb_preinit		= NULL,
650 	.bb_postinit		= NULL,
651 	.bb_reset		= rtw8852bt_bb_reset,
652 	.bb_sethw		= rtw8852bx_bb_sethw,
653 	.read_rf		= rtw89_phy_read_rf_v1,
654 	.write_rf		= rtw89_phy_write_rf_v1,
655 	.set_channel		= rtw8852bt_set_channel,
656 	.set_channel_help	= rtw8852bt_set_channel_help,
657 	.read_efuse		= rtw8852bx_read_efuse,
658 	.read_phycap		= rtw8852bx_read_phycap,
659 	.fem_setup		= NULL,
660 	.rfe_gpio		= NULL,
661 	.rfk_hw_init		= NULL,
662 	.rfk_init		= rtw8852bt_rfk_init,
663 	.rfk_init_late		= NULL,
664 	.rfk_channel		= rtw8852bt_rfk_channel,
665 	.rfk_band_changed	= rtw8852bt_rfk_band_changed,
666 	.rfk_scan		= rtw8852bt_rfk_scan,
667 	.rfk_track		= rtw8852bt_rfk_track,
668 	.power_trim		= rtw8852bx_power_trim,
669 	.set_txpwr		= rtw8852bx_set_txpwr,
670 	.set_txpwr_ctrl		= rtw8852bx_set_txpwr_ctrl,
671 	.init_txpwr_unit	= rtw8852bx_init_txpwr_unit,
672 	.get_thermal		= rtw8852bx_get_thermal,
673 	.ctrl_btg_bt_rx		= rtw8852bx_ctrl_btg_bt_rx,
674 	.query_ppdu		= rtw8852bx_query_ppdu,
675 	.ctrl_nbtg_bt_tx	= rtw8852bx_ctrl_nbtg_bt_tx,
676 	.cfg_txrx_path		= rtw8852bx_bb_cfg_txrx_path,
677 	.set_txpwr_ul_tb_offset	= rtw8852bx_set_txpwr_ul_tb_offset,
678 	.pwr_on_func		= rtw8852bt_pwr_on_func,
679 	.pwr_off_func		= rtw8852bt_pwr_off_func,
680 	.query_rxdesc		= rtw89_core_query_rxdesc,
681 	.fill_txdesc		= rtw89_core_fill_txdesc,
682 	.fill_txdesc_fwcmd	= rtw89_core_fill_txdesc,
683 	.cfg_ctrl_path		= rtw89_mac_cfg_ctrl_path,
684 	.mac_cfg_gnt		= rtw89_mac_cfg_gnt,
685 	.stop_sch_tx		= rtw89_mac_stop_sch_tx,
686 	.resume_sch_tx		= rtw89_mac_resume_sch_tx,
687 	.h2c_dctl_sec_cam	= NULL,
688 	.h2c_default_cmac_tbl	= rtw89_fw_h2c_default_cmac_tbl,
689 	.h2c_assoc_cmac_tbl	= rtw89_fw_h2c_assoc_cmac_tbl,
690 	.h2c_ampdu_cmac_tbl	= NULL,
691 	.h2c_default_dmac_tbl	= NULL,
692 	.h2c_update_beacon	= rtw89_fw_h2c_update_beacon,
693 	.h2c_ba_cam		= rtw89_fw_h2c_ba_cam,
694 
695 	.btc_set_rfe		= rtw8852bt_btc_set_rfe,
696 	.btc_init_cfg		= rtw8852bx_btc_init_cfg,
697 	.btc_set_wl_pri		= rtw8852bx_btc_set_wl_pri,
698 	.btc_set_wl_txpwr_ctrl	= rtw8852bt_btc_set_wl_txpwr_ctrl,
699 	.btc_get_bt_rssi	= rtw8852bx_btc_get_bt_rssi,
700 	.btc_update_bt_cnt	= rtw8852bx_btc_update_bt_cnt,
701 	.btc_wl_s1_standby	= rtw8852bx_btc_wl_s1_standby,
702 	.btc_set_wl_rx_gain	= rtw8852bx_btc_set_wl_rx_gain,
703 	.btc_set_policy		= rtw89_btc_set_policy_v1,
704 };
705 
706 #ifdef CONFIG_PM
707 static const struct wiphy_wowlan_support rtw_wowlan_stub_8852bt = {
708 	.flags = WIPHY_WOWLAN_MAGIC_PKT | WIPHY_WOWLAN_DISCONNECT,
709 	.n_patterns = RTW89_MAX_PATTERN_NUM,
710 	.pattern_max_len = RTW89_MAX_PATTERN_SIZE,
711 	.pattern_min_len = 1,
712 };
713 #endif
714 
715 const struct rtw89_chip_info rtw8852bt_chip_info = {
716 	.chip_id		= RTL8852BT,
717 	.chip_gen		= RTW89_CHIP_AX,
718 	.ops			= &rtw8852bt_chip_ops,
719 	.mac_def		= &rtw89_mac_gen_ax,
720 	.phy_def		= &rtw89_phy_gen_ax,
721 	.fw_basename		= RTW8852BT_FW_BASENAME,
722 	.fw_format_max		= RTW8852BT_FW_FORMAT_MAX,
723 	.try_ce_fw		= true,
724 	.bbmcu_nr		= 0,
725 	.needed_fw_elms		= RTW89_AX_GEN_DEF_NEEDED_FW_ELEMENTS_NO_6GHZ,
726 	.fifo_size		= 458752,
727 	.small_fifo_size	= true,
728 	.dle_scc_rsvd_size	= 98304,
729 	.max_amsdu_limit	= 5000,
730 	.dis_2g_40m_ul_ofdma	= true,
731 	.rsvd_ple_ofst		= 0x6f800,
732 	.hfc_param_ini		= rtw8852bt_hfc_param_ini_pcie,
733 	.dle_mem		= rtw8852bt_dle_mem_pcie,
734 	.wde_qempty_acq_grpnum	= 4,
735 	.wde_qempty_mgq_grpsel	= 4,
736 	.rf_base_addr		= {0xe000, 0xf000},
737 	.pwr_on_seq		= NULL,
738 	.pwr_off_seq		= NULL,
739 	.bb_table		= NULL,
740 	.bb_gain_table		= NULL,
741 	.rf_table		= {},
742 	.nctl_table		= NULL,
743 	.nctl_post_table	= NULL,
744 	.dflt_parms		= NULL,
745 	.rfe_parms_conf		= NULL,
746 	.txpwr_factor_rf	= 2,
747 	.txpwr_factor_mac	= 1,
748 	.dig_table		= NULL,
749 	.dig_regs		= &rtw8852bt_dig_regs,
750 	.tssi_dbw_table		= NULL,
751 	.support_macid_num	= RTW89_MAX_MAC_ID_NUM,
752 	.support_chanctx_num	= 1,
753 	.support_rnr		= false,
754 	.support_bands		= BIT(NL80211_BAND_2GHZ) |
755 				  BIT(NL80211_BAND_5GHZ),
756 	.support_bandwidths	= BIT(NL80211_CHAN_WIDTH_20) |
757 				  BIT(NL80211_CHAN_WIDTH_40) |
758 				  BIT(NL80211_CHAN_WIDTH_80),
759 	.support_unii4		= true,
760 	.ul_tb_waveform_ctrl	= true,
761 	.ul_tb_pwr_diff		= false,
762 	.hw_sec_hdr		= false,
763 	.rf_path_num		= 2,
764 	.tx_nss			= 2,
765 	.rx_nss			= 2,
766 	.acam_num		= 128,
767 	.bcam_num		= 10,
768 	.scam_num		= 128,
769 	.bacam_num		= 2,
770 	.bacam_dynamic_num	= 4,
771 	.bacam_ver		= RTW89_BACAM_V0,
772 	.ppdu_max_usr		= 4,
773 	.sec_ctrl_efuse_size	= 4,
774 	.physical_efuse_size	= 1216,
775 	.logical_efuse_size	= 2048,
776 	.limit_efuse_size	= 1280,
777 	.dav_phy_efuse_size	= 96,
778 	.dav_log_efuse_size	= 16,
779 	.efuse_blocks		= NULL,
780 	.phycap_addr		= 0x580,
781 	.phycap_size		= 128,
782 	.para_ver		= 0,
783 	.wlcx_desired		= 0x070e0000,
784 	.btcx_desired		= 0x7,
785 	.scbd			= 0x1,
786 	.mailbox		= 0x1,
787 
788 	.afh_guard_ch		= 6,
789 	.wl_rssi_thres		= rtw89_btc_8852bt_wl_rssi_thres,
790 	.bt_rssi_thres		= rtw89_btc_8852bt_bt_rssi_thres,
791 	.rssi_tol		= 2,
792 	.mon_reg_num		= ARRAY_SIZE(rtw89_btc_8852bt_mon_reg),
793 	.mon_reg		= rtw89_btc_8852bt_mon_reg,
794 	.rf_para_ulink_num	= ARRAY_SIZE(rtw89_btc_8852bt_rf_ul),
795 	.rf_para_ulink		= rtw89_btc_8852bt_rf_ul,
796 	.rf_para_dlink_num	= ARRAY_SIZE(rtw89_btc_8852bt_rf_dl),
797 	.rf_para_dlink		= rtw89_btc_8852bt_rf_dl,
798 	.ps_mode_supported	= BIT(RTW89_PS_MODE_RFOFF) |
799 				  BIT(RTW89_PS_MODE_CLK_GATED) |
800 				  BIT(RTW89_PS_MODE_PWR_GATED),
801 	.low_power_hci_modes	= 0,
802 	.h2c_cctl_func_id	= H2C_FUNC_MAC_CCTLINFO_UD,
803 	.hci_func_en_addr	= R_AX_HCI_FUNC_EN,
804 	.h2c_desc_size		= sizeof(struct rtw89_txwd_body),
805 	.txwd_body_size		= sizeof(struct rtw89_txwd_body),
806 	.txwd_info_size		= sizeof(struct rtw89_txwd_info),
807 	.h2c_ctrl_reg		= R_AX_H2CREG_CTRL,
808 	.h2c_counter_reg	= {R_AX_UDM1 + 1, B_AX_UDM1_HALMAC_H2C_DEQ_CNT_MASK >> 8},
809 	.h2c_regs		= rtw8852bt_h2c_regs,
810 	.c2h_ctrl_reg		= R_AX_C2HREG_CTRL,
811 	.c2h_counter_reg	= {R_AX_UDM1 + 1, B_AX_UDM1_HALMAC_C2H_ENQ_CNT_MASK >> 8},
812 	.c2h_regs		= rtw8852bt_c2h_regs,
813 	.page_regs		= &rtw8852bt_page_regs,
814 	.wow_reason_reg		= rtw8852bt_wow_wakeup_regs,
815 	.cfo_src_fd		= true,
816 	.cfo_hw_comp		= true,
817 	.dcfo_comp		= &rtw8852bt_dcfo_comp,
818 	.dcfo_comp_sft		= 10,
819 	.imr_info		= &rtw8852bt_imr_info,
820 	.imr_dmac_table		= NULL,
821 	.imr_cmac_table		= NULL,
822 	.rrsr_cfgs		= &rtw8852bt_rrsr_cfgs,
823 	.bss_clr_vld		= {R_BSS_CLR_MAP_V1, B_BSS_CLR_MAP_VLD0},
824 	.bss_clr_map_reg	= R_BSS_CLR_MAP_V1,
825 	.rfkill_init		= &rtw8852bt_rfkill_regs,
826 	.rfkill_get		= {R_AX_GPIO_EXT_CTRL, B_AX_GPIO_IN_9},
827 	.dma_ch_mask		= BIT(RTW89_DMA_ACH4) | BIT(RTW89_DMA_ACH5) |
828 				  BIT(RTW89_DMA_ACH6) | BIT(RTW89_DMA_ACH7) |
829 				  BIT(RTW89_DMA_B1MG) | BIT(RTW89_DMA_B1HI),
830 	.edcca_regs		= &rtw8852bt_edcca_regs,
831 #ifdef CONFIG_PM
832 	.wowlan_stub		= &rtw_wowlan_stub_8852bt,
833 #endif
834 	.xtal_info		= NULL,
835 };
836 EXPORT_SYMBOL(rtw8852bt_chip_info);
837 
838 MODULE_FIRMWARE(RTW8852BT_MODULE_FIRMWARE);
839 MODULE_AUTHOR("Realtek Corporation");
840 MODULE_DESCRIPTION("Realtek 802.11ax wireless 8852BT driver");
841 MODULE_LICENSE("Dual BSD/GPL");
842