aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/rtl8192c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2012-04-19 17:32:42 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-23 15:35:32 -0400
commitd10dc6d1b7655ce1208499d443ca2054ae2d43fe (patch)
tree01797b52b0e86b5b9db1fbb920f1b4f0884d5abd /drivers/net/wireless/rtlwifi/rtl8192c
parent40332e5fd3fff3cb4ab3ceb173033dcfab4d48d5 (diff)
rtlwifi: rtl8192c: Convert driver to use private ps_t struct
Convert driver to use the private instead of global version. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8192c')
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
index 2efd03dc75f9..f7f48c7ac854 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
@@ -33,8 +33,6 @@
33#include "../pci.h" 33#include "../pci.h"
34#include "../base.h" 34#include "../base.h"
35 35
36static struct ps_t dm_pstable;
37
38#define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) 36#define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1)
39#define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1) 37#define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1)
40#define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) 38#define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1)
@@ -1235,15 +1233,20 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw)
1235 1233
1236static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw) 1234static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw)
1237{ 1235{
1238 dm_pstable.pre_ccastate = CCA_MAX; 1236 struct rtl_priv *rtlpriv = rtl_priv(hw);
1239 dm_pstable.cur_ccasate = CCA_MAX; 1237 struct ps_t *dm_pstable = &rtlpriv->dm_pstable;
1240 dm_pstable.pre_rfstate = RF_MAX; 1238
1241 dm_pstable.cur_rfstate = RF_MAX; 1239 dm_pstable->pre_ccastate = CCA_MAX;
1242 dm_pstable.rssi_val_min = 0; 1240 dm_pstable->cur_ccasate = CCA_MAX;
1241 dm_pstable->pre_rfstate = RF_MAX;
1242 dm_pstable->cur_rfstate = RF_MAX;
1243 dm_pstable->rssi_val_min = 0;
1243} 1244}
1244 1245
1245void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) 1246void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal)
1246{ 1247{
1248 struct rtl_priv *rtlpriv = rtl_priv(hw);
1249 struct ps_t *dm_pstable = &rtlpriv->dm_pstable;
1247 static u8 initialize; 1250 static u8 initialize;
1248 static u32 reg_874, reg_c70, reg_85c, reg_a74; 1251 static u32 reg_874, reg_c70, reg_85c, reg_a74;
1249 1252
@@ -1263,27 +1266,27 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal)
1263 } 1266 }
1264 1267
1265 if (!bforce_in_normal) { 1268 if (!bforce_in_normal) {
1266 if (dm_pstable.rssi_val_min != 0) { 1269 if (dm_pstable->rssi_val_min != 0) {
1267 if (dm_pstable.pre_rfstate == RF_NORMAL) { 1270 if (dm_pstable->pre_rfstate == RF_NORMAL) {
1268 if (dm_pstable.rssi_val_min >= 30) 1271 if (dm_pstable->rssi_val_min >= 30)
1269 dm_pstable.cur_rfstate = RF_SAVE; 1272 dm_pstable->cur_rfstate = RF_SAVE;
1270 else 1273 else
1271 dm_pstable.cur_rfstate = RF_NORMAL; 1274 dm_pstable->cur_rfstate = RF_NORMAL;
1272 } else { 1275 } else {
1273 if (dm_pstable.rssi_val_min <= 25) 1276 if (dm_pstable->rssi_val_min <= 25)
1274 dm_pstable.cur_rfstate = RF_NORMAL; 1277 dm_pstable->cur_rfstate = RF_NORMAL;
1275 else 1278 else
1276 dm_pstable.cur_rfstate = RF_SAVE; 1279 dm_pstable->cur_rfstate = RF_SAVE;
1277 } 1280 }
1278 } else { 1281 } else {
1279 dm_pstable.cur_rfstate = RF_MAX; 1282 dm_pstable->cur_rfstate = RF_MAX;
1280 } 1283 }
1281 } else { 1284 } else {
1282 dm_pstable.cur_rfstate = RF_NORMAL; 1285 dm_pstable->cur_rfstate = RF_NORMAL;
1283 } 1286 }
1284 1287
1285 if (dm_pstable.pre_rfstate != dm_pstable.cur_rfstate) { 1288 if (dm_pstable->pre_rfstate != dm_pstable->cur_rfstate) {
1286 if (dm_pstable.cur_rfstate == RF_SAVE) { 1289 if (dm_pstable->cur_rfstate == RF_SAVE) {
1287 rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW, 1290 rtl_set_bbreg(hw, RFPGA0_XCD_RFINTERFACESW,
1288 0x1C0000, 0x2); 1291 0x1C0000, 0x2);
1289 rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), 0); 1292 rtl_set_bbreg(hw, ROFDM0_AGCPARAMETER1, BIT(3), 0);
@@ -1305,7 +1308,7 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal)
1305 rtl_set_bbreg(hw, 0x818, BIT(28), 0x0); 1308 rtl_set_bbreg(hw, 0x818, BIT(28), 0x0);
1306 } 1309 }
1307 1310
1308 dm_pstable.pre_rfstate = dm_pstable.cur_rfstate; 1311 dm_pstable->pre_rfstate = dm_pstable->cur_rfstate;
1309 } 1312 }
1310} 1313}
1311EXPORT_SYMBOL(rtl92c_dm_rf_saving); 1314EXPORT_SYMBOL(rtl92c_dm_rf_saving);
@@ -1313,36 +1316,37 @@ EXPORT_SYMBOL(rtl92c_dm_rf_saving);
1313static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) 1316static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw)
1314{ 1317{
1315 struct rtl_priv *rtlpriv = rtl_priv(hw); 1318 struct rtl_priv *rtlpriv = rtl_priv(hw);
1319 struct ps_t *dm_pstable = &rtlpriv->dm_pstable;
1316 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 1320 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1317 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 1321 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1318 1322
1319 if (((mac->link_state == MAC80211_NOLINK)) && 1323 if (((mac->link_state == MAC80211_NOLINK)) &&
1320 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { 1324 (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) {
1321 dm_pstable.rssi_val_min = 0; 1325 dm_pstable->rssi_val_min = 0;
1322 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, "Not connected to any\n"); 1326 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, "Not connected to any\n");
1323 } 1327 }
1324 1328
1325 if (mac->link_state == MAC80211_LINKED) { 1329 if (mac->link_state == MAC80211_LINKED) {
1326 if (mac->opmode == NL80211_IFTYPE_ADHOC) { 1330 if (mac->opmode == NL80211_IFTYPE_ADHOC) {
1327 dm_pstable.rssi_val_min = 1331 dm_pstable->rssi_val_min =
1328 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 1332 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
1329 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, 1333 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
1330 "AP Client PWDB = 0x%lx\n", 1334 "AP Client PWDB = 0x%lx\n",
1331 dm_pstable.rssi_val_min); 1335 dm_pstable->rssi_val_min);
1332 } else { 1336 } else {
1333 dm_pstable.rssi_val_min = 1337 dm_pstable->rssi_val_min =
1334 rtlpriv->dm.undecorated_smoothed_pwdb; 1338 rtlpriv->dm.undecorated_smoothed_pwdb;
1335 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, 1339 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
1336 "STA Default Port PWDB = 0x%lx\n", 1340 "STA Default Port PWDB = 0x%lx\n",
1337 dm_pstable.rssi_val_min); 1341 dm_pstable->rssi_val_min);
1338 } 1342 }
1339 } else { 1343 } else {
1340 dm_pstable.rssi_val_min = 1344 dm_pstable->rssi_val_min =
1341 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; 1345 rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb;
1342 1346
1343 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, 1347 RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD,
1344 "AP Ext Port PWDB = 0x%lx\n", 1348 "AP Ext Port PWDB = 0x%lx\n",
1345 dm_pstable.rssi_val_min); 1349 dm_pstable->rssi_val_min);
1346 } 1350 }
1347 1351
1348 if (IS_92C_SERIAL(rtlhal->version)) 1352 if (IS_92C_SERIAL(rtlhal->version))