aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-10-16 17:25:50 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:48:31 -0400
commitc09430abed4159e5c56aaea257d040f7452daba6 (patch)
tree1bc3e17162880d7cba27c4d4ee95bb5addf54fb2 /drivers
parent1f80989e8b7f79d8e916b14600488489bdd5569f (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')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-csr.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c26
3 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-csr.h b/drivers/net/wireless/iwlwifi/iwl-csr.h
index 8f183e0fa512..401e1e01be67 100644
--- a/drivers/net/wireless/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/iwlwifi/iwl-csr.h
@@ -235,6 +235,11 @@
235#define CSR_OTP_GP_REG_OTP_ACCESS_MODE (0x00020000) /* 0 - absolute, 1 - relative */ 235#define CSR_OTP_GP_REG_OTP_ACCESS_MODE (0x00020000) /* 0 - absolute, 1 - relative */
236#define CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK (0x00100000) /* bit 20 */ 236#define CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK (0x00100000) /* bit 20 */
237#define CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK (0x00200000) /* bit 21 */ 237#define CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK (0x00200000) /* bit 21 */
238#define CSR_GP_REG_POWER_SAVE_STATUS_MSK (0x03000000) /* bit 24/25 */
239#define CSR_GP_REG_NO_POWER_SAVE (0x00000000)
240#define CSR_GP_REG_MAC_POWER_SAVE (0x01000000)
241#define CSR_GP_REG_PHY_POWER_SAVE (0x02000000)
242#define CSR_GP_REG_POWER_SAVE_ERROR (0x03000000)
238 243
239/* EEPROM signature */ 244/* EEPROM signature */
240#define CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP (0x00000000) 245#define CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP (0x00000000)
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index b9ca475cc61c..96c92eab692a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -106,6 +106,7 @@ struct iwl_debugfs {
106 struct dentry *file_sensitivity; 106 struct dentry *file_sensitivity;
107 struct dentry *file_chain_noise; 107 struct dentry *file_chain_noise;
108 struct dentry *file_tx_power; 108 struct dentry *file_tx_power;
109 struct dentry *file_power_save_status;
109 } dbgfs_debug_files; 110 } dbgfs_debug_files;
110 u32 sram_offset; 111 u32 sram_offset;
111 u32 sram_len; 112 u32 sram_len;
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
1805static 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
1805DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); 1828DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics);
1806DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); 1829DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics);
1807DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); 1830DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
@@ -1813,6 +1836,7 @@ DEBUGFS_READ_FILE_OPS(ucode_general_stats);
1813DEBUGFS_READ_FILE_OPS(sensitivity); 1836DEBUGFS_READ_FILE_OPS(sensitivity);
1814DEBUGFS_READ_FILE_OPS(chain_noise); 1837DEBUGFS_READ_FILE_OPS(chain_noise);
1815DEBUGFS_READ_FILE_OPS(tx_power); 1838DEBUGFS_READ_FILE_OPS(tx_power);
1839DEBUGFS_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);