All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <egrumbach@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 16/40] iwlwifi: mvm: BT Coex - fix debugfs with old API
Date: Sun,  6 Jul 2014 12:35:52 +0300	[thread overview]
Message-ID: <1404639376-3792-16-git-send-email-egrumbach@gmail.com> (raw)
In-Reply-To: <53B917DC.5050902@gmail.com>

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

Fix the debugfs hook to make it able to display the data
with the old firmware API.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/iwlwifi/mvm/debugfs.c | 183 +++++++++++++++++++++++------
 1 file changed, 148 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index e66c659..f131ef0 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -312,20 +312,69 @@ static ssize_t iwl_dbgfs_disable_power_off_write(struct iwl_mvm *mvm, char *buf,
 					 BT_MBOX_MSG(notif, _num, _field),  \
 					 true ? "\n" : ", ");
 
-static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
-				       size_t count, loff_t *ppos)
+static
+int iwl_mvm_coex_dump_mbox(struct iwl_bt_coex_profile_notif *notif, char *buf,
+			   int pos, int bufsz)
 {
-	struct iwl_mvm *mvm = file->private_data;
-	struct iwl_bt_coex_profile_notif *notif = &mvm->last_bt_notif;
-	char *buf;
-	int ret, pos = 0, bufsz = sizeof(char) * 1024;
+	pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw0:\n");
 
-	buf = kmalloc(bufsz, GFP_KERNEL);
-	if (!buf)
-		return -ENOMEM;
+	BT_MBOX_PRINT(0, LE_SLAVE_LAT, false);
+	BT_MBOX_PRINT(0, LE_PROF1, false);
+	BT_MBOX_PRINT(0, LE_PROF2, false);
+	BT_MBOX_PRINT(0, LE_PROF_OTHER, false);
+	BT_MBOX_PRINT(0, CHL_SEQ_N, false);
+	BT_MBOX_PRINT(0, INBAND_S, false);
+	BT_MBOX_PRINT(0, LE_MIN_RSSI, false);
+	BT_MBOX_PRINT(0, LE_SCAN, false);
+	BT_MBOX_PRINT(0, LE_ADV, false);
+	BT_MBOX_PRINT(0, LE_MAX_TX_POWER, false);
+	BT_MBOX_PRINT(0, OPEN_CON_1, true);
 
-	mutex_lock(&mvm->mutex);
+	pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw1:\n");
+
+	BT_MBOX_PRINT(1, BR_MAX_TX_POWER, false);
+	BT_MBOX_PRINT(1, IP_SR, false);
+	BT_MBOX_PRINT(1, LE_MSTR, false);
+	BT_MBOX_PRINT(1, AGGR_TRFC_LD, false);
+	BT_MBOX_PRINT(1, MSG_TYPE, false);
+	BT_MBOX_PRINT(1, SSN, true);
+
+	pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw2:\n");
+
+	BT_MBOX_PRINT(2, SNIFF_ACT, false);
+	BT_MBOX_PRINT(2, PAG, false);
+	BT_MBOX_PRINT(2, INQUIRY, false);
+	BT_MBOX_PRINT(2, CONN, false);
+	BT_MBOX_PRINT(2, SNIFF_INTERVAL, false);
+	BT_MBOX_PRINT(2, DISC, false);
+	BT_MBOX_PRINT(2, SCO_TX_ACT, false);
+	BT_MBOX_PRINT(2, SCO_RX_ACT, false);
+	BT_MBOX_PRINT(2, ESCO_RE_TX, false);
+	BT_MBOX_PRINT(2, SCO_DURATION, true);
 
+	pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw3:\n");
+
+	BT_MBOX_PRINT(3, SCO_STATE, false);
+	BT_MBOX_PRINT(3, SNIFF_STATE, false);
+	BT_MBOX_PRINT(3, A2DP_STATE, false);
+	BT_MBOX_PRINT(3, ACL_STATE, false);
+	BT_MBOX_PRINT(3, MSTR_STATE, false);
+	BT_MBOX_PRINT(3, OBX_STATE, false);
+	BT_MBOX_PRINT(3, OPEN_CON_2, false);
+	BT_MBOX_PRINT(3, TRAFFIC_LOAD, false);
+	BT_MBOX_PRINT(3, CHL_SEQN_LSB, false);
+	BT_MBOX_PRINT(3, INBAND_P, false);
+	BT_MBOX_PRINT(3, MSG_TYPE_2, false);
+	BT_MBOX_PRINT(3, SSN_2, false);
+	BT_MBOX_PRINT(3, UPDATE_REQUEST, true);
+
+	return pos;
+}
+
+static
+int iwl_mvm_coex_dump_mbox_old(struct iwl_bt_coex_profile_notif_old *notif,
+			       char *buf, int pos, int bufsz)
+{
 	pos += scnprintf(buf+pos, bufsz-pos, "MBOX dw0:\n");
 
 	BT_MBOX_PRINT(0, LE_SLAVE_LAT, false);
@@ -378,17 +427,59 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
 	BT_MBOX_PRINT(3, SSN_2, false);
 	BT_MBOX_PRINT(3, UPDATE_REQUEST, true);
 
-	pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n",
-			 notif->bt_ci_compliance);
-	pos += scnprintf(buf+pos, bufsz-pos, "primary_ch_lut = %d\n",
-			 le32_to_cpu(notif->primary_ch_lut));
-	pos += scnprintf(buf+pos, bufsz-pos, "secondary_ch_lut = %d\n",
-			 le32_to_cpu(notif->secondary_ch_lut));
-	pos += scnprintf(buf+pos, bufsz-pos, "bt_activity_grading = %d\n",
-			 le32_to_cpu(notif->bt_activity_grading));
-	pos += scnprintf(buf+pos, bufsz-pos,
-			 "antenna isolation = %d CORUN LUT index = %d\n",
-			 mvm->last_ant_isol, mvm->last_corun_lut);
+	return pos;
+}
+
+static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
+				       size_t count, loff_t *ppos)
+{
+	struct iwl_mvm *mvm = file->private_data;
+	char *buf;
+	int ret, pos = 0, bufsz = sizeof(char) * 1024;
+
+	buf = kmalloc(bufsz, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	mutex_lock(&mvm->mutex);
+
+	if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
+		struct iwl_bt_coex_profile_notif_old *notif =
+			&mvm->last_bt_notif_old;
+
+		pos += iwl_mvm_coex_dump_mbox_old(notif, buf, pos, bufsz);
+
+		pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n",
+				 notif->bt_ci_compliance);
+		pos += scnprintf(buf+pos, bufsz-pos, "primary_ch_lut = %d\n",
+				 le32_to_cpu(notif->primary_ch_lut));
+		pos += scnprintf(buf+pos, bufsz-pos, "secondary_ch_lut = %d\n",
+				 le32_to_cpu(notif->secondary_ch_lut));
+		pos += scnprintf(buf+pos,
+				 bufsz-pos, "bt_activity_grading = %d\n",
+				 le32_to_cpu(notif->bt_activity_grading));
+		pos += scnprintf(buf+pos, bufsz-pos,
+				 "antenna isolation = %d CORUN LUT index = %d\n",
+				 mvm->last_ant_isol, mvm->last_corun_lut);
+	} else {
+		struct iwl_bt_coex_profile_notif *notif =
+			&mvm->last_bt_notif;
+
+		pos += iwl_mvm_coex_dump_mbox(notif, buf, pos, bufsz);
+
+		pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n",
+				 notif->bt_ci_compliance);
+		pos += scnprintf(buf+pos, bufsz-pos, "primary_ch_lut = %d\n",
+				 le32_to_cpu(notif->primary_ch_lut));
+		pos += scnprintf(buf+pos, bufsz-pos, "secondary_ch_lut = %d\n",
+				 le32_to_cpu(notif->secondary_ch_lut));
+		pos += scnprintf(buf+pos,
+				 bufsz-pos, "bt_activity_grading = %d\n",
+				 le32_to_cpu(notif->bt_activity_grading));
+		pos += scnprintf(buf+pos, bufsz-pos,
+				 "antenna isolation = %d CORUN LUT index = %d\n",
+				 mvm->last_ant_isol, mvm->last_corun_lut);
+	}
 
 	mutex_unlock(&mvm->mutex);
 
