xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/Hal8812PhyCfg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2017 Realtek Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  *****************************************************************************/
16 #ifndef __INC_HAL8812PHYCFG_H__
17 #define __INC_HAL8812PHYCFG_H__
18 
19 
20 /*--------------------------Define Parameters-------------------------------*/
21 #define LOOP_LIMIT				5
22 #define MAX_STALL_TIME			50		/* us */
23 #define AntennaDiversityValue	0x80	/* (Adapter->bSoftwareAntennaDiversity ? 0x00 : 0x80) */
24 #define MAX_TXPWR_IDX_NMODE_92S	63
25 #define Reset_Cnt_Limit			3
26 
27 
28 #ifdef CONFIG_PCI_HCI
29 	#define MAX_AGGR_NUM	0x0B
30 #else
31 	#define MAX_AGGR_NUM	0x07
32 #endif /* CONFIG_PCI_HCI */
33 
34 
35 /*--------------------------Define Parameters-------------------------------*/
36 
37 /*------------------------------Define structure----------------------------*/
38 
39 
40 /* BB/RF related */
41 
42 /*------------------------------Define structure----------------------------*/
43 
44 
45 /*------------------------Export global variable----------------------------*/
46 /*------------------------Export global variable----------------------------*/
47 
48 
49 /*------------------------Export Marco Definition---------------------------*/
50 /*------------------------Export Marco Definition---------------------------*/
51 
52 
53 /*--------------------------Exported Function prototype---------------------*/
54 /*
55  * BB and RF register read/write
56  *   */
57 u32	PHY_QueryBBReg8812(PADAPTER	Adapter,
58 				u32			RegAddr,
59 				u32			BitMask);
60 void	PHY_SetBBReg8812(PADAPTER		Adapter,
61 				u32			RegAddr,
62 				u32			BitMask,
63 				u32			Data);
64 u32	PHY_QueryRFReg8812(PADAPTER	Adapter,
65 				enum rf_path	eRFPath,
66 				u32			RegAddr,
67 				u32			BitMask);
68 void	PHY_SetRFReg8812(PADAPTER		Adapter,
69 				enum rf_path	eRFPath,
70 				u32			RegAddr,
71 				u32			BitMask,
72 				u32			Data);
73 
74 /*
75  * Initialization related function
76  *
77  * MAC/BB/RF HAL config */
78 int	PHY_MACConfig8812(PADAPTER	Adapter);
79 int	PHY_BBConfig8812(PADAPTER	Adapter);
80 void	PHY_BB8812_Config_1T(PADAPTER	Adapter);
81 int	PHY_RFConfig8812(PADAPTER	Adapter);
82 
83 /* RF config */
84 
85 s32
86 PHY_SwitchWirelessBand8812(
87 		PADAPTER		Adapter,
88 		u8			Band
89 );
90 
91 /*
92  * BB TX Power R/W
93  *   */
94 void	PHY_SetTxPowerLevel8812(PADAPTER	Adapter, u8	Channel);
95 
96 u8 PHY_GetTxPowerIndex_8812A(
97 		PADAPTER			pAdapter,
98 		enum rf_path			RFPath,
99 		u8					Rate,
100 		u8					BandWidth,
101 		u8					Channel,
102 	struct txpwr_idx_comp *tic
103 );
104 
105 u32 phy_get_tx_bb_swing_8812a(
106 		PADAPTER	Adapter,
107 		BAND_TYPE	Band,
108 		enum rf_path	RFPath
109 );
110 
111 void
112 PHY_SetTxPowerIndex_8812A(
113 		PADAPTER		Adapter,
114 		u32				PowerIndex,
115 		enum rf_path		RFPath,
116 		u8				Rate
117 );
118 
119 /*
120  * channel switch related funciton
121  *   */
122 void
123 PHY_SetSwChnlBWMode8812(
124 		PADAPTER			Adapter,
125 		u8					channel,
126 		enum channel_width	Bandwidth,
127 		u8					Offset40,
128 		u8					Offset80
129 );
130 
131 /*
132  * BB/MAC/RF other monitor API
133  *   */
134 
135 void
136 phy_set_rf_path_switch_8812a(
137 		struct dm_struct		*phydm,
138 		bool		bMain
139 );
140 
141 /*--------------------------Exported Function prototype---------------------*/
142 #endif /* __INC_HAL8192CPHYCFG_H */
143