]> Pileus Git - ~andy/linux/blobdiff - drivers/net/wireless/ath/ath6kl/debug.c
Merge remote branch 'wireless-next/master' into ath6kl-next
[~andy/linux] / drivers / net / wireless / ath / ath6kl / debug.c
index 52149202ffb79397eebdd6ccbe9d968cd2bd6247..eb808b46f94cec1010a16e0733f9dacbf5ee4147 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/circ_buf.h>
 #include <linux/fs.h>
 #include <linux/vmalloc.h>
+#include <linux/export.h>
 
 #include "debug.h"
 #include "target.h"
@@ -1252,7 +1253,7 @@ static ssize_t ath6kl_create_qos_write(struct file *file,
 
        struct ath6kl *ar = file->private_data;
        struct ath6kl_vif *vif;
-       char buf[100];
+       char buf[200];
        ssize_t len;
        char *sptr, *token;
        struct wmi_create_pstream_cmd pstream;
@@ -1550,10 +1551,10 @@ static ssize_t ath6kl_listen_int_read(struct file *file,
                                                size_t count, loff_t *ppos)
 {
        struct ath6kl *ar = file->private_data;
-       char buf[16];
+       char buf[32];
        int len;
 
-       len = snprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t,
+       len = scnprintf(buf, sizeof(buf), "%u %u\n", ar->listen_intvl_t,
                                        ar->listen_intvl_b);
 
        return simple_read_from_buffer(user_buf, count, ppos, buf, len);
@@ -1567,6 +1568,66 @@ static const struct file_operations fops_listen_int = {
        .llseek = default_llseek,
 };
 
+static ssize_t ath6kl_power_params_write(struct file *file,
+                                               const char __user *user_buf,
+                                               size_t count, loff_t *ppos)
+{
+       struct ath6kl *ar = file->private_data;
+       u8 buf[100];
+       unsigned int len = 0;
+       char *sptr, *token;
+       u16 idle_period, ps_poll_num, dtim,
+               tx_wakeup, num_tx;
+
+       len = min(count, sizeof(buf) - 1);
+       if (copy_from_user(buf, user_buf, len))
+               return -EFAULT;
+       buf[len] = '\0';
+       sptr = buf;
+
+       token = strsep(&sptr, " ");
+       if (!token)
+               return -EINVAL;
+       if (kstrtou16(token, 0, &idle_period))
+               return -EINVAL;
+
+       token = strsep(&sptr, " ");
+       if (!token)
+               return -EINVAL;
+       if (kstrtou16(token, 0, &ps_poll_num))
+               return -EINVAL;
+
+       token = strsep(&sptr, " ");
+       if (!token)
+               return -EINVAL;
+       if (kstrtou16(token, 0, &dtim))
+               return -EINVAL;
+
+       token = strsep(&sptr, " ");
+       if (!token)
+               return -EINVAL;
+       if (kstrtou16(token, 0, &tx_wakeup))
+               return -EINVAL;
+
+       token = strsep(&sptr, " ");
+       if (!token)
+               return -EINVAL;
+       if (kstrtou16(token, 0, &num_tx))
+               return -EINVAL;
+
+       ath6kl_wmi_pmparams_cmd(ar->wmi, 0, idle_period, ps_poll_num,
+                               dtim, tx_wakeup, num_tx, 0);
+
+       return count;
+}
+
+static const struct file_operations fops_power_params = {
+       .write = ath6kl_power_params_write,
+       .open = ath6kl_debugfs_open,
+       .owner = THIS_MODULE,
+       .llseek = default_llseek,
+};
+
 int ath6kl_debug_init(struct ath6kl *ar)
 {
        ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
@@ -1649,6 +1710,9 @@ int ath6kl_debug_init(struct ath6kl *ar)
        debugfs_create_file("bgscan_interval", S_IWUSR,
                                ar->debugfs_phy, ar, &fops_bgscan_int);
 
+       debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
+                                               &fops_power_params);
+
        return 0;
 }