@@ -403,26 +494,48 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
 				     size_t count, loff_t *ppos)
 {
 	struct iwl_mvm *mvm = file->private_data;
-	struct iwl_bt_coex_ci_cmd *cmd = &mvm->last_bt_ci_cmd;
 	char buf[256];
 	int bufsz = sizeof(buf);
 	int pos = 0;
 
 	mutex_lock(&mvm->mutex);
 
-	pos += scnprintf(buf+pos, bufsz-pos, "Channel inhibition CMD\n");
-	pos += scnprintf(buf+pos, bufsz-pos,
-		       "\tPrimary Channel Bitmap 0x%016llx\n",
-		       le64_to_cpu(cmd->bt_primary_ci));
-	pos += scnprintf(buf+pos, bufsz-pos,
-		       "\tSecondary Channel Bitmap 0x%016llx\n",
-		       le64_to_cpu(cmd->bt_secondary_ci));
-
-	pos += scnprintf(buf+pos, bufsz-pos, "BT Configuration CMD\n");
-	pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill Mask 0x%08x\n",
-			 iwl_bt_ack_kill_msk[mvm->bt_kill_msk]);
-	pos += scnprintf(buf+pos, bufsz-pos, "\tCTS Kill Mask 0x%08x\n",
-			 iwl_bt_cts_kill_msk[mvm->bt_kill_msk]);
+	if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
+		struct iwl_bt_coex_ci_cmd_old *cmd = &mvm->last_bt_ci_cmd_old;
+
+		pos += scnprintf(buf+pos, bufsz-pos,
+				 "Channel inhibition CMD\n");
+		pos += scnprintf(buf+pos, bufsz-pos,
+			       "\tPrimary Channel Bitmap 0x%016llx\n",
+			       le64_to_cpu(cmd->bt_primary_ci));
+		pos += scnprintf(buf+pos, bufsz-pos,
+			       "\tSecondary Channel Bitmap 0x%016llx\n",
+			       le64_to_cpu(cmd->bt_secondary_ci));
+
+		pos += scnprintf(buf+pos, bufsz-pos, "BT Configuration CMD\n");
+		pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill Mask 0x%08x\n",
+				 iwl_bt_ack_kill_msk[mvm->bt_kill_msk]);
+		pos += scnprintf(buf+pos, bufsz-pos, "\tCTS Kill Mask 0x%08x\n",
+				 iwl_bt_cts_kill_msk[mvm->bt_kill_msk]);
+
+	} else {
+		struct iwl_bt_coex_ci_cmd *cmd = &mvm->last_bt_ci_cmd;
+
+		pos += scnprintf(buf+pos, bufsz-pos,
+				 "Channel inhibition CMD\n");
+		pos += scnprintf(buf+pos, bufsz-pos,
+			       "\tPrimary Channel Bitmap 0x%016llx\n",
+			       le64_to_cpu(cmd->bt_primary_ci));
+		pos += scnprintf(buf+pos, bufsz-pos,
+			       "\tSecondary Channel Bitmap 0x%016llx\n",
+			       le64_to_cpu(cmd->bt_secondary_ci));
+
+		pos += scnprintf(buf+pos, bufsz-pos, "BT Configuration CMD\n");
+		pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill Mask 0x%08x\n",
+				 iwl_bt_ack_kill_msk[mvm->bt_kill_msk]);
+		pos += scnprintf(buf+pos, bufsz-pos, "\tCTS Kill Mask 0x%08x\n",
+				 iwl_bt_cts_kill_msk[mvm->bt_kill_msk]);
+	}
 
 	mutex_unlock(&mvm->mutex);
 
