xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rtl8723bs/hal/phydm/phydm_dynamic_rx_path.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	__PHYDMDYMICRXPATH_H__
17 #define    __PHYDMDYMICRXPATH_H__
18 
19 #define DYNAMIC_RX_PATH_VERSION	"1.0"  /*2016.07.15  Dino */
20 
21 
22 #define	DRP_RSSI_TH	35
23 
24 #define INIT_DRP_TIMMER		0
25 #define CANCEL_DRP_TIMMER		1
26 #define RELEASE_DRP_TIMMER		2
27 
28 #if (RTL8822B_SUPPORT == 1)
29 struct drp_rtl8822b_struct {
30 	enum bb_path	path_judge;
31 	u16	path_a_cck_fa;
32 	u16	path_b_cck_fa;
33 
34 };
35 #endif
36 
37 #ifdef CONFIG_DYNAMIC_RX_PATH
38 
39 enum drp_state_e {
40 	DRP_INIT_STATE				= 0,
41 	DRP_TRAINING_STATE_0	= 1,
42 	DRP_TRAINING_STATE_1		= 2,
43 	DRP_TRAINING_STATE_2		= 3,
44 	DRP_DECISION_STATE		= 4
45 };
46 
47 enum adjustable_value_e {
48 	DRP_TRAINING_TIME		= 0,
49 	DRP_TRAINING_PERIOD	= 1,
50 	DRP_RSSI_THRESHOLD	= 2,
51 	DRP_FA_THRESHOLD		= 3,
52 	DRP_FA_DIFF_THRESHOLD = 4
53 };
54 
55 struct _DYNAMIC_RX_PATH_ {
56 	u8			curr_rx_path;
57 	u8			drp_state;
58 	u16			training_time;
59 	u8			rssi_threshold;
60 	u32			fa_count_thresold;
61 	u32			fa_diff_threshold;
62 	u32			curr_cca_all_cnt_0;
63 	u32			curr_fa_all_cnt_0;
64 	u32			curr_cca_all_cnt_1;
65 	u32			curr_fa_all_cnt_1;
66 	u32			curr_cca_all_cnt_2;
67 	u32			curr_fa_all_cnt_2;
68 	u8			drp_skip_counter;
69 	u8			drp_period;
70 	u8			drp_init_finished;
71 
72 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
73 #if USE_WORKITEM
74 	RT_WORK_ITEM	phydm_dynamic_rx_path_workitem;
75 #endif
76 #endif
77 	struct timer_list		phydm_dynamic_rx_path_timer;
78 
79 };
80 
81 
82 
83 void
84 phydm_process_phy_status_for_dynamic_rx_path(
85 	void			*p_dm_void,
86 	void			*p_phy_info_void,
87 	void			*p_pkt_info_void
88 );
89 
90 void
91 phydm_dynamic_rx_path(
92 	void			*p_dm_void
93 );
94 
95 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
96 void
97 phydm_dynamic_rx_path_callback(
98 	struct timer_list		*p_timer
99 );
100 
101 void
102 phydm_dynamic_rx_path_workitem_callback(
103 	void		*p_context
104 );
105 
106 #else if (DM_ODM_SUPPORT_TYPE == ODM_CE)
107 
108 void
109 phydm_dynamic_rx_path_callback(
110 	void *function_context
111 );
112 
113 #endif
114 
115 void
116 phydm_dynamic_rx_path_timers(
117 	void		*p_dm_void,
118 	u8		state
119 );
120 
121 void
122 phydm_dynamic_rx_path_init(
123 	void			*p_dm_void
124 );
125 
126 void
127 phydm_drp_debug(
128 	void		*p_dm_void,
129 	u32		*const dm_value,
130 	u32		*_used,
131 	char			*output,
132 	u32		*_out_len
133 );
134 
135 void
136 phydm_dynamic_rx_path_caller(
137 	void			*p_dm_void
138 );
139 
140 #endif
141 #endif
142