hc
2024-05-08 f309769f8af08599af39b6de4f675784ce76530d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/******************************************************************************
 *
 * Copyright(c) 2007 - 2017  Realtek Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * The full GNU General Public License is included in this distribution in the
 * file called LICENSE.
 *
 * Contact Information:
 * wlanfae <wlanfae@realtek.com>
 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
 * Hsinchu 300, Taiwan.
 *
 * Larry Finger <Larry.Finger@lwfinger.net>
 *
 *****************************************************************************/
 
#ifndef __PHYDM_CCK_PD_H__
#define __PHYDM_CCK_PD_H__
 
/* 2019.12.25 decrease CS_ratio in 8822C due to Lenovo test result(PCIE-5136).*/
#define CCK_PD_VERSION "4.0"
 
/*@
 * 1 ============================================================
 * 1  Definition
 * 1 ============================================================
 */
#define CCK_FA_MA_RESET 0xffffffff
 
#define INVALID_CS_RATIO_0 0x1b /* @ only for type4 ICs*/
#define INVALID_CS_RATIO_1 0x1d /* @ only for type4 ICs*/
#define MAXVALID_CS_RATIO 0x1f
/*@Run time flag of CCK_PD HW type*/
#define CCK_PD_IC_TYPE1 (ODM_RTL8188E | ODM_RTL8812 | ODM_RTL8821 |\
           ODM_RTL8192E | ODM_RTL8723B | ODM_RTL8814A |\
           ODM_RTL8881A | ODM_RTL8822B | ODM_RTL8703B |\
           ODM_RTL8195A | ODM_RTL8188F)
 
#define CCK_PD_IC_TYPE2 (ODM_RTL8197F | ODM_RTL8821C | ODM_RTL8723D |\
           ODM_RTL8710B | ODM_RTL8195B) /*extend 0xaaa*/
 
#define CCK_PD_IC_TYPE3 (ODM_RTL8192F | ODM_RTL8721D | ODM_RTL8710C)
/*@extend for different bw & path*/
 
#define CCK_PD_IC_TYPE4 ODM_IC_JGR3_SERIES /*@extend for different bw & path*/
#define CCK_PD_IC_TYPE5 (ODM_RTL8723F) /*@extend for different CR*/
 
/*@Compile time flag of CCK_PD HW type*/
#if (RTL8188E_SUPPORT || RTL8812A_SUPPORT || RTL8821A_SUPPORT ||\
   RTL8192E_SUPPORT || RTL8723B_SUPPORT || RTL8814A_SUPPORT ||\
   RTL8881A_SUPPORT || RTL8822B_SUPPORT || RTL8703B_SUPPORT ||\
   RTL8195A_SUPPORT || RTL8188F_SUPPORT)
   #define PHYDM_COMPILE_CCKPD_TYPE1 /*@only 0xa0a*/
#endif
 
#if (RTL8197F_SUPPORT || RTL8821C_SUPPORT || RTL8723D_SUPPORT ||\
   RTL8710B_SUPPORT || RTL8195B_SUPPORT)
   #define PHYDM_COMPILE_CCKPD_TYPE2 /*@extend 0xaaa*/
#endif
 
#if (RTL8192F_SUPPORT || RTL8721D_SUPPORT || RTL8710C_SUPPORT)
   #define PHYDM_COMPILE_CCKPD_TYPE3 /*@extend for different & path*/
#endif
 
#ifdef PHYDM_IC_JGR3_SERIES_SUPPORT
   #define PHYDM_COMPILE_CCKPD_TYPE4 /*@extend for different bw & path*/
#endif
#if (RTL8723F_SUPPORT)
   #define PHYDM_COMPILE_CCKPD_TYPE5 /*@extend for different & path*/
#endif
 
/*@
 * 1 ============================================================
 * 1  enumeration
 * 1 ============================================================
 */
enum cckpd_lv {
   CCK_PD_LV_INIT = 0xff,
   CCK_PD_LV_0 = 0,
   CCK_PD_LV_1 = 1,
   CCK_PD_LV_2 = 2,
   CCK_PD_LV_3 = 3,
   CCK_PD_LV_4 = 4,
   CCK_PD_LV_MAX = 5
};
 
