aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/debugfs.c
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-01-31 04:57:22 -0500
committerLuciano Coelho <coelho@ti.com>2012-02-15 01:38:31 -0500
commit1faff895df6a5213ee16a241951dc79c7ec5b5cb (patch)
tree1abd0438084cc7493f6a28f68491aa370193c86c /drivers/net/wireless/wl12xx/debugfs.c
parentf1d63a59635feef3481ed1972a883a5d6be7f9bb (diff)
wl12xx: add dynamic_ps_timeout debugfs file
Enable read/write of dynamic_ps_timeout which controls the timeout of the dynamic PS implemented in the FW. dynamic_ps_timeout is the timeout (in msec) until going back to PS when there's no Rx/Tx Signed-off-by: Eyal Shapira <eyal@wizery.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/debugfs.c')
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index 5e96e059f2b5..156a7741df34 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -312,6 +312,72 @@ static const struct file_operations start_recovery_ops = {
312 .llseek = default_llseek, 312 .llseek = default_llseek,
313}; 313};
314 314
315static ssize_t dynamic_ps_timeout_read(struct file *file, char __user *user_buf,
316 size_t count, loff_t *ppos)
317{
318 struct wl1271 *wl = file->private_data;
319
320 return wl1271_format_buffer(user_buf, count,
321 ppos, "%d\n",
322 wl->conf.conn.dynamic_ps_timeout);
323}
324
325static ssize_t dynamic_ps_timeout_write(struct file *file,
326 const char __user *user_buf,
327 size_t count, loff_t *ppos)
328{
329 struct wl1271 *wl = file->private_data;
330 struct wl12xx_vif *wlvif;
331 unsigned long value;
332 int ret;
333
334 ret = kstrtoul_from_user(user_buf, count, 10, &value);
335 if (ret < 0) {
336 wl1271_warning("illegal value in dynamic_ps");
337 return -EINVAL;
338 }
339
340 if (value < 1 || value > 65535) {
341 wl1271_warning("dyanmic_ps_timeout is not in valid range");
342 return -ERANGE;
343 }
344
345 mutex_lock(&wl->mutex);
346
347 wl->conf.conn.dynamic_ps_timeout = value;
348
349 if (wl->state == WL1271_STATE_OFF)
350 goto out;
351
352 ret = wl1271_ps_elp_wakeup(wl);
353 if (ret < 0)
354 goto out;
355
356 /* In case we're already in PSM, trigger it again to set new timeout
357 * immediately without waiting for re-association
358 */
359
360 wl12xx_for_each_wlvif_sta(wl, wlvif) {
361 if (test_bit(WLVIF_FLAG_PSM, &wlvif->flags))
362 wl1271_ps_set_mode(wl, wlvif, STATION_AUTO_PS_MODE,
363 wlvif->basic_rate, true);
364
365 }
366
367 wl1271_ps_elp_sleep(wl);
368
369out:
370 mutex_unlock(&wl->mutex);
371 return count;
372}
373
374static const struct file_operations dynamic_ps_timeout_ops = {
375 .read = dynamic_ps_timeout_read,
376 .write = dynamic_ps_timeout_write,
377 .open = wl1271_open_file_generic,
378 .llseek = default_llseek,
379};
380
315static ssize_t driver_state_read(struct file *file, char __user *user_buf, 381static ssize_t driver_state_read(struct file *file, char __user *user_buf,
316 size_t count, loff_t *ppos) 382 size_t count, loff_t *ppos)
317{ 383{
@@ -887,6 +953,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl,
887 DEBUGFS_ADD(dtim_interval, rootdir); 953 DEBUGFS_ADD(dtim_interval, rootdir);
888 DEBUGFS_ADD(beacon_interval, rootdir); 954 DEBUGFS_ADD(beacon_interval, rootdir);
889 DEBUGFS_ADD(beacon_filtering, rootdir); 955 DEBUGFS_ADD(beacon_filtering, rootdir);
956 DEBUGFS_ADD(dynamic_ps_timeout, rootdir);
890 957
891 streaming = debugfs_create_dir("rx_streaming", rootdir); 958 streaming = debugfs_create_dir("rx_streaming", rootdir);
892 if (!streaming || IS_ERR(streaming)) 959 if (!streaming || IS_ERR(streaming))