diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-08-21 16:34:19 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-28 14:40:37 -0400 |
commit | f204b2487e5503ca4a9f3e69dcd63f6af979aaac (patch) | |
tree | bb6be34e06f92da71874853bf56c32f21336ac16 | |
parent | fcbaf8b06da385c73cb6218f079e9ddba9ee9f7c (diff) |
iwlwifi: show current tx power
debugFs file show current tx power for all the transmit chains
Adding "tx_power" file in /sys/kernal/debug/ieee80211/phy0/iwlagn/debug
to display current tx power for all the active chains in 1/2 dB step.
Show tx power information "Not available" if uCode can not provide the
information or interface is down.
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>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debug.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 54 |
2 files changed, 55 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index 723f38a023ce..cbc62904655d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -107,6 +107,7 @@ struct iwl_debugfs { | |||
107 | struct dentry *file_ucode_general_stats; | 107 | struct dentry *file_ucode_general_stats; |
108 | struct dentry *file_sensitivity; | 108 | struct dentry *file_sensitivity; |
109 | struct dentry *file_chain_noise; | 109 | struct dentry *file_chain_noise; |
110 | struct dentry *file_tx_power; | ||
110 | } dbgfs_debug_files; | 111 | } dbgfs_debug_files; |
111 | u32 sram_offset; | 112 | u32 sram_offset; |
112 | u32 sram_len; | 113 | u32 sram_len; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index f68fb4711da2..fb844859a443 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -1563,6 +1563,57 @@ static ssize_t iwl_dbgfs_chain_noise_read(struct file *file, | |||
1563 | return ret; | 1563 | return ret; |
1564 | } | 1564 | } |
1565 | 1565 | ||
1566 | static ssize_t iwl_dbgfs_tx_power_read(struct file *file, | ||
1567 | char __user *user_buf, | ||
1568 | size_t count, loff_t *ppos) { | ||
1569 | |||
1570 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
1571 | char buf[128]; | ||
1572 | int pos = 0; | ||
1573 | ssize_t ret; | ||
1574 | const size_t bufsz = sizeof(buf); | ||
1575 | struct statistics_tx *tx; | ||
1576 | |||
1577 | if (!iwl_is_alive(priv)) | ||
1578 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); | ||
1579 | else { | ||
1580 | /* make request to uCode to retrieve statistics information */ | ||
1581 | mutex_lock(&priv->mutex); | ||
1582 | ret = iwl_send_statistics_request(priv, 0); | ||
1583 | mutex_unlock(&priv->mutex); | ||
1584 | |||
1585 | if (ret) { | ||
1586 | IWL_ERR(priv, "Error sending statistics request: %zd\n", | ||
1587 | ret); | ||
1588 | return -EAGAIN; | ||
1589 | } | ||
1590 | tx = &priv->statistics.tx; | ||
1591 | if (tx->tx_power.ant_a || | ||
1592 | tx->tx_power.ant_b || | ||
1593 | tx->tx_power.ant_c) { | ||
1594 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1595 | "tx power: (1/2 dB step)\n"); | ||
1596 | if ((priv->cfg->valid_tx_ant & ANT_A) && | ||
1597 | tx->tx_power.ant_a) | ||
1598 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1599 | "\tantenna A: 0x%X\n", | ||
1600 | tx->tx_power.ant_a); | ||
1601 | if ((priv->cfg->valid_tx_ant & ANT_B) && | ||
1602 | tx->tx_power.ant_b) | ||
1603 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1604 | "\tantenna B: 0x%X\n", | ||
1605 | tx->tx_power.ant_b); | ||
1606 | if ((priv->cfg->valid_tx_ant & ANT_C) && | ||
1607 | tx->tx_power.ant_c) | ||
1608 | pos += scnprintf(buf + pos, bufsz - pos, | ||
1609 | "\tantenna C: 0x%X\n", | ||
1610 | tx->tx_power.ant_c); | ||
1611 | } else | ||
1612 | pos += scnprintf(buf + pos, bufsz - pos, "N/A\n"); | ||
1613 | } | ||
1614 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1615 | } | ||
1616 | |||
1566 | DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); | 1617 | DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); |
1567 | DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); | 1618 | DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); |
1568 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 1619 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
@@ -1573,6 +1624,7 @@ DEBUGFS_READ_FILE_OPS(ucode_tx_stats); | |||
1573 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); | 1624 | DEBUGFS_READ_FILE_OPS(ucode_general_stats); |
1574 | DEBUGFS_READ_FILE_OPS(sensitivity); | 1625 | DEBUGFS_READ_FILE_OPS(sensitivity); |
1575 | DEBUGFS_READ_FILE_OPS(chain_noise); | 1626 | DEBUGFS_READ_FILE_OPS(chain_noise); |
1627 | DEBUGFS_READ_FILE_OPS(tx_power); | ||
1576 | 1628 | ||
1577 | /* | 1629 | /* |
1578 | * Create the debugfs files and directories | 1630 | * Create the debugfs files and directories |
@@ -1621,6 +1673,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1621 | DEBUGFS_ADD_FILE(traffic_log, debug); | 1673 | DEBUGFS_ADD_FILE(traffic_log, debug); |
1622 | DEBUGFS_ADD_FILE(rx_queue, debug); | 1674 | DEBUGFS_ADD_FILE(rx_queue, debug); |
1623 | DEBUGFS_ADD_FILE(tx_queue, debug); | 1675 | DEBUGFS_ADD_FILE(tx_queue, debug); |
1676 | DEBUGFS_ADD_FILE(tx_power, debug); | ||
1624 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 1677 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
1625 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug); | 1678 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug); |
1626 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug); | 1679 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug); |
@@ -1674,6 +1727,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
1674 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log); | 1727 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_traffic_log); |
1675 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_queue); | 1728 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_queue); |
1676 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue); | 1729 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue); |
1730 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_power); | ||
1677 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 1731 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
1678 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. | 1732 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. |
1679 | file_ucode_rx_stats); | 1733 | file_ucode_rx_stats); |