xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/phl/phl_api.h (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 #ifndef _PHL_API_H_
16 #define _PHL_API_H_
17 
18 u8 rtw_phl_read8(void *phl, u32 addr);
19 u16 rtw_phl_read16(void *phl, u32 addr);
20 u32 rtw_phl_read32(void *phl, u32 addr);
21 void rtw_phl_write8(void *phl, u32 addr, u8 val);
22 void rtw_phl_write16(void *phl, u32 addr, u16 val);
23 void rtw_phl_write32(void *phl, u32 addr, u32 val);
24 
25 u32 rtw_phl_read_macreg(void *phl, u32 offset, u32 bit_mask);
26 void rtw_phl_write_macreg(void *phl,
27 			u32 offset, u32 bit_mask, u32 data);
28 u32 rtw_phl_read_bbreg(void *phl, u32 offset, u32 bit_mask);
29 void rtw_phl_write_bbreg(void *phl,
30 			u32 offset, u32 bit_mask, u32 data);
31 u32 rtw_phl_read_rfreg(void *phl,
32 			enum rf_path path, u32 offset, u32 bit_mask);
33 void rtw_phl_write_rfreg(void *phl,
34 			enum rf_path path, u32 offset, u32 bit_mask, u32 data);
35 enum rtw_phl_status rtw_phl_interrupt_handler(void *phl);
36 void rtw_phl_enable_interrupt(void *phl);
37 void rtw_phl_disable_interrupt(void *phl);
38 bool rtw_phl_recognize_interrupt(void *phl);
39 void rtw_phl_clear_interrupt(void *phl);
40 void rtw_phl_restore_interrupt(void *phl);
41 
42 
43 #ifdef PHL_PLATFORM_LINUX
44 void rtw_phl_mac_reg_dump(void *sel, void *phl);
45 void rtw_phl_bb_reg_dump(void *sel, void *phl);
46 void rtw_phl_bb_reg_dump_ex(void *sel, void *phl);
47 void rtw_phl_rf_reg_dump(void *sel, void *phl);
48 #endif
49 bool rtw_phl_get_sec_cam(void *phl, u16 num, u8 *buf, u16 size);
50 bool rtw_phl_get_addr_cam(void *phl, u16 num, u8 *buf, u16 size);
51 
52 struct rtw_phl_com_t *rtw_phl_get_com(void *phl);
53 enum rtw_phl_status rtw_phl_init(void *drv_priv, void **phl,
54 					struct rtw_ic_info *ic_info);
55 void rtw_phl_deinit(void *phl);
56 
57 void rtw_phl_watchdog_init(void *phl,
58                            u16 period,
59                            void (*core_sw_wdog)(void *drv_priv),
60                            void (*core_hw_wdog)(void *drv_priv));
61 void rtw_phl_watchdog_deinit(void *phl);
62 void rtw_phl_watchdog_start(void *phl);
63 void rtw_phl_watchdog_stop(void *phl);
64 
65 enum rtw_phl_status rtw_phl_trx_alloc(void *phl);
66 void rtw_phl_trx_free(void *phl);
67 void rtw_phl_trx_free_handler(void *phl);
68 void rtw_phl_trx_free_sw_rsc(void *phl);
69 void rtw_phl_cap_pre_config(void *phl);
70 enum rtw_phl_status rtw_phl_preload(void *phl);
71 enum rtw_phl_status rtw_phl_start(void *phl);
72 void rtw_phl_stop(void *phl);
73 bool rtw_phl_is_init_completed(void *phl);
74 
75 void rtw_phl_ps_set_rt_cap(void *phl, u8 band_idx, bool ps_allow, enum phl_ps_rt_rson rt_rson);
76 enum rtw_phl_status rtw_phl_ps_set_rf_state(void *phl, u8 band_idx, enum rtw_rf_state rf_state);
77 
78 enum rtw_phl_status rtw_phl_suspend(void *phl, struct rtw_phl_stainfo_t *sta, u8 wow_en);
79 enum rtw_phl_status rtw_phl_resume(void *phl, struct rtw_phl_stainfo_t *sta, u8 *hw_reinit);
80 
81 enum rtw_phl_status rtw_phl_tx_req_notify(void *phl);
82 enum rtw_phl_status rtw_phl_add_tx_req(void *phl, struct rtw_xmit_req *tx_req);
83 void rtw_phl_tx_stop(void *phl);
84 void rtw_phl_tx_resume(void *phl);
85 u16 rtw_phl_tring_rsc(void *phl, u16 macid, u8 tid);
86 u16 rtw_phl_query_new_rx_num(void *phl);
87 struct rtw_recv_pkt *rtw_phl_query_rx_pkt(void *phl);
88 
89 void rtw_phl_rx_deferred_In_token(void *phl);
90 void rtw_phl_post_in_complete(void *phl, void *rxobj, u32 inbuf_len, u8 status_code);
91 enum rtw_phl_status rtw_phl_return_rxbuf(void *phl, u8* rxpkt);
92 
93 enum rtw_phl_status  rtw_phl_recycle_tx_buf(void *phl, u8 *tx_buf_ptr);
94 
95 enum rtw_phl_status
96 rtw_phl_cmd_cfg_ampdu(void *phl,
97 			struct rtw_wifi_role_t *wrole,
98 			struct rtw_phl_stainfo_t *sta,
99 			enum phl_cmd_type cmd_type,
100 			u32 cmd_timeout);
101 
102 void rtw_phl_proc_cmd(void *phl, char proc_cmd,
103 	struct rtw_proc_cmd *incmd, char *output, u32 out_len);
104 
105 void rtw_phl_get_fw_ver(void *phl, char *ver_str, u16 len);
106 
107 enum rtw_fw_status rtw_phl_get_fw_status(void *phl);
108 
109 /* command thread jobs */
110 enum rtw_phl_status rtw_phl_job_run_func(void *phl,
111 	void *func, void *priv, void *parm, char *name);
112 
113 /*WIFI Role management section*/
114 u8 rtw_phl_wifi_role_alloc(void *phl, u8 *mac_addr, enum role_type type,
115 				u8 ridx, struct rtw_wifi_role_t **wifi_role, bool ignore_hw_fail);
116 
117 enum rtw_phl_status
118 rtw_phl_cmd_wrole_change(void *phl,
119 				struct rtw_wifi_role_t *wrole,
120 				enum wr_chg_id chg_id, u8 *chg_info, u8 chg_info_len,
121 				enum phl_cmd_type cmd_type, u32 cmd_timeout);
122 
123 void rtw_phl_wifi_role_free(void *phl, u8 role_idx);
124 
125 /*WIFI sta_info management section*/
126 struct rtw_phl_stainfo_t *
127 rtw_phl_alloc_stainfo_sw(void *phl,
128                          u8 *sta_addr,
129                          struct rtw_wifi_role_t *wrole);
130 
131 enum rtw_phl_status
132 rtw_phl_free_stainfo_sw(void *phl, struct rtw_phl_stainfo_t *sta);
133 
134 enum rtw_phl_status
135 rtw_phl_cmd_alloc_stainfo(void *phl,
136                           struct rtw_phl_stainfo_t **sta,
137                           u8 *sta_addr,
138                           struct rtw_wifi_role_t *wrole,
139                           bool alloc,
140                           bool only_hw,
141                           enum phl_cmd_type cmd_type,
142                           u32 cmd_timeout);
143 
144 enum rtw_phl_status
145 rtw_phl_cmd_change_stainfo(void *phl,
146 	struct rtw_phl_stainfo_t *sta, enum sta_chg_id chg_id,
147 	u8 *chg_info, u8 chg_info_len,
148 	enum phl_cmd_type cmd_type, u32 cmd_timeout);
149 
150 enum rtw_phl_status
151 rtw_phl_cmd_update_media_status(void *phl,
152                                 struct rtw_phl_stainfo_t *sta,
153                                 u8 *sta_addr,
154                                 bool is_connect,
155                                 enum phl_cmd_type cmd_type,
156                                 u32 cmd_timeout);
157 
158 struct rtw_phl_stainfo_t *
159 rtw_phl_get_stainfo_self(void *phl, struct rtw_wifi_role_t *wrole);
160 
161 struct rtw_phl_stainfo_t *
162 rtw_phl_get_stainfo_by_addr(void *phl, struct rtw_wifi_role_t *wrole, u8 *addr);
163 
164 struct rtw_phl_stainfo_t *
165 rtw_phl_get_stainfo_by_macid(void *phl, u16 macid);
166 
167 u8
168 rtw_phl_get_sta_rssi(struct rtw_phl_stainfo_t *sta);
169 
170 enum rtw_phl_status
171 rtw_phl_query_rainfo(void *phl, struct rtw_phl_stainfo_t *phl_sta,
172 		     struct rtw_phl_rainfo *ra_info);
173 enum rtw_phl_status
174 rtw_phl_get_rx_stat(void *phl, struct rtw_phl_stainfo_t *phl_sta,
175 		     u16 *rx_rate, u8 *bw, u8 *gi_ltf);
176 
177 void rtw_phl_sta_up_rx_bcn(void *phl, struct rtw_bcn_pkt_info *info);
178 
179 /*macid management section, temporary for debuge*/
180 u16
181 rtw_phl_get_macid_max_num(void *phl);
182 
183 u16
184 rtw_phl_wrole_bcmc_id_get(void *phl, struct rtw_wifi_role_t *wrole);
185 
186 u8
187 rtw_phl_macid_is_bmc(void *phl, u16 macid);
188 
189 u8
190 rtw_phl_macid_is_used(void *phl, u16 macid);
191 
192 enum rtw_phl_status
193 rtw_phl_cmd_add_key(void *phl,
194                     struct rtw_phl_stainfo_t *sta,
195                     struct phl_sec_param_h *crypt,
196                     u8 *keybuf,
197                     enum phl_cmd_type cmd_type,
198                     u32 cmd_timeout);
199 
200 enum rtw_phl_status
201 rtw_phl_cmd_del_key(void *phl,
202                     struct rtw_phl_stainfo_t *sta,
203                     struct phl_sec_param_h *crypt,
204                     enum phl_cmd_type cmd_type,
205                     u32 cmd_timeout);
206 /* phy msg forwarder functions*/
207 enum rtw_phl_status rtw_phl_msg_hub_register_recver(void* phl,
208 		struct phl_msg_receiver* ctx, enum phl_msg_recver_layer layer);
209 enum rtw_phl_status rtw_phl_msg_hub_update_recver_mask(void* phl,
210 		enum phl_msg_recver_layer layer, u8* mdl_id, u32 len, u8 clr);
211 enum rtw_phl_status rtw_phl_msg_hub_deregister_recver(void* phl,
212 					enum phl_msg_recver_layer layer);
213 enum rtw_phl_status rtw_phl_msg_hub_send(void* phl,
214 		struct phl_msg_attribute* attr, struct phl_msg* msg);
215 
216 
217 u8 rtw_phl_trans_sec_mode(u8 unicast, u8 multicast);
218 
219 u8 rtw_phl_get_sec_cam_idx(void *phl, struct rtw_phl_stainfo_t *sta,
220 			u8 keyid, u8 key_type);
221 
222 void rtw_phl_test_txtb_cfg(struct rtw_phl_com_t* phl_com, void *buf,
223 	u32 buf_len, u8 *cfg_bssid, u16 cfg_aid, u8 cfg_bsscolor);
224 /* command dispatcher module section*/
225 enum rtw_phl_status rtw_phl_register_module(void *phl, u8 band_idx,
226 					enum phl_module_id id,
227 					struct phl_bk_module_ops* ops);
228 enum rtw_phl_status rtw_phl_deregister_module(void *phl,u8 band_idx,
229 					enum phl_module_id id);
230 u8 rtw_phl_is_fg_empty(void *phl, u8 band_idx);
231 /* opt: refer to enum phl_msg_opt */
232 enum rtw_phl_status rtw_phl_send_msg_to_dispr(void *phl, struct phl_msg* msg,
233 					      struct phl_msg_attribute* attr, u32* msg_hdl);
234 enum rtw_phl_status rtw_phl_cancel_dispr_msg(void *phl, u8 band_idx, u32* msg_hdl);
235 
236 enum rtw_phl_status rtw_phl_add_cmd_token_req(void *phl, u8 band_idx,
237 				struct phl_cmd_token_req* req, u32* req_hdl);
238 enum rtw_phl_status rtw_phl_cancel_cmd_token(void *phl, u8 band_idx, u32* req_hdl);
239 enum rtw_phl_status rtw_phl_set_cur_cmd_info(void *phl, u8 band_idx,
240 					       struct phl_module_op_info* op_info);
241 enum rtw_phl_status rtw_phl_query_cur_cmd_info(void *phl, u8 band_idx,
242 					       struct phl_module_op_info* op_info);
243 
244 enum rtw_phl_status rtw_phl_free_cmd_token(void *phl, u8 band_idx, u32* req_hdl);
245 enum rtw_phl_status rtw_phl_set_bk_module_info(void *phl, u8 band_idx,
246 		enum phl_module_id id,	struct phl_module_op_info* op_info);
247 enum rtw_phl_status rtw_phl_query_bk_module_info(void *phl, u8 band_idx,
248 		enum phl_module_id id,	struct phl_module_op_info* op_info);
249 enum rtw_phl_status rtw_phl_set_msg_disp_seq(void *phl,
250 						struct phl_msg_attribute *attr,
251 						struct msg_self_def_seq* seq);
252 
253 /* BA session management */
254 void rtw_phl_stop_rx_ba_session(void *phl, struct rtw_phl_stainfo_t *sta,
255 				u16 tid);
256 enum rtw_phl_status
257 rtw_phl_start_rx_ba_session(void *phl, struct rtw_phl_stainfo_t *sta,
258 			    u8 dialog_token, u16 timeout, u16 start_seq_num,
259 			    u16 ba_policy, u16 tid, u16 buf_size);
260 void rtw_phl_rx_bar(void *phl, struct rtw_phl_stainfo_t *sta, u8 tid, u16 seq);
261 void rtw_phl_flush_reorder_buf(void *phl, struct rtw_phl_stainfo_t *sta);
262 enum rtw_phl_status
263 rtw_phl_enter_mon_mode(void *phl, struct rtw_wifi_role_t *wrole);
264 enum rtw_phl_status
265 rtw_phl_leave_mon_mode(void *phl, struct rtw_wifi_role_t *wrole);
266 #ifdef RTW_PHL_BCN
267 enum rtw_phl_status rtw_phl_free_bcn_entry(void *phl, struct rtw_wifi_role_t *wrole);
268 enum rtw_phl_status
269 rtw_phl_cmd_issue_beacon(void *phl,
270 				struct rtw_wifi_role_t *wifi_role,
271 				struct rtw_bcn_info_cmn *bcn_cmn,
272 				enum phl_cmd_type cmd_type,
273 				u32 cmd_timeout);
274 enum rtw_phl_status
275 rtw_phl_cmd_stop_beacon(void *phl,
276 				struct rtw_wifi_role_t *wifi_role,
277 				u8 stop,
278 				enum phl_cmd_type cmd_type,
279 				u32 cmd_timeout);
280 #endif
281 
282 #ifdef CONFIG_CMD_DISP
283 enum rtw_phl_status
284 rtw_phl_cmd_chg_op_chdef(struct rtw_wifi_role_t *wrole,
285 	struct rtw_chan_def *new_chdef, bool cmd_wait, u32 cmd_timeout,
286 	void (*chg_opch_done)(void *priv, u8 ridx, enum rtw_phl_status status));
287 
288 
289 enum rtw_phl_status
290 rtw_phl_cmd_set_ch_bw(struct rtw_wifi_role_t *wifi_role,
291                       struct rtw_chan_def *chdef,
292                       bool do_rfk,
293                       enum phl_cmd_type cmd_type,
294                       u32 cmd_timeout);
295 
296 enum rtw_phl_status
297 rtw_phl_cmd_enqueue(void *phl,
298                     enum phl_band_idx band_idx,
299                     enum phl_msg_evt_id evt_id,
300                     u8 *cmd_buf,
301                     u32 cmd_len,
302                     void (*core_cmd_complete)(void *priv, u8 *cmd, u32 cmd_len, enum rtw_phl_status status),
303                     enum phl_cmd_type cmd_type,
304                     u32 cmd_timeout);
305 
306 #endif /*CONFIG_CMD_DISP*/
307 
308 u8 rtw_phl_get_cur_ch(struct rtw_wifi_role_t *wifi_role);
309 enum rtw_phl_status
310 rtw_phl_get_cur_hal_chdef(struct rtw_wifi_role_t *wifi_role,
311 					struct rtw_chan_def *cur_chandef);
312 
313 enum band_type rtw_phl_get_band_type(u8 chan);
314 u8 rtw_phl_get_center_ch(u8 ch,
315 	enum channel_width bw, enum chan_offset offset);
316 
317 enum rtw_phl_status
318 rtw_phl_cmd_dfs_tx_pause(struct rtw_wifi_role_t *wifi_role, bool pause,
319                       		enum phl_cmd_type cmd_type, u32 cmd_timeout);
320 
321 u8
322 rtw_phl_get_operating_class(
323 	struct rtw_chan_def chan_def
324 );
325 
326 bool
327 rtw_phl_get_chandef_from_operating_class(
328 	u8 channel,
329 	u8 operating_class,
330 	struct rtw_chan_def *chan_def
331 );
332 /*
333  * export API from sw cap module
334  */
335 void rtw_phl_final_cap_decision(void *phl);
336 
337 
338 enum rtw_phl_status
339 rtw_phl_get_dft_proto_cap(void *phl, u8 hw_band, enum role_type rtype,
340 				struct protocol_cap_t *role_proto_cap);
341 enum rtw_phl_status
342 rtw_phl_get_dft_cap(void *phl, u8 hw_band, struct role_cap_t *role_cap);
343 
344 void rtw_phl_mac_dbg_status_dump(void *phl, u32 *val, u8 *en);
345 
346 #ifdef CONFIG_DBCC_SUPPORT
347 enum rtw_phl_status
348 rtw_phl_dbcc_test(void *phl, enum dbcc_test_id id, void *param);
349 #endif
350 /*
351  * API for config channel info CR
352  */
353 #ifdef CONFIG_PHL_CHANNEL_INFO
354 enum rtw_phl_status
355 rtw_phl_cmd_cfg_chinfo(void *phl, struct rtw_phl_stainfo_t *sta,
356 		      u8 enable, enum phl_cmd_type cmd_type, u32 cmd_timeout);
357 enum rtw_phl_status rtw_phl_query_chan_info(void *phl, u32 buf_len,
358 	u8* chan_info_buffer, u32 *length, struct csi_header_t *csi_header);
359 #endif /* CONFIG_PHL_CHANNEL_INFO */
360 
361 void rtw_phl_set_edcca_mode(void *phl, enum rtw_edcca_mode mode);
362 enum rtw_edcca_mode rtw_phl_get_edcca_mode(void *phl);
363 
364 bool rtw_phl_set_user_def_chplan(void *phl, struct rtw_user_def_chplan *udef);
365 bool rtw_phl_valid_regulation_domain(u8 domain);
366 bool rtw_phl_regulation_set_domain(void *phl, u8 domain,
367 				       	enum regulation_rsn reason);
368 bool rtw_phl_regulation_set_country(void *phl, char *country,
369 					enum regulation_rsn reason);
370 bool rtw_phl_regulation_set_capability(void *phl,
371 		enum rtw_regulation_capability capability);
372 bool rtw_phl_regulation_query_chplan(
373 			void *phl, enum rtw_regulation_query type,
374 			struct rtw_chlist *filter,
375 			struct rtw_regulation_chplan *plan);
376 bool rtw_phl_query_specific_chplan(void *phl, u8 domain,
377 			struct rtw_regulation_chplan *plan);
378 bool rtw_phl_query_country_chplan(char *country,
379 			struct rtw_regulation_country_chplan *country_chplan);
380 bool rtw_phl_generate_scan_instance(struct instance_strategy *strategy,
381 				struct rtw_regulation_chplan *chplan,
382 				struct instance *inst);
383 bool rtw_phl_scan_instance_insert_ch(void *phl, struct instance *inst,
384 					enum band_type band, u8 channel,
385 						u8 strategy_period);
386 bool rtw_phl_regulation_valid_channel(void *phl, enum band_type band,
387 					u16 channel, u8 reject);
388 bool rtw_phl_regulation_dfs_channel(void *phl, enum band_type band,
389 					u16 channel, bool *dfs);
390 bool rtw_phl_query_regulation_info(void *phl, struct rtw_regulation_info *info);
391 bool rtw_phl_regulation_query_ch(void *phl, enum band_type band, u8 channel,
392 					struct rtw_regulation_channel *ch);
393 u8 rtw_phl_get_domain_regulation_2g(u8 domain);
394 u8 rtw_phl_get_domain_regulation_5g(u8 domain);
395 
396 enum rtw_phl_status rtw_phl_get_mac_addr_efuse(void* phl, u8 *addr);
397 
398 /**
399  * rtw_phl_usb_tx_ep_id - query  USB tx end point index
400  * identified by macid, tid and band
401  * @macid: input target macid is 0 ~ 127
402 * @tid: input target tid, range is 0 ~ 7
403  * @band: input target band, 0 for band 0 / 1 for band 1
404  *
405  * returns corresponding end point idx of a specific tid
406  */
407 u8 rtw_phl_usb_tx_ep_id(void *phl, u16 macid, u8 tid, u8 band);
408 
409 enum rtw_phl_status
410 rtw_phl_cfg_trx_path(void* phl, enum rf_path tx, u8 tx_nss,
411 		     enum rf_path rx, u8 rx_nss);
412 
413 void rtw_phl_reset_stat_ma_rssi(struct rtw_phl_com_t *phl_com);
414 
415 u8
416 rtw_phl_get_ma_rssi(struct rtw_phl_com_t *phl_com,
417 		    enum rtw_rssi_type rssi_type);
418 
419 bool rtw_phl_chanctx_chk(void *phl, struct rtw_wifi_role_t *wifi_role,
420 		u8 chan, enum channel_width bw, enum chan_offset offset);
421 bool rtw_phl_chanctx_add(void *phl, struct rtw_wifi_role_t *wifi_role,
422 		u8 *chan, enum channel_width *bw, enum chan_offset *offset);
423 int rtw_phl_chanctx_del(void *phl, struct rtw_wifi_role_t *wifi_role,
424 						struct rtw_chan_def *chan_def);
425 enum rtw_phl_status rtw_phl_chanctx_del_no_self(void *phl, struct rtw_wifi_role_t *wifi_role);
426 int rtw_phl_mr_get_chanctx_num(void *phl, struct rtw_wifi_role_t *wifi_role);
427 enum rtw_phl_status rtw_phl_mr_get_chandef(void *phl, struct rtw_wifi_role_t *wifi_role,
428 							struct rtw_chan_def *chandef);
429 enum rtw_phl_status rtw_phl_mr_upt_chandef(void *phl, struct rtw_wifi_role_t *wifi_role);
430 
431 #ifdef CONFIG_MCC_SUPPORT
432 u8 rtw_phl_mr_query_mcc_inprogress (void *phl, struct rtw_wifi_role_t *wrole,
433 							enum rtw_phl_mcc_chk_inprocess_type check_type);
434 #endif
435 
436 u8 rtw_phl_mr_dump_mac_addr(void *phl,
437 					struct rtw_wifi_role_t *wifi_role);
438 u8 rtw_phl_mr_buddy_dump_mac_addr(void *phl,
439 					struct rtw_wifi_role_t *wifi_role);
440 enum rtw_phl_status
441 rtw_phl_mr_rx_filter(void *phl, struct rtw_wifi_role_t *wrole);
442 
443 #ifdef CONFIG_FSM
444 enum rtw_phl_status
445 rtw_phl_mr_offch_hdl(void *phl,
446 		     struct rtw_wifi_role_t *wrole,
447 		     bool off_ch,
448 		     void *obj_priv,
449 		     u8 (*issue_null_data)(void *priv, u8 ridx, bool ps),
450 		     struct rtw_chan_def *chandef);
451 #endif
452 void rtw_phl_mr_ops_init (void *phl, struct rtw_phl_mr_ops *mr_ops);
453 
454 #ifdef	PHL_MR_PROC_CMD
455 void rtw_phl_mr_dump_info(void *phl, bool show_caller);
456 void rtw_phl_mr_dump_band_ctl(void *phl, bool show_caller);
457 bool rtw_phl_chanctx_test(void *phl, struct rtw_wifi_role_t *wifi_role, bool is_add,
458 		u8 *chan, enum channel_width *bw, enum chan_offset *offset);
459 #endif
460 void rtw_phl_sta_dump_info(void *phl, bool show_caller, struct rtw_wifi_role_t *wr, u8 mode);
461 
462 bool rtw_phl_mr_query_info(void *phl, struct rtw_wifi_role_t *wrole,
463 				struct mr_query_info *info);
464 
465 u8 rtw_phl_mr_get_opch_list(void *phl, struct rtw_wifi_role_t *wifi_role,
466 				struct rtw_chan_def *chdef_list, u8 list_size);
467 
468 void rtw_phl_mr_dump_cur_chandef(void *phl, struct rtw_wifi_role_t *wifi_role);
469 
470 enum mr_op_mode
471 rtw_phl_mr_get_opmode(void *phl, struct rtw_wifi_role_t *wrole);
472 
473 void rtw_phl_led_set_ctrl_mode(void *phl, enum rtw_led_id led_id,
474 			       enum rtw_led_ctrl_mode ctrl_mode);
475 void rtw_phl_led_set_toggle_intervals(void *phl, u8 intervals_idx,
476 				      u32 *intervals, u8 intervals_len);
477 void rtw_phl_led_set_action(void *phl, enum rtw_led_event event,
478 			    enum rtw_led_state state_condition,
479 			    struct rtw_led_action_args_t *action_args_arr,
480 			    u8 action_args_arr_len, u32 toggle_delay_unit);
481 void rtw_phl_led_control(void *phl, enum rtw_led_event led_event);
482 
483 #ifdef CONFIG_RTW_ACS
484 u16 rtw_phl_acs_get_channel_by_idx(void *phl, u8 ch_idx);
485 u8 rtw_phl_acs_get_clm_ratio_by_idx(void *phl, u8 ch_idx);
486 s8  rtw_phl_noise_query_by_idx(void *phl, u8 ch_idx);
487 #endif /* CONFIG_RTW_ACS */
488 
489 void rtw_phl_get_env_rpt(void *phl, struct rtw_env_report *env_rpt, struct rtw_wifi_role_t *wrole);
490 
491 #ifdef RTW_WKARD_DYNAMIC_BFEE_CAP
492 enum rtw_phl_status
493 rtw_phl_bfee_ctrl(void *phl, struct rtw_wifi_role_t *wrole, bool ctrl);
494 #endif
495 
496 enum rtw_phl_status
497 rtw_phl_snd_init_ops_send_ndpa(void *phl,
498                                enum rtw_phl_status (*snd_send_ndpa)(void *,
499                                                                   struct rtw_wifi_role_t *,
500                                                                   u8 *,
501                                                                   u32 *,
502                                                                   enum channel_width));
503 
504 u8 rtw_phl_snd_chk_in_progress(void *phl);
505 
506 enum rtw_phl_status
507 rtw_phl_sound_start(void *phl, u8 wrole_idx, u8 st_dlg_tkn, u8 period, u8 test_flag);
508 
509 enum rtw_phl_status
510 rtw_phl_sound_abort(void *phl);
511 
512 enum rtw_phl_status
513 rtw_phl_set_power_lmt(void *phl, u8 hw_band);
514 
515 s8 rtw_phl_get_power_limit(void *phl, u8 hw_band,
516 	u16 rate, u8 bandwidth, u8 beamforming, u8 tx_num, u8 channel);
517 
518 void
519 rtw_phl_enable_ext_pwr_lmt(void *phl, u8 hw_band,
520 	struct rtw_phl_ext_pwr_lmt_info *ext_pwr_lmt_info);
521 void
522 rtw_phl_set_ext_pwr_lmt_en(void *phl, bool enable);
523 
524 void rtw_phl_init_ppdu_sts_para(struct rtw_phl_com_t *phl_com,
525 				bool en_psts_per_pkt, bool psts_ampdu,
526 				u8 rx_fltr);
527 
528 enum rtw_phl_status rtw_phl_rf_on(void *phl);
529 enum rtw_phl_status rtw_phl_rf_off(void *phl);
530 
531 
532 #ifdef CONFIG_PHL_TWT
533 enum rtw_phl_status
534 rtw_phl_twt_alloc_twt_config(void *phl, struct rtw_wifi_role_t *role,
535 		struct rtw_phl_twt_setup_info setup_info, u8 benable, u8 *id);
536 
537 enum rtw_phl_status
538 rtw_phl_twt_free_twt_config(void *phl, u8 id);
539 
540 enum rtw_phl_status
541 rtw_phl_twt_enable_twt_config(void *phl, u8 id);
542 
543 enum rtw_phl_status
544 rtw_phl_twt_free_all_twt_by_role(void *phl, struct rtw_wifi_role_t *role);
545 
546 enum rtw_phl_status
547 rtw_phl_twt_disable_all_twt_by_role(void *phl, struct rtw_wifi_role_t *role);
548 
549 enum rtw_phl_status
550 rtw_phl_twt_enable_all_twt_by_role(void *phl, struct rtw_wifi_role_t *role);
551 
552 enum rtw_phl_status
553 rtw_phl_twt_add_sta_info(void *phl, struct rtw_phl_stainfo_t *phl_sta,
554 			u8 config_id, u8 id);
555 
556 enum rtw_phl_status
557 rtw_phl_twt_teardown_sta(void *phl, struct rtw_phl_stainfo_t *phl_sta,
558 			struct rtw_phl_twt_flow_field *twt_flow, u8 *bitmap);
559 
560 enum rtw_phl_status
561 rtw_phl_twt_get_new_flow_id(void *phl, struct rtw_phl_stainfo_t *phl_sta, u8 *id);
562 
563 
564 enum rtw_phl_status
565 rtw_phl_twt_accept_for_sta_mode(void *phl, struct rtw_phl_stainfo_t *phl_sta,
566 			struct rtw_phl_twt_setup_info *setup_info, u8 *id);
567 
568 enum rtw_phl_status
569 rtw_phl_twt_teardown_for_sta_mode(void *phl, struct rtw_phl_stainfo_t *phl_sta,
570 				struct rtw_phl_twt_flow_field *twt_flow);
571 
572 enum rtw_phl_status
573 rtw_phl_twt_delete_all_sta_info(void *phl, struct rtw_phl_stainfo_t *phl_sta,
574 				u8 *bitmap);
575 
576 enum rtw_phl_status
577 rtw_phl_twt_get_target_wake_time(void *phl, u8 port, u8 id, u16 offset, u32 *tsf_h,
578 				u32 *tsf_l);
579 
580 enum rtw_phl_status
581 rtw_phl_twt_sta_announce_to_fw(void *phl, u16 macid);
582 
583 enum rtw_phl_status
584 rtw_phl_twt_handle_c2h(void *phl_com, void *c);
585 
586 enum rtw_phl_status
587 rtw_phl_twt_fill_twt_element(struct rtw_phl_twt_element *twt_ele, u8 *buf,
588 								u8 *length);
589 
590 enum rtw_phl_status
591 rtw_phl_twt_fill_flow_field(struct rtw_phl_twt_flow_field *twt_flow, u8 *buf,
592 								u16 *length);
593 enum rtw_phl_status
594 rtw_phl_twt_parse_element(u8 *twt_ele, u16 length,
595 				struct rtw_phl_twt_element *twt_element);
596 
597 enum rtw_phl_status
598 rtw_phl_twt_parse_setup_info(u8 *pkt, u16 length,
599 				struct rtw_phl_twt_setup_info *setup_info);
600 
601 enum rtw_phl_status
602 rtw_phl_twt_parse_flow_field(u8 *ie_twt_flow, u16 length,
603 				struct rtw_phl_twt_flow_field *twt_flow);
604 #endif /* CONFIG_PHL_TWT */
605 
606 enum rtw_phl_status
607 rtw_phl_snd_cmd_set_vht_gid(void *phl,
608 			struct rtw_wifi_role_t *wrole,
609 			struct rtw_phl_gid_pos_tbl *tbl);
610 
611 enum rtw_phl_status
612 rtw_phl_snd_cmd_set_aid(void *phl,
613 			struct rtw_wifi_role_t *wrole,
614 			struct rtw_phl_stainfo_t *sta,
615 			u16 aid);
616 
617 #ifdef RTW_WKARD_P2PPS_REFINE
618 #ifdef CONFIG_PHL_P2PPS
619 enum rtw_phl_status
620 rtw_phl_p2pps_noa_update(void *phl, struct rtw_phl_noa_desc *in_desc);
621 
622 void
623 rtw_phl_p2pps_init_ops(void *phl, struct rtw_phl_p2pps_ops *ops);
624 
625 void rtw_phl_p2pps_noa_disable_all(void *phl, struct rtw_wifi_role_t *w_role);
626 #endif
627 #endif
628 enum rtw_phl_status
629 rtw_phl_snd_cmd_set_vht_gid(void *phl,
630 			struct rtw_wifi_role_t *wrole,
631 			struct rtw_phl_gid_pos_tbl *tbl);
632 
633 void rtw_phl_event_notify(void *phl, enum phl_msg_evt_id event,
634 			struct rtw_wifi_role_t *wrole);
635 void rtw_phl_notification(void *phl,
636                           enum phl_msg_evt_id event,
637                           struct rtw_wifi_role_t *wrole,
638                           bool direct);
639 void rtw_phl_dev_terminate_ntf(void *phl);
640 
641 enum rtw_phl_status
642 rtw_phl_cmd_force_usb_switch(void *phl, u32 speed,
643 				enum phl_band_idx band_idx,
644 				enum phl_cmd_type cmd_type, u32 cmd_timeout);
645 enum rtw_phl_status
646 rtw_phl_cmd_get_usb_speed(void *phl, u32* speed,
647 				enum phl_band_idx band_idx,
648 				enum phl_cmd_type cmd_type, u32 cmd_timeout);
649 enum rtw_phl_status
650 rtw_phl_cmd_get_usb_support_ability(void *phl, u32* ability,
651 				enum phl_band_idx band_idx,
652 				enum phl_cmd_type cmd_type, u32 cmd_timeout);
653 u8 rtw_phl_get_sta_mgnt_rssi(struct rtw_phl_stainfo_t *psta);
654 
655 enum rtw_phl_status
656 rtw_phl_txsts_rpt_config(void *phl, struct rtw_phl_stainfo_t *phl_sta);
657 
658 #if defined(CONFIG_USB_HCI) || defined(CONFIG_PCI_HCI)
659 /* tx_ok/tx_fail are from release report*/
660 enum rtw_phl_status
661 rtw_phl_get_tx_ok_rpt(void *phl, struct rtw_phl_stainfo_t *phl_sta, u32 *tx_ok_cnt,
662  enum phl_ac_queue qsel);
663 
664 enum rtw_phl_status
665 rtw_phl_get_tx_fail_rpt(void *phl, struct rtw_phl_stainfo_t *phl_sta, u32 *tx_fail_cnt,
666  enum phl_ac_queue qsel);
667 
668 /* tx retry is from ra sts report.*/
669 enum rtw_phl_status
670 rtw_phl_get_tx_retry_rpt(void *phl, struct rtw_phl_stainfo_t *phl_sta, u32 *tx_retry_cnt,
671  enum phl_ac_queue qsel);
672 #endif /* CONFIG_USB_HCI */
673 
674 enum rtw_rx_status rtw_phl_get_rx_status(void *phl);
675 
676 void rtw_phl_dbg_dump_rx(void *phl, struct rtw_wifi_role_t *wrole);
677 
678 /******************************************************************************
679  *
680  * TX power APIs
681  *
682  *****************************************************************************/
683 const char *rtw_phl_get_pw_lmt_regu_type_str(void *phl, enum band_type band);
684 
685 bool rtw_phl_get_pwr_lmt_en(void *phl, u8 band_idx);
686 
687 enum rtw_phl_status rtw_phl_set_tx_power(void *phl, u8 band_idx);
688 
689 enum rtw_phl_status rtw_phl_get_txinfo_pwr(void *phl, s16 *pwr_dbm);
690 /*****************************************************************************/
691 
692 u32 rtw_phl_get_phy_stat_info(void *phl, enum phl_band_idx hw_band,
693 			      enum phl_stat_info_query phy_stat);
694 #endif /*_PHL_API_H_*/
695 
696