|
@@ -378,19 +378,16 @@ static void dm_bandwidth_autoswitch(struct net_device *dev)
|
|
|
struct r8192_priv *priv = rtllib_priv(dev);
|
|
|
|
|
|
if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 ||
|
|
|
- !priv->rtllib->bandwidth_auto_switch.bautoswitch_enable) {
|
|
|
+ !priv->rtllib->bandwidth_auto_switch.bautoswitch_enable)
|
|
|
return;
|
|
|
+ if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) {
|
|
|
+ if (priv->undecorated_smoothed_pwdb <=
|
|
|
+ priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
|
|
|
+ priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = true;
|
|
|
} else {
|
|
|
- if (priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz == false) {
|
|
|
- if (priv->undecorated_smoothed_pwdb <=
|
|
|
- priv->rtllib->bandwidth_auto_switch.threshold_40Mhzto20Mhz)
|
|
|
- priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = true;
|
|
|
- } else {
|
|
|
- if (priv->undecorated_smoothed_pwdb >=
|
|
|
- priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
|
|
|
- priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false;
|
|
|
-
|
|
|
- }
|
|
|
+ if (priv->undecorated_smoothed_pwdb >=
|
|
|
+ priv->rtllib->bandwidth_auto_switch.threshold_20Mhzto40Mhz)
|
|
|
+ priv->rtllib->bandwidth_auto_switch.bforced_tx20Mhz = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -581,148 +578,148 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
|
|
|
"priv->CCKPresentAttentuation = %d\n",
|
|
|
priv->CCKPresentAttentuation);
|
|
|
return;
|
|
|
- } else {
|
|
|
- if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) {
|
|
|
- if (RF_Type == RF_2T4R) {
|
|
|
-
|
|
|
- if ((priv->rfa_txpowertrackingindex > 0) &&
|
|
|
- (priv->rfc_txpowertrackingindex > 0)) {
|
|
|
- priv->rfa_txpowertrackingindex--;
|
|
|
- if (priv->rfa_txpowertrackingindex_real > 4) {
|
|
|
- priv->rfa_txpowertrackingindex_real--;
|
|
|
- rtl8192_setBBreg(dev,
|
|
|
- rOFDM0_XATxIQImbalance,
|
|
|
- bMaskDWord,
|
|
|
- priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
|
|
|
- }
|
|
|
-
|
|
|
- priv->rfc_txpowertrackingindex--;
|
|
|
- if (priv->rfc_txpowertrackingindex_real > 4) {
|
|
|
- priv->rfc_txpowertrackingindex_real--;
|
|
|
- rtl8192_setBBreg(dev,
|
|
|
- rOFDM0_XCTxIQImbalance,
|
|
|
- bMaskDWord,
|
|
|
- priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value);
|
|
|
- }
|
|
|
- } else {
|
|
|
- rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance,
|
|
|
- bMaskDWord,
|
|
|
- priv->txbbgain_table[4].txbbgain_value);
|
|
|
- rtl8192_setBBreg(dev,
|
|
|
- rOFDM0_XCTxIQImbalance,
|
|
|
- bMaskDWord, priv->txbbgain_table[4].txbbgain_value);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (priv->rfa_txpowertrackingindex > 0) {
|
|
|
- priv->rfa_txpowertrackingindex--;
|
|
|
- if (priv->rfa_txpowertrackingindex_real > 4) {
|
|
|
- priv->rfa_txpowertrackingindex_real--;
|
|
|
- rtl8192_setBBreg(dev,
|
|
|
- rOFDM0_XATxIQImbalance,
|
|
|
- bMaskDWord,
|
|
|
- priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
|
|
|
- }
|
|
|
- } else
|
|
|
- rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance,
|
|
|
- bMaskDWord, priv->txbbgain_table[4].txbbgain_value);
|
|
|
+ }
|
|
|
+ if (Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) {
|
|
|
+ if (RF_Type == RF_2T4R) {
|
|
|
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (RF_Type == RF_2T4R) {
|
|
|
- if ((priv->rfa_txpowertrackingindex <
|
|
|
- TxBBGainTableLength - 1) &&
|
|
|
- (priv->rfc_txpowertrackingindex <
|
|
|
- TxBBGainTableLength - 1)) {
|
|
|
- priv->rfa_txpowertrackingindex++;
|
|
|
- priv->rfa_txpowertrackingindex_real++;
|
|
|
+ if ((priv->rfa_txpowertrackingindex > 0) &&
|
|
|
+ (priv->rfc_txpowertrackingindex > 0)) {
|
|
|
+ priv->rfa_txpowertrackingindex--;
|
|
|
+ if (priv->rfa_txpowertrackingindex_real > 4) {
|
|
|
+ priv->rfa_txpowertrackingindex_real--;
|
|
|
rtl8192_setBBreg(dev,
|
|
|
rOFDM0_XATxIQImbalance,
|
|
|
bMaskDWord,
|
|
|
- priv->txbbgain_table
|
|
|
- [priv->rfa_txpowertrackingindex_real].txbbgain_value);
|
|
|
- priv->rfc_txpowertrackingindex++;
|
|
|
- priv->rfc_txpowertrackingindex_real++;
|
|
|
+ priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
|
|
|
+ }
|
|
|
+
|
|
|
+ priv->rfc_txpowertrackingindex--;
|
|
|
+ if (priv->rfc_txpowertrackingindex_real > 4) {
|
|
|
+ priv->rfc_txpowertrackingindex_real--;
|
|
|
rtl8192_setBBreg(dev,
|
|
|
rOFDM0_XCTxIQImbalance,
|
|
|
bMaskDWord,
|
|
|
priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value);
|
|
|
- } else {
|
|
|
- rtl8192_setBBreg(dev,
|
|
|
- rOFDM0_XATxIQImbalance,
|
|
|
- bMaskDWord,
|
|
|
- priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value);
|
|
|
- rtl8192_setBBreg(dev,
|
|
|
- rOFDM0_XCTxIQImbalance,
|
|
|
- bMaskDWord, priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value);
|
|
|
}
|
|
|
} else {
|
|
|
- if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) {
|
|
|
- priv->rfa_txpowertrackingindex++;
|
|
|
- priv->rfa_txpowertrackingindex_real++;
|
|
|
- rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance,
|
|
|
+ rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance,
|
|
|
+ bMaskDWord,
|
|
|
+ priv->txbbgain_table[4].txbbgain_value);
|
|
|
+ rtl8192_setBBreg(dev,
|
|
|
+ rOFDM0_XCTxIQImbalance,
|
|
|
+ bMaskDWord, priv->txbbgain_table[4].txbbgain_value);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (priv->rfa_txpowertrackingindex > 0) {
|
|
|
+ priv->rfa_txpowertrackingindex--;
|
|
|
+ if (priv->rfa_txpowertrackingindex_real > 4) {
|
|
|
+ priv->rfa_txpowertrackingindex_real--;
|
|
|
+ rtl8192_setBBreg(dev,
|
|
|
+ rOFDM0_XATxIQImbalance,
|
|
|
bMaskDWord,
|
|
|
priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
|
|
|
- } else
|
|
|
- rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance,
|
|
|
- bMaskDWord,
|
|
|
- priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value);
|
|
|
- }
|
|
|
+ }
|
|
|
+ } else
|
|
|
+ rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance,
|
|
|
+ bMaskDWord, priv->txbbgain_table[4].txbbgain_value);
|
|
|
+
|
|
|
}
|
|
|
+ } else {
|
|
|
if (RF_Type == RF_2T4R) {
|
|
|
- priv->CCKPresentAttentuation_difference
|
|
|
- = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default;
|
|
|
+ if ((priv->rfa_txpowertrackingindex <
|
|
|
+ TxBBGainTableLength - 1) &&
|
|
|
+ (priv->rfc_txpowertrackingindex <
|
|
|
+ TxBBGainTableLength - 1)) {
|
|
|
+ priv->rfa_txpowertrackingindex++;
|
|
|
+ priv->rfa_txpowertrackingindex_real++;
|
|
|
+ rtl8192_setBBreg(dev,
|
|
|
+ rOFDM0_XATxIQImbalance,
|
|
|
+ bMaskDWord,
|
|
|
+ priv->txbbgain_table
|
|
|
+ [priv->rfa_txpowertrackingindex_real].txbbgain_value);
|
|
|
+ priv->rfc_txpowertrackingindex++;
|
|
|
+ priv->rfc_txpowertrackingindex_real++;
|
|
|
+ rtl8192_setBBreg(dev,
|
|
|
+ rOFDM0_XCTxIQImbalance,
|
|
|
+ bMaskDWord,
|
|
|
+ priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value);
|
|
|
+ } else {
|
|
|
+ rtl8192_setBBreg(dev,
|
|
|
+ rOFDM0_XATxIQImbalance,
|
|
|
+ bMaskDWord,
|
|
|
+ priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value);
|
|
|
+ rtl8192_setBBreg(dev,
|
|
|
+ rOFDM0_XCTxIQImbalance,
|
|
|
+ bMaskDWord, priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value);
|
|
|
+ }
|
|
|
} else {
|
|
|
- priv->CCKPresentAttentuation_difference
|
|
|
- = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default;
|
|
|
- }
|
|
|
-
|
|
|
- if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20)
|
|
|
- priv->CCKPresentAttentuation =
|
|
|
- priv->CCKPresentAttentuation_20Mdefault +
|
|
|
- priv->CCKPresentAttentuation_difference;
|
|
|
- else
|
|
|
- priv->CCKPresentAttentuation =
|
|
|
- priv->CCKPresentAttentuation_40Mdefault +
|
|
|
- priv->CCKPresentAttentuation_difference;
|
|
|
-
|
|
|
- if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength-1))
|
|
|
- priv->CCKPresentAttentuation = CCKTxBBGainTableLength-1;
|
|
|
- if (priv->CCKPresentAttentuation < 0)
|
|
|
- priv->CCKPresentAttentuation = 0;
|
|
|
-
|
|
|
- if (priv->CCKPresentAttentuation > -1 &&
|
|
|
- priv->CCKPresentAttentuation < CCKTxBBGainTableLength) {
|
|
|
- if (priv->rtllib->current_network.channel == 14 &&
|
|
|
- !priv->bcck_in_ch14) {
|
|
|
- priv->bcck_in_ch14 = true;
|
|
|
- dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
|
|
|
- } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) {
|
|
|
- priv->bcck_in_ch14 = false;
|
|
|
- dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
|
|
|
+ if (priv->rfa_txpowertrackingindex < (TxBBGainTableLength - 1)) {
|
|
|
+ priv->rfa_txpowertrackingindex++;
|
|
|
+ priv->rfa_txpowertrackingindex_real++;
|
|
|
+ rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance,
|
|
|
+ bMaskDWord,
|
|
|
+ priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value);
|
|
|
} else
|
|
|
- dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
|
|
|
+ rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance,
|
|
|
+ bMaskDWord,
|
|
|
+ priv->txbbgain_table[TxBBGainTableLength - 1].txbbgain_value);
|
|
|
}
|
|
|
- RT_TRACE(COMP_POWER_TRACKING,
|
|
|
- "priv->rfa_txpowertrackingindex = %d\n",
|
|
|
- priv->rfa_txpowertrackingindex);
|
|
|
- RT_TRACE(COMP_POWER_TRACKING,
|
|
|
- "priv->rfa_txpowertrackingindex_real = %d\n",
|
|
|
- priv->rfa_txpowertrackingindex_real);
|
|
|
- RT_TRACE(COMP_POWER_TRACKING,
|
|
|
- "priv->CCKPresentAttentuation_difference = %d\n",
|
|
|
- priv->CCKPresentAttentuation_difference);
|
|
|
- RT_TRACE(COMP_POWER_TRACKING,
|
|
|
- "priv->CCKPresentAttentuation = %d\n",
|
|
|
- priv->CCKPresentAttentuation);
|
|
|
+ }
|
|
|
+ if (RF_Type == RF_2T4R) {
|
|
|
+ priv->CCKPresentAttentuation_difference
|
|
|
+ = priv->rfa_txpowertrackingindex - priv->rfa_txpowertracking_default;
|
|
|
+ } else {
|
|
|
+ priv->CCKPresentAttentuation_difference
|
|
|
+ = priv->rfa_txpowertrackingindex_real - priv->rfa_txpowertracking_default;
|
|
|
+ }
|
|
|
|
|
|
- if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) {
|
|
|
- priv->rtllib->bdynamic_txpower_enable = true;
|
|
|
- write_nic_byte(dev, Pw_Track_Flag, 0);
|
|
|
- write_nic_byte(dev, FW_Busy_Flag, 0);
|
|
|
- RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n");
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20)
|
|
|
+ priv->CCKPresentAttentuation =
|
|
|
+ priv->CCKPresentAttentuation_20Mdefault +
|
|
|
+ priv->CCKPresentAttentuation_difference;
|
|
|
+ else
|
|
|
+ priv->CCKPresentAttentuation =
|
|
|
+ priv->CCKPresentAttentuation_40Mdefault +
|
|
|
+ priv->CCKPresentAttentuation_difference;
|
|
|
+
|
|
|
+ if (priv->CCKPresentAttentuation > (CCKTxBBGainTableLength-1))
|
|
|
+ priv->CCKPresentAttentuation = CCKTxBBGainTableLength-1;
|
|
|
+ if (priv->CCKPresentAttentuation < 0)
|
|
|
+ priv->CCKPresentAttentuation = 0;
|
|
|
+
|
|
|
+ if (priv->CCKPresentAttentuation > -1 &&
|
|
|
+ priv->CCKPresentAttentuation < CCKTxBBGainTableLength) {
|
|
|
+ if (priv->rtllib->current_network.channel == 14 &&
|
|
|
+ !priv->bcck_in_ch14) {
|
|
|
+ priv->bcck_in_ch14 = true;
|
|
|
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
|
|
|
+ } else if (priv->rtllib->current_network.channel != 14 && priv->bcck_in_ch14) {
|
|
|
+ priv->bcck_in_ch14 = false;
|
|
|
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
|
|
|
+ } else
|
|
|
+ dm_cck_txpower_adjust(dev, priv->bcck_in_ch14);
|
|
|
+ }
|
|
|
+ RT_TRACE(COMP_POWER_TRACKING,
|
|
|
+ "priv->rfa_txpowertrackingindex = %d\n",
|
|
|
+ priv->rfa_txpowertrackingindex);
|
|
|
+ RT_TRACE(COMP_POWER_TRACKING,
|
|
|
+ "priv->rfa_txpowertrackingindex_real = %d\n",
|
|
|
+ priv->rfa_txpowertrackingindex_real);
|
|
|
+ RT_TRACE(COMP_POWER_TRACKING,
|
|
|
+ "priv->CCKPresentAttentuation_difference = %d\n",
|
|
|
+ priv->CCKPresentAttentuation_difference);
|
|
|
+ RT_TRACE(COMP_POWER_TRACKING,
|
|
|
+ "priv->CCKPresentAttentuation = %d\n",
|
|
|
+ priv->CCKPresentAttentuation);
|
|
|
+
|
|
|
+ if (priv->CCKPresentAttentuation_difference <= -12 || priv->CCKPresentAttentuation_difference >= 24) {
|
|
|
+ priv->rtllib->bdynamic_txpower_enable = true;
|
|
|
+ write_nic_byte(dev, Pw_Track_Flag, 0);
|
|
|
+ write_nic_byte(dev, FW_Busy_Flag, 0);
|
|
|
+ RT_TRACE(COMP_POWER_TRACKING, "tx power track--->limited\n");
|
|
|
+ return;
|
|
|
}
|
|
|
+
|
|
|
write_nic_byte(dev, Pw_Track_Flag, 0);
|
|
|
Avg_TSSI_Meas_from_driver = 0;
|
|
|
for (k = 0; k < 5; k++)
|
|
@@ -1401,13 +1398,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
|
|
|
TxPowerCheckCnt = 5;
|
|
|
else
|
|
|
TxPowerCheckCnt = 2;
|
|
|
- if (!priv->btxpower_tracking) {
|
|
|
+ if (!priv->btxpower_tracking)
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (priv->txpower_count <= TxPowerCheckCnt) {
|
|
|
+ priv->txpower_count++;
|
|
|
return;
|
|
|
- } else {
|
|
|
- if (priv->txpower_count <= TxPowerCheckCnt) {
|
|
|
- priv->txpower_count++;
|
|
|
- return;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
if (!TM_Trigger) {
|
|
@@ -1419,15 +1415,12 @@ static void dm_CheckTXPowerTracking_ThermalMeter(struct net_device *dev)
|
|
|
}
|
|
|
TM_Trigger = 1;
|
|
|
return;
|
|
|
- } else {
|
|
|
- netdev_info(dev,
|
|
|
- "===============>Schedule TxPowerTrackingWorkItem\n");
|
|
|
-
|
|
|
- queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0);
|
|
|
- TM_Trigger = 0;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
+ netdev_info(dev, "===============>Schedule TxPowerTrackingWorkItem\n");
|
|
|
+ queue_delayed_work_rsl(priv->priv_wq, &priv->txpower_tracking_wq, 0);
|
|
|
+ TM_Trigger = 0;
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
static void dm_check_txpower_tracking(struct net_device *dev)
|
|
|
{
|
|
@@ -1835,8 +1828,7 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
|
|
|
if (dm_digtable.dig_state == DM_STA_DIG_OFF &&
|
|
|
(priv->reset_count == reset_cnt))
|
|
|
return;
|
|
|
- else
|
|
|
- reset_cnt = priv->reset_count;
|
|
|
+ reset_cnt = priv->reset_count;
|
|
|
|
|
|
dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX;
|
|
|
dm_digtable.dig_state = DM_STA_DIG_OFF;
|
|
@@ -1865,12 +1857,11 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm(
|
|
|
(priv->reset_count == reset_cnt)) {
|
|
|
dm_ctrl_initgain_byrssi_highpwr(dev);
|
|
|
return;
|
|
|
- } else {
|
|
|
- if (priv->reset_count != reset_cnt)
|
|
|
- reset_flag = 1;
|
|
|
-
|
|
|
- reset_cnt = priv->reset_count;
|
|
|
}
|
|
|
+ if (priv->reset_count != reset_cnt)
|
|
|
+ reset_flag = 1;
|
|
|
+
|
|
|
+ reset_cnt = priv->reset_count;
|
|
|
|
|
|
dm_digtable.dig_state = DM_STA_DIG_ON;
|
|
|
|
|
@@ -1912,8 +1903,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev)
|
|
|
if (dm_digtable.dig_highpwr_state == DM_STA_DIG_ON &&
|
|
|
(priv->reset_count == reset_cnt_highpwr))
|
|
|
return;
|
|
|
- else
|
|
|
- dm_digtable.dig_highpwr_state = DM_STA_DIG_ON;
|
|
|
+ dm_digtable.dig_highpwr_state = DM_STA_DIG_ON;
|
|
|
|
|
|
if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20)
|
|
|
write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10);
|
|
@@ -1923,8 +1913,7 @@ static void dm_ctrl_initgain_byrssi_highpwr(struct net_device *dev)
|
|
|
if (dm_digtable.dig_highpwr_state == DM_STA_DIG_OFF &&
|
|
|
(priv->reset_count == reset_cnt_highpwr))
|
|
|
return;
|
|
|
- else
|
|
|
- dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF;
|
|
|
+ dm_digtable.dig_highpwr_state = DM_STA_DIG_OFF;
|
|
|
|
|
|
if (priv->undecorated_smoothed_pwdb < dm_digtable.rssi_high_power_lowthresh &&
|
|
|
priv->undecorated_smoothed_pwdb >= dm_digtable.rssi_high_thresh) {
|