diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2012-04-19 17:32:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-23 15:35:32 -0400 |
commit | 40332e5fd3fff3cb4ab3ceb173033dcfab4d48d5 (patch) | |
tree | fe7a705df1c88e4f59c03d92e38691d1fad2c0e6 /drivers/net/wireless/rtlwifi | |
parent | 0985dfbc512da3e7f63b3071b8373f5300d0e40b (diff) |
rtlwifi: rtl8192c: Convert driver to use private dm structs
Convert rtl8192c to use the dm_digtable struct in the common header file
instead of the global variable. Without this change, every instance of
rtl8192ce and rtl8192cu will be using the same global arrays.
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')
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | 232 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192ce/dm.h | 1 |
4 files changed, 123 insertions, 112 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c index 1208b753f62f..2efd03dc75f9 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "../pci.h" | 33 | #include "../pci.h" |
34 | #include "../base.h" | 34 | #include "../base.h" |
35 | 35 | ||
36 | struct dig_t dm_digtable; | ||
37 | static struct ps_t dm_pstable; | 36 | static struct ps_t dm_pstable; |
38 | 37 | ||
39 | #define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) | 38 | #define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) |
@@ -163,33 +162,37 @@ static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8] = { | |||
163 | 162 | ||
164 | static void rtl92c_dm_diginit(struct ieee80211_hw *hw) | 163 | static void rtl92c_dm_diginit(struct ieee80211_hw *hw) |
165 | { | 164 | { |
166 | dm_digtable.dig_enable_flag = true; | 165 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
167 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 166 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; |
168 | dm_digtable.cur_igvalue = 0x20; | 167 | |
169 | dm_digtable.pre_igvalue = 0x0; | 168 | dm_digtable->dig_enable_flag = true; |
170 | dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; | 169 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
171 | dm_digtable.presta_connectstate = DIG_STA_DISCONNECT; | 170 | dm_digtable->cur_igvalue = 0x20; |
172 | dm_digtable.curmultista_connectstate = DIG_MULTISTA_DISCONNECT; | 171 | dm_digtable->pre_igvalue = 0x0; |
173 | dm_digtable.rssi_lowthresh = DM_DIG_THRESH_LOW; | 172 | dm_digtable->cursta_connectctate = DIG_STA_DISCONNECT; |
174 | dm_digtable.rssi_highthresh = DM_DIG_THRESH_HIGH; | 173 | dm_digtable->presta_connectstate = DIG_STA_DISCONNECT; |
175 | dm_digtable.fa_lowthresh = DM_FALSEALARM_THRESH_LOW; | 174 | dm_digtable->curmultista_connectstate = DIG_MULTISTA_DISCONNECT; |
176 | dm_digtable.fa_highthresh = DM_FALSEALARM_THRESH_HIGH; | 175 | dm_digtable->rssi_lowthresh = DM_DIG_THRESH_LOW; |
177 | dm_digtable.rx_gain_range_max = DM_DIG_MAX; | 176 | dm_digtable->rssi_highthresh = DM_DIG_THRESH_HIGH; |
178 | dm_digtable.rx_gain_range_min = DM_DIG_MIN; | 177 | dm_digtable->fa_lowthresh = DM_FALSEALARM_THRESH_LOW; |
179 | dm_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; | 178 | dm_digtable->fa_highthresh = DM_FALSEALARM_THRESH_HIGH; |
180 | dm_digtable.backoff_val_range_max = DM_DIG_BACKOFF_MAX; | 179 | dm_digtable->rx_gain_range_max = DM_DIG_MAX; |
181 | dm_digtable.backoff_val_range_min = DM_DIG_BACKOFF_MIN; | 180 | dm_digtable->rx_gain_range_min = DM_DIG_MIN; |
182 | dm_digtable.pre_cck_pd_state = CCK_PD_STAGE_MAX; | 181 | dm_digtable->backoff_val = DM_DIG_BACKOFF_DEFAULT; |
183 | dm_digtable.cur_cck_pd_state = CCK_PD_STAGE_MAX; | 182 | dm_digtable->backoff_val_range_max = DM_DIG_BACKOFF_MAX; |
183 | dm_digtable->backoff_val_range_min = DM_DIG_BACKOFF_MIN; | ||
184 | dm_digtable->pre_cck_pd_state = CCK_PD_STAGE_MAX; | ||
185 | dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; | ||
184 | } | 186 | } |
185 | 187 | ||
186 | static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) | 188 | static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) |
187 | { | 189 | { |
188 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 190 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
191 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
189 | long rssi_val_min = 0; | 192 | long rssi_val_min = 0; |
190 | 193 | ||
191 | if ((dm_digtable.curmultista_connectstate == DIG_MULTISTA_CONNECT) && | 194 | if ((dm_digtable->curmultista_connectstate == DIG_MULTISTA_CONNECT) && |
192 | (dm_digtable.cursta_connectctate == DIG_STA_CONNECT)) { | 195 | (dm_digtable->cursta_connectctate == DIG_STA_CONNECT)) { |
193 | if (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb != 0) | 196 | if (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb != 0) |
194 | rssi_val_min = | 197 | rssi_val_min = |
195 | (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb > | 198 | (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb > |
@@ -198,10 +201,10 @@ static u8 rtl92c_dm_initial_gain_min_pwdb(struct ieee80211_hw *hw) | |||
198 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 201 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
199 | else | 202 | else |
200 | rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; | 203 | rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; |
201 | } else if (dm_digtable.cursta_connectctate == DIG_STA_CONNECT || | 204 | } else if (dm_digtable->cursta_connectctate == DIG_STA_CONNECT || |
202 | dm_digtable.cursta_connectctate == DIG_STA_BEFORE_CONNECT) { | 205 | dm_digtable->cursta_connectctate == DIG_STA_BEFORE_CONNECT) { |
203 | rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; | 206 | rssi_val_min = rtlpriv->dm.undecorated_smoothed_pwdb; |
204 | } else if (dm_digtable.curmultista_connectstate == | 207 | } else if (dm_digtable->curmultista_connectstate == |
205 | DIG_MULTISTA_CONNECT) { | 208 | DIG_MULTISTA_CONNECT) { |
206 | rssi_val_min = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 209 | rssi_val_min = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
207 | } | 210 | } |
@@ -260,7 +263,8 @@ static void rtl92c_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) | |||
260 | static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) | 263 | static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) |
261 | { | 264 | { |
262 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 265 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
263 | u8 value_igi = dm_digtable.cur_igvalue; | 266 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; |
267 | u8 value_igi = dm_digtable->cur_igvalue; | ||
264 | 268 | ||
265 | if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) | 269 | if (rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) |
266 | value_igi--; | 270 | value_igi--; |
@@ -277,43 +281,44 @@ static void rtl92c_dm_ctrl_initgain_by_fa(struct ieee80211_hw *hw) | |||
277 | if (rtlpriv->falsealm_cnt.cnt_all > 10000) | 281 | if (rtlpriv->falsealm_cnt.cnt_all > 10000) |
278 | value_igi = 0x32; | 282 | value_igi = 0x32; |
279 | 283 | ||
280 | dm_digtable.cur_igvalue = value_igi; | 284 | dm_digtable->cur_igvalue = value_igi; |
281 | rtl92c_dm_write_dig(hw); | 285 | rtl92c_dm_write_dig(hw); |
282 | } | 286 | } |
283 | 287 | ||
284 | static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) | 288 | static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) |
285 | { | 289 | { |
286 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 290 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
291 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
287 | 292 | ||
288 | if (rtlpriv->falsealm_cnt.cnt_all > dm_digtable.fa_highthresh) { | 293 | if (rtlpriv->falsealm_cnt.cnt_all > dm_digtable->fa_highthresh) { |
289 | if ((dm_digtable.backoff_val - 2) < | 294 | if ((dm_digtable->backoff_val - 2) < |
290 | dm_digtable.backoff_val_range_min) | 295 | dm_digtable->backoff_val_range_min) |
291 | dm_digtable.backoff_val = | 296 | dm_digtable->backoff_val = |
292 | dm_digtable.backoff_val_range_min; | 297 | dm_digtable->backoff_val_range_min; |
293 | else | 298 | else |
294 | dm_digtable.backoff_val -= 2; | 299 | dm_digtable->backoff_val -= 2; |
295 | } else if (rtlpriv->falsealm_cnt.cnt_all < dm_digtable.fa_lowthresh) { | 300 | } else if (rtlpriv->falsealm_cnt.cnt_all < dm_digtable->fa_lowthresh) { |
296 | if ((dm_digtable.backoff_val + 2) > | 301 | if ((dm_digtable->backoff_val + 2) > |
297 | dm_digtable.backoff_val_range_max) | 302 | dm_digtable->backoff_val_range_max) |
298 | dm_digtable.backoff_val = | 303 | dm_digtable->backoff_val = |
299 | dm_digtable.backoff_val_range_max; | 304 | dm_digtable->backoff_val_range_max; |
300 | else | 305 | else |
301 | dm_digtable.backoff_val += 2; | 306 | dm_digtable->backoff_val += 2; |
302 | } | 307 | } |
303 | 308 | ||
304 | if ((dm_digtable.rssi_val_min + 10 - dm_digtable.backoff_val) > | 309 | if ((dm_digtable->rssi_val_min + 10 - dm_digtable->backoff_val) > |
305 | dm_digtable.rx_gain_range_max) | 310 | dm_digtable->rx_gain_range_max) |
306 | dm_digtable.cur_igvalue = dm_digtable.rx_gain_range_max; | 311 | dm_digtable->cur_igvalue = dm_digtable->rx_gain_range_max; |
307 | else if ((dm_digtable.rssi_val_min + 10 - | 312 | else if ((dm_digtable->rssi_val_min + 10 - |
308 | dm_digtable.backoff_val) < dm_digtable.rx_gain_range_min) | 313 | dm_digtable->backoff_val) < dm_digtable->rx_gain_range_min) |
309 | dm_digtable.cur_igvalue = dm_digtable.rx_gain_range_min; | 314 | dm_digtable->cur_igvalue = dm_digtable->rx_gain_range_min; |
310 | else | 315 | else |
311 | dm_digtable.cur_igvalue = dm_digtable.rssi_val_min + 10 - | 316 | dm_digtable->cur_igvalue = dm_digtable->rssi_val_min + 10 - |
312 | dm_digtable.backoff_val; | 317 | dm_digtable->backoff_val; |
313 | 318 | ||
314 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, | 319 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
315 | "rssi_val_min = %x backoff_val %x\n", | 320 | "rssi_val_min = %x backoff_val %x\n", |
316 | dm_digtable.rssi_val_min, dm_digtable.backoff_val); | 321 | dm_digtable->rssi_val_min, dm_digtable->backoff_val); |
317 | 322 | ||
318 | rtl92c_dm_write_dig(hw); | 323 | rtl92c_dm_write_dig(hw); |
319 | } | 324 | } |
@@ -322,6 +327,7 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) | |||
322 | { | 327 | { |
323 | static u8 initialized; /* initialized to false */ | 328 | static u8 initialized; /* initialized to false */ |
324 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 329 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
330 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
325 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 331 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
326 | long rssi_strength = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 332 | long rssi_strength = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
327 | bool multi_sta = false; | 333 | bool multi_sta = false; |
@@ -330,68 +336,69 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) | |||
330 | multi_sta = true; | 336 | multi_sta = true; |
331 | 337 | ||
332 | if (!multi_sta || | 338 | if (!multi_sta || |
333 | dm_digtable.cursta_connectctate != DIG_STA_DISCONNECT) { | 339 | dm_digtable->cursta_connectctate != DIG_STA_DISCONNECT) { |
334 | initialized = false; | 340 | initialized = false; |
335 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 341 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
336 | return; | 342 | return; |
337 | } else if (initialized == false) { | 343 | } else if (initialized == false) { |
338 | initialized = true; | 344 | initialized = true; |
339 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; | 345 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; |
340 | dm_digtable.cur_igvalue = 0x20; | 346 | dm_digtable->cur_igvalue = 0x20; |
341 | rtl92c_dm_write_dig(hw); | 347 | rtl92c_dm_write_dig(hw); |
342 | } | 348 | } |
343 | 349 | ||
344 | if (dm_digtable.curmultista_connectstate == DIG_MULTISTA_CONNECT) { | 350 | if (dm_digtable->curmultista_connectstate == DIG_MULTISTA_CONNECT) { |
345 | if ((rssi_strength < dm_digtable.rssi_lowthresh) && | 351 | if ((rssi_strength < dm_digtable->rssi_lowthresh) && |
346 | (dm_digtable.dig_ext_port_stage != DIG_EXT_PORT_STAGE_1)) { | 352 | (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_1)) { |
347 | 353 | ||
348 | if (dm_digtable.dig_ext_port_stage == | 354 | if (dm_digtable->dig_ext_port_stage == |
349 | DIG_EXT_PORT_STAGE_2) { | 355 | DIG_EXT_PORT_STAGE_2) { |
350 | dm_digtable.cur_igvalue = 0x20; | 356 | dm_digtable->cur_igvalue = 0x20; |
351 | rtl92c_dm_write_dig(hw); | 357 | rtl92c_dm_write_dig(hw); |
352 | } | 358 | } |
353 | 359 | ||
354 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_1; | 360 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_1; |
355 | } else if (rssi_strength > dm_digtable.rssi_highthresh) { | 361 | } else if (rssi_strength > dm_digtable->rssi_highthresh) { |
356 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_2; | 362 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_2; |
357 | rtl92c_dm_ctrl_initgain_by_fa(hw); | 363 | rtl92c_dm_ctrl_initgain_by_fa(hw); |
358 | } | 364 | } |
359 | } else if (dm_digtable.dig_ext_port_stage != DIG_EXT_PORT_STAGE_0) { | 365 | } else if (dm_digtable->dig_ext_port_stage != DIG_EXT_PORT_STAGE_0) { |
360 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; | 366 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; |
361 | dm_digtable.cur_igvalue = 0x20; | 367 | dm_digtable->cur_igvalue = 0x20; |
362 | rtl92c_dm_write_dig(hw); | 368 | rtl92c_dm_write_dig(hw); |
363 | } | 369 | } |
364 | 370 | ||
365 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, | 371 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
366 | "curmultista_connectstate = %x dig_ext_port_stage %x\n", | 372 | "curmultista_connectstate = %x dig_ext_port_stage %x\n", |
367 | dm_digtable.curmultista_connectstate, | 373 | dm_digtable->curmultista_connectstate, |
368 | dm_digtable.dig_ext_port_stage); | 374 | dm_digtable->dig_ext_port_stage); |
369 | } | 375 | } |
370 | 376 | ||
371 | static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) | 377 | static void rtl92c_dm_initial_gain_sta(struct ieee80211_hw *hw) |
372 | { | 378 | { |
373 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 379 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
380 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
374 | 381 | ||
375 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, | 382 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
376 | "presta_connectstate = %x, cursta_connectctate = %x\n", | 383 | "presta_connectstate = %x, cursta_connectctate = %x\n", |
377 | dm_digtable.presta_connectstate, | 384 | dm_digtable->presta_connectstate, |
378 | dm_digtable.cursta_connectctate); | 385 | dm_digtable->cursta_connectctate); |
379 | 386 | ||
380 | if (dm_digtable.presta_connectstate == dm_digtable.cursta_connectctate | 387 | if (dm_digtable->presta_connectstate == dm_digtable->cursta_connectctate |
381 | || dm_digtable.cursta_connectctate == DIG_STA_BEFORE_CONNECT | 388 | || dm_digtable->cursta_connectctate == DIG_STA_BEFORE_CONNECT |
382 | || dm_digtable.cursta_connectctate == DIG_STA_CONNECT) { | 389 | || dm_digtable->cursta_connectctate == DIG_STA_CONNECT) { |
383 | 390 | ||
384 | if (dm_digtable.cursta_connectctate != DIG_STA_DISCONNECT) { | 391 | if (dm_digtable->cursta_connectctate != DIG_STA_DISCONNECT) { |
385 | dm_digtable.rssi_val_min = | 392 | dm_digtable->rssi_val_min = |
386 | rtl92c_dm_initial_gain_min_pwdb(hw); | 393 | rtl92c_dm_initial_gain_min_pwdb(hw); |
387 | rtl92c_dm_ctrl_initgain_by_rssi(hw); | 394 | rtl92c_dm_ctrl_initgain_by_rssi(hw); |
388 | } | 395 | } |
389 | } else { | 396 | } else { |
390 | dm_digtable.rssi_val_min = 0; | 397 | dm_digtable->rssi_val_min = 0; |
391 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 398 | dm_digtable->dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
392 | dm_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; | 399 | dm_digtable->backoff_val = DM_DIG_BACKOFF_DEFAULT; |
393 | dm_digtable.cur_igvalue = 0x20; | 400 | dm_digtable->cur_igvalue = 0x20; |
394 | dm_digtable.pre_igvalue = 0; | 401 | dm_digtable->pre_igvalue = 0; |
395 | rtl92c_dm_write_dig(hw); | 402 | rtl92c_dm_write_dig(hw); |
396 | } | 403 | } |
397 | } | 404 | } |
@@ -400,40 +407,41 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
400 | { | 407 | { |
401 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 408 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
402 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 409 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
410 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
403 | 411 | ||
404 | if (dm_digtable.cursta_connectctate == DIG_STA_CONNECT) { | 412 | if (dm_digtable->cursta_connectctate == DIG_STA_CONNECT) { |
405 | dm_digtable.rssi_val_min = rtl92c_dm_initial_gain_min_pwdb(hw); | 413 | dm_digtable->rssi_val_min = rtl92c_dm_initial_gain_min_pwdb(hw); |
406 | 414 | ||
407 | if (dm_digtable.pre_cck_pd_state == CCK_PD_STAGE_LowRssi) { | 415 | if (dm_digtable->pre_cck_pd_state == CCK_PD_STAGE_LowRssi) { |
408 | if (dm_digtable.rssi_val_min <= 25) | 416 | if (dm_digtable->rssi_val_min <= 25) |
409 | dm_digtable.cur_cck_pd_state = | 417 | dm_digtable->cur_cck_pd_state = |
410 | CCK_PD_STAGE_LowRssi; | 418 | CCK_PD_STAGE_LowRssi; |
411 | else | 419 | else |
412 | dm_digtable.cur_cck_pd_state = | 420 | dm_digtable->cur_cck_pd_state = |
413 | CCK_PD_STAGE_HighRssi; | 421 | CCK_PD_STAGE_HighRssi; |
414 | } else { | 422 | } else { |
415 | if (dm_digtable.rssi_val_min <= 20) | 423 | if (dm_digtable->rssi_val_min <= 20) |
416 | dm_digtable.cur_cck_pd_state = | 424 | dm_digtable->cur_cck_pd_state = |
417 | CCK_PD_STAGE_LowRssi; | 425 | CCK_PD_STAGE_LowRssi; |
418 | else | 426 | else |
419 | dm_digtable.cur_cck_pd_state = | 427 | dm_digtable->cur_cck_pd_state = |
420 | CCK_PD_STAGE_HighRssi; | 428 | CCK_PD_STAGE_HighRssi; |
421 | } | 429 | } |
422 | } else { | 430 | } else { |
423 | dm_digtable.cur_cck_pd_state = CCK_PD_STAGE_MAX; | 431 | dm_digtable->cur_cck_pd_state = CCK_PD_STAGE_MAX; |
424 | } | 432 | } |
425 | 433 | ||
426 | if (dm_digtable.pre_cck_pd_state != dm_digtable.cur_cck_pd_state) { | 434 | if (dm_digtable->pre_cck_pd_state != dm_digtable->cur_cck_pd_state) { |
427 | if (dm_digtable.cur_cck_pd_state == CCK_PD_STAGE_LowRssi) { | 435 | if (dm_digtable->cur_cck_pd_state == CCK_PD_STAGE_LowRssi) { |
428 | if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800) | 436 | if (rtlpriv->falsealm_cnt.cnt_cck_fail > 800) |
429 | dm_digtable.cur_cck_fa_state = | 437 | dm_digtable->cur_cck_fa_state = |
430 | CCK_FA_STAGE_High; | 438 | CCK_FA_STAGE_High; |
431 | else | 439 | else |
432 | dm_digtable.cur_cck_fa_state = CCK_FA_STAGE_Low; | 440 | dm_digtable->cur_cck_fa_state = CCK_FA_STAGE_Low; |
433 | 441 | ||
434 | if (dm_digtable.pre_cck_fa_state != | 442 | if (dm_digtable->pre_cck_fa_state != |
435 | dm_digtable.cur_cck_fa_state) { | 443 | dm_digtable->cur_cck_fa_state) { |
436 | if (dm_digtable.cur_cck_fa_state == | 444 | if (dm_digtable->cur_cck_fa_state == |
437 | CCK_FA_STAGE_Low) | 445 | CCK_FA_STAGE_Low) |
438 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, | 446 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, |
439 | 0x83); | 447 | 0x83); |
@@ -441,8 +449,8 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
441 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, | 449 | rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, |
442 | 0xcd); | 450 | 0xcd); |
443 | 451 | ||
444 | dm_digtable.pre_cck_fa_state = | 452 | dm_digtable->pre_cck_fa_state = |
445 | dm_digtable.cur_cck_fa_state; | 453 | dm_digtable->cur_cck_fa_state; |
446 | } | 454 | } |
447 | 455 | ||
448 | rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40); | 456 | rtl_set_bbreg(hw, RCCK0_SYSTEM, MASKBYTE1, 0x40); |
@@ -458,11 +466,11 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
458 | rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, | 466 | rtl_set_bbreg(hw, RCCK0_FALSEALARMREPORT, |
459 | MASKBYTE2, 0xd3); | 467 | MASKBYTE2, 0xd3); |
460 | } | 468 | } |
461 | dm_digtable.pre_cck_pd_state = dm_digtable.cur_cck_pd_state; | 469 | dm_digtable->pre_cck_pd_state = dm_digtable->cur_cck_pd_state; |
462 | } | 470 | } |
463 | 471 | ||
464 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n", | 472 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "CCKPDStage=%x\n", |
465 | dm_digtable.cur_cck_pd_state); | 473 | dm_digtable->cur_cck_pd_state); |
466 | 474 | ||
467 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n", | 475 | RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, "is92C=%x\n", |
468 | IS_92C_SERIAL(rtlhal->version)); | 476 | IS_92C_SERIAL(rtlhal->version)); |
@@ -470,31 +478,34 @@ static void rtl92c_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) | |||
470 | 478 | ||
471 | static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) | 479 | static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) |
472 | { | 480 | { |
481 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
482 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
473 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 483 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
474 | 484 | ||
475 | if (mac->act_scanning) | 485 | if (mac->act_scanning) |
476 | return; | 486 | return; |
477 | 487 | ||
478 | if (mac->link_state >= MAC80211_LINKED) | 488 | if (mac->link_state >= MAC80211_LINKED) |
479 | dm_digtable.cursta_connectctate = DIG_STA_CONNECT; | 489 | dm_digtable->cursta_connectctate = DIG_STA_CONNECT; |
480 | else | 490 | else |
481 | dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; | 491 | dm_digtable->cursta_connectctate = DIG_STA_DISCONNECT; |
482 | 492 | ||
483 | rtl92c_dm_initial_gain_sta(hw); | 493 | rtl92c_dm_initial_gain_sta(hw); |
484 | rtl92c_dm_initial_gain_multi_sta(hw); | 494 | rtl92c_dm_initial_gain_multi_sta(hw); |
485 | rtl92c_dm_cck_packet_detection_thresh(hw); | 495 | rtl92c_dm_cck_packet_detection_thresh(hw); |
486 | 496 | ||
487 | dm_digtable.presta_connectstate = dm_digtable.cursta_connectctate; | 497 | dm_digtable->presta_connectstate = dm_digtable->cursta_connectctate; |
488 | 498 | ||
489 | } | 499 | } |
490 | 500 | ||
491 | static void rtl92c_dm_dig(struct ieee80211_hw *hw) | 501 | static void rtl92c_dm_dig(struct ieee80211_hw *hw) |
492 | { | 502 | { |
493 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 503 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
504 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
494 | 505 | ||
495 | if (rtlpriv->dm.dm_initialgain_enable == false) | 506 | if (rtlpriv->dm.dm_initialgain_enable == false) |
496 | return; | 507 | return; |
497 | if (dm_digtable.dig_enable_flag == false) | 508 | if (dm_digtable->dig_enable_flag == false) |
498 | return; | 509 | return; |
499 | 510 | ||
500 | rtl92c_dm_ctrl_initgain_by_twoport(hw); | 511 | rtl92c_dm_ctrl_initgain_by_twoport(hw); |
@@ -514,23 +525,24 @@ static void rtl92c_dm_init_dynamic_txpower(struct ieee80211_hw *hw) | |||
514 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw) | 525 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw) |
515 | { | 526 | { |
516 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 527 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
528 | struct dig_t *dm_digtable = &rtlpriv->dm_digtable; | ||
517 | 529 | ||
518 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, | 530 | RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, |
519 | "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n", | 531 | "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n", |
520 | dm_digtable.cur_igvalue, dm_digtable.pre_igvalue, | 532 | dm_digtable->cur_igvalue, dm_digtable->pre_igvalue, |
521 | dm_digtable.backoff_val); | 533 | dm_digtable->backoff_val); |
522 | 534 | ||
523 | dm_digtable.cur_igvalue += 2; | 535 | dm_digtable->cur_igvalue += 2; |
524 | if (dm_digtable.cur_igvalue > 0x3f) | 536 | if (dm_digtable->cur_igvalue > 0x3f) |
525 | dm_digtable.cur_igvalue = 0x3f; | 537 | dm_digtable->cur_igvalue = 0x3f; |
526 | 538 | ||
527 | if (dm_digtable.pre_igvalue != dm_digtable.cur_igvalue) { | 539 | if (dm_digtable->pre_igvalue != dm_digtable->cur_igvalue) { |
528 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, | 540 | rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, |
529 | dm_digtable.cur_igvalue); | 541 | dm_digtable->cur_igvalue); |
530 | rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, | 542 | rtl_set_bbreg(hw, ROFDM0_XBAGCCORE1, 0x7f, |
531 | dm_digtable.cur_igvalue); | 543 | dm_digtable->cur_igvalue); |
532 | 544 | ||
533 | dm_digtable.pre_igvalue = dm_digtable.cur_igvalue; | 545 | dm_digtable->pre_igvalue = dm_digtable->cur_igvalue; |
534 | } | 546 | } |
535 | } | 547 | } |
536 | EXPORT_SYMBOL(rtl92c_dm_write_dig); | 548 | EXPORT_SYMBOL(rtl92c_dm_write_dig); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h index b3180ea5aa31..518e208c0180 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h | |||
@@ -155,7 +155,6 @@ enum dm_dig_connect_e { | |||
155 | DIG_CONNECT_MAX | 155 | DIG_CONNECT_MAX |
156 | }; | 156 | }; |
157 | 157 | ||
158 | extern struct dig_t dm_digtable; | ||
159 | void rtl92c_dm_init(struct ieee80211_hw *hw); | 158 | void rtl92c_dm_init(struct ieee80211_hw *hw); |
160 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw); | 159 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw); |
161 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw); | 160 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c index 4c016241f340..cdcad7d9f15e 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | |||
@@ -1881,6 +1881,7 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw) | |||
1881 | { | 1881 | { |
1882 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1882 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1883 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1883 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
1884 | struct dig_t dm_digtable = rtlpriv->dm_digtable; | ||
1884 | 1885 | ||
1885 | RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, | 1886 | RT_TRACE(rtlpriv, COMP_CMD, DBG_TRACE, |
1886 | "--->Cmd(%#x), set_io_inprogress(%d)\n", | 1887 | "--->Cmd(%#x), set_io_inprogress(%d)\n", |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h index 56611d7049b4..d4a3d032c7bf 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/dm.h | |||
@@ -150,7 +150,6 @@ enum dm_dig_connect_e { | |||
150 | DIG_CONNECT_MAX | 150 | DIG_CONNECT_MAX |
151 | }; | 151 | }; |
152 | 152 | ||
153 | extern struct dig_t dm_digtable; | ||
154 | void rtl92c_dm_init(struct ieee80211_hw *hw); | 153 | void rtl92c_dm_init(struct ieee80211_hw *hw); |
155 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw); | 154 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw); |
156 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw); | 155 | void rtl92c_dm_write_dig(struct ieee80211_hw *hw); |