* [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval
@ 2011-04-17 8:20 Eliad Peller
2011-04-29 19:58 ` Luciano Coelho
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eliad Peller @ 2011-04-17 8:20 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless
When configuring ACX_WAKE_UP_CONDITIONS (before entering psm), we
tell the firmware to wake up once in N DTIMs/beacons.
Allow control of this value via debugfs (for debugging purposes).
Signed-off-by: Eliad Peller <eliad@wizery.com>
---
drivers/net/wireless/wl12xx/debugfs.c | 132 +++++++++++++++++++++++++++++++++
1 files changed, 132 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index 8e75b09..684ad3a 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -291,6 +291,136 @@ static const struct file_operations gpio_power_ops = {
.llseek = default_llseek,
};
+static ssize_t dtim_interval_read(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wl1271 *wl = file->private_data;
+ u8 value;
+
+ if (wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_DTIM ||
+ wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_N_DTIM)
+ value = wl->conf.conn.listen_interval;
+ else
+ value = 0;
+
+ return wl1271_format_buffer(user_buf, count, ppos, "%d\n", value);
+}
+
+static ssize_t dtim_interval_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wl1271 *wl = file->private_data;
+ char buf[10];
+ size_t len;
+ unsigned long value;
+ int ret;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+ buf[len] = '\0';
+
+ ret = strict_strtoul(buf, 0, &value);
+ if (ret < 0) {
+ wl1271_warning("illegal value for dtim_interval");
+ return -EINVAL;
+ }
+
+ if (value < 1 || value > 10) {
+ wl1271_warning("dtim value is not in valid range");
+ return -ERANGE;
+ }
+
+ mutex_lock(&wl->mutex);
+
+ wl->conf.conn.listen_interval = value;
+ /* for some reason there are different event types for 1 and >1 */
+ if (value == 1)
+ wl->conf.conn.wake_up_event = CONF_WAKE_UP_EVENT_DTIM;
+ else
+ wl->conf.conn.wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM;
+
+ /*
+ * we don't reconfigure ACX_WAKE_UP_CONDITIONS now, so it will only
+ * take effect on the next time we enter psm.
+ */
+ mutex_unlock(&wl->mutex);
+ return count;
+}
+
+static const struct file_operations dtim_interval_ops = {
+ .read = dtim_interval_read,
+ .write = dtim_interval_write,
+ .open = wl1271_open_file_generic,
+ .llseek = default_llseek,
+};
+
+static ssize_t beacon_interval_read(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wl1271 *wl = file->private_data;
+ u8 value;
+
+ if (wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_BEACON||
+ wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_N_BEACONS)
+ value = wl->conf.conn.listen_interval;
+ else
+ value = 0;
+
+ return wl1271_format_buffer(user_buf, count, ppos, "%d\n", value);
+}
+
+static ssize_t beacon_interval_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wl1271 *wl = file->private_data;
+ char buf[10];
+ size_t len;
+ unsigned long value;
+ int ret;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+ buf[len] = '\0';
+
+ ret = strict_strtoul(buf, 0, &value);
+ if (ret < 0) {
+ wl1271_warning("illegal value for beacon_interval");
+ return -EINVAL;
+ }
+
+ if (value < 1 || value > 255) {
+ wl1271_warning("beacon interval value is not in valid range");
+ return -ERANGE;
+ }
+
+ mutex_lock(&wl->mutex);
+
+ wl->conf.conn.listen_interval = value;
+ /* for some reason there are different event types for 1 and >1 */
+ if (value == 1)
+ wl->conf.conn.wake_up_event = CONF_WAKE_UP_EVENT_BEACON;
+ else
+ wl->conf.conn.wake_up_event = CONF_WAKE_UP_EVENT_N_BEACONS;
+
+ /*
+ * we don't reconfigure ACX_WAKE_UP_CONDITIONS now, so it will only
+ * take effect on the next time we enter psm.
+ */
+ mutex_unlock(&wl->mutex);
+ return count;
+}
+
+static const struct file_operations beacon_interval_ops = {
+ .read = beacon_interval_read,
+ .write = beacon_interval_write,
+ .open = wl1271_open_file_generic,
+ .llseek = default_llseek,
+};
+
static int wl1271_debugfs_add_files(struct wl1271 *wl,
struct dentry *rootdir)
{
@@ -399,6 +529,8 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl,
DEBUGFS_ADD(excessive_retries, rootdir);
DEBUGFS_ADD(gpio_power, rootdir);
+ DEBUGFS_ADD(dtim_interval, rootdir);
+ DEBUGFS_ADD(beacon_interval, rootdir);
return 0;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval
2011-04-17 8:20 [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval Eliad Peller
@ 2011-04-29 19:58 ` Luciano Coelho
2011-04-29 20:00 ` [PATCH] wl12xx: strict_stroul introduced converted to kstrtoul Luciano Coelho
2011-04-29 20:04 ` [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval Luciano Coelho
2 siblings, 0 replies; 4+ messages in thread
From: Luciano Coelho @ 2011-04-29 19:58 UTC (permalink / raw)
To: Eliad Peller; +Cc: linux-wireless
On Sun, 2011-04-17 at 11:20 +0300, Eliad Peller wrote:
> When configuring ACX_WAKE_UP_CONDITIONS (before entering psm), we
> tell the firmware to wake up once in N DTIMs/beacons.
>
> Allow control of this value via debugfs (for debugging purposes).
>
> Signed-off-by: Eliad Peller <eliad@wizery.com>
> ---
Applied, thanks.
I've also added a new patch to s/strict_strtoul/kstrtoul/.
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] wl12xx: strict_stroul introduced converted to kstrtoul
2011-04-17 8:20 [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval Eliad Peller
2011-04-29 19:58 ` Luciano Coelho
@ 2011-04-29 20:00 ` Luciano Coelho
2011-04-29 20:04 ` [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval Luciano Coelho
2 siblings, 0 replies; 4+ messages in thread
From: Luciano Coelho @ 2011-04-29 20:00 UTC (permalink / raw)
To: linux-wireless; +Cc: eliad
One new patch applied added a couple of new strict_strtoul calls.
Converted those to kstroul().
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/debugfs.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index 88c6efe..b17cff6 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -321,7 +321,7 @@ static ssize_t dtim_interval_write(struct file *file,
return -EFAULT;
buf[len] = '\0';
- ret = strict_strtoul(buf, 0, &value);
+ ret = kstrtoul(buf, 0, &value);
if (ret < 0) {
wl1271_warning("illegal value for dtim_interval");
return -EINVAL;
@@ -386,7 +386,7 @@ static ssize_t beacon_interval_write(struct file *file,
return -EFAULT;
buf[len] = '\0';
- ret = strict_strtoul(buf, 0, &value);
+ ret = kstrtoul(buf, 0, &value);
if (ret < 0) {
wl1271_warning("illegal value for beacon_interval");
return -EINVAL;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval
2011-04-17 8:20 [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval Eliad Peller
2011-04-29 19:58 ` Luciano Coelho
2011-04-29 20:00 ` [PATCH] wl12xx: strict_stroul introduced converted to kstrtoul Luciano Coelho
@ 2011-04-29 20:04 ` Luciano Coelho
2 siblings, 0 replies; 4+ messages in thread
From: Luciano Coelho @ 2011-04-29 20:04 UTC (permalink / raw)
To: Eliad Peller; +Cc: linux-wireless
On Sun, 2011-04-17 at 11:20 +0300, Eliad Peller wrote:
> +static ssize_t beacon_interval_read(struct file *file, char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct wl1271 *wl = file->private_data;
> + u8 value;
> +
> + if (wl->conf.conn.wake_up_event == CONF_WAKE_UP_EVENT_BEACON||
I also added one extra space before || here to avoid a checkpatch.pl
warning.
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-29 20:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-17 8:20 [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval Eliad Peller
2011-04-29 19:58 ` Luciano Coelho
2011-04-29 20:00 ` [PATCH] wl12xx: strict_stroul introduced converted to kstrtoul Luciano Coelho
2011-04-29 20:04 ` [PATCH] wl12xx: add debugfs entries for dtim_interval and beacon_interval Luciano Coelho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).