aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-02-02 05:03:40 -0500
committerLuciano Coelho <coelho@ti.com>2012-02-15 01:38:33 -0500
commit59a10c66d0a1970d3f8a7e65bb1f03dec3aae3c5 (patch)
treec83e55d52cd30527a0cbe3f95c2f3661bc70c927
parentdae728fe67c7c5ab10f91366bd9d1f8db203e123 (diff)
wl12xx: add suspend_listen_interval debugfs file
Add read/write to suspend_dtim_interval file which controls the number of DTIM periods between wakeups while the host is suspended. The value while the host is resumed is controlled by the file dtim_interval which existed previously. Signed-off-by: Eyal Shapira <eyal@wizery.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index 4dcb3f758fe2..15353fac0707 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -625,6 +625,64 @@ static const struct file_operations dtim_interval_ops = {
625 .llseek = default_llseek, 625 .llseek = default_llseek,
626}; 626};
627 627
628
629
630static ssize_t suspend_dtim_interval_read(struct file *file,
631 char __user *user_buf,
632 size_t count, loff_t *ppos)
633{
634 struct wl1271 *wl = file->private_data;
635 u8 value;
636
637 if (wl->conf.conn.suspend_wake_up_event == CONF_WAKE_UP_EVENT_DTIM ||
638 wl->conf.conn.suspend_wake_up_event == CONF_WAKE_UP_EVENT_N_DTIM)
639 value = wl->conf.conn.suspend_listen_interval;
640 else
641 value = 0;
642
643 return wl1271_format_buffer(user_buf, count, ppos, "%d\n", value);
644}
645
646static ssize_t suspend_dtim_interval_write(struct file *file,
647 const char __user *user_buf,
648 size_t count, loff_t *ppos)
649{
650 struct wl1271 *wl = file->private_data;
651 unsigned long value;
652 int ret;
653
654 ret = kstrtoul_from_user(user_buf, count, 10, &value);
655 if (ret < 0) {
656 wl1271_warning("illegal value for suspend_dtim_interval");
657 return -EINVAL;
658 }
659
660 if (value < 1 || value > 10) {
661 wl1271_warning("suspend_dtim value is not in valid range");
662 return -ERANGE;
663 }
664
665 mutex_lock(&wl->mutex);
666
667 wl->conf.conn.suspend_listen_interval = value;
668 /* for some reason there are different event types for 1 and >1 */
669 if (value == 1)
670 wl->conf.conn.suspend_wake_up_event = CONF_WAKE_UP_EVENT_DTIM;
671 else
672 wl->conf.conn.suspend_wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM;
673
674 mutex_unlock(&wl->mutex);
675 return count;
676}
677
678
679static const struct file_operations suspend_dtim_interval_ops = {
680 .read = suspend_dtim_interval_read,
681 .write = suspend_dtim_interval_write,
682 .open = wl1271_open_file_generic,
683 .llseek = default_llseek,
684};
685
628static ssize_t beacon_interval_read(struct file *file, char __user *user_buf, 686static ssize_t beacon_interval_read(struct file *file, char __user *user_buf,
629 size_t count, loff_t *ppos) 687 size_t count, loff_t *ppos)
630{ 688{
@@ -949,6 +1007,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl,
949 DEBUGFS_ADD(driver_state, rootdir); 1007 DEBUGFS_ADD(driver_state, rootdir);
950 DEBUGFS_ADD(vifs_state, rootdir); 1008 DEBUGFS_ADD(vifs_state, rootdir);
951 DEBUGFS_ADD(dtim_interval, rootdir); 1009 DEBUGFS_ADD(dtim_interval, rootdir);
1010 DEBUGFS_ADD(suspend_dtim_interval, rootdir);
952 DEBUGFS_ADD(beacon_interval, rootdir); 1011 DEBUGFS_ADD(beacon_interval, rootdir);
953 DEBUGFS_ADD(beacon_filtering, rootdir); 1012 DEBUGFS_ADD(beacon_filtering, rootdir);
954 DEBUGFS_ADD(dynamic_ps_timeout, rootdir); 1013 DEBUGFS_ADD(dynamic_ps_timeout, rootdir);