xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852be/phl/phl_chan.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_CHANA_H_
16 #define _PHL_CHANA_H_
17 
18 u8 phl_chanctx_get_rnum(struct phl_info_t *phl_info,
19 					struct phl_queue *chan_ctx_queue,
20 					struct rtw_chan_ctx *chanctx);
21 
22 u8 phl_chanctx_get_rnum_with_lock(struct phl_info_t *phl_info,
23 			struct phl_queue *chan_ctx_queue,
24 			struct rtw_chan_ctx *chanctx);
25 
26 u8 phl_get_chanctx_rolemap(struct phl_info_t *phl_info, u8 band_idx);
27 
28 enum rtw_phl_status
29 phl_chanctx_free(struct phl_info_t *phl_info, struct hw_band_ctl_t *band_ctl);
30 
31 enum rtw_phl_status
32 phl_set_ch_bw(struct rtw_wifi_role_t *wifi_role,
33 		 struct rtw_chan_def *chdef, bool do_rfk);
34 
35 
36 bool rtw_phl_chanctx_add(void *phl, struct rtw_wifi_role_t *wifi_role,
37 		u8 *chan, enum channel_width *bw, enum chan_offset *offset);
38 
39 int rtw_phl_chanctx_del(void *phl, struct rtw_wifi_role_t *wifi_role,
40 						struct rtw_chan_def *chan_def);
41 
42 #ifdef CONFIG_CMD_DISP
43 enum rtw_phl_status
44 phl_cmd_chg_op_chdef_start_hdl(struct phl_info_t *phl, u8 *param);
45 
46 enum rtw_phl_status
47 phl_cmd_set_ch_bw_hdl(struct phl_info_t *phl_info, u8 *param);
48 enum rtw_phl_status
49 rtw_phl_cmd_set_ch_bw(struct rtw_wifi_role_t *wifi_role,
50                       struct rtw_chan_def *chdef,
51                       bool do_rfk,
52                       enum phl_cmd_type cmd_type,
53                       u32 cmd_timeout);
54 enum rtw_phl_status
55 phl_cmd_dfs_tx_pause_hdl(struct phl_info_t *phl_info, u8 *param);
56 #endif
57 
58 #ifdef DBG_PHL_CHAN
59 void phl_chan_dump_chandef(const char *caller, const int line, bool show_caller,
60 						struct rtw_chan_def *chandef);
61 #define PHL_DUMP_CHAN_DEF(_chandef) phl_chan_dump_chandef(__FUNCTION__, __LINE__, false, _chandef);
62 #define PHL_DUMP_CHAN_DEF_EX(_chandef) phl_chan_dump_chandef(__FUNCTION__, __LINE__, true, _chandef);
63 #else
64 #define PHL_DUMP_CHAN_DEF(_chandef)
65 #define PHL_DUMP_CHAN_DEF_EX(_chandef)
66 #endif
67 
68 #ifdef CONFIG_DBCC_SUPPORT
69 enum rtw_phl_status
70 rtw_phl_dbcc_test(void *phl, enum dbcc_test_id id, void *param);
71 #endif
72 
73 enum band_type rtw_phl_get_band_type(u8 chan);
74 u8 rtw_phl_get_center_ch(u8 ch,
75 	enum channel_width bw, enum chan_offset offset);
76 u8
77 rtw_phl_get_operating_class(
78 	struct rtw_chan_def chan_def
79 );
80 
81 bool
82 rtw_phl_get_chandef_from_operating_class(
83 	u8 channel,
84 	u8 operating_class,
85 	struct rtw_chan_def *chan_def
86 );
87 #endif /*_PHL_CHANA_H_*/
88