aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index e5d8fa38432e..f8e4e4b18d02 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1299,47 +1299,6 @@ int iwl3945_calc_db_from_ratio(int sig_ratio)
1299 return (int)ratio2dB[sig_ratio]; 1299 return (int)ratio2dB[sig_ratio];
1300} 1300}
1301 1301
1302#define PERFECT_RSSI (-20) /* dBm */
1303#define WORST_RSSI (-95) /* dBm */
1304#define RSSI_RANGE (PERFECT_RSSI - WORST_RSSI)
1305
1306/* Calculate an indication of rx signal quality (a percentage, not dBm!).
1307 * See http://www.ces.clemson.edu/linux/signal_quality.shtml for info
1308 * about formulas used below. */
1309int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm)
1310{
1311 int sig_qual;
1312 int degradation = PERFECT_RSSI - rssi_dbm;
1313
1314 /* If we get a noise measurement, use signal-to-noise ratio (SNR)
1315 * as indicator; formula is (signal dbm - noise dbm).
1316 * SNR at or above 40 is a great signal (100%).
1317 * Below that, scale to fit SNR of 0 - 40 dB within 0 - 100% indicator.
1318 * Weakest usable signal is usually 10 - 15 dB SNR. */
1319 if (noise_dbm) {
1320 if (rssi_dbm - noise_dbm >= 40)
1321 return 100;
1322 else if (rssi_dbm < noise_dbm)
1323 return 0;
1324 sig_qual = ((rssi_dbm - noise_dbm) * 5) / 2;
1325
1326 /* Else use just the signal level.
1327 * This formula is a least squares fit of data points collected and
1328 * compared with a reference system that had a percentage (%) display
1329 * for signal quality. */
1330 } else
1331 sig_qual = (100 * (RSSI_RANGE * RSSI_RANGE) - degradation *
1332 (15 * RSSI_RANGE + 62 * degradation)) /
1333 (RSSI_RANGE * RSSI_RANGE);
1334
1335 if (sig_qual > 100)
1336 sig_qual = 100;
1337 else if (sig_qual < 1)
1338 sig_qual = 0;
1339
1340 return sig_qual;
1341}
1342
1343/** 1302/**
1344 * iwl3945_rx_handle - Main entry function for receiving responses from uCode 1303 * iwl3945_rx_handle - Main entry function for receiving responses from uCode
1345 * 1304 *