enum cckpd_mode {
   CCK_BW20_1R = 0,
   CCK_BW20_2R = 1,
   CCK_BW20_3R = 2,
   CCK_BW20_4R = 3,
   CCK_BW40_1R = 4,
   CCK_BW40_2R = 5,
   CCK_BW40_3R = 6,
   CCK_BW40_4R = 7
};
 
enum dcc_mode {
   DCC_DIG        = 0,
   DCC_CCK_PD    = 1
};
 
enum phydm_cck_pd_trend {
   CCKPD_STABLE            = 0,
   CCKPD_INCREASING        = 1,
   CCKPD_DECREASING        = 2
};
 
/*@
 * 1 ============================================================
 * 1  structure
 * 1 ============================================================
 */
 
#ifdef PHYDM_SUPPORT_CCKPD
 
#ifdef PHYDM_DCC_ENHANCE
struct phydm_dcc_struct { /*DIG CCK_PD coexistence*/
   boolean        dcc_en;
   enum dcc_mode    dcc_mode;
   u32        dig_execute_cnt;
   u8        dcc_ratio;
};
#endif
 
struct phydm_cckpd_struct {
   u8        cckpd_hw_type;
   u8        cur_cck_cca_thres; /*@current cck_pd value 0xa0a*/
   u32        cck_fa_ma;
   u32        rvrt_val; /*all rvrt_val for pause API must set to u32*/
   u8        pause_lv;
   u8        cck_n_rx;
   u16        cck_fa_th[2];
   enum channel_width cck_bw;
   enum cckpd_lv    cck_pd_lv;
   #ifdef PHYDM_COMPILE_CCKPD_TYPE2
   u8        cck_cca_th_aaa; /*@current cs_ratio value 0xaaa*/
   u8        aaa_default;    /*@Init cs_ratio value - 0xaaa*/
   #endif
   #ifdef PHYDM_COMPILE_CCKPD_TYPE3
   /*Default value*/
   u8        cck_pd_20m_1r;
   u8        cck_pd_20m_2r;
   u8        cck_pd_40m_1r;
   u8        cck_pd_40m_2r;
   u8        cck_cs_ratio_20m_1r;
   u8        cck_cs_ratio_20m_2r;
   u8        cck_cs_ratio_40m_1r;
   u8        cck_cs_ratio_40m_2r;
    u8        cck_din_shift_opt;
   /*Current value*/
   u8        cur_cck_pd_20m_1r;
   u8        cur_cck_pd_20m_2r;
   u8        cur_cck_pd_40m_1r;
   u8        cur_cck_pd_40m_2r;
   u8        cur_cck_cs_ratio_20m_1r;
   u8        cur_cck_cs_ratio_20m_2r;
   u8        cur_cck_cs_ratio_40m_1r;
   u8        cur_cck_cs_ratio_40m_2r;
   #endif
   #ifdef PHYDM_COMPILE_CCKPD_TYPE4
   /*@[bw][nrx][0:PD/1:CS][lv]*/
   u8        cckpd_jgr3[2][4][2][CCK_PD_LV_MAX];
   #endif
   #ifdef PHYDM_COMPILE_CCKPD_TYPE5
   /*@[bw][nrx][0:PD/1:CS][lv]*/
   u8        cck_pd_table_jgr3[2][4][2][CCK_PD_LV_MAX];
   #endif
};
#endif
 
/*@
 * 1 ============================================================
 * 1  function prototype
 * 1 ============================================================
 */
void phydm_set_cckpd_val(void *dm_void, u32 *val_buf, u8 val_len);
 
void phydm_cck_pd_th(void *dm_void);
 
void phydm_cck_pd_init(void *dm_void);
 
#ifdef PHYDM_DCC_ENHANCE
void phydm_cckpd_type4_dcc(void *dm_void);
 
void phydm_dig_cckpd_coex(void *dm_void);
 
void phydm_dig_cckpd_coex_init(void *dm_void);
 
void phydm_dig_cckpd_coex_dbg(void *dm_void, char input[][16], u32 *_used,
                 char *output, u32 *_out_len);
#endif
#endif