]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
iwlwifi: mvm: add debugfs entry to read the current temperature
authorLuciano Coelho <luciano.coelho@intel.com>
Thu, 4 Sep 2014 12:58:47 +0000 (15:58 +0300)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 16 Sep 2014 09:57:50 +0000 (12:57 +0300)
When read, this new debugfs entry requests the current temperature
from the firmware and outputs it.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/debugfs.c
drivers/net/wireless/iwlwifi/mvm/mvm.h
drivers/net/wireless/iwlwifi/mvm/tt.c

index 95eb9a5ef6938d550a3aba351438961cf7197916..50527a9bb26739b572e1b0faad8b7afa5114662d 100644 (file)
@@ -326,6 +326,29 @@ out:
        return count;
 }
 
+static ssize_t iwl_dbgfs_nic_temp_read(struct file *file,
+                                      char __user *user_buf,
+                                      size_t count, loff_t *ppos)
+{
+       struct iwl_mvm *mvm = file->private_data;
+       char buf[16];
+       int pos, temp;
+
+       if (!mvm->ucode_loaded)
+               return -EIO;
+
+       mutex_lock(&mvm->mutex);
+       temp = iwl_mvm_get_temp(mvm);
+       mutex_unlock(&mvm->mutex);
+
+       if (temp < 0)
+               return temp;
+
+       pos = scnprintf(buf , sizeof(buf), "%d\n", temp);
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
+}
+
 static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
                                       size_t count, loff_t *ppos)
 {
@@ -1378,6 +1401,7 @@ MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16);
 MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(sram, 64);
 MVM_DEBUGFS_READ_WRITE_FILE_OPS(set_nic_temperature, 64);
+MVM_DEBUGFS_READ_FILE_OPS(nic_temp);
 MVM_DEBUGFS_READ_FILE_OPS(stations);
 MVM_DEBUGFS_READ_FILE_OPS(bt_notif);
 MVM_DEBUGFS_READ_FILE_OPS(bt_cmd);
@@ -1420,6 +1444,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
        MVM_DEBUGFS_ADD_FILE(sram, mvm->debugfs_dir, S_IWUSR | S_IRUSR);
        MVM_DEBUGFS_ADD_FILE(set_nic_temperature, mvm->debugfs_dir,
                             S_IWUSR | S_IRUSR);
+       MVM_DEBUGFS_ADD_FILE(nic_temp, dbgfs_dir, S_IRUSR);
        MVM_DEBUGFS_ADD_FILE(stations, dbgfs_dir, S_IRUSR);
        MVM_DEBUGFS_ADD_FILE(fw_error_dump, dbgfs_dir, S_IRUSR);
        MVM_DEBUGFS_ADD_FILE(bt_notif, dbgfs_dir, S_IRUSR);
index 8eacebb90f23992f47c65d271ad1a99ad4913537..c913d5e80c9de6a86a2c5038813f9c288ce2c165 100644 (file)
@@ -1188,6 +1188,7 @@ void iwl_mvm_tt_handler(struct iwl_mvm *mvm);
 void iwl_mvm_tt_initialize(struct iwl_mvm *mvm, u32 min_backoff);
 void iwl_mvm_tt_exit(struct iwl_mvm *mvm);
 void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state);
+int iwl_mvm_get_temp(struct iwl_mvm *mvm);
 
 /* smart fifo */
 int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
index c750ca7b8269eeb0547f1978e065ce55829875a8..acca44a450864cc446d3a0a653c20e85314465fd 100644 (file)
@@ -135,7 +135,7 @@ static int iwl_mvm_get_temp_cmd(struct iwl_mvm *mvm)
                                    sizeof(cmd), &cmd);
 }
 
-static int iwl_mvm_get_temp(struct iwl_mvm *mvm)
+int iwl_mvm_get_temp(struct iwl_mvm *mvm)
 {
        struct iwl_notification_wait wait_temp_notif;
        static const u8 temp_notif[] = { DTS_MEASUREMENT_NOTIFICATION };