aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debugfs.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-08-07 18:41:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-14 09:13:48 -0400
commit5225935b53ce1eafb222c644230d03ad6011d357 (patch)
tree32a6993f8cb22af972228e5773e3aa3047a6e41b /drivers/net/wireless/iwlwifi/iwl-debugfs.c
parente8fe59aecb9020b06305be4f8c67d73cbf49cbd2 (diff)
iwlwifi: Display sensitivity and chain noise information
Display sensitivity and chain noise data to help understand the current environment and RF condition. The data is feeded by statistics notification and Beacon from uCode; then used by sensitivity calibration and chain noise calibration to determine how DSP should react to the environment changes Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c149
1 files changed, 148 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 20e4edb36ec4..1ad4ff6bfff7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -38,7 +38,7 @@
38#include "iwl-debug.h" 38#include "iwl-debug.h"
39#include "iwl-core.h" 39#include "iwl-core.h"
40#include "iwl-io.h" 40#include "iwl-io.h"
41 41#include "iwl-calib.h"
42 42
43/* create and remove of files */ 43/* create and remove of files */
44#define DEBUGFS_ADD_DIR(name, parent) do { \ 44#define DEBUGFS_ADD_DIR(name, parent) do { \
@@ -1346,6 +1346,145 @@ static ssize_t iwl_dbgfs_ucode_general_stats_read(struct file *file,
1346 return ret; 1346 return ret;
1347} 1347}
1348 1348
1349static ssize_t iwl_dbgfs_sensitivity_read(struct file *file,
1350 char __user *user_buf,
1351 size_t count, loff_t *ppos) {
1352
1353 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1354 int pos = 0;
1355 int cnt = 0;
1356 char *buf;
1357 int bufsz = sizeof(struct iwl_sensitivity_data) * 4 + 100;
1358 ssize_t ret;
1359 struct iwl_sensitivity_data *data;
1360
1361 data = &priv->sensitivity_data;
1362 buf = kzalloc(bufsz, GFP_KERNEL);
1363 if (!buf) {
1364 IWL_ERR(priv, "Can not allocate Buffer\n");
1365 return -ENOMEM;
1366 }
1367
1368 pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm:\t\t\t %u\n",
1369 data->auto_corr_ofdm);
1370 pos += scnprintf(buf + pos, bufsz - pos,
1371 "auto_corr_ofdm_mrc:\t\t %u\n",
1372 data->auto_corr_ofdm_mrc);
1373 pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_ofdm_x1:\t\t %u\n",
1374 data->auto_corr_ofdm_x1);
1375 pos += scnprintf(buf + pos, bufsz - pos,
1376 "auto_corr_ofdm_mrc_x1:\t\t %u\n",
1377 data->auto_corr_ofdm_mrc_x1);
1378 pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck:\t\t\t %u\n",
1379 data->auto_corr_cck);
1380 pos += scnprintf(buf + pos, bufsz - pos, "auto_corr_cck_mrc:\t\t %u\n",
1381 data->auto_corr_cck_mrc);
1382 pos += scnprintf(buf + pos, bufsz - pos,
1383 "last_bad_plcp_cnt_ofdm:\t\t %u\n",
1384 data->last_bad_plcp_cnt_ofdm);
1385 pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_ofdm:\t\t %u\n",
1386 data->last_fa_cnt_ofdm);
1387 pos += scnprintf(buf + pos, bufsz - pos,
1388 "last_bad_plcp_cnt_cck:\t\t %u\n",
1389 data->last_bad_plcp_cnt_cck);
1390 pos += scnprintf(buf + pos, bufsz - pos, "last_fa_cnt_cck:\t\t %u\n",
1391 data->last_fa_cnt_cck);
1392 pos += scnprintf(buf + pos, bufsz - pos, "nrg_curr_state:\t\t\t %u\n",
1393 data->nrg_curr_state);
1394 pos += scnprintf(buf + pos, bufsz - pos, "nrg_prev_state:\t\t\t %u\n",
1395 data->nrg_prev_state);
1396 pos += scnprintf(buf + pos, bufsz - pos, "nrg_value:\t\t\t");
1397 for (cnt = 0; cnt < 10; cnt++) {
1398 pos += scnprintf(buf + pos, bufsz - pos, " %u",
1399 data->nrg_value[cnt]);
1400 }
1401 pos += scnprintf(buf + pos, bufsz - pos, "\n");
1402 pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_rssi:\t\t");
1403 for (cnt = 0; cnt < NRG_NUM_PREV_STAT_L; cnt++) {
1404 pos += scnprintf(buf + pos, bufsz - pos, " %u",
1405 data->nrg_silence_rssi[cnt]);
1406 }
1407 pos += scnprintf(buf + pos, bufsz - pos, "\n");
1408 pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_ref:\t\t %u\n",
1409 data->nrg_silence_ref);
1410 pos += scnprintf(buf + pos, bufsz - pos, "nrg_energy_idx:\t\t\t %u\n",
1411 data->nrg_energy_idx);
1412 pos += scnprintf(buf + pos, bufsz - pos, "nrg_silence_idx:\t\t %u\n",
1413 data->nrg_silence_idx);
1414 pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_cck:\t\t\t %u\n",
1415 data->nrg_th_cck);
1416 pos += scnprintf(buf + pos, bufsz - pos,
1417 "nrg_auto_corr_silence_diff:\t %u\n",
1418 data->nrg_auto_corr_silence_diff);
1419 pos += scnprintf(buf + pos, bufsz - pos, "num_in_cck_no_fa:\t\t %u\n",
1420 data->num_in_cck_no_fa);
1421 pos += scnprintf(buf + pos, bufsz - pos, "nrg_th_ofdm:\t\t\t %u\n",
1422 data->nrg_th_ofdm);
1423
1424 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1425 kfree(buf);
1426 return ret;
1427}
1428
1429
1430static ssize_t iwl_dbgfs_chain_noise_read(struct file *file,
1431 char __user *user_buf,
1432 size_t count, loff_t *ppos) {
1433
1434 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
1435 int pos = 0;
1436 int cnt = 0;
1437 char *buf;
1438 int bufsz = sizeof(struct iwl_chain_noise_data) * 4 + 100;
1439 ssize_t ret;
1440 struct iwl_chain_noise_data *data;
1441
1442 data = &priv->chain_noise_data;
1443 buf = kzalloc(bufsz, GFP_KERNEL);
1444 if (!buf) {
1445 IWL_ERR(priv, "Can not allocate Buffer\n");
1446 return -ENOMEM;
1447 }
1448
1449 pos += scnprintf(buf + pos, bufsz - pos, "active_chains:\t\t\t %u\n",
1450 data->active_chains);
1451 pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_a:\t\t\t %u\n",
1452 data->chain_noise_a);
1453 pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_b:\t\t\t %u\n",
1454 data->chain_noise_b);
1455 pos += scnprintf(buf + pos, bufsz - pos, "chain_noise_c:\t\t\t %u\n",
1456 data->chain_noise_c);
1457 pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_a:\t\t\t %u\n",
1458 data->chain_signal_a);
1459 pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_b:\t\t\t %u\n",
1460 data->chain_signal_b);
1461 pos += scnprintf(buf + pos, bufsz - pos, "chain_signal_c:\t\t\t %u\n",
1462 data->chain_signal_c);
1463 pos += scnprintf(buf + pos, bufsz - pos, "beacon_count:\t\t\t %u\n",
1464 data->beacon_count);
1465
1466 pos += scnprintf(buf + pos, bufsz - pos, "disconn_array:\t\t\t");
1467 for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) {
1468 pos += scnprintf(buf + pos, bufsz - pos, " %u",
1469 data->disconn_array[cnt]);
1470 }
1471 pos += scnprintf(buf + pos, bufsz - pos, "\n");
1472 pos += scnprintf(buf + pos, bufsz - pos, "delta_gain_code:\t\t");
1473 for (cnt = 0; cnt < NUM_RX_CHAINS; cnt++) {
1474 pos += scnprintf(buf + pos, bufsz - pos, " %u",
1475 data->delta_gain_code[cnt]);
1476 }
1477 pos += scnprintf(buf + pos, bufsz - pos, "\n");
1478 pos += scnprintf(buf + pos, bufsz - pos, "radio_write:\t\t\t %u\n",
1479 data->radio_write);
1480 pos += scnprintf(buf + pos, bufsz - pos, "state:\t\t\t\t %u\n",
1481 data->state);
1482
1483 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1484 kfree(buf);
1485 return ret;
1486}
1487
1349DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); 1488DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics);
1350DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); 1489DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics);
1351DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); 1490DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
@@ -1354,6 +1493,8 @@ DEBUGFS_READ_FILE_OPS(tx_queue);
1354DEBUGFS_READ_FILE_OPS(ucode_rx_stats); 1493DEBUGFS_READ_FILE_OPS(ucode_rx_stats);
1355DEBUGFS_READ_FILE_OPS(ucode_tx_stats); 1494DEBUGFS_READ_FILE_OPS(ucode_tx_stats);
1356DEBUGFS_READ_FILE_OPS(ucode_general_stats); 1495DEBUGFS_READ_FILE_OPS(ucode_general_stats);
1496DEBUGFS_READ_FILE_OPS(sensitivity);
1497DEBUGFS_READ_FILE_OPS(chain_noise);
1357 1498
1358/* 1499/*
1359 * Create the debugfs files and directories 1500 * Create the debugfs files and directories
@@ -1404,6 +1545,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
1404 DEBUGFS_ADD_FILE(ucode_rx_stats, debug); 1545 DEBUGFS_ADD_FILE(ucode_rx_stats, debug);
1405 DEBUGFS_ADD_FILE(ucode_tx_stats, debug); 1546 DEBUGFS_ADD_FILE(ucode_tx_stats, debug);
1406 DEBUGFS_ADD_FILE(ucode_general_stats, debug); 1547 DEBUGFS_ADD_FILE(ucode_general_stats, debug);
1548 DEBUGFS_ADD_FILE(sensitivity, debug);
1549 DEBUGFS_ADD_FILE(chain_noise, debug);
1407 } 1550 }
1408 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); 1551 DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
1409 DEBUGFS_ADD_BOOL(disable_chain_noise, rf, 1552 DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
@@ -1456,6 +1599,10 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv)
1456 file_ucode_tx_stats); 1599 file_ucode_tx_stats);
1457 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. 1600 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.
1458 file_ucode_general_stats); 1601 file_ucode_general_stats);
1602 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.
1603 file_sensitivity);
1604 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.
1605 file_chain_noise);
1459 } 1606 }
1460 DEBUGFS_REMOVE(priv->dbgfs->dir_debug); 1607 DEBUGFS_REMOVE(priv->dbgfs->dir_debug);
1461 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); 1608 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity);