aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2012-04-19 17:32:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-04-23 15:35:33 -0400
commitc21916ec4cf9cbdb1ed1c0a4aedc80d9d6400485 (patch)
tree6585d4e920efaf3de003c99878651974590d917d /drivers/net/wireless/rtlwifi/rtl8192de/dm.c
parentd10dc6d1b7655ce1208499d443ca2054ae2d43fe (diff)
rtlwifi: rtl8192de: Convert driver to use private dm structs
Convert driver to use the private dig_t instead of a 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/rtl8192de/dm.c')
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/dm.c185
1 files changed, 96 insertions, 89 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
index 4737018c9daa..a7d63a84551a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
@@ -37,8 +37,6 @@
37 37
38#define UNDEC_SM_PWDB entry_min_undecoratedsmoothed_pwdb 38#define UNDEC_SM_PWDB entry_min_undecoratedsmoothed_pwdb
39 39
40struct dig_t de_digtable;
41
42static const u32 ofdmswing_table[OFDM_TABLE_SIZE_92D] = { 40static const u32 ofdmswing_table[OFDM_TABLE_SIZE_92D] = {
43 0x7f8001fe, /* 0, +6.0dB */ 41 0x7f8001fe, /* 0, +6.0dB */
44 0x788001e2, /* 1, +5.5dB */ 42 0x788001e2, /* 1, +5.5dB */
@@ -159,27 +157,30 @@ static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = {
159 157
160static void rtl92d_dm_diginit(struct ieee80211_hw *hw) 158static void rtl92d_dm_diginit(struct ieee80211_hw *hw)
161{ 159{
162 de_digtable.dig_enable_flag = true; 160 struct rtl_priv *rtlpriv = rtl_priv(hw);
163 de_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; 161 struct dig_t *de_digtable = &rtlpriv->dm_digtable;
164 de_digtable.cur_igvalue = 0x20; 162
165 de_digtable.pre_igvalue = 0x0; 163 de_digtable->dig_enable_flag = true;
166 de_digtable.cursta_connectctate = DIG_STA_DISCONNECT; 164 de_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX;
167 de_digtable.presta_connectstate = DIG_STA_DISCONNECT; 165 de_digtable->cur_igvalue = 0x20;
168 de_digtable.curmultista_connectstate = DIG_MULTISTA_DISCONNECT; 166 de_digtable->pre_igvalue = 0x0;
169 de_digtable.rssi_lowthresh = DM_DIG_THRESH_LOW; 167 de_digtable->cursta_connectctate = DIG_STA_DISCONNECT;
170 de_digtable.rssi_highthresh = DM_DIG_THRESH_HIGH; 168 de_digtable->presta_connectstate = DIG_STA_DISCONNECT;
171 de_digtable.fa_lowthresh = DM_FALSEALARM_THRESH_LOW; 169 de_digtable->curmultista_connectstate = DIG_MULTISTA_DISCONNECT;
172 de_digtable.fa_highthresh = DM_FALSEALARM_THRESH_HIGH; 170 de_digtable->rssi_lowthresh = DM_DIG_THRESH_LOW;
173 de_digtable.rx_gain_range_max = DM_DIG_FA_UPPER; 171 de_digtable->rssi_highthresh = DM_DIG_THRESH_HIGH;
174 de_digtable.rx_gain_range_min = DM_DIG_FA_LOWER; 172 de_digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW;
175 de_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; 173 de_digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH;
176 de_digtable.backoff_val_range_max = DM_DIG_BACKOFF_MAX; 174 de_digtable->rx_gain_range_max = DM_DIG_FA_UPPER;
177 de_digtable.backoff_val_range_min = DM_DIG_BACKOFF_MIN; 175 de_digtable->rx_gain_range_min = DM_DIG_FA_LOWER;
178 de_digtable.pre_cck_pd_state = CCK_PD_STAGE_LOWRSSI; 176 de_digtable->backoff_val = DM_DIG_BACKOFF_DEFAULT;
179 de_digtable.cur_cck_pd_state = CCK_PD_STAGE_MAX; 177 de_digtable->backoff_val_range_max = DM_DIG_BACKOFF_MAX;
180 de_digtable.large_fa_hit = 0; 178 de_digtable->backoff_val_range_min = DM_DIG_BACKOFF_MIN;
181 de_digtable.recover_cnt = 0; 179 de_digtable->pre_cck_pd_state = CCK_PD_STAGE_LOWRSSI;
182 de_digtable.forbidden_igi = DM_DIG_FA_LOWER; 180 de_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX;
181 de_digtable->large_fa_hit = 0;
182 de_digtable->recover_cnt = 0;
183 de_digtable->forbidden_igi = DM_DIG_FA_LOWER;
183} 184}
184 185
185static void rtl92d_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) 186static void rtl92d_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw)
@@ -266,68 +267,70 @@ static void rtl92d_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw)
266static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw) 267static void rtl92d_dm_find_minimum_rssi(struct ieee80211_hw *hw)
267{ 268{
268 struct rtl_priv *rtlpriv = rtl_priv(hw); 269 struct rtl_priv *rtlpriv = rtl_priv(hw);
270 struct dig_t *de_digtable = &rtlpriv->dm_digtable;
269 struct rtl_mac *mac = rtl_mac(rtlpriv); 271 struct rtl_mac *mac = rtl_mac(rtlpriv);
270 272
271 /* Determine the minimum RSSI */ 273 /* Determine the minimum RSSI */
272 if ((mac->link_state < MAC80211_LINKED) && 274 if ((mac->link_state < MAC80211_LINKED) &&
273 (rtlpriv->dm.UNDEC_SM_PWDB == 0)) { 275 (rtlpriv->dm.UNDEC_SM_PWDB == 0)) {
274 de_digtable.min_undecorated_pwdb_for_dm = 0; 276 de_digtable->min_undecorated_pwdb_for_dm = 0;
275 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, 277 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
276 "Not connected to any\n"); 278 "Not connected to any\n");
277 } 279 }
278 if (mac->link_state >= MAC80211_LINKED) { 280 if (mac->link_state >= MAC80211_LINKED) {
279 if (mac->opmode == NL80211_IFTYPE_AP || 281 if (mac->opmode == NL80211_IFTYPE_AP ||
280 mac->opmode == NL80211_IFTYPE_ADHOC) { 282 mac->opmode == NL80211_IFTYPE_ADHOC) {
281 de_digtable.min_undecorated_pwdb_for_dm = 283 de_digtable->min_undecorated_pwdb_for_dm =
282 rtlpriv->dm.UNDEC_SM_PWDB; 284 rtlpriv->dm.UNDEC_SM_PWDB;
283 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, 285 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
284 "AP Client PWDB = 0x%lx\n", 286 "AP Client PWDB = 0x%lx\n",
285 rtlpriv->dm.UNDEC_SM_PWDB); 287 rtlpriv->dm.UNDEC_SM_PWDB);
286 } else { 288 } else {
287 de_digtable.min_undecorated_pwdb_for_dm = 289 de_digtable->min_undecorated_pwdb_for_dm =
288 rtlpriv->dm.undecorated_smoothed_pwdb; 290 rtlpriv->dm.undecorated_smoothed_pwdb;
289 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, 291 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
290 "STA Default Port PWDB = 0x%x\n", 292 "STA Default Port PWDB = 0x%x\n",
291 de_digtable.min_undecorated_pwdb_for_dm); 293 de_digtable->min_undecorated_pwdb_for_dm);
292 } 294 }
293 } else { 295 } else {
294 de_digtable.min_undecorated_pwdb_for_dm = 296 de_digtable->min_undecorated_pwdb_for_dm =
295 rtlpriv->dm.UNDEC_SM_PWDB; 297 rtlpriv->dm.UNDEC_SM_PWDB;
296 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, 298 RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD,
297 "AP Ext Port or disconnect PWDB = 0x%x\n", 299 "AP Ext Port or disconnect PWDB = 0x%x\n",
298 de_digtable.min_undecorated_pwdb_for_dm); 300 de_digtable->min_undecorated_pwdb_for_dm);
299 } 301 }
300 302
301 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n", 303 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n",
302 de_digtable.min_undecorated_pwdb_for_dm); 304 de_digtable->min_undecorated_pwdb_for_dm);
303} 305}
304 306
305static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) 307static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
306{ 308{
307 struct rtl_priv *rtlpriv = rtl_priv(hw); 309 struct rtl_priv *rtlpriv = rtl_priv(hw);
310 struct dig_t *de_digtable = &rtlpriv->dm_digtable;
308 unsigned long flag = 0; 311 unsigned long flag = 0;
309 312
310 if (de_digtable.cursta_connectctate == DIG_STA_CONNECT) { 313 if (de_digtable->cursta_connectctate == DIG_STA_CONNECT) {
311 if (de_digtable.pre_cck_pd_state == CCK_PD_STAGE_LOWRSSI) { 314 if (de_digtable->pre_cck_pd_state == CCK_PD_STAGE_LOWRSSI) {
312 if (de_digtable.min_undecorated_pwdb_for_dm <= 25) 315 if (de_digtable->min_undecorated_pwdb_for_dm <= 25)
313 de_digtable.cur_cck_pd_state = 316 de_digtable->cur_cck_pd_state =
314 CCK_PD_STAGE_LOWRSSI; 317 CCK_PD_STAGE_LOWRSSI;
315 else 318 else
316 de_digtable.cur_cck_pd_state = 319 de_digtable->cur_cck_pd_state =
317 CCK_PD_STAGE_HIGHRSSI; 320 CCK_PD_STAGE_HIGHRSSI;
318 } else { 321 } else {
319 if (de_digtable.min_undecorated_pwdb_for_dm <= 20) 322 if (de_digtable->min_undecorated_pwdb_for_dm <= 20)
320 de_digtable.cur_cck_pd_state = 323 de_digtable->cur_cck_pd_state =
321 CCK_PD_STAGE_LOWRSSI; 324 CCK_PD_STAGE_LOWRSSI;
322 else 325 else
323 de_digtable.cur_cck_pd_state = 326 de_digtable->cur_cck_pd_state =
324 CCK_PD_STAGE_HIGHRSSI; 327 CCK_PD_STAGE_HIGHRSSI;
325 } 328 }
326 } else { 329 } else {
327 de_digtable.cur_cck_pd_state = CCK_PD_STAGE_LOWRSSI; 330 de_digtable->cur_cck_pd_state = CCK_PD_STAGE_LOWRSSI;
328 } 331 }
329 if (de_digtable.pre_cck_pd_state != de_digtable.cur_cck_pd_state) { 332 if (de_digtable->pre_cck_pd_state != de_digtable->cur_cck_pd_state) {
330 if (de_digtable.cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI) { 333 if (de_digtable->cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI) {
331 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag); 334 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag);
332 rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0x83); 335 rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0x83);
333 rtl92d_release_cckandrw_pagea_ctl(hw, &flag); 336 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
@@ -336,13 +339,13 @@ static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
336 rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0xcd); 339 rtl_set_bbreg(hw, RCCK0_CCA, BMASKBYTE2, 0xcd);
337 rtl92d_release_cckandrw_pagea_ctl(hw, &flag); 340 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
338 } 341 }
339 de_digtable.pre_cck_pd_state = de_digtable.cur_cck_pd_state; 342 de_digtable->pre_cck_pd_state = de_digtable->cur_cck_pd_state;
340 } 343 }
341 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CurSTAConnectState=%s\n", 344 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CurSTAConnectState=%s\n",
342 de_digtable.cursta_connectctate == DIG_STA_CONNECT ? 345 de_digtable->cursta_connectctate == DIG_STA_CONNECT ?
343 "DIG_STA_CONNECT " : "DIG_STA_DISCONNECT"); 346 "DIG_STA_CONNECT " : "DIG_STA_DISCONNECT");
344 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CCKPDStage=%s\n", 347 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "CCKPDStage=%s\n",
345 de_digtable.cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI ? 348 de_digtable->cur_cck_pd_state == CCK_PD_STAGE_LOWRSSI ?
346 "Low RSSI " : "High RSSI "); 349 "Low RSSI " : "High RSSI ");
347 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "is92d single phy =%x\n", 350 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "is92d single phy =%x\n",
348 IS_92D_SINGLEPHY(rtlpriv->rtlhal.version)); 351 IS_92D_SINGLEPHY(rtlpriv->rtlhal.version));
@@ -352,37 +355,40 @@ static void rtl92d_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw)
352void rtl92d_dm_write_dig(struct ieee80211_hw *hw) 355void rtl92d_dm_write_dig(struct ieee80211_hw *hw)
353{ 356{
354 struct rtl_priv *rtlpriv = rtl_priv(hw); 357 struct rtl_priv *rtlpriv = rtl_priv(hw);
358 struct dig_t *de_digtable = &rtlpriv->dm_digtable;
355 359
356 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 360 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
357 "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n", 361 "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n",
358 de_digtable.cur_igvalue, de_digtable.pre_igvalue, 362 de_digtable->cur_igvalue, de_digtable->pre_igvalue,
359 de_digtable.backoff_val); 363 de_digtable->backoff_val);
360 if (de_digtable.dig_enable_flag == false) { 364 if (de_digtable->dig_enable_flag == false) {
361 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "DIG is disabled\n"); 365 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "DIG is disabled\n");
362 de_digtable.pre_igvalue = 0x17; 366 de_digtable->pre_igvalue = 0x17;
363 return; 367 return;
364 } 368 }
365 if (de_digtable.pre_igvalue != de_digtable.cur_igvalue) { 369 if (de_digtable->pre_igvalue != de_digtable->cur_igvalue) {
366 rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, 370 rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f,
367 de_digtable.cur_igvalue); 371 de_digtable->cur_igvalue);
368 rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, 372 rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f,
369 de_digtable.cur_igvalue); 373 de_digtable->cur_igvalue);
370 de_digtable.pre_igvalue = de_digtable.cur_igvalue; 374 de_digtable->pre_igvalue = de_digtable->cur_igvalue;
371 } 375 }
372} 376}
373 377
374static void rtl92d_early_mode_enabled(struct rtl_priv *rtlpriv) 378static void rtl92d_early_mode_enabled(struct rtl_priv *rtlpriv)
375{ 379{
380 struct dig_t *de_digtable = &rtlpriv->dm_digtable;
381
376 if ((rtlpriv->mac80211.link_state >= MAC80211_LINKED) && 382 if ((rtlpriv->mac80211.link_state >= MAC80211_LINKED) &&
377 (rtlpriv->mac80211.vendor == PEER_CISCO)) { 383 (rtlpriv->mac80211.vendor == PEER_CISCO)) {
378 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "IOT_PEER = CISCO\n"); 384 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "IOT_PEER = CISCO\n");
379 if (de_digtable.last_min_undecorated_pwdb_for_dm >= 50 385 if (de_digtable->last_min_undecorated_pwdb_for_dm >= 50
380 && de_digtable.min_undecorated_pwdb_for_dm < 50) { 386 && de_digtable->min_undecorated_pwdb_for_dm < 50) {
381 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x00); 387 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x00);
382 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 388 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
383 "Early Mode Off\n"); 389 "Early Mode Off\n");
384 } else if (de_digtable.last_min_undecorated_pwdb_for_dm <= 55 && 390 } else if (de_digtable->last_min_undecorated_pwdb_for_dm <= 55 &&
385 de_digtable.min_undecorated_pwdb_for_dm > 55) { 391 de_digtable->min_undecorated_pwdb_for_dm > 55) {
386 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f); 392 rtl_write_byte(rtlpriv, REG_EARLY_MODE_CONTROL, 0x0f);
387 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 393 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
388 "Early Mode On\n"); 394 "Early Mode On\n");
@@ -396,14 +402,15 @@ static void rtl92d_early_mode_enabled(struct rtl_priv *rtlpriv)
396static void rtl92d_dm_dig(struct ieee80211_hw *hw) 402static void rtl92d_dm_dig(struct ieee80211_hw *hw)
397{ 403{
398 struct rtl_priv *rtlpriv = rtl_priv(hw); 404 struct rtl_priv *rtlpriv = rtl_priv(hw);
399 u8 value_igi = de_digtable.cur_igvalue; 405 struct dig_t *de_digtable = &rtlpriv->dm_digtable;
406 u8 value_igi = de_digtable->cur_igvalue;
400 struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); 407 struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt);
401 408
402 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "==>\n"); 409 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "==>\n");
403 if (rtlpriv->rtlhal.earlymode_enable) { 410 if (rtlpriv->rtlhal.earlymode_enable) {
404 rtl92d_early_mode_enabled(rtlpriv); 411 rtl92d_early_mode_enabled(rtlpriv);
405 de_digtable.last_min_undecorated_pwdb_for_dm = 412 de_digtable->last_min_undecorated_pwdb_for_dm =
406 de_digtable.min_undecorated_pwdb_for_dm; 413 de_digtable->min_undecorated_pwdb_for_dm;
407 } 414 }
408 if (!rtlpriv->dm.dm_initialgain_enable) 415 if (!rtlpriv->dm.dm_initialgain_enable)
409 return; 416 return;
@@ -421,9 +428,9 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw)
421 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "progress\n"); 428 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "progress\n");
422 /* Decide the current status and if modify initial gain or not */ 429 /* Decide the current status and if modify initial gain or not */
423 if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) 430 if (rtlpriv->mac80211.link_state >= MAC80211_LINKED)
424 de_digtable.cursta_connectctate = DIG_STA_CONNECT; 431 de_digtable->cursta_connectctate = DIG_STA_CONNECT;
425 else 432 else
426 de_digtable.cursta_connectctate = DIG_STA_DISCONNECT; 433 de_digtable->cursta_connectctate = DIG_STA_DISCONNECT;
427 434
428 /* adjust initial gain according to false alarm counter */ 435 /* adjust initial gain according to false alarm counter */
429 if (falsealm_cnt->cnt_all < DM_DIG_FA_TH0) 436 if (falsealm_cnt->cnt_all < DM_DIG_FA_TH0)
@@ -436,64 +443,64 @@ static void rtl92d_dm_dig(struct ieee80211_hw *hw)
436 value_igi += 2; 443 value_igi += 2;
437 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 444 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
438 "dm_DIG() Before: large_fa_hit=%d, forbidden_igi=%x\n", 445 "dm_DIG() Before: large_fa_hit=%d, forbidden_igi=%x\n",
439 de_digtable.large_fa_hit, de_digtable.forbidden_igi); 446 de_digtable->large_fa_hit, de_digtable->forbidden_igi);
440 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 447 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
441 "dm_DIG() Before: Recover_cnt=%d, rx_gain_range_min=%x\n", 448 "dm_DIG() Before: Recover_cnt=%d, rx_gain_range_min=%x\n",
442 de_digtable.recover_cnt, de_digtable.rx_gain_range_min); 449 de_digtable->recover_cnt, de_digtable->rx_gain_range_min);
443 450
444 /* deal with abnorally large false alarm */ 451 /* deal with abnorally large false alarm */
445 if (falsealm_cnt->cnt_all > 10000) { 452 if (falsealm_cnt->cnt_all > 10000) {
446 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 453 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
447 "dm_DIG(): Abnormally false alarm case\n"); 454 "dm_DIG(): Abnormally false alarm case\n");
448 455
449 de_digtable.large_fa_hit++; 456 de_digtable->large_fa_hit++;
450 if (de_digtable.forbidden_igi < de_digtable.cur_igvalue) { 457 if (de_digtable->forbidden_igi < de_digtable->cur_igvalue) {
451 de_digtable.forbidden_igi = de_digtable.cur_igvalue; 458 de_digtable->forbidden_igi = de_digtable->cur_igvalue;
452 de_digtable.large_fa_hit = 1; 459 de_digtable->large_fa_hit = 1;
453 } 460 }
454 if (de_digtable.large_fa_hit >= 3) { 461 if (de_digtable->large_fa_hit >= 3) {
455 if ((de_digtable.forbidden_igi + 1) > DM_DIG_MAX) 462 if ((de_digtable->forbidden_igi + 1) > DM_DIG_MAX)
456 de_digtable.rx_gain_range_min = DM_DIG_MAX; 463 de_digtable->rx_gain_range_min = DM_DIG_MAX;
457 else 464 else
458 de_digtable.rx_gain_range_min = 465 de_digtable->rx_gain_range_min =
459 (de_digtable.forbidden_igi + 1); 466 (de_digtable->forbidden_igi + 1);
460 de_digtable.recover_cnt = 3600; /* 3600=2hr */ 467 de_digtable->recover_cnt = 3600; /* 3600=2hr */
461 } 468 }
462 } else { 469 } else {
463 /* Recovery mechanism for IGI lower bound */ 470 /* Recovery mechanism for IGI lower bound */
464 if (de_digtable.recover_cnt != 0) { 471 if (de_digtable->recover_cnt != 0) {
465 de_digtable.recover_cnt--; 472 de_digtable->recover_cnt--;
466 } else { 473 } else {
467 if (de_digtable.large_fa_hit == 0) { 474 if (de_digtable->large_fa_hit == 0) {
468 if ((de_digtable.forbidden_igi - 1) < 475 if ((de_digtable->forbidden_igi - 1) <
469 DM_DIG_FA_LOWER) { 476 DM_DIG_FA_LOWER) {
470 de_digtable.forbidden_igi = 477 de_digtable->forbidden_igi =
471 DM_DIG_FA_LOWER; 478 DM_DIG_FA_LOWER;
472 de_digtable.rx_gain_range_min = 479 de_digtable->rx_gain_range_min =
473 DM_DIG_FA_LOWER; 480 DM_DIG_FA_LOWER;
474 481
475 } else { 482 } else {
476 de_digtable.forbidden_igi--; 483 de_digtable->forbidden_igi--;
477 de_digtable.rx_gain_range_min = 484 de_digtable->rx_gain_range_min =
478 (de_digtable.forbidden_igi + 1); 485 (de_digtable->forbidden_igi + 1);
479 } 486 }
480 } else if (de_digtable.large_fa_hit == 3) { 487 } else if (de_digtable->large_fa_hit == 3) {
481 de_digtable.large_fa_hit = 0; 488 de_digtable->large_fa_hit = 0;
482 } 489 }
483 } 490 }
484 } 491 }
485 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 492 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
486 "dm_DIG() After: large_fa_hit=%d, forbidden_igi=%x\n", 493 "dm_DIG() After: large_fa_hit=%d, forbidden_igi=%x\n",
487 de_digtable.large_fa_hit, de_digtable.forbidden_igi); 494 de_digtable->large_fa_hit, de_digtable->forbidden_igi);
488 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, 495 RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD,
489 "dm_DIG() After: recover_cnt=%d, rx_gain_range_min=%x\n", 496 "dm_DIG() After: recover_cnt=%d, rx_gain_range_min=%x\n",
490 de_digtable.recover_cnt, de_digtable.rx_gain_range_min); 497 de_digtable->recover_cnt, de_digtable->rx_gain_range_min);
491 498
492 if (value_igi > DM_DIG_MAX) 499 if (value_igi > DM_DIG_MAX)
493 value_igi = DM_DIG_MAX; 500 value_igi = DM_DIG_MAX;
494 else if (value_igi < de_digtable.rx_gain_range_min) 501 else if (value_igi < de_digtable->rx_gain_range_min)
495 value_igi = de_digtable.rx_gain_range_min; 502 value_igi = de_digtable->rx_gain_range_min;
496 de_digtable.cur_igvalue = value_igi; 503 de_digtable->cur_igvalue = value_igi;
497 rtl92d_dm_write_dig(hw); 504 rtl92d_dm_write_dig(hw);
498 if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G) 505 if (rtlpriv->rtlhal.current_bandtype != BAND_ON_5G)
499 rtl92d_dm_cck_packet_detection_thresh(hw); 506 rtl92d_dm_cck_packet_detection_thresh(hw);