diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-10-16 17:25:50 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-27 16:48:31 -0400 |
commit | c09430abed4159e5c56aaea257d040f7452daba6 (patch) | |
tree | 1bc3e17162880d7cba27c4d4ee95bb5addf54fb2 /drivers/net/wireless/iwlwifi/iwl-debugfs.c | |
parent | 1f80989e8b7f79d8e916b14600488489bdd5569f (diff) |
iwlwifi: show current power save status reported by uCode
Power save request is sent from driver to uCode, but there is no
indication from uCode about the current device power save state.
Reading GP_CNTRL register bit 25:24 to show the current power save
status
00: no power save
01: MAC power down
10: PHY power down
11: Error
The uCode could switch in and out of power save mode in the order of
once per 100-300 ms in many cases. The reading here should just be used for
reference on the current uCode power save status. Do not confuse this
reading with the PowerSave set by driver and mac80211.
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.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 2cd11ba96370..e78cd26b809f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -1802,6 +1802,29 @@ static ssize_t iwl_dbgfs_tx_power_read(struct file *file, | |||
1802 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 1802 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, | ||
1806 | char __user *user_buf, | ||
1807 | size_t count, loff_t *ppos) | ||
1808 | { | ||
1809 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
1810 | char buf[60]; | ||
1811 | int pos = 0; | ||
1812 | const size_t bufsz = sizeof(buf); | ||
1813 | u32 pwrsave_status; | ||
1814 | |||
1815 | pwrsave_status = iwl_read32(priv, CSR_GP_CNTRL) & | ||
1816 | CSR_GP_REG_POWER_SAVE_STATUS_MSK; | ||
1817 | |||
1818 | pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); | ||
1819 | pos += scnprintf(buf + pos, bufsz - pos, "%s\n", | ||
1820 | (pwrsave_status == CSR_GP_REG_NO_POWER_SAVE) ? "none" : | ||
1821 | (pwrsave_status == CSR_GP_REG_MAC_POWER_SAVE) ? "MAC" : | ||
1822 | (pwrsave_status == CSR_GP_REG_PHY_POWER_SAVE) ? "PHY" : | ||
1823 | "error"); | ||
1824 | |||
1825 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
1826 | } | ||
1827 | |||
1805 | DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); | 1828 | DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); |
1806 | DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); | 1829 | DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); |
1807 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 1830 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
@@ -1813,6 +1836,7 @@ DEBUGFS_READ_FILE_OPS(ucode_general_stats); | |||
1813 | DEBUGFS_READ_FILE_OPS(sensitivity); | 1836 | DEBUGFS_READ_FILE_OPS(sensitivity); |
1814 | DEBUGFS_READ_FILE_OPS(chain_noise); | 1837 | DEBUGFS_READ_FILE_OPS(chain_noise); |
1815 | DEBUGFS_READ_FILE_OPS(tx_power); | 1838 | DEBUGFS_READ_FILE_OPS(tx_power); |
1839 | DEBUGFS_READ_FILE_OPS(power_save_status); | ||
1816 | 1840 | ||
1817 | /* | 1841 | /* |
1818 | * Create the debugfs files and directories | 1842 | * Create the debugfs files and directories |
@@ -1860,6 +1884,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1860 | DEBUGFS_ADD_FILE(rx_queue, debug); | 1884 | DEBUGFS_ADD_FILE(rx_queue, debug); |
1861 | DEBUGFS_ADD_FILE(tx_queue, debug); | 1885 | DEBUGFS_ADD_FILE(tx_queue, debug); |
1862 | DEBUGFS_ADD_FILE(tx_power, debug); | 1886 | DEBUGFS_ADD_FILE(tx_power, debug); |
1887 | DEBUGFS_ADD_FILE(power_save_status, debug); | ||
1863 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 1888 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
1864 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug); | 1889 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug); |
1865 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug); | 1890 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug); |
@@ -1912,6 +1937,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
1912 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_queue); | 1937 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_rx_queue); |
1913 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue); | 1938 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue); |
1914 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_power); | 1939 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_power); |
1940 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_power_save_status); | ||
1915 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 1941 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
1916 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. | 1942 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. |
1917 | file_ucode_rx_stats); | 1943 | file_ucode_rx_stats); |