[PATCH v2 3/5] Add the DUMP command interface which can be used contro the FW action

dreamfly281 at gmail.com dreamfly281 at gmail.com
Mon Jul 8 12:43:26 EDT 2013


From: Yanbo Li <yanbol at qti.qualcomm.com>

The DUMP command can be used to control lots of FW action, currently we
only use it to dynamic turn on/off some FW module's debug level to get
more debug info from QXDM. IE;

echo 13 6 3 1 means open all CXM module log

Signed-off-by: Yanbo Li <yanbol at qti.qualcomm.com>
---
 debug.c |   41 +++++++++++++++++++++++++++++++++++++++++
 debug.h |    3 +++
 hal.h   |   14 +++++++-------
 smd.c   |   20 ++++++++++++++++++++
 smd.h   |    3 +++
 5 files changed, 74 insertions(+), 7 deletions(-)

diff --git a/debug.c b/debug.c
index 6698166..3e0c5e8 100644
--- a/debug.c
+++ b/debug.c
@@ -82,6 +82,46 @@ static const struct file_operations fops_wcn36xx_bmps = {
 	.write =       write_file_bool_bmps,
 };
 
+static ssize_t write_file_bool_dump(struct file *file,
+				    const char __user *user_buf,
+				    size_t count, loff_t *ppos)
+{
+	struct wcn36xx *wcn = file->private_data;
+	char buf[255], *tmp;
+	int buf_size;
+	u32 arg[WCN36xx_MAX_DUMP_ARGS];
+	int i;
+
+	memset(buf, 0, sizeof(buf));
+	memset(arg, 0, sizeof(arg));
+
+	buf_size = min(count, (sizeof(buf) - 1));
+	if (copy_from_user(buf, user_buf, buf_size))
+		return -EFAULT;
+
+	tmp = buf;
+	for (i = 0; i < WCN36xx_MAX_DUMP_ARGS; i++) {
+		char *begin;
+		begin = strsep(&tmp, " ");
+		if (begin == NULL)
+			break;
+
+		if (kstrtoul(begin, 0, (unsigned long *)(arg + i)) != 0)
+			break;
+	}
+
+	wcn36xx_info("DUMP args is %d %d %d %d %d\n", arg[0], arg[1], arg[2],
+		     arg[3], arg[4]);
+	wcn36xx_smd_dump_cmd_req(wcn, arg[0], arg[1], arg[2], arg[3], arg[4]);
+
+	return count;
+}
+
+static const struct file_operations fops_wcn36xx_dump = {
+	.open  =       wcn36xx_debugfs_open,
+	.write =       write_file_bool_dump,
+};
+
 #define ADD_FILE_BOOL(name, mode, fop, priv_data)		\
 	do {							\
 		struct dentry *d;				\
@@ -108,6 +148,7 @@ void wcn36xx_debugfs_init(struct wcn36xx *wcn)
 	}
 	ADD_FILE_BOOL(bmps_switcher, S_IRUSR | S_IWUSR,
 		      &fops_wcn36xx_bmps, wcn);
+	ADD_FILE_BOOL(dump, S_IWUSR, &fops_wcn36xx_dump, wcn);
 }
 
 void wcn36xx_debugfs_exit(struct wcn36xx *wcn)
diff --git a/debug.h b/debug.h
index 8afb673..5bafc7e 100644
--- a/debug.h
+++ b/debug.h
@@ -24,6 +24,8 @@
 
 #include <linux/kernel.h>
 
+#define WCN36xx_MAX_DUMP_ARGS	5
+
 struct wcn36xx_dfs_file {
 	struct dentry *dentry;
 	u32 value;
@@ -32,6 +34,7 @@ struct wcn36xx_dfs_file {
 struct wcn36xx_dfs_entry {
 	struct dentry *rootdir;
 	struct wcn36xx_dfs_file file_bmps_switcher;
+	struct wcn36xx_dfs_file file_dump;
 };
 
 void wcn36xx_debugfs_init(struct wcn36xx *wcn);
diff --git a/hal.h b/hal.h
index 83b9f49..de08f86 100644
--- a/hal.h
+++ b/hal.h
@@ -3597,12 +3597,12 @@ struct wcn36xx_hal_configure_apps_cpu_wakeup_state_rsp_msg {
 struct wcn36xx_hal_dump_cmd_req_msg {
 	struct wcn36xx_hal_msg_header header;
 
-	u32 argument1;
-	u32 argument2;
-	u32 argument3;
-	u32 argument4;
-	u32 argument5;
-};
+	u32 arg1;
+	u32 arg2;
+	u32 arg3;
+	u32 arg4;
+	u32 arg5;
+} __packed;
 
 struct wcn36xx_hal_dump_cmd_rsp_msg {
 	struct wcn36xx_hal_msg_header header;
@@ -3616,7 +3616,7 @@ struct wcn36xx_hal_dump_cmd_rsp_msg {
 	/* FIXME: Currently considering the the responce will be less than
 	 * 100bytes */
 	u8 rsp_buffer[DUMPCMD_RSP_BUFFER];
-};
+} __packed;
 
 #define WLAN_COEX_IND_DATA_SIZE (4)
 #define WLAN_COEX_IND_TYPE_DISABLE_HB_MONITOR (0)
diff --git a/smd.c b/smd.c
index e3e8dd5..bd65bad 100644
--- a/smd.c
+++ b/smd.c
@@ -1066,6 +1066,25 @@ int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn)
 
 	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
 }
+
+int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
+			     u32 arg3, u32 arg4, u32 arg5)
+{
+	struct wcn36xx_hal_dump_cmd_req_msg msg_body;
+
+	INIT_HAL_MSG(msg_body, WCN36XX_HAL_DUMP_COMMAND_REQ);
+
+	msg_body.arg1 = arg1;
+	msg_body.arg2 = arg2;
+	msg_body.arg3 = arg3;
+	msg_body.arg4 = arg4;
+	msg_body.arg5 = arg5;
+
+	PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
+
+	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+}
+
 static void wcn36xx_smd_notify(void *data, unsigned event)
 {
 	struct wcn36xx *wcn = (struct wcn36xx *)data;
@@ -1164,6 +1183,7 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
 	case WCN36XX_HAL_RMV_BSSKEY_RSP:
 	case WCN36XX_HAL_ENTER_BMPS_RSP:
 	case WCN36XX_HAL_EXIT_BMPS_RSP:
+	case WCN36XX_HAL_DUMP_COMMAND_RSP:
 		if (wcn36xx_smd_rsp_status_check(buf, len)) {
 			wcn36xx_warn("error response from hal request %d",
 				     msg_header->msg_type);
diff --git a/smd.h b/smd.h
index ad7a31f..fc5c684 100644
--- a/smd.h
+++ b/smd.h
@@ -90,6 +90,9 @@ int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
 int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, u64 tbtt);
 int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn);
 
+int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
+			     u32 arg3, u32 arg4, u32 arg5);
+
 /* WCN36XX configuration parameters */
 struct wcn36xx_fw_cfg {
 	u16		id;
-- 
1.7.9.5




More information about the wcn36xx mailing list