-- 
1.8.3.2


  parent reply	other threads:[~2014-07-06  9:36 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-06  9:33 pull request: iwlwifi-next 2014-07-06 Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 01/40] iwlwifi: fix naming mistake for the fw_monitor module parameter Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 02/40] iwlwifi: remove wrong comment about alignment in iwl-fw-error-dump.h Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 03/40] iwlwifi: mvm: don't collect logs in the interrupt thread Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 04/40] iwlwifi: mvm: kill iwl_mvm_fw_error_rxf_dump Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 05/40] iwlwifi: mvm: update layout of firmware error dump Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 06/40] iwlwifi: mvm: wait for d0i3 exit in add interface flow Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 07/40] iwlwifi: mvm: read the mac address in family 8000 Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 08/40] iwlwifi: rename iwl_fw_error_fw_mon to iwl_fw_error_dump_fw_mon Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 09/40] iwlwifi: mvm: remove unused flags from TX command Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 10/40] iwlwifi: mvm: BT Coex - prepare towards new API Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 11/40] iwlwifi: mvm: BT Coex - " Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 12/40] iwlwifi: mvm: BT Coex - convert the sw boost update to " Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 13/40] iwlwifi: mvm: BT Coex - convert the co-running " Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 14/40] iwlwifi: mvm: BT Coex - convert reduced Tx power " Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 15/40] iwlwifi: mvm: BT Coex - add High Band retention Emmanuel Grumbach
