xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8821cs/hal/phydm/rtl8821c/phydm_rtl8821c.c (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  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  * wlanfae <wlanfae@realtek.com>
19  * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20  * Hsinchu 300, Taiwan.
21  *
22  * Larry Finger <Larry.Finger@lwfinger.net>
23  *
24  *****************************************************************************/
25 #include "mp_precomp.h"
26 #include "../phydm_precomp.h"
27 
28 #if (RTL8821C_SUPPORT)
phydm_dynamic_switch_htstf_agc_8821c(struct dm_struct * dm)29 void phydm_dynamic_switch_htstf_agc_8821c(struct dm_struct *dm)
30 {
31 	u16 ndp_valid_cnt = 0;
32 
33 	if (dm->bhtstfdisabled)
34 		return;
35 
36 	/*This count will be reset every 2 seconds*/
37 	ndp_valid_cnt = (u16)odm_get_bb_reg(dm, R_0xf24, MASKLWORD);
38 
39 	if (dm->total_tp == 0 || ndp_valid_cnt != 0) {
40 		odm_set_bb_reg(dm, R_0x8d8, BIT(17), 0x1);
41 		dm->no_ndp_cnts = 0;
42 	} else {
43 		dm->no_ndp_cnts++;
44 
45 		if (dm->no_ndp_cnts == 3) {
46 			odm_set_bb_reg(dm, R_0x8d8, BIT(17), 0x0);
47 			dm->no_ndp_cnts = 0;
48 		}
49 	}
50 	dm->ndp_cnt_pre = ndp_valid_cnt;
51 }
52 
phydm_hwsetting_8821c(struct dm_struct * dm)53 void phydm_hwsetting_8821c(struct dm_struct *dm)
54 {
55 	/*phydm_dynamic_switch_htstf_agc_8821c(dm);*/
56 }
57 #endif
58