diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/debug.c')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/debug.c | 51 |
1 files changed, 51 insertions, 0 deletions
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 | ||
36 | int ath6kl_printk(const char *level, const char *fmt, ...) | 38 | int 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 | ||
285 | static 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 | |||
297 | static 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 | |||
317 | static 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 | |||
283 | static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, | 325 | static 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 | ||