1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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 #ifndef __RTL8723A_DM_H__
16 #define __RTL8723A_DM_H__
17 /*  */
18 /*  Description: */
19 /*  */
20 /*  This file is for 8723A dynamic mechanism only */
21 /*  */
22 /*  */
23 /*  */
24 #define DYNAMIC_FUNC_BT BIT(0)
25 
26 enum{
27 	UP_LINK,
28 	DOWN_LINK,
29 };
30 /*  */
31 /*  structure and define */
32 /*  */
33 
34 /*  duplicate code,will move to ODM ######### */
35 #define IQK_MAC_REG_NUM		4
36 #define IQK_ADDA_REG_NUM		16
37 #define IQK_BB_REG_NUM			9
38 #define HP_THERMAL_NUM		8
39 /*  duplicate code,will move to ODM ######### */
40 struct dm_priv {
41 	u32	InitODMFlag;
42 
43 	/*  Upper and Lower Signal threshold for Rate Adaptive*/
44 	int	UndecoratedSmoothedPWDB;
45 	int	UndecoratedSmoothedCCK;
46 	int	EntryMinUndecoratedSmoothedPWDB;
47 	int	EntryMaxUndecoratedSmoothedPWDB;
48 	int	MinUndecoratedPWDBForDM;
49 	int	LastMinUndecoratedPWDBForDM;
50 
51 	s32	UndecoratedSmoothedBeacon;
52 	#ifdef CONFIG_8723AU_BT_COEXIST
53 	s32 BT_EntryMinUndecoratedSmoothedPWDB;
54 	s32 BT_EntryMaxUndecoratedSmoothedPWDB;
55 	#endif
56 
57 	/* for High Power */
58 	u8 DynamicTxHighPowerLvl;/* Add by Jacken Tx Power Control for Near/Far Range 2008/03/06 */
59 
60 	/* for tx power tracking */
61 	u8	bTXPowerTracking;
62 	u8	TXPowercount;
63 	u8	bTXPowerTrackingInit;
64 	u8	TxPowerTrackControl;	/* for mp mode, turn off txpwrtracking as default */
65 	u8	TM_Trigger;
66 
67 	u8	ThermalMeter[2];				/*  ThermalMeter, index 0 for RFIC0, and 1 for RFIC1 */
68 	u8	ThermalValue;
69 	u8	ThermalValue_LCK;
70 	u8	ThermalValue_IQK;
71 	u8	ThermalValue_DPK;
72 
73 	u8	bRfPiEnable;
74 
75 	/* for APK */
76 	u32	APKoutput[2][2];	/* path A/B; output1_1a/output1_2a */
77 	u8	bAPKdone;
78 	u8	bAPKThermalMeterIgnore;
79 	u8	bDPdone;
80 	u8	bDPPathAOK;
81 	u8	bDPPathBOK;
82 
83 	/* for IQK */
84 	u32	RegC04;
85 	u32	Reg874;
86 	u32	RegC08;
87 	u32	RegB68;
88 	u32	RegB6C;
89 	u32	Reg870;
90 	u32	Reg860;
91 	u32	Reg864;
92 	u32	ADDA_backup[IQK_ADDA_REG_NUM];
93 	u32	IQK_MAC_backup[IQK_MAC_REG_NUM];
94 	u32	IQK_BB_backup_recover[9];
95 	u32	IQK_BB_backup[IQK_BB_REG_NUM];
96 	u8	PowerIndex_backup[6];
97 
98 	u8	bCCKinCH14;
99 
100 	u8	CCK_index;
101 	u8	OFDM_index[2];
102 
103 	u8	bDoneTxpower;
104 	u8	CCK_index_HP;
105 	u8	OFDM_index_HP[2];
106 	u8	ThermalValue_HP[HP_THERMAL_NUM];
107 	u8	ThermalValue_HP_index;
108 
109 	/* for TxPwrTracking */
110 	s32	RegE94;
111 	s32     RegE9C;
112 	s32	RegEB4;
113 	s32	RegEBC;
114 
115 	u32	TXPowerTrackingCallbackCnt;	/* cosa add for debug */
116 
117 	u32	prv_traffic_idx; /*  edca turbo */
118 
119 	s32	OFDM_Pkt_Cnt;
120 	u8	RSSI_Select;
121 /*	u8	DIG_Dynamic_MIN ; */
122 /*  duplicate code,will move to ODM ######### */
123 	/*  Add for Reading Initial Data Rate SEL Register 0x484 during watchdog. Using for fill tx desc. 2011.3.21 by Thomas */
124 	u8	INIDATA_RATE[32];
125 };
126 
127 
128 /*  */
129 /*  function prototype */
130 /*  */
131 
132 void rtl8723a_init_dm_priv(struct rtw_adapter *padapter);
133 
134 void rtl8723a_InitHalDm(struct rtw_adapter *padapter);
135 void rtl8723a_HalDmWatchDog(struct rtw_adapter *padapter);
136 
137 #endif
138