xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8723bs/hal/phydm/phydm_ccx.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2017 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 
16 #ifndef	__PHYDMCCX_H__
17 #define    __PHYDMCCX_H__
18 
19 #define CCX_EN 1
20 
21 #define IGI_TO_NHM_TH_MULTIPLIER	2
22 #define CCA_CAP	14
23 
24 
25 
26 enum nhm_setting {
27 	SET_NHM_SETTING,
28 	STORE_NHM_SETTING,
29 	RESTORE_NHM_SETTING
30 };
31 
32 enum nhm_inexclude_cca {
33 	NHM_EXCLUDE_CCA,
34 	NHM_INCLUDE_CCA
35 };
36 
37 enum nhm_inexclude_txon {
38 	NHM_EXCLUDE_TXON,
39 	NHM_INCLUDE_TXON
40 };
41 
42 
43 struct _CCX_INFO {
44 
45 	/*Settings*/
46 	u8					nhm_th[11];
47 	u16					nhm_period;				/* 4us per unit */
48 	u16					clm_period;				/* 4us per unit */
49 	enum nhm_inexclude_txon		nhm_inexclude_txon;
50 	enum nhm_inexclude_cca		nhm_inexclude_cca;
51 
52 	/*Previous Settings*/
53 	u8					nhm_th_restore[11];
54 	u16					nhm_period_restore;				/* 4us per unit */
55 	u16					clm_period_restore;				/* 4us per unit */
56 	enum nhm_inexclude_txon		nhm_inexclude_txon_restore;
57 	enum nhm_inexclude_cca		nhm_inexclude_cca_restore;
58 
59 	/*Report*/
60 	u8		nhm_result[12];
61 	u8		nhm_ratio;		/*1% per nuit, it means the interference igi can't overcome.*/
62 	u8		nhm_result_total;
63 	u16		nhm_duration;
64 	u16		clm_result;
65 	u8		clm_ratio;
66 
67 	boolean		echo_clm_en;
68 	u8			echo_igi;	/* nhm_result comes from this igi */
69 
70 };
71 
72 /*NHM*/
73 
74 void
75 phydm_nhm_init(
76 	void					*p_dm_void
77 );
78 
79 boolean
80 phydm_cal_nhm_cnt(
81 	void		*p_dm_void
82 );
83 
84 void
85 phydm_nhm_setting(
86 	void		*p_dm_void,
87 	u8	nhm_setting
88 );
89 
90 void
91 phydm_nhm_trigger(
92 	void		*p_dm_void
93 );
94 
95 void
96 phydm_get_nhm_result(
97 	void		*p_dm_void
98 );
99 
100 boolean
101 phydm_check_nhm_rdy(
102 	void		*p_dm_void
103 );
104 
105 /*CLM*/
106 
107 void
108 phydm_clm_setting(
109 	void			*p_dm_void
110 );
111 
112 void
113 phydm_clm_trigger(
114 	void			*p_dm_void
115 );
116 
117 boolean
118 phydm_check_clm_rdy(
119 	void			*p_dm_void
120 );
121 
122 void
123 phydm_get_clm_result(
124 	void			*p_dm_void
125 );
126 
127 void
128 phydm_ccx_monitor(
129 	void			*p_dm_void
130 );
131 
132 void
133 phydm_ccx_monitor_trigger(
134 	void			*p_dm_void,
135 	u16				monitor_time
136 );
137 
138 void
139 phydm_ccx_monitor_result(
140 	void			*p_dm_void
141 );
142 
143 void
144 phydm_set_nhm_th_by_igi(
145 	void			*p_dm_void,
146 	u8				igi
147 );
148 
149 #endif
150