linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <egrumbach@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Luciano Coelho <luciano.coelho@intel.com>,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 06/17] iwlwifi: mvm: add debugfs entry to read the current temperature
Date: Sun, 21 Sep 2014 22:22:07 +0300	[thread overview]
Message-ID: <1411327338-23099-6-git-send-email-egrumbach@gmail.com> (raw)
In-Reply-To: <541F23D2.90600@gmail.com>

From: Luciano Coelho <luciano.coelho@intel.com>

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 | 25 +++++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/mvm/mvm.h     |  1 +
 drivers/net/wireless/iwlwifi/mvm/tt.c      |  2 +-
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index 95eb9a5..50527a9 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -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);
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 8eacebb..c913d5e 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -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,
diff --git a/drivers/net/wireless/iwlwifi/mvm/tt.c b/drivers/net/wireless/iwlwifi/mvm/tt.c
index c750ca7..acca44a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tt.c
@@ -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 };
-- 
1.9.1


  parent reply	other threads:[~2014-09-21 19:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-21 19:15 pull request: iwlwifi-next 2014-09-21 Emmanuel Grumbach
2014-09-21 19:21 ` Emmanuel Grumbach
2014-09-26 17:35   ` John W. Linville
2014-09-21 19:22 ` [PATCH 01/17] iwlwifi: mvm: support cloned tx skbs Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 02/17] iwlwifi: mvm: Update TX power in TPC reports Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 03/17] iwlwifi: mvm: Announce Quiet Period support Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 04/17] iwlwifi: mvm: Set RRM_ENABLED bit in scan commands Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 05/17] iwlwifi: mvm: prepare for scheduler config command Emmanuel Grumbach
2014-09-21 19:22 ` Emmanuel Grumbach [this message]
2014-09-21 19:22 ` [PATCH 07/17] iwlwifi: mvm: Allow schedule scan while connected Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 08/17] iwlwifi: mvm: choose an initial tx rate based on rssi conditions Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 09/17] iwlwifi: mvm: rs: refactor to allow direct rs updating Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 10/17] iwlwifi: mvm: limit aggregation size in low latency to 6 Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 11/17] iwlwifi: Add missing PCI IDs for the 7260 series Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 12/17] iwlwifi: pcie: fix HW_REV saving for 8000 series Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 13/17] iwlwifi: 8000: fix fw name to account for revision Emmanuel Grumbach
2014-09-22 10:45   ` Bjørn Mork
2014-09-22 17:28     ` Grumbach, Emmanuel
2014-09-23 11:09       ` Bjørn Mork
2014-09-23 11:38         ` Grumbach, Emmanuel
2014-09-26 19:44           ` Luca Coelho
2014-09-27  6:41             ` Bjørn Mork
2015-11-21 21:12               ` [PATCH] iwlwifi: mvm: add hwmon device for the temperature sensor Bjørn Mork
2015-11-26 15:46                 ` Johannes Berg
2015-11-26 16:52                   ` Bjørn Mork
2015-11-26 17:04                     ` Johannes Berg
2014-09-21 19:22 ` [PATCH 14/17] iwlwifi: mvm: report all BA notifs to RS Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 15/17] iwlwifi: mvm: rs: fix logic in case of multiple TIDs Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 16/17] iwlwifi: mvm: disable BT Co-running by default Emmanuel Grumbach
2014-09-21 19:22 ` [PATCH 17/17] iwlwifi: mvm: Refactor and fix max probe len computation Emmanuel Grumbach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1411327338-23099-6-git-send-email-egrumbach@gmail.com \
    --to=egrumbach@gmail.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).