aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2011-09-02 03:32:04 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-09-02 03:32:04 -0400
commit939f1ccec80bd2dad5638de2a6819c66d4cb6f32 (patch)
tree3ef66e86f9165a4c86d0083a3a1fbd15b0c5cba7
parentbdf5396be177b689c00ae6ebed00d13fafaed36e (diff)
ath6kl: implement support to set firmware log parameters
Firmware log parameters can be controlled now with help of fwlog_mask debugfs file. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.h1
-rw-r--r--drivers/net/wireless/ath/ath6kl/debug.c51
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c19
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.h6
4 files changed, 77 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 319e768d9ad6..58c810acdbf2 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -474,6 +474,7 @@ struct ath6kl {
474 struct circ_buf fwlog_buf; 474 struct circ_buf fwlog_buf;
475 spinlock_t fwlog_lock; 475 spinlock_t fwlog_lock;
476 void *fwlog_tmp; 476 void *fwlog_tmp;
477 u32 fwlog_mask;
477 } debug; 478 } debug;
478#endif /* CONFIG_ATH6KL_DEBUG */ 479#endif /* CONFIG_ATH6KL_DEBUG */
479}; 480};
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index b2706da58149..239c092d3e11 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -17,6 +17,7 @@
17#include "core.h" 17#include "core.h"
18 18
19#include <linux/circ_buf.h> 19#include <linux/circ_buf.h>
20#include <linux/fs.h>
20 21
21#include "debug.h" 22#include "debug.h"
22#include "target.h" 23#include "target.h"
@@ -32,6 +33,7 @@ struct ath6kl_fwlog_slot {
32#define ATH6KL_FWLOG_SIZE 32768 33#define ATH6KL_FWLOG_SIZE 32768
33#define ATH6KL_FWLOG_SLOT_SIZE (sizeof(struct ath6kl_fwlog_slot) + \ 34#define ATH6KL_FWLOG_SLOT_SIZE (sizeof(struct ath6kl_fwlog_slot) + \
34 ATH6KL_FWLOG_PAYLOAD_SIZE) 35 ATH6KL_FWLOG_PAYLOAD_SIZE)
36#define ATH6KL_FWLOG_VALID_MASK 0x1ffff
35 37
36int ath6kl_printk(const char *level, const char *fmt, ...) 38int ath6kl_printk(const char *level, const char *fmt, ...)
37{ 39{
@@ -280,6 +282,46 @@ static const struct file_operations fops_fwlog = {
280 .llseek = default_llseek, 282 .llseek = default_llseek,
281}; 283};
282 284
285static ssize_t ath6kl_fwlog_mask_read(struct file *file, char __user *user_buf,
286 size_t count, loff_t *ppos)
287{
288 struct ath6kl *ar = file->private_data;
289 char buf[16];
290 int len;
291
292 len = snprintf(buf, sizeof(buf), "0x%x\n", ar->debug.fwlog_mask);
293
294 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
295}
296
297static ssize_t ath6kl_fwlog_mask_write(struct file *file,
298 const char __user *user_buf,
299 size_t count, loff_t *ppos)
300{
301 struct ath6kl *ar = file->private_data;
302 int ret;
303
304 ret = kstrtou32_from_user(user_buf, count, 0, &ar->debug.fwlog_mask);
305 if (ret)
306 return ret;
307
308 ret = ath6kl_wmi_config_debug_module_cmd(ar->wmi,
309 ATH6KL_FWLOG_VALID_MASK,
310 ar->debug.fwlog_mask);
311 if (ret)
312 return ret;
313
314 return count;
315}
316
317static const struct file_operations fops_fwlog_mask = {
318 .open = ath6kl_debugfs_open,
319 .read = ath6kl_fwlog_mask_read,
320 .write = ath6kl_fwlog_mask_write,
321 .owner = THIS_MODULE,
322 .llseek = default_llseek,
323};
324
283static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, 325static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf,
284 size_t count, loff_t *ppos) 326 size_t count, loff_t *ppos)
285{ 327{
@@ -497,6 +539,12 @@ int ath6kl_debug_init(struct ath6kl *ar)
497 539
498 spin_lock_init(&ar->debug.fwlog_lock); 540 spin_lock_init(&ar->debug.fwlog_lock);
499 541
542 /*
543 * Actually we are lying here but don't know how to read the mask
544 * value from the firmware.
545 */
546 ar->debug.fwlog_mask = 0;
547
500 ar->debugfs_phy = debugfs_create_dir("ath6kl", 548 ar->debugfs_phy = debugfs_create_dir("ath6kl",
501 ar->wdev->wiphy->debugfsdir); 549 ar->wdev->wiphy->debugfsdir);
502 if (!ar->debugfs_phy) { 550 if (!ar->debugfs_phy) {
@@ -514,6 +562,9 @@ int ath6kl_debug_init(struct ath6kl *ar)
514 debugfs_create_file("fwlog", S_IRUSR, ar->debugfs_phy, ar, 562 debugfs_create_file("fwlog", S_IRUSR, ar->debugfs_phy, ar,
515 &fops_fwlog); 563 &fops_fwlog);
516 564
565 debugfs_create_file("fwlog_mask", S_IRUSR | S_IWUSR, ar->debugfs_phy,
566 ar, &fops_fwlog_mask);
567
517 return 0; 568 return 0;
518} 569}
519 570
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 954d5e18e888..7201a72ac1b8 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -2412,6 +2412,25 @@ int ath6kl_wmi_get_challenge_resp_cmd(struct wmi *wmi, u32 cookie, u32 source)
2412 return ret; 2412 return ret;
2413} 2413}
2414 2414
2415int ath6kl_wmi_config_debug_module_cmd(struct wmi *wmi, u32 valid, u32 config)
2416{
2417 struct ath6kl_wmix_dbglog_cfg_module_cmd *cmd;
2418 struct sk_buff *skb;
2419 int ret;
2420
2421 skb = ath6kl_wmi_get_new_buf(sizeof(*cmd));
2422 if (!skb)
2423 return -ENOMEM;
2424
2425 cmd = (struct ath6kl_wmix_dbglog_cfg_module_cmd *) skb->data;
2426 cmd->valid = cpu_to_le32(valid);
2427 cmd->config = cpu_to_le32(config);
2428
2429 ret = ath6kl_wmi_cmd_send_xtnd(wmi, skb, WMIX_DBGLOG_CFG_MODULE_CMDID,
2430 NO_SYNC_WMIFLAG);
2431 return ret;
2432}
2433
2415int ath6kl_wmi_get_stats_cmd(struct wmi *wmi) 2434int ath6kl_wmi_get_stats_cmd(struct wmi *wmi)
2416{ 2435{
2417 return ath6kl_wmi_simple_cmd(wmi, WMI_GET_STATISTICS_CMDID); 2436 return ath6kl_wmi_simple_cmd(wmi, WMI_GET_STATISTICS_CMDID);
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.h b/drivers/net/wireless/ath/ath6kl/wmi.h
index 5d68d8f2032c..1c565816f622 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.h
+++ b/drivers/net/wireless/ath/ath6kl/wmi.h
@@ -2083,6 +2083,11 @@ struct wmix_hb_challenge_resp_cmd {
2083 __le32 source; 2083 __le32 source;
2084} __packed; 2084} __packed;
2085 2085
2086struct ath6kl_wmix_dbglog_cfg_module_cmd {
2087 __le32 valid;
2088 __le32 config;
2089} __packed;
2090
2086/* End of Extended WMI (WMIX) */ 2091/* End of Extended WMI (WMIX) */
2087 2092
2088enum wmi_sync_flag { 2093enum wmi_sync_flag {
@@ -2162,6 +2167,7 @@ int ath6kl_wmi_set_lpreamble_cmd(struct wmi *wmi, u8 status,
2162 u8 preamble_policy); 2167 u8 preamble_policy);
2163 2168
2164int ath6kl_wmi_get_challenge_resp_cmd(struct wmi *wmi, u32 cookie, u32 source); 2169int ath6kl_wmi_get_challenge_resp_cmd(struct wmi *wmi, u32 cookie, u32 source);
2170int ath6kl_wmi_config_debug_module_cmd(struct wmi *wmi, u32 valid, u32 config);
2165 2171
2166int ath6kl_wmi_get_stats_cmd(struct wmi *wmi); 2172int ath6kl_wmi_get_stats_cmd(struct wmi *wmi);
2167int ath6kl_wmi_addkey_cmd(struct wmi *wmi, u8 key_index, 2173int ath6kl_wmi_addkey_cmd(struct wmi *wmi, u8 key_index,