2014-07-06  9:35 ` Emmanuel Grumbach [this message]
2014-07-06  9:35 ` [PATCH 17/40] iwlwifi: mvm: warn about empty OTP Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 18/40] iwlwifi: mvm: rs: don't clear persistent fields Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 19/40] iwlwifi: mvm: rs: don't save debugfs files Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 20/40] iwlwifi: mvm: add unified LMAC scan API Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 21/40] iwlwifi: mvm: init lmac scan command Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 22/40] iwlwifi: mvm: fix endianity in " Emmanuel Grumbach
2014-07-06  9:35 ` [PATCH 23/40] iwlwifi: 8000: drop a print when the address is invalid Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 24/40] iwlwifi: mvm: let iwl_mvm_update_quotas disregard a disabled vif Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 25/40] iwlwifi: mvm: don't send zero quota to the firmware Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 26/40] iwlwifi: mvm: validate that we don't send zero quota Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 27/40] iwlwifi: mvm: don't pass update type to quota iterator Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 28/40] iwlwifi: mvm: remove update type argument from quota update Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 29/40] iwlwifi: mvm: add switch_vif_chanctx operation Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 30/40] iwlwifi: mvm: CSA unbind-bind flow support for client Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 31/40] iwlwifi: mvm: Use beacon_get_template instead of beacon_get Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 32/40] iwlwifi: mvm: Protect mvm->csa_vif with RCU Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 33/40] iwlwifi: mvm: Reflect GO channel switch in NoA Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 34/40] iwlwifi: mvm: Use CS tx block bit for AP/GO Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 35/40] iwlwifi: mvm: disallow new TDLS stations when appropriate Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 36/40] iwlwifi: mvm: protect TDLS discovery session Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 37/40] iwlwifi: disable PSM on vifs with associated TDLS peers Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 38/40] iwlwifi: mvm: teardown TDLS peers when initiating DCM Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 39/40] iwlwifi: mvm: remove 8000 HW family setting of adc sampling on nic config Emmanuel Grumbach
2014-07-06  9:36 ` [PATCH 40/40] iwlwifi: mvm: minor fix in comment Emmanuel Grumbach
2014-07-07 18:44 ` pull request: iwlwifi-next 2014-07-06 Emmanuel Grumbach
2014-07-07 20:08   ` John W. Linville

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=1404639376-3792-16-git-send-email-egrumbach@gmail.com \
    --to=egrumbach@gmail.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.