xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/phl/hal_g6/hal_api_bb.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2019 Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  *****************************************************************************/
15 #define _HAL_API_BB_C_
16 #include "hal_headers.h"
17 #include "phy/bb/halbb_export_fun.h"
18 
19 //kevin-cmd
20 #include "phy/bb/halbb_hw_cfg_ex.h"
21 
22 #ifdef USE_TRUE_PHY
rtw_hal_bb_band_to_phy_idx(struct rtw_hal_com_t * hal_com,u8 band_idx)23 enum phl_phy_idx rtw_hal_bb_band_to_phy_idx(struct rtw_hal_com_t *hal_com, u8 band_idx)
24 {
25 	enum phl_phy_idx p_idx = HW_PHY_0;
26 
27 	if (band_idx == 1)
28 		p_idx = HW_PHY_1;
29 
30 	return p_idx;
31 }
32 
rtw_hal_bb_dfs_en(struct hal_info_t * hal_info,bool en)33 void rtw_hal_bb_dfs_en(struct hal_info_t *hal_info, bool en)
34 {
35 	halbb_dfs_en(hal_info->bb, en);
36 }
37 
rtw_hal_bb_tssi_cont_en(struct hal_info_t * hal_info,bool en,enum rf_path path)38 void rtw_hal_bb_tssi_cont_en(struct hal_info_t *hal_info, bool en, enum rf_path path)
39 {
40 	halbb_tssi_cont_en(hal_info->bb, en, path);
41 }
42 
rtw_hal_bb_adc_en(struct hal_info_t * hal_info,bool en)43 void rtw_hal_bb_adc_en(struct hal_info_t *hal_info, bool en)
44 {
45 	halbb_adc_en(hal_info->bb, en);
46 }
47 
rtw_hal_bb_reset_en(struct hal_info_t * hal_info,bool en,enum phl_phy_idx phy_idx)48 void rtw_hal_bb_reset_en(struct hal_info_t *hal_info, bool en, enum phl_phy_idx phy_idx)
49 {
50 	halbb_bb_reset_en(hal_info->bb, en, phy_idx);
51 }
52 
rtw_hal_bb_proc_cmd(struct hal_info_t * hal_info,struct rtw_proc_cmd * incmd,char * output,u32 out_len)53 bool rtw_hal_bb_proc_cmd(struct hal_info_t *hal_info, struct rtw_proc_cmd *incmd,
54 						char *output, u32 out_len)
55 {
56 	if(incmd->in_type == RTW_ARG_TYPE_BUF)
57 		halbb_cmd(hal_info->bb, incmd->in.buf, output, out_len);
58 	else if(incmd->in_type == RTW_ARG_TYPE_ARRAY){
59 		halbb_cmd_parser(hal_info->bb, incmd->in.vector,
60 					incmd->in_cnt_len, output, out_len);
61 	}
62 
63 	return true;
64 }
65 
rtw_hal_bb_watchdog(struct hal_info_t * hal_info,u8 is_lps)66 enum rtw_hal_status rtw_hal_bb_watchdog(struct hal_info_t *hal_info, u8 is_lps)
67 {
68 	enum bb_watchdog_mode_t mode = BB_WATCHDOG_NORMAL;
69 
70 	if (is_lps)
71 		mode = BB_WATCHDOG_LOW_IO;
72 
73 	halbb_watchdog(hal_info->bb, mode, HW_PHY_0);
74 
75 	return RTW_HAL_STATUS_SUCCESS;
76 }
77 
rtw_hal_bb_simple_watchdog(struct hal_info_t * hal_info,u8 io_en)78 enum rtw_hal_status rtw_hal_bb_simple_watchdog(struct hal_info_t *hal_info, u8 io_en)
79 {
80 	enum bb_watchdog_mode_t mode = BB_WATCHDOG_NON_IO;
81 
82 	if (io_en)
83 		mode = BB_WATCHDOG_LOW_IO;
84 
85 	halbb_watchdog(hal_info->bb, mode, HW_PHY_0);
86 
87 	return RTW_HAL_STATUS_SUCCESS;
88 }
89 
rtw_hal_bb_reset(struct hal_info_t * hal_info)90 void rtw_hal_bb_reset(struct hal_info_t *hal_info)
91 {
92 	halbb_watchdog_reset(hal_info->bb);
93 }
94 
rtw_hal_bb_fw_edcca(struct hal_info_t * hal_info)95 void rtw_hal_bb_fw_edcca(struct hal_info_t *hal_info)
96 {
97 	PHL_INFO("[Cert], %s() ==> !! \n", __func__);
98 
99 	halbb_fw_edcca(hal_info->bb);
100 }
101 
rtw_hal_bb_dm_init(struct hal_info_t * hal_info)102 void rtw_hal_bb_dm_init(struct hal_info_t *hal_info)
103 {
104 	halbb_dm_init(hal_info->bb, HW_PHY_0);
105 }
106 
rtw_hal_bb_dm_deinit(struct rtw_phl_com_t * phl_com,struct hal_info_t * hal_info)107 void rtw_hal_bb_dm_deinit(struct rtw_phl_com_t *phl_com, struct hal_info_t *hal_info)
108 {
109 	halbb_dm_deinit(phl_com, hal_info->bb);
110 }
111 
rtw_hal_bb_ctrl_rx_cca(struct rtw_hal_com_t * hal_com,bool cca_en,enum phl_phy_idx phy_idx)112 enum rtw_hal_status rtw_hal_bb_ctrl_rx_cca(struct rtw_hal_com_t *hal_com,
113 	bool cca_en, enum phl_phy_idx phy_idx)
114 {
115 	struct hal_info_t *hal = (struct hal_info_t *)hal_com->hal_priv;
116 
117 	halbb_ctrl_rx_cca(hal->bb, cca_en, phy_idx);
118 
119 	return RTW_HAL_STATUS_SUCCESS;
120 }
121 
rtw_hal_bb_ctrl_dbcc(struct hal_info_t * hal_info,bool dbcc_en)122 enum rtw_hal_status rtw_hal_bb_ctrl_dbcc(struct hal_info_t *hal_info, bool dbcc_en)
123 {
124 	halbb_ctrl_dbcc(hal_info->bb, dbcc_en);
125 
126 	return RTW_HAL_STATUS_SUCCESS;
127 }
128 
rtw_hal_bb_cfg_dbcc(struct hal_info_t * hal_info,bool dbcc_en)129 enum rtw_hal_status rtw_hal_bb_cfg_dbcc(struct hal_info_t *hal_info, bool dbcc_en)
130 {
131 	halbb_cfg_dbcc(hal_info->bb, dbcc_en);
132 
133 	return RTW_HAL_STATUS_SUCCESS;
134 }
135 
rtw_hal_bb_init(struct rtw_phl_com_t * phl_com,struct hal_info_t * hal_info)136 u32 rtw_hal_bb_init(struct rtw_phl_com_t *phl_com, struct hal_info_t *hal_info)
137 {
138 	struct rtw_hal_com_t *hal_com = hal_info->hal_com;
139 	enum rtw_hal_status hal_status;
140 
141 	hal_status = halbb_buffer_init(phl_com, hal_com, &(hal_info->bb));
142 
143 	if ((hal_status != RTW_HAL_STATUS_SUCCESS) || (hal_info->bb == NULL))
144 		PHL_ERR("[PHL] rtw_hal_bb_init failed status(%d), hal_info->bb(%p)\n",
145 			hal_status, hal_info->bb);
146 
147 	return hal_status;
148 }
149 
rtw_hal_bb_deinit(struct rtw_phl_com_t * phl_com,struct hal_info_t * hal_info)150 void rtw_hal_bb_deinit(struct rtw_phl_com_t *phl_com,
151 						struct hal_info_t *hal_info)
152 {
153 	struct rtw_hal_com_t *hal_com = hal_info->hal_com;
154 
155 	halbb_buffer_deinit(phl_com, hal_com, hal_info->bb);
156 }
157 
rtw_hal_init_bb_reg(struct hal_info_t * hal_info)158 void rtw_hal_init_bb_reg(struct hal_info_t *hal_info)
159 {
160 	halbb_init_reg(hal_info->bb);
161 	halbb_reset_bb(hal_info->bb);
162 }
163 
rtw_hal_read_rf_reg(struct rtw_hal_com_t * hal_com,enum rf_path path,u32 addr,u32 mask)164 u32 rtw_hal_read_rf_reg(struct rtw_hal_com_t *hal_com,
165 			enum rf_path path, u32 addr, u32 mask)
166 {
167 	struct hal_info_t *hal = (struct hal_info_t *)hal_com->hal_priv;
168 
169 	return halbb_read_rf_reg(hal->bb, path, addr, mask);
170 }
171 
rtw_hal_write_rf_reg(struct rtw_hal_com_t * hal_com,enum rf_path path,u32 addr,u32 mask,u32 data)172 bool rtw_hal_write_rf_reg(struct rtw_hal_com_t *hal_com,
173 			  enum rf_path path, u32 addr, u32 mask, u32 data)
174 {
175 	struct hal_info_t *hal = (struct hal_info_t *)hal_com->hal_priv;
176 
177 	return halbb_write_rf_reg(hal->bb, path, addr, mask, data);
178 }
179 
rtw_hal_read_bb_reg(struct rtw_hal_com_t * hal_com,u32 addr,u32 mask)180 u32 rtw_hal_read_bb_reg(struct rtw_hal_com_t *hal_com, u32 addr, u32 mask)
181 {
182 	struct hal_info_t *hal = (struct hal_info_t *)hal_com->hal_priv;
183 
184 	return halbb_get_reg(hal->bb, addr, mask);
185 }
186 
rtw_hal_write_bb_reg(struct rtw_hal_com_t * hal_com,u32 addr,u32 mask,u32 data)187 bool rtw_hal_write_bb_reg(struct rtw_hal_com_t *hal_com,
188 			  u32 addr, u32 mask, u32 data)
189 {
190 	struct hal_info_t *hal = (struct hal_info_t *)hal_com->hal_priv;
191 
192 	halbb_set_reg(hal->bb, addr, mask, data);
193 	return true;
194 }
195 
rtw_hal_bb_read_cr(struct rtw_hal_com_t * hal_com,u32 addr,u32 mask)196 u32 rtw_hal_bb_read_cr(struct rtw_hal_com_t *hal_com, u32 addr, u32 mask)
197 {
198 	struct hal_info_t *hal = (struct hal_info_t *)hal_com->hal_priv;
199 
200 	return halbb_rf_get_bb_reg(hal->bb, addr, mask);
201 }
202 
rtw_hal_bb_write_cr(struct rtw_hal_com_t * hal_com,u32 addr,u32 mask,u32 data)203 bool rtw_hal_bb_write_cr(struct rtw_hal_com_t *hal_com,
204 			     u32 addr, u32 mask, u32 data)
205 {
206 	struct hal_info_t *hal = (struct hal_info_t *)hal_com->hal_priv;
207 
208 	return halbb_rf_set_bb_reg(hal->bb, addr, mask, data);
209 }
210 
211 enum rtw_hal_status
rtw_hal_bb_stainfo_init(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)212 rtw_hal_bb_stainfo_init(struct hal_info_t *hal_info,
213 				struct rtw_phl_stainfo_t *sta)
214 {
215 	enum rtw_hal_status hal_status = RTW_HAL_STATUS_FAILURE;
216 
217 	if (halbb_sta_info_init(hal_info->bb, sta))
218 		hal_status = RTW_HAL_STATUS_SUCCESS;
219 	else
220 		PHL_ERR("[HAL] halbb_stainfo_init failed status(%d)\n",
221 			hal_status);
222 
223 	return hal_status;
224 }
225 
226 enum rtw_hal_status
rtw_hal_bb_stainfo_deinit(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)227 rtw_hal_bb_stainfo_deinit(struct hal_info_t *hal_info,
228 				struct rtw_phl_stainfo_t *sta)
229 {
230 	enum rtw_hal_status hal_status = RTW_HAL_STATUS_FAILURE;
231 
232 	if (halbb_sta_info_deinit(hal_info->bb, sta))
233 		hal_status = RTW_HAL_STATUS_SUCCESS;
234 	else
235 		PHL_ERR("[HAL] rtw_hal_bb_stainfo_deinit failed status(%d)\n",
236 			hal_status);
237 
238 	return hal_status;
239 }
240 
241 enum rtw_hal_status
rtw_hal_bb_stainfo_add(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)242 rtw_hal_bb_stainfo_add(struct hal_info_t *hal_info,
243 				struct rtw_phl_stainfo_t *sta)
244 {
245 	enum rtw_hal_status hal_status = RTW_HAL_STATUS_FAILURE;
246 
247 	if (halbb_sta_info_add_entry(hal_info->bb, sta))
248 		hal_status = RTW_HAL_STATUS_SUCCESS;
249 	else
250 		PHL_ERR("[HAL] halbb_stainfo_init failed status(%d)\n",
251 			hal_status);
252 
253 	return hal_status;
254 }
255 
256 enum rtw_hal_status
rtw_hal_bb_stainfo_delete(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)257 rtw_hal_bb_stainfo_delete(struct hal_info_t *hal_info,
258 				struct rtw_phl_stainfo_t *sta)
259 {
260 	enum rtw_hal_status hal_status = RTW_HAL_STATUS_FAILURE;
261 
262 	if (halbb_sta_info_delete_entry(hal_info->bb, sta))
263 		hal_status = RTW_HAL_STATUS_SUCCESS;
264 	else
265 		PHL_ERR("[HAL] rtw_hal_bb_stainfo_deinit failed status(%d)\n",
266 			hal_status);
267 
268 	return hal_status;
269 }
270 
rtw_hal_bb_media_status_update(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta,bool is_connected)271 void rtw_hal_bb_media_status_update(struct hal_info_t *hal_info,
272 			struct rtw_phl_stainfo_t *sta, bool is_connected)
273 {
274 	halbb_media_status_update(hal_info->bb, sta, is_connected);
275 }
276 
277 enum rtw_hal_status
rtw_hal_bb_upt_ramask(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)278 rtw_hal_bb_upt_ramask(struct hal_info_t *hal_info,
279 				struct rtw_phl_stainfo_t *sta)
280 {
281 	if (!rtw_halbb_dft_mask(hal_info->bb, sta)) {
282 		PHL_ERR("rtw_halbb_set_dft_mask failed\n");
283 		return RTW_HAL_STATUS_FAILURE;
284 	}
285 
286 	PHL_INFO("sta's cur_ra_mask : 0x%016llx\n", sta->hal_sta->ra_info.cur_ra_mask);
287 
288 	if (sta->hal_sta->ra_info.ra_mask) {
289 		sta->hal_sta->ra_info.cur_ra_mask &= sta->hal_sta->ra_info.ra_mask;
290 		PHL_INFO("ra_mask : 0x%016llx, cur_ra_mask : 0x%016llx\n",
291 			sta->hal_sta->ra_info.ra_mask, sta->hal_sta->ra_info.cur_ra_mask);
292 	}
293 	return RTW_HAL_STATUS_SUCCESS;
294 }
295 
296 enum rtw_hal_status
rtw_hal_bb_ra_register(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)297 rtw_hal_bb_ra_register(struct hal_info_t *hal_info,
298 				struct rtw_phl_stainfo_t *sta)
299 {
300 	if (!rtw_halbb_raregistered(hal_info->bb, sta))
301 		return RTW_HAL_STATUS_FAILURE;
302 
303 	sta->hal_sta->ra_info.ra_registered = true;
304 	return RTW_HAL_STATUS_SUCCESS;
305 }
306 
307 enum rtw_hal_status
rtw_hal_bb_ra_deregister(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)308 rtw_hal_bb_ra_deregister(struct hal_info_t *hal_info,
309 				struct rtw_phl_stainfo_t *sta)
310 {
311 	if (!rtw_halbb_ra_deregistered(hal_info->bb, sta))
312 		PHL_ERR("rtw_halbb_ra_deregistered failed\n");
313 
314 	sta->hal_sta->ra_info.ra_registered = false;
315 	return RTW_HAL_STATUS_SUCCESS;
316 }
317 
318 enum rtw_hal_status
rtw_hal_bb_ra_update(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)319 rtw_hal_bb_ra_update(struct hal_info_t *hal_info,
320 				struct rtw_phl_stainfo_t *sta)
321 {
322 	if (!sta->hal_sta->ra_info.ra_registered) {
323 		PHL_WARN("%s mac-id:%d not register RA\n", __func__, sta->macid);
324 		return RTW_HAL_STATUS_SUCCESS;
325 	}
326 
327 	if (sta->hal_sta->ra_info.ra_mask) {
328 		sta->hal_sta->ra_info.cur_ra_mask &= sta->hal_sta->ra_info.ra_mask;
329 		PHL_INFO("ra_mask : 0x%016llx, cur_ra_mask : 0x%016llx\n",
330 			sta->hal_sta->ra_info.ra_mask, sta->hal_sta->ra_info.cur_ra_mask);
331 	}
332 
333 	if (rtw_halbb_raupdate(hal_info->bb, sta) == true)
334 		return RTW_HAL_STATUS_SUCCESS;
335 	else
336 		return RTW_HAL_STATUS_FAILURE;
337 }
338 
339 #ifdef CONFIG_BTCOEX
rtw_hal_btc_cfg_tx_1ss(struct rtw_hal_com_t * hal_com,struct rtw_phl_com_t * phl_com,u8 rid,bool enable)340 enum rtw_hal_status rtw_hal_btc_cfg_tx_1ss(struct rtw_hal_com_t *hal_com,
341 			struct rtw_phl_com_t *phl_com, u8 rid, bool enable)
342 {
343 	enum rtw_hal_status hstats = RTW_HAL_STATUS_FAILURE;
344 	struct hal_info_t *hal_i = (struct hal_info_t *)hal_com->hal_priv;
345 	void *drv = halcom_to_drvpriv(hal_com);
346 	struct rtw_wifi_role_t *wrole = rtw_phl_get_wrole_by_ridx(phl_com, rid);
347 	struct phl_queue *sta_queue = NULL;
348 	struct rtw_phl_stainfo_t *sta = NULL;
349 	u8 ra_nss_limit = enable ? 1 : 0;
350 
351 	PHL_PRINT("%s: rid(%d), enable(%d)\n", __FUNCTION__, rid, enable);
352 	if (wrole == NULL) {
353 		PHL_ERR("%s: Get role failed\n", __FUNCTION__);
354 		goto exit;
355 	}
356 	sta_queue = &wrole->assoc_sta_queue;
357 	_os_spinlock(drv, &sta_queue->lock, _bh, NULL);
358 	phl_list_for_loop(sta, struct rtw_phl_stainfo_t,
359 				&sta_queue->queue, list) {
360 		if (!sta)
361 			continue;
362 		sta->hal_sta->ra_info.ra_nss_limit = ra_nss_limit;
363 		hstats = rtw_hal_bb_ra_update(hal_i, sta);
364 		if (RTW_HAL_STATUS_SUCCESS != hstats) {
365 			PHL_ERR("%s: macid(%d), Fail to cfg ra_nss_limit(%d)\n",
366 				__FUNCTION__, sta->macid, ra_nss_limit);
367 			break;
368 		} else {
369 			PHL_PRINT("%s: macid(%d), succee to cfg ra_nss_limit(%d)\n",
370 				__FUNCTION__, sta->macid, ra_nss_limit);
371 		}
372 	}
373 	_os_spinunlock(drv, &sta_queue->lock, _bh, NULL);
374 exit:
375 	return hstats;
376 }
377 #endif /* CONFIG_BTCOEX */
378 
379 enum rtw_hal_status
rtw_hal_bb_query_txsts_rpt(struct hal_info_t * hal_info,u16 macid0,u16 macid1)380 rtw_hal_bb_query_txsts_rpt(struct hal_info_t *hal_info,
381 				u16 macid0, u16 macid1)
382 {
383 	if (!rtw_halbb_query_txsts(hal_info->bb, macid0, macid1))
384 		return RTW_HAL_STATUS_FAILURE;
385 
386 	return RTW_HAL_STATUS_SUCCESS;
387 }
388 
389 #define INVALID_ARFR_IDX 0xFF
390 #define rtw_halbb_get_arfr_idx(_bb, _sta)	INVALID_ARFR_IDX
rtw_hal_bb_get_arfr_idx(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)391 u8 rtw_hal_bb_get_arfr_idx(struct hal_info_t *hal_info,
392 				struct rtw_phl_stainfo_t *sta)
393 {
394 	return rtw_halbb_get_arfr_idx(hal_info->bb, sta);
395 }
396 
397 enum rtw_hal_status
rtw_hal_bb_get_efuse_info(struct rtw_hal_com_t * hal_com,u8 * efuse_map,enum rtw_efuse_info info_type,void * value,u8 size,u8 map_valid)398 rtw_hal_bb_get_efuse_info(struct rtw_hal_com_t *hal_com,
399 	u8 *efuse_map, enum rtw_efuse_info info_type, void *value,
400 	u8 size, u8 map_valid)
401 {
402 	PHL_INFO("%s\n", __FUNCTION__);
403 	return RTW_HAL_STATUS_SUCCESS;
404 }
405 
hal_get_primary_channel_idx(u8 pri_ch,u8 central_ch,enum channel_width bw,enum chan_offset bw_offset)406 u8 hal_get_primary_channel_idx(u8 pri_ch,
407 				u8 central_ch, enum channel_width bw,
408 				enum chan_offset bw_offset)
409 {
410 	u8 idx = 255;
411 
412 	if(bw == CHANNEL_WIDTH_80) {
413 		if(bw_offset == CHAN_OFFSET_NO_EXT ||
414 		   bw_offset == CHAN_OFFSET_NO_DEF) {
415 		   PHL_ERR("%s invalid bw offset\n",__FUNCTION__);
416 		   return idx;
417 		}
418 		if (central_ch > pri_ch)
419 			idx = (bw_offset == CHAN_OFFSET_UPPER) ? (4) : (2);
420 		else
421 			idx = (bw_offset == CHAN_OFFSET_UPPER) ? (1) : (3);
422 	}
423 	else if(bw == CHANNEL_WIDTH_40) {
424 		if(bw_offset == CHAN_OFFSET_NO_EXT ||
425 		   bw_offset == CHAN_OFFSET_NO_DEF) {
426 		   PHL_ERR("%s invalid bw offset\n",__FUNCTION__);
427 		   return idx;
428 		}
429 		idx = (bw_offset == CHAN_OFFSET_UPPER) ? (2) : (1);
430 	}
431 	else {
432 		idx = 0;
433 	}
434 	PHL_INFO("Using SC index %u for P%u C%u B%u O%u\n",
435 		 idx, pri_ch, central_ch, bw, bw_offset);
436 	return idx;
437 }
438 
rtw_hal_bb_set_ch_bw(struct hal_info_t * hal_info,enum phl_phy_idx phy_idx,u8 pri_ch,u8 central_ch_seg0,u8 central_ch_seg1,enum band_type band,enum channel_width bw)439 enum rtw_hal_status rtw_hal_bb_set_ch_bw(struct hal_info_t *hal_info,
440 					enum phl_phy_idx phy_idx,
441 					u8 pri_ch,
442 					u8 central_ch_seg0,
443 					u8 central_ch_seg1,
444 					enum band_type band,
445 					enum channel_width bw)
446 {
447 	if(halbb_ctrl_bw_ch(hal_info->bb, pri_ch, central_ch_seg0,
448 				central_ch_seg1, band, bw, phy_idx) == false)
449 		return RTW_HAL_STATUS_FAILURE;
450 	return RTW_HAL_STATUS_SUCCESS;
451 }
452 
453 #ifdef CONFIG_PHL_CUSTOM_FEATURE
454 /**
455  * Early Weak Interference Rejection (EWIR)
456  * rtw_hal_bb_set_pop_en: configure bb feature about packet on packet.
457  * @hal_info: see struct hal_info_t
458  * @en: enable: true, disable: false
459  * @phy_idx: corresponding to the hw_band in wifi_role.
460  * returns enum rtw_hal_status
461  */
rtw_hal_bb_set_pop_en(struct hal_info_t * hal_info,bool en,enum phl_phy_idx phy_idx)462 enum rtw_hal_status rtw_hal_bb_set_pop_en(struct hal_info_t *hal_info,
463                                           bool en,
464                                           enum phl_phy_idx phy_idx)
465 {
466 	PHL_INFO(" %s, pop_enable(%d)\n", __FUNCTION__, en);
467 	halbb_pop_en(hal_info->bb, en, phy_idx);
468 	return RTW_HAL_STATUS_SUCCESS;
469 }
470 
471 /**
472  * Early Weak Interference Rejection (EWIR)
473  * rtw_hal_bb_query_pop_en: query the status of packet on packet operation.
474  * @hal_info: see struct hal_info_t
475  * @phy_idx: corresponding to the hw_band in wifi_role.
476  * returns true: running; false: not running.
477  */
rtw_hal_bb_query_pop_en(struct hal_info_t * hal_info,enum phl_phy_idx phy_idx)478 bool rtw_hal_bb_query_pop_en(struct hal_info_t *hal_info,
479                              enum phl_phy_idx phy_idx)
480 {
481 	return halbb_querry_pop_en(hal_info->bb, phy_idx);
482 }
483 
484 /**
485  * rtw_hal_bb_set_pkt_detect_thold: configure packet threshold(dbm) detection
486  * It would pause DIG while pd threshold enabling(value > 0)
487  * @hal_info: see struct hal_info_t
488  * @bound: pd threshold value
489  * returns enum rtw_hal_status
490  */
rtw_hal_bb_set_pkt_detect_thold(struct hal_info_t * hal_info,u32 bound)491 enum rtw_hal_status rtw_hal_bb_set_pkt_detect_thold(struct hal_info_t *hal_info,
492                                                     u32 bound)
493 {
494 	enum rtw_hal_status hal_status = RTW_HAL_STATUS_FAILURE;
495 	enum halbb_pause_type pause_type = HALBB_PAUSE;
496 	u8 pause_result = 0;
497 	u32 val[5] = {0};
498 	val[0] = bound;
499 	val[1] = 0;
500 	if (bound == 0) {
501 		pause_type = HALBB_RESUME;
502 	} else if ((bound > 102) || (bound < 40)) {
503 		PHL_INFO(" %s, invalid boundary!\n", __FUNCTION__);
504 		return hal_status;
505 	}
506 	pause_result = halbb_pause_func(hal_info->bb,
507 					F_DIG, pause_type,
508 					HALBB_PAUSE_LV_2,
509 					2,
510 					val);
511 	if (pause_result == PAUSE_SUCCESS)
512 		hal_status = RTW_HAL_STATUS_SUCCESS;
513 	return hal_status;
514 }
515 
516 /**
517  * rtw_hal_bb_query_pkt_detect_thold: query packet threshold(dbm) value.
518  * @hal_info: see struct hal_info_t
519  * @get_en_info: Caller can confirm the feature running or not with true value.
520  * 1. true: for query pd threshold detection enabling or not.
521  * 2. false:for query pd threshold value.
522  * @phy_idx: corresponding to the hw_band in wifi_role.
523  * returns pd threshold value
524  */
rtw_hal_bb_query_pkt_detect_thold(struct hal_info_t * hal_info,bool get_en_info,enum phl_phy_idx phy_idx)525 u8 rtw_hal_bb_query_pkt_detect_thold(struct hal_info_t *hal_info,
526                                      bool get_en_info,
527                                      enum phl_phy_idx phy_idx)
528 {
529 	return halbb_querry_pd_lower_bound(hal_info->bb, get_en_info, phy_idx);
530 }
531 #endif
532 
533 #ifdef CONFIG_PHL_DFS
rtw_hal_in_radar_domain(void * hal,u8 ch,enum channel_width bw)534 bool rtw_hal_in_radar_domain(void *hal,
535 			u8 ch, enum channel_width bw)
536 {
537 	struct hal_info_t *hal_info = (struct hal_info_t *)hal;
538 
539 	return halbb_is_dfs_band(hal_info->bb, ch, bw);
540 }
541 
542 enum rtw_hal_status
rtw_hal_bb_dfs_rpt_cfg(struct hal_info_t * hal_info,bool dfs_en)543 rtw_hal_bb_dfs_rpt_cfg(struct hal_info_t *hal_info, bool dfs_en)
544 {
545 	if (dfs_en)
546 		halbb_radar_detect_enable(hal_info->bb);
547 	else
548 		halbb_radar_detect_disable(hal_info->bb);
549 	return RTW_HAL_STATUS_SUCCESS;
550 }
551 
552 bool
rtw_hal_bb_radar_detect(struct hal_info_t * hal_info,struct hal_dfs_rpt * hal_dfs)553 rtw_hal_bb_radar_detect(struct hal_info_t *hal_info,
554 				struct hal_dfs_rpt *hal_dfs)
555 {
556 
557 	return halbb_radar_detect(hal_info->bb, hal_dfs);
558 }
559 #endif /*CONFIG_PHL_DFS*/
560 
561 #ifdef CONFIG_PHL_CHANNEL_INFO
562 enum rtw_hal_status
rtw_hal_bb_ch_info_parsing(struct hal_info_t * hal_info,u8 * addr,u32 len,u8 * rpt_buf,struct ch_rpt_hdr_info * ch_hdr_rpt,struct phy_info_rpt * phy_rpt,struct ch_info_drv_rpt * drv)563 rtw_hal_bb_ch_info_parsing(struct hal_info_t *hal_info,
564 	u8 *addr, u32 len, u8 *rpt_buf, struct ch_rpt_hdr_info *ch_hdr_rpt,
565 	struct phy_info_rpt *phy_rpt, struct ch_info_drv_rpt *drv)
566 {
567 	enum bb_ch_info_t chinfo_status = BB_CH_INFO_SUCCESS;
568 
569 	chinfo_status = halbb_ch_info_parsing(hal_info->bb, addr, len, rpt_buf
570 		, (void*)ch_hdr_rpt, (void *)phy_rpt, (void *)drv);
571 
572 	if (chinfo_status == BB_CH_INFO_SUCCESS)
573 		return RTW_HAL_STATUS_SUCCESS;
574 	else if (chinfo_status == BB_CH_INFO_LAST_SEG)
575 		return RTW_HAL_STATUS_BB_CH_INFO_LAST_SEG;
576 	else
577 		return RTW_HAL_STATUS_FAILURE;
578 }
579 
580 void
rtw_hal_bb_chan_info_cfg(struct hal_info_t * hal_info,struct chinfo_bbcr_cfg * bbcr)581 rtw_hal_bb_chan_info_cfg(struct hal_info_t *hal_info, struct chinfo_bbcr_cfg *bbcr)
582 {
583 	halbb_cfg_ch_info_cr(hal_info->bb, (void*)bbcr);
584 }
585 #endif /* CONFIG_PHL_CHANNEL_INFO */
586 
587 enum rtw_hal_status
rtw_hal_bb_ctrl_btg(struct rtw_hal_com_t * hal_com,bool btg)588 rtw_hal_bb_ctrl_btg(struct rtw_hal_com_t *hal_com, bool btg)
589 {
590 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
591 	enum rtw_hal_status status = RTW_HAL_STATUS_FAILURE;
592 
593 	PHL_INFO("[HAL] call rtw_hal_bb_ctrl_btg !!!\n");
594 
595 	halbb_ctrl_btg(hal_info->bb, btg);
596 
597 	return status;
598 }
599 
600 enum rtw_hal_status
rtw_hal_bb_ctrl_btc_preagc(struct rtw_hal_com_t * hal_com,bool bt_en)601 rtw_hal_bb_ctrl_btc_preagc(struct rtw_hal_com_t *hal_com, bool bt_en)
602 {
603 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
604 	enum rtw_hal_status status = RTW_HAL_STATUS_FAILURE;
605 
606 	PHL_INFO("[HAL] call rtw_hal_bb_ctrl_btc_preagc !!!\n");
607 
608 	halbb_ctrl_btc_preagc(hal_info->bb, bt_en);
609 
610 	return status;
611 }
612 
613 enum rtw_hal_status
rtw_hal_bb_cfg_rx_path(struct rtw_hal_com_t * hal_com,u8 rx_path)614 rtw_hal_bb_cfg_rx_path(struct rtw_hal_com_t *hal_com, u8 rx_path)
615 {
616 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
617 	enum rtw_hal_status status = RTW_HAL_STATUS_FAILURE;
618 
619 	PHL_INFO("[HAL] call halbb_ctrl_rx_path !!!\n");
620 
621 	if(halbb_ctrl_rx_path(hal_info->bb, rx_path))
622 		status = RTW_HAL_STATUS_SUCCESS;
623 	else
624 		status = RTW_HAL_STATUS_FAILURE;
625 
626 	return status;
627 
628 }
629 
630 enum rtw_hal_status
rtw_hal_bb_cfg_tx_path(struct rtw_hal_com_t * hal_com,u8 tx_path)631 rtw_hal_bb_cfg_tx_path(struct rtw_hal_com_t *hal_com, u8 tx_path)
632 {
633 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
634 	enum rtw_hal_status status = RTW_HAL_STATUS_FAILURE;
635 
636 	PHL_INFO("[HAL] call halbb_ctrl_tx_path !!!\n");
637 
638 	if(halbb_ctrl_tx_path(hal_info->bb, tx_path))
639 		status = RTW_HAL_STATUS_SUCCESS;
640 	else
641 		status = RTW_HAL_STATUS_FAILURE;
642 	return status;
643 }
644 
rtw_hal_bb_get_rx_ok(struct hal_info_t * hal_info,u8 cur_phy_idx,u32 * rx_ok)645 enum rtw_hal_status  rtw_hal_bb_get_rx_ok(struct hal_info_t *hal_info, u8 cur_phy_idx, u32 *rx_ok)
646 {
647 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
648 
649 	PHL_INFO("[MP HAL BB API]%s\n", __FUNCTION__);
650 
651 	*rx_ok = halbb_mp_get_rx_crc_ok(hal_info->bb, cur_phy_idx);
652 
653 	return ret;
654 }
655 
rtw_hal_bb_get_rx_crc(struct hal_info_t * hal_info,u8 cur_phy_idx,u32 * rx_crc_err)656 enum rtw_hal_status  rtw_hal_bb_get_rx_crc(struct hal_info_t *hal_info, u8 cur_phy_idx, u32 *rx_crc_err)
657 {
658 	enum rtw_hal_status ret = RTW_HAL_STATUS_SUCCESS;
659 
660 	PHL_INFO("[MP HAL BB API]%s\n", __FUNCTION__);
661 
662 	*rx_crc_err = halbb_mp_get_rx_crc_err(hal_info->bb, cur_phy_idx);
663 
664 	return ret;
665 }
666 
rtw_hal_bb_set_reset_cnt(void * hal)667 enum rtw_hal_status  rtw_hal_bb_set_reset_cnt(void *hal)
668 {
669 	struct hal_info_t *hal_info = (struct hal_info_t *)hal;
670 
671 	PHL_INFO("[HAL] call halbb_mp_seset_cnt !!!\n");
672 	halbb_mp_reset_cnt(hal_info->bb);
673 	return RTW_HAL_STATUS_SUCCESS;
674 }
675 
676 enum rtw_hal_status
rtw_hal_bb_set_power(struct rtw_hal_com_t * hal_com,s16 power_dbm,enum phl_phy_idx phy_idx)677 rtw_hal_bb_set_power(struct rtw_hal_com_t *hal_com, s16 power_dbm,
678 					 enum phl_phy_idx phy_idx)
679 {
680 	enum rtw_hal_status hal_status = RTW_HAL_STATUS_FAILURE;
681 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
682 
683 	PHL_INFO("[MP HAL API] %s: call halbb_set_txpwr_dbm \n", __FUNCTION__);
684 	PHL_INFO("[MP HAL API] %s: power_dbm = %d\n", __FUNCTION__, power_dbm);
685 
686 	if(halbb_set_txpwr_dbm(hal_info->bb, power_dbm, phy_idx))
687 		hal_status = RTW_HAL_STATUS_SUCCESS;
688 	else
689 		hal_status = RTW_HAL_STATUS_FAILURE;
690 
691 	return hal_status;
692 }
693 
694 enum rtw_hal_status
rtw_hal_bb_get_power(struct rtw_hal_com_t * hal_com,s16 * power_dbm,enum phl_phy_idx phy_idx)695 rtw_hal_bb_get_power(struct rtw_hal_com_t *hal_com, s16 *power_dbm,
696 					 enum phl_phy_idx phy_idx)
697 {
698 	int ret = RTW_HAL_STATUS_SUCCESS;
699 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
700 
701 	PHL_INFO("[MP HAL API] %s: call halbb_get_txpwr_dbm \n", __FUNCTION__);
702 	*power_dbm = halbb_get_txpwr_dbm(hal_info->bb, phy_idx);
703 	PHL_INFO("[MP HAL API] %s: power_dbm = %d\n", __FUNCTION__, *power_dbm);
704 	return ret;
705 }
706 
707 enum rtw_hal_status
rtw_hal_bb_set_pwr_index(void * hal,u16 pwr_idx,enum rf_path tx_path,bool is_cck)708 rtw_hal_bb_set_pwr_index(void *hal, u16 pwr_idx, enum rf_path tx_path, bool is_cck)
709 {
710 	enum rtw_hal_status hal_status = RTW_HAL_STATUS_FAILURE;
711 	struct hal_info_t *hal_info = (struct hal_info_t *)hal;
712 
713 	PHL_INFO("[MP HAL API] %s: call halbb_set_txpwr_idx\n", __FUNCTION__);
714 
715 	if (is_cck) {
716 		if(halbb_set_cck_txpwr_idx(hal_info->bb, pwr_idx, tx_path))
717 			hal_status = RTW_HAL_STATUS_SUCCESS;
718 		else
719 			hal_status = RTW_HAL_STATUS_FAILURE;
720 
721 	} else {
722 		if(halbb_set_ofdm_txpwr_idx(hal_info->bb, pwr_idx, tx_path))
723 			hal_status = RTW_HAL_STATUS_SUCCESS;
724 		else
725 			hal_status = RTW_HAL_STATUS_FAILURE;
726 	}
727 	return hal_status;
728 }
729 
rtw_hal_bb_get_pwr_index(void * hal,u16 * pwr_idx,enum rf_path tx_path,bool is_cck)730 enum rtw_hal_status rtw_hal_bb_get_pwr_index(void *hal, u16 *pwr_idx, enum rf_path tx_path, bool is_cck){
731 	int ret = RTW_HAL_STATUS_SUCCESS;
732 	struct hal_info_t *hal_info = (struct hal_info_t *)hal;
733 
734 	PHL_INFO("[MP HAL API] %s: call halbb_get_txpwr_idx\n", __FUNCTION__);
735 
736 	if (is_cck) {
737 		PHL_INFO("[MP HAL API] call halbb_get_cck_txpwr_idx\n");
738 		*pwr_idx = halbb_get_cck_txpwr_idx(hal_info->bb, tx_path);
739 
740 	} else {
741 		PHL_INFO("[MP HAL API] call halbb_get_ofdm_txpwr_idx\n");
742 		*pwr_idx = halbb_get_ofdm_txpwr_idx(hal_info->bb, tx_path);
743 	}
744 
745 
746 	return ret;
747 }
748 
rtw_hal_bb_set_plcp_tx(struct rtw_hal_com_t * hal_com,struct mp_plcp_param_t * plcp_tx_struct,struct mp_usr_plcp_gen_in * plcp_usr_info,enum phl_phy_idx plcp_phy_idx,u8 * plcp_sts)749 enum rtw_hal_status rtw_hal_bb_set_plcp_tx(struct rtw_hal_com_t *hal_com,
750 						struct mp_plcp_param_t *plcp_tx_struct,
751 						struct mp_usr_plcp_gen_in *plcp_usr_info,
752 						enum phl_phy_idx plcp_phy_idx,
753 						u8 *plcp_sts)
754 {
755 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
756 
757 	PHL_INFO("%s\n", __FUNCTION__);
758 
759 	*plcp_sts = halbb_plcp_gen(hal_info->bb, (void*)plcp_tx_struct,(void*)plcp_usr_info,plcp_phy_idx);
760 	return RTW_HAL_STATUS_SUCCESS;
761 }
762 
763 enum rtw_hal_status
rtw_hal_bb_set_pmac_cont_tx(struct rtw_hal_com_t * hal_com,u8 enable,u8 is_cck,enum phl_phy_idx phy_idx)764 rtw_hal_bb_set_pmac_cont_tx(struct rtw_hal_com_t *hal_com, u8 enable, u8 is_cck,
765 							enum phl_phy_idx phy_idx)
766 {
767 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
768 	struct halbb_pmac_info tx_info = {0};
769 
770 	PHL_INFO("%s: enable = %d is_cck = %d phy_idx = %d\n",
771 			 __FUNCTION__, enable, is_cck, phy_idx);
772 
773 	tx_info.en_pmac_tx = enable;
774 	tx_info.is_cck = is_cck;
775 	tx_info.mode = CONT_TX;
776 
777 	halbb_set_pmac_tx(hal_info->bb, &tx_info, phy_idx);
778 	return RTW_HAL_STATUS_SUCCESS;
779 }
780 
781 enum rtw_hal_status
rtw_hal_bb_set_pmac_packet_tx(struct rtw_hal_com_t * hal_com,u8 enable,u8 is_cck,u16 tx_cnt,u16 period,u16 tx_time,enum phl_phy_idx phy_idx)782 rtw_hal_bb_set_pmac_packet_tx(struct rtw_hal_com_t *hal_com, u8 enable,
783 							  u8 is_cck, u16 tx_cnt ,u16 period, u16 tx_time,
784 							  enum phl_phy_idx phy_idx)
785 {
786 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
787 	struct halbb_pmac_info tx_info = {0};
788 
789 	PHL_INFO("%s: enable = %d is_cck = %d phy_idx = %d\n",
790 			 __FUNCTION__, enable, is_cck, phy_idx);
791 	PHL_INFO("%s: tx_cnt = %d period = %d tx_time = %d\n",
792 			 __FUNCTION__, tx_cnt, period, tx_time);
793 
794 	tx_info.en_pmac_tx = enable;
795 	tx_info.is_cck = is_cck;
796 	tx_info.mode = PKTS_TX;
797 	tx_info.tx_cnt = tx_cnt;
798 	tx_info.period = period;
799 	tx_info.tx_time = tx_time;
800 
801 	halbb_set_pmac_tx(hal_info->bb, &tx_info, phy_idx);
802 	return RTW_HAL_STATUS_SUCCESS;
803 }
804 
805 enum rtw_hal_status
rtw_hal_bb_set_pmac_fw_trigger_tx(struct rtw_hal_com_t * hal_com,u8 enable,u8 is_cck,u16 tx_cnt,u8 tx_duty,enum phl_phy_idx phy_idx)806 rtw_hal_bb_set_pmac_fw_trigger_tx(struct rtw_hal_com_t *hal_com, u8 enable,
807 							  u8 is_cck, u16 tx_cnt, u8 tx_duty,
808 							  enum phl_phy_idx phy_idx)
809 {
810 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
811 	struct halbb_pmac_info tx_info = {0};
812 
813 	PHL_INFO("%s: enable = %d is_cck = %d phy_idx = %d\n",
814 			 __FUNCTION__, enable, is_cck, phy_idx);
815 	PHL_INFO("%s: tx_cnt = %d\n", __FUNCTION__, tx_cnt);
816 	PHL_INFO("%s: tx_duty = %d\n", __FUNCTION__, tx_duty);
817 
818 	tx_info.en_pmac_tx = enable;
819 	tx_info.is_cck = is_cck;
820 	tx_info.mode = FW_TRIG_TX;
821 	tx_info.tx_cnt = tx_cnt;
822 	tx_info.duty_cycle = tx_duty;
823 
824 	halbb_set_pmac_tx(hal_info->bb, &tx_info, phy_idx);
825 	return RTW_HAL_STATUS_SUCCESS;
826 }
827 
828 enum rtw_hal_status
rtw_hal_bb_parse_phy_sts(void * hal,void * ppdu_sts,struct rtw_phl_rx_pkt * phl_rx,u8 is_su)829 rtw_hal_bb_parse_phy_sts(void *hal, void *ppdu_sts,
830 			 struct rtw_phl_rx_pkt *phl_rx, u8 is_su)
831 {
832 	enum rtw_hal_status hstutus = RTW_HAL_STATUS_SUCCESS;
833 
834 	struct hal_info_t *hal_info = (struct hal_info_t *)hal;
835 	struct hal_ppdu_sts *hal_ppdu = (struct hal_ppdu_sts *)ppdu_sts;
836 	struct rtw_r_meta_data *mdata = &(phl_rx->r.mdata);
837 	struct rtw_phl_ppdu_phy_info *phy_info = &(phl_rx->r.phy_info);
838 	struct physts_rxd rxdesc = {0};
839 	struct physts_result bb_rpt = {0};
840 	u8 i = 0;
841 	bool valid = false;
842 
843 	rxdesc.data_rate = mdata->rx_rate;
844 	rxdesc.gi_ltf = mdata->rx_gi_ltf;
845 	rxdesc.is_su = is_su;
846 	rxdesc.macid_su = (u8)mdata->macid;
847 	rxdesc.user_num = hal_ppdu->usr_num;
848 	rxdesc.is_to_self = mdata->a1_match;
849 	rxdesc.phy_idx = (mdata->bb_sel == 0) ? HW_PHY_0 : HW_PHY_1;
850 
851 	for (i = 0; i < rxdesc.user_num; i++) {
852 		rxdesc.user_i[i].macid = (u8)hal_ppdu->usr[i].macid;
853 		rxdesc.user_i[i].is_data = hal_ppdu->usr[i].has_data;
854 		rxdesc.user_i[i].is_ctrl = hal_ppdu->usr[i].has_ctrl;
855 		rxdesc.user_i[i].is_mgnt = hal_ppdu->usr[i].has_ctrl;
856 		rxdesc.user_i[i].is_bcn = hal_ppdu->usr[i].has_bcn;
857 	}
858 
859 	valid = halbb_physts_parsing(hal_info->bb, hal_ppdu->phy_st_ptr,
860 			     (u16)hal_ppdu->phy_st_size,
861 			     &rxdesc, &bb_rpt);
862 	if (valid != true) {
863 		PHL_TRACE(COMP_PHL_PSTS, _PHL_DEBUG_,
864 						"halbb_physts_parsing Fail!\n");
865 		hstutus = RTW_HAL_STATUS_FAILURE;
866 	}
867 
868 	if ((bb_rpt.rssi_avg != 0) || (bb_rpt.physts_rpt_valid == 1)) {
869 		phy_info->is_valid = true;
870 		/* rssi from bb rpt, bit 0 is 0.0 ~ 0.9, removed it */
871 		phy_info->rssi = (bb_rpt.rssi_avg >> 1);
872 		phy_info->ch_idx = bb_rpt.ch_idx;
873 		phy_info->tx_bf = bb_rpt.is_bf;
874 		for (i = 0; i < RTW_PHL_MAX_RF_PATH; i++) {
875 			/* rssi from bb rpt, bit 0 is 0.0 ~ 0.9, removed it */
876 			phy_info->rssi_path[i] = (bb_rpt.rssi[i] >> 1);
877 			PHL_TRACE(COMP_PHL_PSTS, _PHL_INFO_,
878 					"phy_info->rssi_path[%d] = %d\n",
879 					i, phy_info->rssi_path[i]);
880 		}
881 #ifdef RTW_WKARD_SINGLE_PATH_RSSI
882 		if (RF_PATH_A == hal_info->hal_com->cur_rx_rfpath) {
883 			phy_info->rssi = phy_info->rssi_path[0];
884 		} else if (RF_PATH_B == hal_info->hal_com->cur_rx_rfpath) {
885 			phy_info->rssi = phy_info->rssi_path[1];
886 		} else if (RF_PATH_C == hal_info->hal_com->cur_rx_rfpath) {
887 			phy_info->rssi = phy_info->rssi_path[2];
888 		} else if (RF_PATH_D == hal_info->hal_com->cur_rx_rfpath) {
889 			phy_info->rssi = phy_info->rssi_path[3];
890 		}
891 #endif
892 		PHL_TRACE(COMP_PHL_PSTS, _PHL_INFO_,
893 				"avg_rssi %d ; ch_idx %d\n",
894 				phy_info->rssi, phy_info->ch_idx);
895 	}
896 
897 	return hstutus;
898 }
899 
rtw_hal_bb_get_tx_ok(void * hal,u8 cur_phy_idx,u32 * tx_ok)900 enum rtw_hal_status rtw_hal_bb_get_tx_ok(void *hal, u8 cur_phy_idx, u32 *tx_ok)
901 {
902 	/* struct hal_info_t *hal_info = (struct hal_info_t *)hal; */
903 
904 	PHL_INFO("[HAL] call get halbb_mp_get_tx_ok !!!\n");
905 	/*tx_ok = halbb_mp_get_tx_ok(hal_info->bb, cur_phy_idx);*/
906 	return RTW_HAL_STATUS_SUCCESS;
907 }
908 
rtw_hal_bb_get_txpwr_ref(struct hal_info_t * hal_info,u8 is_cck,u8 tx_path,s16 * txpwr_ref)909 enum rtw_hal_status rtw_hal_bb_get_txpwr_ref(struct hal_info_t *hal_info, u8 is_cck, u8 tx_path, s16 *txpwr_ref)
910 {
911 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
912 
913 	PHL_INFO("[MP HAL API]%s\n", __FUNCTION__);
914 
915 	if (is_cck)
916 		*txpwr_ref = halbb_get_cck_ref_dbm(hal_info->bb, tx_path);
917 	else
918 		*txpwr_ref = halbb_get_ofdm_ref_dbm(hal_info->bb, tx_path);
919 
920 	PHL_INFO("[MP HAL API] %s: txpwr_ref = %x\n", __FUNCTION__, *txpwr_ref);
921 
922 	return ret;
923 }
924 
rtw_hal_bb_get_rssi(struct hal_info_t * hal_info,enum rf_path rx_path,u8 * rssi)925 enum rtw_hal_status rtw_hal_bb_get_rssi(struct hal_info_t *hal_info, enum rf_path rx_path, u8 *rssi)
926 {
927 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
928 
929 	PHL_INFO("[MP HAL API]%s\n", __FUNCTION__);
930 
931 	*rssi = halbb_mp_get_rssi(hal_info->bb, rx_path);
932 
933 	return ret;
934 }
935 
rtw_hal_bb_get_rssi_ex(struct hal_info_t * hal_info,enum rf_path rx_path,s16 * rssi,u8 cur_phy_idx)936 enum rtw_hal_status rtw_hal_bb_get_rssi_ex(struct hal_info_t *hal_info, enum rf_path rx_path, s16 *rssi, u8 cur_phy_idx)
937 {
938 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
939 
940 	PHL_INFO("[MP HAL API]%s\n", __FUNCTION__);
941 
942 	/*
943 	ToDo: Should follow halbb master
944 	[HALBB][8852A][B-Cut] Refine rssi structure from s32 to s8
945 	sha-1:f301ebb0e7cd0c1521d3c67e94c2dd4434d87f44
946 
947 	struct rssi_physts  rssi_t;
948 	*rssi_t = halbb_get_mp_rssi_physts(hal_info->bb, RF_PATH_AB, cur_phy_idx);
949 	*rssi = rssi_t.rssi_seg[cur_phy_idx].rssi[0];
950 	*rssi = (*rssi<<8)|rssi_t.rssi_seg[cur_phy_idx].rssi[1];
951 	*/
952 	return ret;
953 }
954 
rtw_hal_bb_get_rxevm(struct hal_info_t * hal_info,u8 user,u8 strm,u8 rxevm_table,u8 * rx_evm)955 enum rtw_hal_status rtw_hal_bb_get_rxevm(struct hal_info_t *hal_info, u8 user, u8 strm, u8 rxevm_table, u8 *rx_evm)
956 {
957 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
958 
959 	PHL_INFO("[MP HAL API]%s\n", __FUNCTION__);
960 
961 	*rx_evm = halbb_mp_get_rxevm(hal_info->bb,  user, strm, rxevm_table);
962 
963 	return ret;
964 }
965 
rtw_hal_bb_trigger_rxevm(struct hal_info_t * hal_info,u8 cur_phy_idx,u32 * phy0_user0_rxevm,u32 * phy0_user1_rxevm,u32 * phy0_user2_rxevm,u32 * phy0_user3_rxevm,u32 * phy1_user0_rxevm,u32 * phy1_user1_rxevm,u32 * phy1_user2_rxevm,u32 * phy1_user3_rxevm)966 enum rtw_hal_status rtw_hal_bb_trigger_rxevm(struct hal_info_t *hal_info, u8 cur_phy_idx,
967 	u32 *phy0_user0_rxevm, u32 *phy0_user1_rxevm, u32 *phy0_user2_rxevm, u32 *phy0_user3_rxevm,
968 	u32 *phy1_user0_rxevm, u32 *phy1_user1_rxevm, u32 *phy1_user2_rxevm, u32 *phy1_user3_rxevm)
969 {
970 
971 	struct rxevm_physts evm;
972 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
973 
974 	PHL_INFO("[MP HAL API]%s\n", __FUNCTION__);
975 
976 	evm = halbb_mp_get_rxevm_physts(hal_info->bb, cur_phy_idx);
977 	*phy0_user0_rxevm = evm.rxevm_seg[0].rxevm_user[0].rxevm_ss_3;
978 	*phy0_user0_rxevm = (*phy0_user0_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[0].rxevm_ss_2;
979 	*phy0_user0_rxevm = (*phy0_user0_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[0].rxevm_ss_1;
980 	*phy0_user0_rxevm = (*phy0_user0_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[0].rxevm_ss_0;
981 
982 	*phy0_user1_rxevm = evm.rxevm_seg[0].rxevm_user[1].rxevm_ss_3;
983 	*phy0_user1_rxevm = (*phy0_user1_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[1].rxevm_ss_2;
984 	*phy0_user1_rxevm = (*phy0_user1_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[1].rxevm_ss_1;
985 	*phy0_user1_rxevm = (*phy0_user1_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[1].rxevm_ss_0;
986 
987 	*phy0_user2_rxevm = evm.rxevm_seg[0].rxevm_user[2].rxevm_ss_3;
988 	*phy0_user2_rxevm = (*phy0_user2_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[2].rxevm_ss_2;
989 	*phy0_user2_rxevm = (*phy0_user2_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[2].rxevm_ss_1;
990 	*phy0_user2_rxevm = (*phy0_user2_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[2].rxevm_ss_0;
991 
992 	*phy0_user3_rxevm = evm.rxevm_seg[0].rxevm_user[3].rxevm_ss_3;
993 	*phy0_user3_rxevm = (*phy0_user3_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[3].rxevm_ss_2;
994 	*phy0_user3_rxevm = (*phy0_user3_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[3].rxevm_ss_1;
995 	*phy0_user3_rxevm = (*phy0_user3_rxevm<<8)|evm.rxevm_seg[0].rxevm_user[3].rxevm_ss_0;
996 
997 	*phy1_user0_rxevm = evm.rxevm_seg[1].rxevm_user[0].rxevm_ss_3;
998 	*phy1_user0_rxevm = (*phy1_user0_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[0].rxevm_ss_2;
999 	*phy1_user0_rxevm = (*phy1_user0_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[0].rxevm_ss_1;
1000 	*phy1_user0_rxevm = (*phy1_user0_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[0].rxevm_ss_0;
1001 
1002 	*phy1_user1_rxevm = evm.rxevm_seg[1].rxevm_user[1].rxevm_ss_3;
1003 	*phy1_user1_rxevm = (*phy1_user1_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[1].rxevm_ss_2;
1004 	*phy1_user1_rxevm = (*phy1_user1_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[1].rxevm_ss_1;
1005 	*phy1_user1_rxevm = (*phy1_user1_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[1].rxevm_ss_0;
1006 
1007 	*phy1_user2_rxevm = evm.rxevm_seg[1].rxevm_user[2].rxevm_ss_3;
1008 	*phy1_user2_rxevm = (*phy1_user2_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[2].rxevm_ss_2;
1009 	*phy1_user2_rxevm = (*phy1_user2_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[2].rxevm_ss_1;
1010 	*phy1_user2_rxevm = (*phy1_user2_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[2].rxevm_ss_0;
1011 
1012 	*phy1_user3_rxevm = evm.rxevm_seg[1].rxevm_user[3].rxevm_ss_3;
1013 	*phy1_user3_rxevm = (*phy1_user3_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[3].rxevm_ss_2;
1014 	*phy1_user3_rxevm = (*phy1_user3_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[3].rxevm_ss_1;
1015 	*phy1_user3_rxevm = (*phy1_user3_rxevm<<8)|evm.rxevm_seg[1].rxevm_user[3].rxevm_ss_0;
1016 
1017 	return ret;
1018 }
1019 
1020 /* mode: 0 = tmac, 1 = pmac */
1021 enum rtw_hal_status
rtw_hal_bb_tx_mode_switch(struct rtw_hal_com_t * hal_com,enum phl_phy_idx phy_idx,u8 mode)1022 rtw_hal_bb_tx_mode_switch(struct rtw_hal_com_t *hal_com,
1023 						  enum phl_phy_idx phy_idx,
1024 						  u8 mode)
1025 {
1026 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
1027 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
1028 
1029 	if(mode == 0) {
1030 		PHL_INFO("%s: tmac mode\n", __FUNCTION__);
1031 		halbb_set_tmac_tx(hal_info->bb, phy_idx);
1032 	}
1033 	else {
1034 		PHL_INFO("%s: pmac mode\n", __FUNCTION__);
1035 	}
1036 
1037 	return ret;
1038 }
1039 
rtw_hal_bb_set_txsc(struct hal_info_t * hal_info,u8 txsc,enum phl_phy_idx phy_idx)1040 enum rtw_hal_status rtw_hal_bb_set_txsc(struct hal_info_t *hal_info, u8 txsc,
1041 										enum phl_phy_idx phy_idx)
1042 {
1043 	enum rtw_hal_status status = RTW_HAL_STATUS_FAILURE;
1044 	PHL_INFO("[HAL] call halbb_set_txsc !!!\n");
1045 
1046 	if(halbb_set_txsc(hal_info->bb, txsc, phy_idx))
1047 		status = RTW_HAL_STATUS_SUCCESS;
1048 	else
1049 		status = RTW_HAL_STATUS_FAILURE;
1050 
1051 	return status;
1052 }
1053 
1054 
rtw_hal_bb_get_txsc(struct rtw_hal_com_t * hal_com,u8 pri_ch,u8 central_ch,enum channel_width cbw,enum channel_width dbw)1055 u8 rtw_hal_bb_get_txsc(struct rtw_hal_com_t *hal_com, u8 pri_ch,
1056 		u8 central_ch, enum channel_width cbw, enum channel_width dbw)
1057 {
1058 	struct hal_info_t *hal_info = (struct hal_info_t *)(hal_com->hal_priv);
1059 
1060 	return halbb_get_txsc(hal_info->bb, pri_ch, central_ch, cbw, dbw);
1061 }
1062 
rtw_hal_bb_process_c2h(void * hal,struct rtw_c2h_info * c2h)1063 u32 rtw_hal_bb_process_c2h(void *hal, struct rtw_c2h_info *c2h)
1064 {
1065 #ifdef RTW_WKARD_BB_C2H
1066 	struct hal_info_t *hal_info = (struct hal_info_t *)hal;
1067 	u8 cls = c2h->c2h_class;
1068 	u8 func = c2h->c2h_func;
1069 	u16 len = c2h->content_len;
1070 	u8 *buf = c2h->content;
1071 
1072 	return rtw_halbb_c2h_parsing(hal_info->bb, cls, func, (u8)len, buf);
1073 #else
1074 	return 0;
1075 #endif
1076 }
1077 
rtw_hal_bb_get_su_rx_rate(struct rtw_hal_com_t * hal_com)1078 u16 rtw_hal_bb_get_su_rx_rate(struct rtw_hal_com_t *hal_com)
1079 {
1080 	struct hal_info_t *hal_info = (struct hal_info_t *)(hal_com->hal_priv);
1081 	struct bb_pkt_cnt_su_info rpt;
1082 	u16 max_num_tmp = 0;
1083 	u16 rx_rate = 0;
1084 	u16 i = 0;
1085 	u16 *pkt_cnt_tmp;
1086 	u8 rate_num_tmp;
1087 	u16 ofst_mode = 0;
1088 	u16 ofst_ss = 0;
1089 	u16 idx = 0;
1090 	bool is_ht_mode = false;
1091 	bool is_legacy_rate = true;
1092 
1093 	halbb_get_rx_pkt_cnt_rpt_su(hal_info->bb, &rpt);
1094 
1095 	/*Legacy rate*/
1096 	if (rpt.pkt_cnt_cck || rpt.pkt_cnt_ofdm) {
1097 		for (i = 0; i < 12; i++) {
1098 			if (rpt.pkt_cnt_legacy[i] >= max_num_tmp) {
1099 				max_num_tmp = rpt.pkt_cnt_legacy[i];
1100 				rx_rate = i;
1101 			}
1102 		}
1103 	}
1104 	if (rpt.pkt_cnt_t == 0) {
1105 		return rx_rate;
1106 	}
1107 	/*HT, VHT, HE*/
1108 	if (rpt.he_pkt_not_zero) {
1109 		pkt_cnt_tmp = rpt.pkt_cnt_he;
1110 		rate_num_tmp = 24;
1111 		ofst_mode = 0x180;
1112 	} else if (rpt.vht_pkt_not_zero) {
1113 		pkt_cnt_tmp = rpt.pkt_cnt_vht;
1114 		rate_num_tmp = 24;
1115 		ofst_mode = 0x100;
1116 	} else if (rpt.ht_pkt_not_zero) {
1117 		pkt_cnt_tmp = rpt.pkt_cnt_ht;
1118 		rate_num_tmp = 16;
1119 		ofst_mode = 0x80;
1120 		is_ht_mode = true;
1121 	} else {
1122 		return rx_rate;
1123 	}
1124 	for (i = 0; i < rate_num_tmp; i++) {
1125 		if (pkt_cnt_tmp[i] >= max_num_tmp) {
1126 			max_num_tmp = pkt_cnt_tmp[i];
1127 			idx = i;
1128 			is_legacy_rate = false;
1129 		}
1130 	}
1131 	if (is_legacy_rate)
1132 		return rx_rate;
1133 	if (!is_ht_mode) {
1134 		ofst_ss = idx / HE_VHT_NUM_MCS;
1135 
1136 		if (ofst_ss >= 0) /*>=2SS*/
1137 			idx -= (ofst_ss * HE_VHT_NUM_MCS);
1138 	}
1139 	rx_rate = ofst_mode + (ofst_ss << 4) + idx;
1140 	return rx_rate;
1141 }
1142 
1143 #ifdef CONFIG_DBCC_SUPPORT
1144 enum rtw_hal_status
rtw_hal_phy_dbcc_pre_cfg(struct hal_info_t * hal_info,struct rtw_phl_com_t * phl_com,bool dbcc_en)1145 rtw_hal_phy_dbcc_pre_cfg(struct hal_info_t *hal_info,
1146 			struct rtw_phl_com_t *phl_com, bool dbcc_en)
1147 {
1148 
1149 	rtw_hal_init_bb_reg(hal_info);
1150 
1151 	return RTW_HAL_STATUS_SUCCESS;
1152 }
1153 
1154 enum rtw_hal_status
rtw_hal_phy_dbcc_cfg(struct hal_info_t * hal_info,struct rtw_phl_com_t * phl_com,bool dbcc_en)1155 rtw_hal_phy_dbcc_cfg(struct hal_info_t *hal_info,
1156 	struct rtw_phl_com_t *phl_com, bool dbcc_en)
1157 {
1158 	enum rtw_hal_status hal_status = RTW_HAL_STATUS_SUCCESS;
1159 
1160 	/* BB DBCC Settings */
1161 	rtw_hal_bb_cfg_dbcc(hal_info, dbcc_en);
1162 	/* enable/disable rf */
1163 	hal_status = rtw_hal_rf_ctrl_dbcc(hal_info->hal_com, dbcc_en);
1164 	if (RTW_HAL_STATUS_SUCCESS != hal_status) {
1165 		hal_status = RTW_HAL_STATUS_FAILURE;
1166 	}
1167 
1168 	return hal_status;
1169 }
1170 #endif
1171 
1172 enum rtw_hal_status
rtw_hal_bb_get_txinfo_power(struct hal_info_t * hal_info,s16 * txinfo_power_dbm)1173 rtw_hal_bb_get_txinfo_power(struct hal_info_t *hal_info,
1174 					s16 *txinfo_power_dbm)
1175 {
1176 	int ret = RTW_HAL_STATUS_SUCCESS;
1177 
1178 	PHL_INFO("[MP HAL API] %s: call halbb_get_txinfo_txpwr_dbm \n",
1179 		__FUNCTION__);
1180 
1181 	*txinfo_power_dbm = halbb_get_txinfo_txpwr_dbm(hal_info->bb);
1182 
1183 	PHL_INFO("[MP HAL API] %s: txinfo_power_dbm = %d\n",
1184 		__FUNCTION__, *txinfo_power_dbm);
1185 	return ret;
1186 }
1187 
1188 enum rtw_hal_status
rtw_hal_bb_ctrl_rf_mode(struct hal_info_t * hal_info,enum phl_rf_mode rf_mode)1189 rtw_hal_bb_ctrl_rf_mode(struct hal_info_t *hal_info,
1190 					enum phl_rf_mode rf_mode){
1191 	int ret = RTW_HAL_STATUS_SUCCESS;
1192 
1193 	PHL_INFO("[MP HAL API] %s: call rtw_hal_bb_ctrl_rf_mode \n",
1194 		__FUNCTION__);
1195 
1196 	halbb_ctrl_rf_mode(hal_info->bb, rf_mode);
1197 
1198 	return ret;
1199 }
1200 
1201 enum rtw_hal_status
rtw_hal_bb_set_sta_id(struct hal_info_t * hal_info,u16 staid,enum phl_phy_idx phy_idx)1202 rtw_hal_bb_set_sta_id(struct hal_info_t *hal_info,
1203 	u16 staid, enum phl_phy_idx phy_idx)
1204 {
1205 	int ret = RTW_HAL_STATUS_SUCCESS;
1206 
1207 	halbb_set_sta_id(hal_info->bb, staid, phy_idx);
1208 
1209 	return ret;
1210 }
1211 
1212 enum rtw_hal_status
rtw_hal_bb_set_bss_color(struct hal_info_t * hal_info,u8 bsscolor,enum phl_phy_idx phy_idx)1213 rtw_hal_bb_set_bss_color(struct hal_info_t *hal_info,
1214 	u8 bsscolor, enum phl_phy_idx phy_idx)
1215 {
1216 	int ret = RTW_HAL_STATUS_SUCCESS;
1217 
1218 	halbb_set_bss_color(hal_info->bb, bsscolor, phy_idx);
1219 
1220 	return ret;
1221 }
1222 
1223 #ifdef RTW_WKARD_DEF_CMACTBL_CFG
1224 enum rtw_hal_status
rtw_hal_bb_trx_path_cfg(struct hal_info_t * hal_info,enum rf_path tx,u8 tx_nss,enum rf_path rx,u8 rx_nss)1225 rtw_hal_bb_trx_path_cfg(struct hal_info_t *hal_info,
1226 		enum rf_path tx, u8 tx_nss, enum rf_path rx, u8 rx_nss)
1227 {
1228 	int ret = RTW_HAL_STATUS_SUCCESS;
1229 
1230 	halbb_ctrl_trx_path(hal_info->bb, tx, tx_nss, rx, rx_nss);
1231 	PHL_TRACE(COMP_PHL_DBG, _PHL_INFO_,
1232 		"tx_ant(%d) tx_nss(%d) rx_ant(%d) rx_nss(%d)\n",
1233 		tx, tx_nss, rx, rx_nss);
1234 	return ret;
1235 }
1236 
rtw_hal_bb_cfg_cmac_tx_ant(struct hal_info_t * hal_info,enum rf_path tx_path)1237 u16 rtw_hal_bb_cfg_cmac_tx_ant(struct hal_info_t *hal_info,
1238 	enum rf_path tx_path)
1239 {
1240 	u16 ret;
1241 
1242 	ret = (BIT(RF_PATH_A) | BIT(RF_PATH_B))|(RF_PATH_A<<4)|(RF_PATH_B<<6);
1243 	ret = halbb_cfg_cmac_tx_ant(hal_info->bb, tx_path);
1244 
1245 	return ret;
1246 }
1247 #endif
1248 
1249 enum rtw_hal_status
rtw_hal_bb_backup_info(struct rtw_hal_com_t * hal_com,u8 cur_phy_idx)1250 rtw_hal_bb_backup_info(struct rtw_hal_com_t *hal_com, u8 cur_phy_idx)
1251 {
1252 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
1253 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
1254 
1255 	PHL_INFO("[MP HAL API] %s ==>start\n", __FUNCTION__);
1256 
1257 	halbb_backup_info(hal_info->bb, cur_phy_idx);
1258 
1259 	PHL_INFO("[MP HAL API] %s ==>end\n", __FUNCTION__);
1260 
1261 	return ret;
1262 }
1263 
1264 enum rtw_hal_status
rtw_hal_bb_restore_info(struct rtw_hal_com_t * hal_com,u8 cur_phy_idx)1265 rtw_hal_bb_restore_info(struct rtw_hal_com_t *hal_com, u8 cur_phy_idx)
1266 {
1267 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
1268 	enum rtw_hal_status ret=RTW_HAL_STATUS_SUCCESS;
1269 
1270 	PHL_INFO("[MP HAL API] %s ==>start\n", __FUNCTION__);
1271 
1272 	halbb_restore_info(hal_info->bb, cur_phy_idx);
1273 
1274 	PHL_INFO("[MP HAL API] %s ==>end\n", __FUNCTION__);
1275 
1276 	return ret;
1277 }
1278 
rtw_hal_bb_set_tx_pow_ref(struct rtw_hal_com_t * hal_com,enum phl_phy_idx phy_idx)1279 void rtw_hal_bb_set_tx_pow_ref(struct rtw_hal_com_t *hal_com,
1280 			       enum phl_phy_idx phy_idx)
1281 {
1282 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
1283 
1284 	halbb_set_tx_pow_ref(hal_info->bb, phy_idx);
1285 }
1286 
1287 #ifdef CONFIG_RTW_ACS
rtw_hal_bb_acs_mntr_trigger(struct hal_info_t * hal_info,u16 monitor_time)1288 void rtw_hal_bb_acs_mntr_trigger(struct hal_info_t *hal_info, u16 monitor_time)
1289 {
1290 	struct ccx_para_info para = {0};
1291 	struct env_trig_rpt trig_rpt = {0};
1292 
1293 	para.rac_lv = RAC_LV_3;
1294 	para.mntr_time = monitor_time;
1295 	/*clm para*/
1296 	para.clm_app = CLM_ACS;
1297 	para.clm_input_opt = CLM_CCA_P20;
1298 
1299 	/*nhm para*/
1300 	para.nhm_app = NHM_ACS;
1301 	para.nhm_incld_cca = NHM_INCLUDE_CCA;
1302 
1303 	halbb_env_mntr_trigger(hal_info->bb, &para, &trig_rpt);
1304 }
1305 
rtw_hal_bb_acs_mntr_result(struct hal_info_t * hal_info,void * rpt)1306 enum rtw_hal_status rtw_hal_bb_acs_mntr_result(struct hal_info_t *hal_info, void *rpt)
1307 {
1308 	u8 result = 0;
1309 	struct env_mntr_rpt mntr_rpt = {0};
1310 	struct auto_chan_sel_report *acs_rpt = (struct auto_chan_sel_report *)rpt;
1311 
1312 	result = halbb_env_mntr_result(hal_info->bb, &mntr_rpt);
1313 
1314 	if ((result & (CLM_SUCCESS | NHM_SUCCESS)) != (CLM_SUCCESS | NHM_SUCCESS)) {
1315 		return RTW_HAL_STATUS_FAILURE;
1316 	} else {
1317 		acs_rpt->clm_ratio = mntr_rpt.clm_ratio;
1318 		acs_rpt->nhm_pwr = mntr_rpt.nhm_pwr;
1319 		return RTW_HAL_STATUS_SUCCESS;
1320 	}
1321 }
1322 #endif /* CONFIG_RTW_ACS */
1323 
1324 enum rtw_hal_status
rtw_hal_bb_tssi_bb_reset(struct rtw_hal_com_t * hal_com)1325 rtw_hal_bb_tssi_bb_reset(struct rtw_hal_com_t *hal_com)
1326 {
1327 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
1328 
1329 	halbb_tssi_bb_reset(hal_info->bb);
1330 
1331 	return RTW_HAL_STATUS_SUCCESS;
1332 }
1333 #ifdef RTW_WKARD_DYNAMIC_BFEE_CAP
rtw_hal_bb_dcr_en(struct hal_info_t * hal_info,bool en)1334 void rtw_hal_bb_dcr_en(struct hal_info_t *hal_info, bool en)
1335 {
1336 	halbb_dcr_en(hal_info->bb, en);
1337 	PHL_TRACE(COMP_PHL_DBG, _PHL_DEBUG_,
1338 		  "rtw_hal_bb_dcr_en : %d \n", (en ? 1 : 0));
1339 	 return;
1340 }
1341 
rtw_hal_bb_csi_rsp(struct hal_info_t * hal_info)1342 bool rtw_hal_bb_csi_rsp(struct hal_info_t *hal_info)
1343 {
1344 	bool ret = true;
1345 	if (0 == halbb_dyn_csi_rsp_rlt_get(hal_info->bb)) {
1346 		ret = false;
1347 	}
1348 	PHL_TRACE(COMP_PHL_DBG, _PHL_DEBUG_,
1349 		  "rtw_hal_bb_csi_rsp : %d \n", (ret ? 1 : 0));
1350 	return ret;
1351 }
1352 #endif
1353 
rtw_hal_bb_notification(struct hal_info_t * hal_info,enum phl_msg_evt_id event,enum phl_phy_idx phy_idx)1354 void rtw_hal_bb_notification(struct hal_info_t *hal_info,
1355                              enum phl_msg_evt_id event,
1356                              enum phl_phy_idx phy_idx)
1357 {
1358 	halbb_wifi_event_notify(hal_info->bb, event, phy_idx);
1359 }
1360 
rtw_hal_bb_cmd_notification(struct hal_info_t * hal_info,void * hal_cmd,enum phl_phy_idx phy_idx)1361 void rtw_hal_bb_cmd_notification(struct hal_info_t *hal_info,
1362                              void *hal_cmd,
1363                              enum phl_phy_idx phy_idx)
1364 {
1365 	halbb_bb_cmd_notify(hal_info->bb, hal_cmd, phy_idx);
1366 }
1367 
1368 enum rtw_hal_status
rtw_hal_bb_set_gain_offset(struct hal_info_t * hal_info,s8 rx_gain_offset,enum rf_path rx_path,enum phl_phy_idx phy_idx,u8 iscck)1369 rtw_hal_bb_set_gain_offset(struct hal_info_t *hal_info, s8 rx_gain_offset,
1370 				enum rf_path rx_path, enum phl_phy_idx phy_idx, u8 iscck)
1371 {
1372 	if(iscck)
1373 		halbb_normal_efuse_verify_cck(hal_info->bb, rx_gain_offset, rx_path, phy_idx);
1374 	else
1375 		halbb_normal_efuse_verify(hal_info->bb, rx_gain_offset, rx_path, phy_idx);
1376 
1377 	return RTW_HAL_STATUS_SUCCESS;
1378 }
1379 
rtw_hal_bb_get_efuse_init(struct rtw_hal_com_t * hal_com)1380 void rtw_hal_bb_get_efuse_init(struct rtw_hal_com_t *hal_com)
1381 {
1382 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
1383 
1384 	halbb_get_efuse_init(hal_info->bb);
1385 	PHL_INFO("[HAL API] %s ==>end\n", __FUNCTION__);
1386 }
1387 enum rtw_hal_status
rtw_hal_bb_set_dpd_bypass(struct rtw_hal_com_t * hal_com,bool pdp_bypass,enum phl_phy_idx phy_idx)1388 rtw_hal_bb_set_dpd_bypass(struct rtw_hal_com_t *hal_com, bool pdp_bypass,
1389 						enum phl_phy_idx phy_idx)
1390 {
1391 	struct hal_info_t *hal_info = (struct hal_info_t *)hal_com->hal_priv;
1392 	PHL_INFO("%s: pdp_bypass = %d phy_idx = %d\n",
1393 			 __FUNCTION__, pdp_bypass, phy_idx);
1394 
1395 	halbb_dpd_bypass(hal_info->bb, pdp_bypass, phy_idx);
1396 	return RTW_HAL_STATUS_SUCCESS;
1397 }
1398 
1399 
rtw_hal_bb_gpio_setting(struct rtw_hal_com_t * hal_com,u8 gpio_idx,u8 path,bool inv,u8 src)1400 void rtw_hal_bb_gpio_setting(struct rtw_hal_com_t *hal_com, u8 gpio_idx, u8 path,
1401 			bool inv,  u8 src)
1402 {
1403 	struct hal_info_t *hal_info = (struct hal_info_t *)(hal_com->hal_priv);
1404 
1405 	halbb_gpio_setting(hal_info->bb, gpio_idx, path, inv, src);
1406 }
1407 
rtw_hal_bb_gpio_setting_all(struct rtw_hal_com_t * hal_com,u8 rfe_idx)1408 void rtw_hal_bb_gpio_setting_all(struct rtw_hal_com_t *hal_com, u8 rfe_idx)
1409 {
1410 	struct hal_info_t *hal_info = (struct hal_info_t *)(hal_com->hal_priv);
1411 
1412 	halbb_gpio_setting_all(hal_info->bb, rfe_idx);
1413 }
1414 
rtw_hal_bb_check_tx_idle(struct hal_info_t * hal_info,enum phl_phy_idx phy_idx)1415 bool rtw_hal_bb_check_tx_idle(struct hal_info_t *hal_info, enum phl_phy_idx phy_idx)
1416 {
1417 	return halbb_chk_tx_idle(hal_info->bb, phy_idx);
1418 }
1419 
1420 static enum rtw_hal_status
_cnvrt_rainfo_to_rate(enum hal_rate_mode rate_mode,u8 mcs_ss_idx,enum rtw_data_rate * data_rate)1421 _cnvrt_rainfo_to_rate(enum hal_rate_mode rate_mode, u8 mcs_ss_idx,
1422 		      enum rtw_data_rate *data_rate)
1423 {
1424 	enum rtw_hal_status hal_sts = RTW_HAL_STATUS_FAILURE;
1425 	u16 rate_idx = 0, ss = 0;
1426 
1427 	switch(rate_mode) {
1428 	case HAL_LEGACY_MODE:
1429 		rate_idx = (u16)(mcs_ss_idx & 0xf);
1430 		ss = 0;
1431 		hal_sts = RTW_HAL_STATUS_SUCCESS;
1432 		break;
1433 	case HAL_HT_MODE:
1434 		rate_idx = (u16)(mcs_ss_idx & 0x1f);
1435 		ss = 0;
1436 		hal_sts = RTW_HAL_STATUS_SUCCESS;
1437 		break;
1438 	case HAL_VHT_MODE:
1439 	case HAL_HE_MODE:
1440 		rate_idx = (u16)(mcs_ss_idx & 0xf);
1441 		ss = (mcs_ss_idx & 0x30) >> 4;
1442 		hal_sts = RTW_HAL_STATUS_SUCCESS;
1443 		break;
1444 	default:
1445 		PHL_TRACE(COMP_PHL_XMIT, _PHL_ERR_,
1446 			  "%s : incorrect rate mode(0x%x), fail to covert rate\n",
1447 			  __func__, rate_mode);
1448 		hal_sts = RTW_HAL_STATUS_FAILURE;
1449 		break;
1450 	}
1451 
1452 	if (RTW_HAL_STATUS_SUCCESS == hal_sts)
1453 		*data_rate = rate_idx | (ss << 4) | (rate_mode << 7);
1454 
1455 	return hal_sts;
1456 }
1457 
1458 enum rtw_hal_status
rtw_hal_bb_ic_hw_setting_init(struct hal_info_t * hal_info)1459 rtw_hal_bb_ic_hw_setting_init(struct hal_info_t *hal_info)
1460 {
1461 	halbb_dm_init(hal_info->bb, HW_PHY_0);
1462 
1463 	return RTW_HAL_STATUS_SUCCESS;
1464 }
1465 
1466 enum rtw_hal_status
rtw_hal_bb_query_rainfo(void * hal,struct rtw_hal_stainfo_t * hal_sta,struct rtw_phl_rainfo * phl_rainfo)1467 rtw_hal_bb_query_rainfo(void *hal, struct rtw_hal_stainfo_t *hal_sta,
1468 			struct rtw_phl_rainfo *phl_rainfo)
1469 {
1470 	enum rtw_hal_status hal_sts = RTW_HAL_STATUS_FAILURE;
1471 	struct rtw_rate_info *rainfo = NULL;
1472 
1473 	do {
1474 		if (NULL == hal_sta) {
1475 			PHL_TRACE(COMP_PHL_XMIT, _PHL_ERR_,
1476 				  "%s : hal_sta is NULL\n",
1477 				  __func__);
1478 			break;
1479 		}
1480 
1481 		if (NULL == phl_rainfo) {
1482 			PHL_TRACE(COMP_PHL_XMIT, _PHL_ERR_,
1483 				  "%s : Input parameter is NULL\n",
1484 				  __func__);
1485 			break;
1486 		}
1487 
1488 		rainfo = &hal_sta->ra_info.rpt_rt_i;
1489 
1490 		phl_rainfo->gi_ltf = rainfo->gi_ltf;
1491 		if (HAL_RATE_BW_20 == rainfo->bw) {
1492 			phl_rainfo->bw = CHANNEL_WIDTH_20;
1493 		} else if (HAL_RATE_BW_40 == rainfo->bw) {
1494 			phl_rainfo->bw = CHANNEL_WIDTH_40;
1495 		} else if (HAL_RATE_BW_80 == rainfo->bw) {
1496 			phl_rainfo->bw = CHANNEL_WIDTH_80;
1497 		} else if (HAL_RATE_BW_160 == rainfo->bw) {
1498 			phl_rainfo->bw = CHANNEL_WIDTH_160;
1499 		} else {
1500 			PHL_TRACE(COMP_PHL_XMIT, _PHL_ERR_,
1501 				  "%s : incorrect bw(0x%x), fail to covert rate\n",
1502 				  __func__, rainfo->bw);
1503 			break;
1504 		}
1505 
1506 		if (RTW_HAL_STATUS_SUCCESS ==
1507 		    _cnvrt_rainfo_to_rate(rainfo->mode,
1508 					  rainfo->mcs_ss_idx,
1509 					  &phl_rainfo->rate)) {
1510 			hal_sts = RTW_HAL_STATUS_SUCCESS;
1511 			break;
1512 		} else {
1513 			break;
1514 		}
1515 	} while (false);
1516 
1517 	return hal_sts;
1518 }
1519 
rtw_hal_bb_nhm_mntr_result(struct rtw_hal_com_t * hal_com,void * rpt,enum phl_phy_idx phy_idx)1520 void rtw_hal_bb_nhm_mntr_result(struct rtw_hal_com_t *hal_com, void *rpt, enum phl_phy_idx phy_idx)
1521 {
1522 	struct hal_info_t *hal_info = (struct hal_info_t *)(hal_com->hal_priv);
1523 	struct env_mntr_rpt mntr_rpt = {0};
1524 	struct watchdog_nhm_report *nhm_rpt = (struct watchdog_nhm_report *)rpt;
1525 
1526 	halbb_env_mntr_get_bg_result(hal_info->bb, &mntr_rpt, phy_idx);
1527 
1528 	nhm_rpt->ccx_rpt_stamp = mntr_rpt.ccx_rpt_stamp;
1529 	nhm_rpt->ccx_rpt_result = mntr_rpt.ccx_rpt_result;
1530 	nhm_rpt->nhm_pwr_dbm = (s8) ((s16) mntr_rpt.nhm_pwr - 110);
1531 	nhm_rpt->nhm_ratio = mntr_rpt.nhm_ratio;
1532 }
1533 
rtw_hal_bb_set_pow_patten_sharp(struct rtw_hal_com_t * hal_com,u8 channel,u8 is_cck,u8 sharp_id,enum phl_phy_idx phy_idx)1534 void rtw_hal_bb_set_pow_patten_sharp(struct rtw_hal_com_t *hal_com, u8 channel, u8 is_cck, u8 sharp_id, enum phl_phy_idx phy_idx)
1535 {
1536 	u8 is_ofdm = (is_cck == 0)?1:0;
1537 	struct hal_info_t *hal_info = (struct hal_info_t *)(hal_com->hal_priv);
1538 	struct rtw_tpu_info *tpu = &hal_info->hal_com->band[phy_idx].rtw_tpu_i;
1539 	tpu->tx_ptrn_shap_idx = sharp_id;
1540 
1541 	halbb_set_tx_pow_pattern_shap(hal_info->bb, channel, is_ofdm, phy_idx);
1542 }
1543 
rtw_hal_bb_env_rpt(struct rtw_hal_com_t * hal_com,struct rtw_env_report * env_rpt,enum phl_phy_idx phy_indx)1544 void rtw_hal_bb_env_rpt(struct rtw_hal_com_t *hal_com, struct rtw_env_report *env_rpt,
1545 		     enum phl_phy_idx phy_indx)
1546 {
1547 	struct hal_info_t *hal_info = (struct hal_info_t *)(hal_com->hal_priv);
1548 	struct env_mntr_rpt bg_rpt = {0};
1549 	u8 env_rpt_status = 0;
1550 
1551 	halbb_env_mntr_get_bg_result(hal_info->bb, &bg_rpt, phy_indx);
1552 	env_rpt_status = bg_rpt.ccx_rpt_result;
1553 	env_rpt_status = env_rpt_status & CCX_SUCCESS;
1554 
1555 	/*if ok update env rpt */
1556 	if (env_rpt_status == CCX_SUCCESS) {
1557 		env_rpt->clm_ratio = bg_rpt.clm_ratio;
1558 		env_rpt->nhm_pwr = bg_rpt.nhm_pwr;
1559 		env_rpt->nhm_ratio = bg_rpt.nhm_ratio;
1560 		env_rpt->nhm_tx_ratio = bg_rpt.nhm_tx_ratio;
1561 		env_rpt->nhm_cca_ratio = bg_rpt.nhm_cca_ratio;
1562 		env_rpt->rpt_status = 1;
1563 	} else {
1564 		env_rpt->rpt_status = 0;
1565 	}
1566 }
1567 
1568 enum rtw_hal_status
rtw_hal_bb_set_tb_pwr_ofst(struct hal_info_t * hal_info,s16 ofst,enum phl_phy_idx phy_idx)1569 rtw_hal_bb_set_tb_pwr_ofst(struct hal_info_t *hal_info,
1570 			s16 ofst, enum phl_phy_idx phy_idx)
1571 {
1572 	bool ret = false;
1573 
1574 	ret = halbb_set_pwr_ul_tb_ofst(hal_info->bb, ofst, phy_idx);
1575 	if (ret == true)
1576 		return RTW_HAL_STATUS_SUCCESS;
1577 	else
1578 		return RTW_HAL_STATUS_FAILURE;
1579 }
1580 
1581 #ifdef CONFIG_MCC_SUPPORT
1582 enum rtw_hal_status
rtw_hal_bb_upd_mcc_macid(struct hal_info_t * hal_info,struct rtw_phl_mcc_role * mrole)1583 rtw_hal_bb_upd_mcc_macid(struct hal_info_t *hal_info,
1584                          struct rtw_phl_mcc_role *mrole)
1585 {
1586 	bool ret = false;
1587 	struct bb_mcc_i mi = {0};
1588 
1589 	mi.type = mrole->wrole->type;
1590 	mi.self_macid = (u8)mrole->macid;
1591 	mi.chandef = mrole->chandef;
1592 	mi.macid_bitmap = mrole->used_macid.bitmap;
1593 	mi.macid_map_len = mrole->used_macid.len;
1594 
1595 	ret = halbb_upd_mcc_macid(hal_info->bb, &mi);
1596 
1597 	if (ret == true)
1598 		return RTW_HAL_STATUS_SUCCESS;
1599 	else
1600 		return RTW_HAL_STATUS_FAILURE;
1601 }
1602 
1603 void
rtw_hal_bb_mcc_stop(struct hal_info_t * hal_info)1604 rtw_hal_bb_mcc_stop(struct hal_info_t *hal_info)
1605 {
1606 	halbb_mcc_stop(hal_info->bb);
1607 }
1608 
1609 enum rtw_hal_status
rtw_hal_bb_mcc_start(struct hal_info_t * hal_info,struct rtw_phl_mcc_role * m_role1,struct rtw_phl_mcc_role * m_role2)1610 rtw_hal_bb_mcc_start(struct hal_info_t *hal_info,
1611                      struct rtw_phl_mcc_role *m_role1,
1612                      struct rtw_phl_mcc_role *m_role2)
1613 {
1614 	bool ret = false;
1615 	struct bb_mcc_i mi_1 = {0}, mi_2 = {0};
1616 
1617 	mi_1.type = m_role1->wrole->type;
1618 	mi_1.self_macid = (u8)m_role1->macid;
1619 	mi_1.chandef = m_role1->chandef;
1620 	mi_1.macid_bitmap = m_role1->used_macid.bitmap;
1621 	mi_1.macid_map_len = m_role1->used_macid.len;
1622 
1623 	mi_2.type = m_role2->wrole->type;
1624 	mi_2.self_macid = (u8)m_role2->macid;
1625 	mi_2.chandef = m_role2->chandef;
1626 	mi_2.macid_bitmap = m_role2->used_macid.bitmap;
1627 	mi_2.macid_map_len = m_role2->used_macid.len;
1628 
1629 	ret = halbb_mcc_start(hal_info->bb, &mi_1, &mi_2);
1630 
1631 	if (ret == true)
1632 		return RTW_HAL_STATUS_SUCCESS;
1633 	else
1634 		return RTW_HAL_STATUS_FAILURE;
1635 }
1636 #endif
1637 
1638 
1639 #else /*ifndef USE_TRUE_PHY*/
rtw_hal_bb_band_to_phy_idx(struct rtw_hal_com_t * hal_com,u8 band_idx)1640 enum phl_phy_idx rtw_hal_bb_band_to_phy_idx(struct rtw_hal_com_t *hal_com, u8 band_idx)
1641 {
1642 	return HW_PHY_0;
1643 }
1644 
rtw_hal_bb_dfs_en(struct hal_info_t * hal_info,bool en)1645 void rtw_hal_bb_dfs_en(struct hal_info_t *hal_info, bool en)
1646 {
1647 }
1648 
rtw_hal_bb_tssi_cont_en(struct hal_info_t * hal_info,bool en,enum rf_path path)1649 void rtw_hal_bb_tssi_cont_en(struct hal_info_t *hal_info, bool en, enum rf_path path)
1650 {
1651 }
1652 
rtw_hal_bb_adc_en(struct hal_info_t * hal_info,bool en)1653 void rtw_hal_bb_adc_en(struct hal_info_t *hal_info, bool en)
1654 {
1655 }
1656 
rtw_hal_bb_reset_en(struct hal_info_t * hal_info,bool en,enum phl_phy_idx phy_idx)1657 void rtw_hal_bb_reset_en(struct hal_info_t *hal_info, bool en, enum phl_phy_idx phy_idx)
1658 {
1659 }
rtw_hal_bb_proc_cmd(struct hal_info_t * hal_info,struct rtw_proc_cmd * incmd,char * output,u32 out_len)1660 bool rtw_hal_bb_proc_cmd(struct hal_info_t *hal_info, struct rtw_proc_cmd *incmd,
1661 			 char *output, u32 out_len)
1662 {
1663 	return true;
1664 }
1665 
rtw_hal_bb_watchdog(struct hal_info_t * hal_info,u8 is_lps)1666 enum rtw_hal_status rtw_hal_bb_watchdog(struct hal_info_t *hal_info, u8 is_lps)
1667 {
1668 	return RTW_HAL_STATUS_SUCCESS;
1669 }
1670 
rtw_hal_bb_simple_watchdog(struct hal_info_t * hal_info,u8 io_en)1671 enum rtw_hal_status rtw_hal_bb_simple_watchdog(struct hal_info_t *hal_info, u8 io_en)
1672 {
1673 	return RTW_HAL_STATUS_SUCCESS;
1674 }
1675 
rtw_hal_bb_reset(struct hal_info_t * hal_info)1676 void rtw_hal_bb_reset(struct hal_info_t *hal_info)
1677 {
1678 }
1679 
rtw_hal_bb_fw_edcca(struct hal_info_t * hal_info)1680 void rtw_hal_bb_fw_edcca(struct hal_info_t *hal_info)
1681 {
1682 }
1683 
rtw_hal_bb_dm_init(struct hal_info_t * hal_info)1684 void rtw_hal_bb_dm_init(struct hal_info_t *hal_info)
1685 {
1686 }
1687 
rtw_hal_bb_dm_deinit(struct rtw_phl_com_t * phl_com,struct hal_info_t * hal_info)1688 void rtw_hal_bb_dm_deinit(struct rtw_phl_com_t *phl_com, struct hal_info_t *hal_info)
1689 {
1690 }
1691 
rtw_hal_bb_ctrl_rx_cca(struct rtw_hal_com_t * hal_com,bool cca_en,enum phl_phy_idx phy_idx)1692 enum rtw_hal_status rtw_hal_bb_ctrl_rx_cca(struct rtw_hal_com_t *hal_com,
1693 	bool cca_en, enum phl_phy_idx phy_idx)
1694 {
1695 	return RTW_HAL_STATUS_SUCCESS;
1696 }
1697 
rtw_hal_bb_ctrl_dbcc(struct hal_info_t * hal_info,bool dbcc_en)1698 enum rtw_hal_status rtw_hal_bb_ctrl_dbcc(struct hal_info_t *hal_info, bool dbcc_en)
1699 {
1700 	return RTW_HAL_STATUS_SUCCESS;
1701 }
1702 
rtw_hal_bb_cfg_dbcc(struct hal_info_t * hal_info,bool dbcc_en)1703 enum rtw_hal_status rtw_hal_bb_cfg_dbcc(struct hal_info_t *hal_info, bool dbcc_en)
1704 {
1705 	return RTW_HAL_STATUS_SUCCESS;
1706 }
1707 
rtw_hal_bb_init(struct rtw_phl_com_t * phl_com,struct hal_info_t * hal_info)1708 u32 rtw_hal_bb_init(struct rtw_phl_com_t *phl_com, struct hal_info_t *hal_info)
1709 {
1710 	return RTW_HAL_STATUS_SUCCESS;
1711 }
1712 
rtw_hal_bb_deinit(struct rtw_phl_com_t * phl_com,struct hal_info_t * hal_info)1713 void rtw_hal_bb_deinit(struct rtw_phl_com_t *phl_com,
1714 		       struct hal_info_t *hal_info)
1715 {
1716 }
1717 
rtw_hal_init_bb_reg(struct hal_info_t * hal_info)1718 void rtw_hal_init_bb_reg(struct hal_info_t *hal_info)
1719 {
1720 }
1721 
rtw_hal_bb_init_reg_by_hdr(struct hal_info_t * hal_info,u32 * folder_array,u32 folder_len,u8 is_form_folder,enum phl_phy_idx phy_idx)1722 void rtw_hal_bb_init_reg_by_hdr(struct hal_info_t *hal_info, u32 *folder_array,
1723 				u32 folder_len, u8 is_form_folder, enum phl_phy_idx phy_idx)
1724 
1725 {
1726 }
1727 
rtw_hal_read_rf_reg(struct rtw_hal_com_t * hal_com,enum rf_path path,u32 addr,u32 mask)1728 u32 rtw_hal_read_rf_reg(struct rtw_hal_com_t *hal_com,
1729 			enum rf_path path, u32 addr, u32 mask)
1730 {
1731 	return RTW_HAL_STATUS_SUCCESS;
1732 }
1733 
rtw_hal_write_rf_reg(struct rtw_hal_com_t * hal_com,enum rf_path path,u32 addr,u32 mask,u32 data)1734 bool rtw_hal_write_rf_reg(struct rtw_hal_com_t *hal_com,
1735 			  enum rf_path path, u32 addr, u32 mask, u32 data)
1736 {
1737 	return RTW_HAL_STATUS_SUCCESS;
1738 }
1739 
rtw_hal_read_bb_reg(struct rtw_hal_com_t * hal_com,u32 addr,u32 mask)1740 u32 rtw_hal_read_bb_reg(struct rtw_hal_com_t *hal_com,
1741 			u32 addr, u32 mask)
1742 {
1743 	return RTW_HAL_STATUS_SUCCESS;
1744 }
1745 
rtw_hal_write_bb_reg(struct rtw_hal_com_t * hal_com,u32 addr,u32 mask,u32 data)1746 bool rtw_hal_write_bb_reg(struct rtw_hal_com_t *hal_com,
1747 			  u32 addr, u32 mask, u32 data)
1748 {
1749 	return true;
1750 }
1751 
rtw_hal_bb_read_cr(struct rtw_hal_com_t * hal_com,u32 addr,u32 mask)1752 u32 rtw_hal_bb_read_cr(struct rtw_hal_com_t *hal_com, u32 addr, u32 mask)
1753 {
1754 	return RTW_HAL_STATUS_SUCCESS;
1755 }
1756 
rtw_hal_bb_write_cr(struct rtw_hal_com_t * hal_com,u32 addr,u32 mask,u32 data)1757 bool rtw_hal_bb_write_cr(struct rtw_hal_com_t *hal_com, u32 addr, u32 mask,
1758 			 u32 data)
1759 {
1760 	return true;
1761 }
1762 
1763 enum rtw_hal_status
rtw_hal_bb_stainfo_init(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1764 rtw_hal_bb_stainfo_init(struct hal_info_t *hal_info,
1765 			struct rtw_phl_stainfo_t *sta)
1766 {
1767 	return RTW_HAL_STATUS_SUCCESS;
1768 }
1769 
1770 enum rtw_hal_status
rtw_hal_bb_stainfo_deinit(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1771 rtw_hal_bb_stainfo_deinit(struct hal_info_t *hal_info,
1772 			  struct rtw_phl_stainfo_t *sta)
1773 {
1774 	return RTW_HAL_STATUS_SUCCESS;
1775 }
1776 
1777 enum rtw_hal_status
rtw_hal_bb_stainfo_add(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1778 rtw_hal_bb_stainfo_add(struct hal_info_t *hal_info,
1779 		       struct rtw_phl_stainfo_t *sta)
1780 {
1781 	return RTW_HAL_STATUS_SUCCESS;
1782 }
1783 
1784 enum rtw_hal_status
rtw_hal_bb_stainfo_delete(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1785 rtw_hal_bb_stainfo_delete(struct hal_info_t *hal_info,
1786 			  struct rtw_phl_stainfo_t *sta)
1787 {
1788 	return RTW_HAL_STATUS_SUCCESS;
1789 }
1790 
rtw_hal_bb_media_status_update(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta,bool is_connected)1791 void rtw_hal_bb_media_status_update(struct hal_info_t *hal_info,
1792 			struct rtw_phl_stainfo_t *sta, bool is_connected)
1793 {
1794 }
1795 
1796 enum rtw_hal_status
rtw_hal_bb_upt_ramask(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1797 rtw_hal_bb_upt_ramask(struct hal_info_t *hal_info,
1798 		      struct rtw_phl_stainfo_t *sta)
1799 {
1800 	return RTW_HAL_STATUS_SUCCESS;
1801 }
1802 
1803 enum rtw_hal_status
rtw_hal_bb_ra_register(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1804 rtw_hal_bb_ra_register(struct hal_info_t *hal_info,
1805 		       struct rtw_phl_stainfo_t *sta)
1806 {
1807 	return RTW_HAL_STATUS_SUCCESS;
1808 }
1809 
1810 enum rtw_hal_status
rtw_hal_bb_ra_deregister(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1811 rtw_hal_bb_ra_deregister(struct hal_info_t *hal_info,
1812 			 struct rtw_phl_stainfo_t *sta)
1813 {
1814 	return RTW_HAL_STATUS_SUCCESS;
1815 }
1816 
1817 enum rtw_hal_status
rtw_hal_bb_ra_update(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1818 rtw_hal_bb_ra_update(struct hal_info_t *hal_info,
1819 		     struct rtw_phl_stainfo_t *sta)
1820 {
1821 	return RTW_HAL_STATUS_SUCCESS;
1822 }
1823 
rtw_hal_bb_get_arfr_idx(struct hal_info_t * hal_info,struct rtw_phl_stainfo_t * sta)1824 u8 rtw_hal_bb_get_arfr_idx(struct hal_info_t *hal_info,
1825 			   struct rtw_phl_stainfo_t *sta)
1826 {
1827 	return RTW_HAL_STATUS_SUCCESS;
1828 }
1829 
1830 enum rtw_hal_status
rtw_hal_bb_get_efuse_info(struct rtw_hal_com_t * hal_com,u8 * efuse_map,enum rtw_efuse_info info_type,void * value,u8 size,u8 map_valid)1831 rtw_hal_bb_get_efuse_info(struct rtw_hal_com_t *hal_com, u8 *efuse_map,
1832 			  enum rtw_efuse_info info_type, void *value,
1833 			  u8 size, u8 map_valid)
1834 {
1835 	return RTW_HAL_STATUS_SUCCESS;
1836 }
1837 
hal_get_primary_channel_idx(u8 pri_ch,u8 central_ch,enum channel_width bw,enum chan_offset bw_offset)1838 u8 hal_get_primary_channel_idx(u8 pri_ch, u8 central_ch, enum channel_width bw,
1839 			       enum chan_offset bw_offset)
1840 {
1841 	return 0;
1842 }
1843 
rtw_hal_bb_set_ch_bw(struct hal_info_t * hal_info,enum phl_phy_idx phy_idx,u8 pri_ch,u8 central_ch_seg0,u8 central_ch_seg1,enum band_type band,enum channel_width bw)1844 enum rtw_hal_status rtw_hal_bb_set_ch_bw(struct hal_info_t *hal_info,
1845 					 enum phl_phy_idx phy_idx,
1846 					 u8 pri_ch,
1847 					 u8 central_ch_seg0,
1848 					 u8 central_ch_seg1,
1849 					 enum band_type band,
1850 					 enum channel_width bw)
1851 {
1852 	return RTW_HAL_STATUS_SUCCESS;
1853 }
1854 
rtw_hal_in_radar_domain(void * hal,u8 ch,enum channel_width bw)1855 bool rtw_hal_in_radar_domain(void *hal, u8 ch, enum channel_width bw)
1856 {
1857 	return RTW_HAL_STATUS_SUCCESS;
1858 }
1859 
1860 enum rtw_hal_status
rtw_hal_bb_dfs_rpt_cfg(struct hal_info_t * hal_info,bool dfs_en)1861 rtw_hal_bb_dfs_rpt_cfg(struct hal_info_t *hal_info, bool dfs_en)
1862 {
1863 	return RTW_HAL_STATUS_SUCCESS;
1864 }
1865 
rtw_hal_bb_radar_detect(struct hal_info_t * hal_info,struct hal_dfs_rpt * hal_dfs)1866 bool rtw_hal_bb_radar_detect(struct hal_info_t *hal_info,
1867 			     struct hal_dfs_rpt *hal_dfs)
1868 {
1869 	return RTW_HAL_STATUS_SUCCESS;
1870 }
1871 
1872 enum rtw_hal_status
rtw_hal_bb_ctrl_btg(struct rtw_hal_com_t * hal_com,bool btg)1873 rtw_hal_bb_ctrl_btg(struct rtw_hal_com_t *hal_com, bool btg)
1874 {
1875 	return RTW_HAL_STATUS_SUCCESS;
1876 }
1877 
1878 enum rtw_hal_status
rtw_hal_bb_ctrl_btc_preagc(struct rtw_hal_com_t * hal_com,bool bt_en)1879 rtw_hal_bb_ctrl_btc_preagc(struct rtw_hal_com_t *hal_com, bool bt_en)
1880 {
1881 	return RTW_HAL_STATUS_SUCCESS;
1882 }
1883 
1884 enum rtw_hal_status
rtw_hal_bb_cfg_rx_path(struct rtw_hal_com_t * hal_com,u8 rx_path)1885 rtw_hal_bb_cfg_rx_path(struct rtw_hal_com_t *hal_com, u8 rx_path)
1886 {
1887 	return RTW_HAL_STATUS_SUCCESS;
1888 }
1889 
1890 enum rtw_hal_status
rtw_hal_bb_cfg_tx_path(struct rtw_hal_com_t * hal_com,u8 tx_path)1891 rtw_hal_bb_cfg_tx_path(struct rtw_hal_com_t *hal_com, u8 tx_path)
1892 {
1893 	return RTW_HAL_STATUS_SUCCESS;
1894 }
1895 
rtw_hal_bb_get_rx_ok(struct hal_info_t * hal_info,u8 cur_phy_idx,u32 * rx_ok)1896 enum rtw_hal_status  rtw_hal_bb_get_rx_ok(struct hal_info_t *hal_info,
1897 					  u8 cur_phy_idx, u32 *rx_ok)
1898 {
1899 	return RTW_HAL_STATUS_SUCCESS;
1900 }
1901 
rtw_hal_bb_get_rx_crc(struct hal_info_t * hal_info,u8 cur_phy_idx,u32 * rx_crc_err)1902 enum rtw_hal_status  rtw_hal_bb_get_rx_crc(struct hal_info_t *hal_info,
1903 					   u8 cur_phy_idx, u32 *rx_crc_err)
1904 {
1905 	return RTW_HAL_STATUS_SUCCESS;
1906 }
1907 
rtw_hal_bb_set_reset_cnt(void * hal)1908 enum rtw_hal_status  rtw_hal_bb_set_reset_cnt(void *hal)
1909 {
1910 	return RTW_HAL_STATUS_SUCCESS;
1911 }
1912 
1913 enum rtw_hal_status
rtw_hal_bb_set_power(struct rtw_hal_com_t * hal_com,s16 power_dbm,enum phl_phy_idx phy_idx)1914 rtw_hal_bb_set_power(struct rtw_hal_com_t *hal_com, s16 power_dbm,
1915 		     enum phl_phy_idx phy_idx)
1916 {
1917 	return RTW_HAL_STATUS_SUCCESS;
1918 }
1919 
1920 enum rtw_hal_status
rtw_hal_bb_get_power(struct rtw_hal_com_t * hal_com,s16 * power_dbm,enum phl_phy_idx phy_idx)1921 rtw_hal_bb_get_power(struct rtw_hal_com_t *hal_com, s16 *power_dbm,
1922 		     enum phl_phy_idx phy_idx)
1923 {
1924 	return RTW_HAL_STATUS_SUCCESS;
1925 }
1926 
1927 enum rtw_hal_status
rtw_hal_bb_set_pwr_index(void * hal,u16 pwr_idx,enum rf_path tx_path,bool is_cck)1928 rtw_hal_bb_set_pwr_index(void *hal, u16 pwr_idx, enum rf_path tx_path, bool is_cck)
1929 {
1930 	return RTW_HAL_STATUS_SUCCESS;
1931 }
1932 
rtw_hal_bb_get_pwr_index(void * hal,u16 * pwr_idx,enum rf_path tx_path,bool is_cck)1933 enum rtw_hal_status rtw_hal_bb_get_pwr_index(void *hal, u16 *pwr_idx,
1934 					     enum rf_path tx_path, bool is_cck)
1935 {
1936 	return RTW_HAL_STATUS_SUCCESS;
1937 }
1938 
1939 enum rtw_hal_status
rtw_hal_bb_set_plcp_tx(struct rtw_hal_com_t * hal_com,struct mp_plcp_param_t * plcp_tx_struct,struct mp_usr_plcp_gen_in * plcp_usr_info,enum phl_phy_idx plcp_phy_idx,u8 * plcp_sts)1940 rtw_hal_bb_set_plcp_tx(struct rtw_hal_com_t *hal_com,
1941 						struct mp_plcp_param_t *plcp_tx_struct,
1942 						struct mp_usr_plcp_gen_in *plcp_usr_info,
1943 						enum phl_phy_idx plcp_phy_idx,
1944 						u8 *plcp_sts)
1945 {
1946 	return RTW_HAL_STATUS_SUCCESS;
1947 }
1948 
1949 enum rtw_hal_status
rtw_hal_bb_set_pmac_cont_tx(struct rtw_hal_com_t * hal_com,u8 enable,u8 is_cck,enum phl_phy_idx phy_idx)1950 rtw_hal_bb_set_pmac_cont_tx(struct rtw_hal_com_t *hal_com, u8 enable,
1951 			    u8 is_cck, enum phl_phy_idx phy_idx)
1952 {
1953 	return RTW_HAL_STATUS_SUCCESS;
1954 }
1955 
1956 enum rtw_hal_status
rtw_hal_bb_set_pmac_packet_tx(struct rtw_hal_com_t * hal_com,u8 enable,u8 is_cck,u16 tx_cnt,u16 period,u16 tx_time,enum phl_phy_idx phy_idx)1957 rtw_hal_bb_set_pmac_packet_tx(struct rtw_hal_com_t *hal_com, u8 enable,
1958 			      u8 is_cck, u16 tx_cnt ,u16 period, u16 tx_time,
1959 			      enum phl_phy_idx phy_idx)
1960 {
1961 	return RTW_HAL_STATUS_SUCCESS;
1962 }
1963 
1964 enum rtw_hal_status
rtw_hal_bb_set_pmac_fw_trigger_tx(struct rtw_hal_com_t * hal_com,u8 enable,u8 is_cck,u16 tx_cnt,u8 tx_duty,enum phl_phy_idx phy_idx)1965 rtw_hal_bb_set_pmac_fw_trigger_tx(struct rtw_hal_com_t *hal_com, u8 enable,
1966 				  u8 is_cck, u16 tx_cnt, u8 tx_duty,
1967 				  enum phl_phy_idx phy_idx)
1968 {
1969 	return RTW_HAL_STATUS_SUCCESS;
1970 }
1971 
1972 enum rtw_hal_status
rtw_hal_bb_parse_phy_sts(void * hal,void * ppdu_sts,struct rtw_phl_rx_pkt * phl_rx,u8 is_su)1973 rtw_hal_bb_parse_phy_sts(void *hal, void *ppdu_sts,
1974 			 struct rtw_phl_rx_pkt *phl_rx, u8 is_su)
1975 {
1976 	return RTW_HAL_STATUS_SUCCESS;
1977 }
1978 
rtw_hal_bb_get_tx_ok(void * hal,u8 cur_phy_idx,u32 * tx_ok)1979 enum rtw_hal_status rtw_hal_bb_get_tx_ok(void *hal, u8 cur_phy_idx, u32 *tx_ok)
1980 {
1981 	return RTW_HAL_STATUS_SUCCESS;
1982 }
1983 
1984 enum rtw_hal_status
rtw_hal_bb_get_txpwr_ref(struct hal_info_t * hal_info,u8 is_cck,u8 tx_path,s16 * txpwr_ref)1985 rtw_hal_bb_get_txpwr_ref(struct hal_info_t *hal_info, u8 is_cck, u8 tx_path,
1986 			 s16 *txpwr_ref)
1987 {
1988 	return RTW_HAL_STATUS_SUCCESS;
1989 }
1990 
rtw_hal_bb_get_rssi(struct hal_info_t * hal_info,enum rf_path rx_path,u8 * rssi)1991 enum rtw_hal_status rtw_hal_bb_get_rssi(struct hal_info_t *hal_info,
1992 					enum rf_path rx_path, u8 *rssi)
1993 {
1994 	return RTW_HAL_STATUS_SUCCESS;
1995 }
1996 
rtw_hal_bb_get_rssi_ex(struct hal_info_t * hal_info,enum rf_path rx_path,s16 * rssi,u8 cur_phy_idx)1997 enum rtw_hal_status rtw_hal_bb_get_rssi_ex(struct hal_info_t *hal_info,
1998 					enum rf_path rx_path, s16 *rssi, u8 cur_phy_idx)
1999 {
2000 	return RTW_HAL_STATUS_SUCCESS;
2001 }
2002 
rtw_hal_bb_get_rxevm(struct hal_info_t * hal_info,u8 user,u8 strm,u8 rxevm_table,u8 * rx_evm)2003 enum rtw_hal_status rtw_hal_bb_get_rxevm(struct hal_info_t *hal_info, u8 user,
2004 					 u8 strm, u8 rxevm_table, u8 *rx_evm)
2005 {
2006 	return RTW_HAL_STATUS_SUCCESS;
2007 }
2008 
rtw_hal_bb_trigger_rxevm(struct hal_info_t * hal_info,u8 cur_phy_idx,u32 * phy0_user0_rxevm,u32 * phy0_user1_rxevm,u32 * phy0_user2_rxevm,u32 * phy0_user3_rxevm,u32 * phy1_user0_rxevm,u32 * phy1_user1_rxevm,u32 * phy1_user2_rxevm,u32 * phy1_user3_rxevm)2009 enum rtw_hal_status rtw_hal_bb_trigger_rxevm(struct hal_info_t *hal_info, u8 cur_phy_idx,
2010 	u32 *phy0_user0_rxevm, u32 *phy0_user1_rxevm, u32 *phy0_user2_rxevm, u32 *phy0_user3_rxevm,
2011 	u32 *phy1_user0_rxevm, u32 *phy1_user1_rxevm, u32 *phy1_user2_rxevm, u32 *phy1_user3_rxevm)
2012 {
2013 	return RTW_HAL_STATUS_SUCCESS;
2014 }
2015 
2016 /* mode: 0 = tmac, 1 = pmac */
2017 enum rtw_hal_status
rtw_hal_bb_tx_mode_switch(struct rtw_hal_com_t * hal_com,enum phl_phy_idx phy_idx,u8 mode)2018 rtw_hal_bb_tx_mode_switch(struct rtw_hal_com_t *hal_com,
2019 			  enum phl_phy_idx phy_idx, u8 mode)
2020 {
2021 	return RTW_HAL_STATUS_SUCCESS;
2022 }
2023 
rtw_hal_bb_set_txsc(struct hal_info_t * hal_info,u8 txsc,enum phl_phy_idx phy_idx)2024 enum rtw_hal_status rtw_hal_bb_set_txsc(struct hal_info_t *hal_info, u8 txsc,
2025 					enum phl_phy_idx phy_idx)
2026 {
2027 	return RTW_HAL_STATUS_FAILURE;
2028 }
2029 
rtw_hal_bb_get_txsc(struct rtw_hal_com_t * hal_com,u8 pri_ch,u8 central_ch,enum channel_width cbw,enum channel_width dbw)2030 u8 rtw_hal_bb_get_txsc(struct rtw_hal_com_t *hal_com, u8 pri_ch,
2031 		       u8 central_ch, enum channel_width cbw, enum channel_width dbw)
2032 {
2033 	return 0;
2034 }
2035 
rtw_hal_bb_process_c2h(void * hal,struct rtw_c2h_info * c2h)2036 u32 rtw_hal_bb_process_c2h(void *hal, struct rtw_c2h_info *c2h)
2037 {
2038 	return 0;
2039 }
2040 
2041 #ifdef CONFIG_DBCC_SUPPORT
2042 enum rtw_hal_status
rtw_hal_phy_dbcc_pre_cfg(struct hal_info_t * hal_info,struct rtw_phl_com_t * phl_com,bool dbcc_en)2043 rtw_hal_phy_dbcc_pre_cfg(struct hal_info_t *hal_info,
2044 			struct rtw_phl_com_t *phl_com, bool dbcc_en)
2045 {
2046 	return RTW_HAL_STATUS_SUCCESS;
2047 }
2048 enum rtw_hal_status
rtw_hal_phy_dbcc_cfg(struct hal_info_t * hal_info,struct rtw_phl_com_t * phl_com,bool dbcc_en)2049 rtw_hal_phy_dbcc_cfg(struct hal_info_t *hal_info,
2050 			struct rtw_phl_com_t *phl_com, bool dbcc_en)
2051 {
2052 	return RTW_HAL_STATUS_SUCCESS;
2053 }
2054 #endif
2055 
2056 enum rtw_hal_status
rtw_hal_bb_get_txinfo_power(struct hal_info_t * hal_info,s16 * txinfo_power_dbm)2057 rtw_hal_bb_get_txinfo_power(struct hal_info_t *hal_info,
2058 					s16 *txinfo_power_dbm)
2059 {
2060 	return RTW_HAL_STATUS_SUCCESS;
2061 }
2062 
2063 enum rtw_hal_status
rtw_hal_bb_ctrl_rf_mode(struct hal_info_t * hal_info,enum phl_rf_mode rf_mode)2064 rtw_hal_bb_ctrl_rf_mode(struct hal_info_t *hal_info,
2065 					enum phl_rf_mode rf_mode){
2066 	return RTW_HAL_STATUS_SUCCESS;
2067 }
2068 
2069 enum rtw_hal_status
rtw_hal_bb_set_sta_id(struct hal_info_t * hal_info,u16 staid,enum phl_phy_idx phy_idx)2070 rtw_hal_bb_set_sta_id(struct hal_info_t *hal_info,
2071 	u16 staid, enum phl_phy_idx phy_idx)
2072 {
2073 	return RTW_HAL_STATUS_SUCCESS;
2074 }
2075 
2076 enum rtw_hal_status
rtw_hal_bb_set_bss_color(struct hal_info_t * hal_info,u8 bsscolor,enum phl_phy_idx phy_idx)2077 rtw_hal_bb_set_bss_color(struct hal_info_t *hal_info,
2078 	u8 bsscolor, enum phl_phy_idx phy_idx)
2079 {
2080 	return RTW_HAL_STATUS_SUCCESS;
2081 }
2082 
2083 #ifdef RTW_WKARD_DEF_CMACTBL_CFG
2084 enum rtw_hal_status
rtw_hal_bb_trx_path_cfg(struct hal_info_t * hal_info,enum rf_path tx,u8 tx_nss,enum rf_path rx,u8 rx_nss)2085 rtw_hal_bb_trx_path_cfg(struct hal_info_t *hal_info,
2086 		enum rf_path tx, u8 tx_nss, enum rf_path rx, u8 rx_nss)
2087 {
2088 	return RTW_HAL_STATUS_SUCCESS;
2089 }
2090 
rtw_hal_bb_cfg_cmac_tx_ant(struct hal_info_t * hal_info,enum rf_path tx_path)2091 u16 rtw_hal_bb_cfg_cmac_tx_ant(struct hal_info_t *hal_info,
2092 	enum rf_path tx_path)
2093 {
2094 	return 0;
2095 }
2096 #endif
2097 
2098 enum rtw_hal_status
rtw_hal_bb_backup_info(struct rtw_hal_com_t * hal_com,u8 cur_phy_idx)2099 rtw_hal_bb_backup_info(struct rtw_hal_com_t *hal_com, u8 cur_phy_idx)
2100 {
2101 	return RTW_HAL_STATUS_SUCCESS;
2102 }
2103 
2104 enum rtw_hal_status
rtw_hal_bb_restore_info(struct rtw_hal_com_t * hal_com,u8 cur_phy_idx)2105 rtw_hal_bb_restore_info(struct rtw_hal_com_t *hal_com, u8 cur_phy_idx)
2106 {
2107 	return RTW_HAL_STATUS_SUCCESS;
2108 }
2109 
rtw_hal_bb_set_tx_pow_ref(struct rtw_hal_com_t * hal_com,enum phl_phy_idx phy_idx)2110 void rtw_hal_bb_set_tx_pow_ref(struct rtw_hal_com_t *hal_com,
2111 			       enum phl_phy_idx phy_idx)
2112 {
2113 }
2114 
2115 enum rtw_hal_status
rtw_hal_bb_tssi_bb_reset(struct rtw_hal_com_t * hal_com)2116 rtw_hal_bb_tssi_bb_reset(struct rtw_hal_com_t *hal_com)
2117 {
2118 	return RTW_HAL_STATUS_SUCCESS;
2119 }
2120 
2121 #ifdef CONFIG_RTW_ACS
rtw_hal_bb_acs_mntr_trigger(struct hal_info_t * hal_info,u16 monitor_time)2122 void rtw_hal_bb_acs_mntr_trigger(struct hal_info_t *hal_info, u16 monitor_time)
2123 {
2124 
2125 }
2126 
rtw_hal_bb_acs_mntr_result(struct hal_info_t * hal_info,void * rpt)2127 enum rtw_hal_status rtw_hal_bb_acs_mntr_result(struct hal_info_t *hal_info, void *rpt)
2128 {
2129 	return RTW_HAL_STATUS_FAILURE;
2130 }
2131 #endif /* CONFIG_RTW_ACS */
2132 #ifdef RTW_WKARD_DYNAMIC_BFEE_CAP
rtw_hal_bb_dcr_en(struct hal_info_t * hal_info,bool en)2133 void rtw_hal_bb_dcr_en(struct hal_info_t *hal_info, bool en)
2134 {
2135 	return;
2136 }
2137 
rtw_hal_bb_csi_rsp(struct hal_info_t * hal_info)2138 bool rtw_hal_bb_csi_rsp(struct hal_info_t *hal_info)
2139 {
2140 	return true;
2141 }
2142 
2143 
2144 #endif
2145 
rtw_hal_bb_get_efuse_init(struct rtw_hal_com_t * hal_com)2146 void rtw_hal_bb_get_efuse_init(struct rtw_hal_com_t *hal_com)
2147 {
2148 
2149 }
2150 
rtw_hal_bb_notification(struct hal_info_t * hal_info,enum phl_msg_evt_id event,enum phl_phy_idx phy_idx)2151 void rtw_hal_bb_notification(struct hal_info_t *hal_info,
2152                              enum phl_msg_evt_id event,
2153                              enum phl_phy_idx phy_idx)
2154 {
2155 
2156 }
2157 
rtw_hal_bb_cmd_notification(struct hal_info_t * hal_info,void * hal_cmd,enum phl_phy_idx phy_idx)2158 void rtw_hal_bb_cmd_notification(struct hal_info_t *hal_info,
2159                              void *hal_cmd,
2160                              enum phl_phy_idx phy_idx)
2161 {
2162 
2163 }
2164 
2165 enum rtw_hal_status
rtw_hal_bb_set_dpd_bypass(struct rtw_hal_com_t * hal_com,bool pdp_bypass,enum phl_phy_idx phy_idx)2166 rtw_hal_bb_set_dpd_bypass(struct rtw_hal_com_t *hal_com, bool pdp_bypass,
2167 						enum phl_phy_idx phy_idx)
2168 {
2169 	return RTW_HAL_STATUS_SUCCESS;
2170 }
2171 
2172 
2173 enum rtw_hal_status
rtw_hal_bb_set_gain_offset(struct hal_info_t * hal_info,s8 rx_gain_offset,enum rf_path rx_path,enum phl_phy_idx phy_idx,u8 iscck)2174 rtw_hal_bb_set_gain_offset(struct hal_info_t *hal_info, s8 rx_gain_offset,
2175 				enum rf_path rx_path, enum phl_phy_idx phy_idx, u8 iscck)
2176 {
2177 	return RTW_HAL_STATUS_SUCCESS;
2178 }
2179 
2180 
rtw_hal_bb_check_tx_idle(struct hal_info_t * hal_info,enum phl_phy_idx phy_idx)2181 bool rtw_hal_bb_check_tx_idle(struct hal_info_t *hal_info, enum phl_phy_idx phy_idx)
2182 {
2183 	return false;
2184 }
2185 
2186 enum rtw_hal_status
rtw_hal_bb_ic_hw_setting_init(struct hal_info_t * hal_info)2187 rtw_hal_bb_ic_hw_setting_init(struct hal_info_t *hal_info)
2188 {
2189 
2190 	return RTW_HAL_STATUS_FAILURE;
2191 }
2192 
2193 enum rtw_hal_status
rtw_hal_bb_query_rainfo(void * hal,struct rtw_hal_stainfo_t * hal_sta,struct rtw_phl_rainfo * phl_rainfo)2194 rtw_hal_bb_query_rainfo(void *hal, struct rtw_hal_stainfo_t *hal_sta,
2195 			struct rtw_phl_rainfo *phl_rainfo)
2196 {
2197 	return RTW_HAL_STATUS_FAILURE;
2198 }
2199 
2200 
rtw_hal_bb_nhm_mntr_result(struct rtw_hal_com_t * hal_com,void * rpt,enum phl_phy_idx phy_idx)2201 void rtw_hal_bb_nhm_mntr_result(struct rtw_hal_com_t *hal_com, void *rpt, enum phl_phy_idx phy_idx)
2202 {
2203 
2204 }
2205 
2206 
rtw_hal_bb_set_pow_patten_sharp(struct rtw_hal_com_t * hal_com,u8 channel,u8 is_cck,u8 sharp_id,enum phl_phy_idx phy_idx)2207 void rtw_hal_bb_set_pow_patten_sharp(struct rtw_hal_com_t *hal_com, u8 channel, u8 is_cck, u8 sharp_id, enum phl_phy_idx phy_idx)
2208 {
2209 
2210 }
2211 
rtw_hal_bb_env_rpt(struct rtw_hal_com_t * hal_com,struct rtw_env_report * env_rpt,enum phl_phy_idx phy_indx)2212 void rtw_hal_bb_env_rpt(struct rtw_hal_com_t *hal_com, struct rtw_env_report *env_rpt,
2213 					 enum phl_phy_idx phy_indx)
2214 {
2215 
2216 }
2217 
2218 
2219 enum rtw_hal_status
rtw_hal_bb_set_tb_pwr_ofst(struct hal_info_t * hal_info,s16 ofst,enum phl_phy_idx phy_idx)2220 rtw_hal_bb_set_tb_pwr_ofst(struct hal_info_t *hal_info,
2221 			s16 ofst, enum phl_phy_idx phy_idx)
2222 {
2223 	return RTW_HAL_STATUS_SUCCESS;
2224 }
2225 
2226 #ifdef CONFIG_MCC_SUPPORT
2227 enum rtw_hal_status
rtw_hal_bb_upd_mcc_macid(struct hal_info_t * hal_info,struct rtw_phl_mcc_role * mrole)2228 rtw_hal_bb_upd_mcc_macid(struct hal_info_t *hal_info,
2229                          struct rtw_phl_mcc_role *mrole)
2230 {
2231 	return RTW_HAL_STATUS_SUCCESS;
2232 }
2233 
2234 void
rtw_hal_bb_mcc_stop(struct hal_info_t * hal_info)2235 rtw_hal_bb_mcc_stop(struct hal_info_t *hal_info)
2236 {
2237 
2238 }
2239 
2240 enum rtw_hal_status
rtw_hal_bb_mcc_start(struct hal_info_t * hal_info,struct rtw_phl_mcc_role * m_role1,struct rtw_phl_mcc_role * m_role2)2241 rtw_hal_bb_mcc_start(struct hal_info_t *hal_info,
2242                      struct rtw_phl_mcc_role *m_role1,
2243                      struct rtw_phl_mcc_role *m_role2)
2244 {
2245 	return RTW_HAL_STATUS_SUCCESS;
2246 }
2247 #endif
2248 #endif /*ifdef USE_TRUE_PHY*/
2249