diff options
author | Eyal Shapira <eyal@wizery.com> | 2012-02-02 05:03:42 -0500 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2012-02-15 01:38:34 -0500 |
commit | 20ae7e5e4b13937da6882bf84b080eb31feb9a7b (patch) | |
tree | 968d8ee42c76ab68240bede0aae6e1e295a0f220 /drivers/net/wireless/wl12xx | |
parent | 5c0dc2fcfec606cf9f2d28ff31bbeb0a6225b27a (diff) |
wl12xx: add forced_ps debugfs file
Added control over forced_ps option through debugfs.
This can be either 1 or 0.
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')
-rw-r--r-- | drivers/net/wireless/wl12xx/debugfs.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index 02da445ea98a..1c2623850eae 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -376,6 +376,75 @@ static const struct file_operations dynamic_ps_timeout_ops = { | |||
376 | .llseek = default_llseek, | 376 | .llseek = default_llseek, |
377 | }; | 377 | }; |
378 | 378 | ||
379 | static ssize_t forced_ps_read(struct file *file, char __user *user_buf, | ||
380 | size_t count, loff_t *ppos) | ||
381 | { | ||
382 | struct wl1271 *wl = file->private_data; | ||
383 | |||
384 | return wl1271_format_buffer(user_buf, count, | ||
385 | ppos, "%d\n", | ||
386 | wl->conf.conn.forced_ps); | ||
387 | } | ||
388 | |||
389 | static ssize_t forced_ps_write(struct file *file, | ||
390 | const char __user *user_buf, | ||
391 | size_t count, loff_t *ppos) | ||
392 | { | ||
393 | struct wl1271 *wl = file->private_data; | ||
394 | struct wl12xx_vif *wlvif; | ||
395 | unsigned long value; | ||
396 | int ret, ps_mode; | ||
397 | |||
398 | ret = kstrtoul_from_user(user_buf, count, 10, &value); | ||
399 | if (ret < 0) { | ||
400 | wl1271_warning("illegal value in forced_ps"); | ||
401 | return -EINVAL; | ||
402 | } | ||
403 | |||
404 | if (value != 1 && value != 0) { | ||
405 | wl1271_warning("forced_ps should be either 0 or 1"); | ||
406 | return -ERANGE; | ||
407 | } | ||
408 | |||
409 | mutex_lock(&wl->mutex); | ||
410 | |||
411 | if (wl->conf.conn.forced_ps == value) | ||
412 | goto out; | ||
413 | |||
414 | wl->conf.conn.forced_ps = value; | ||
415 | |||
416 | if (wl->state == WL1271_STATE_OFF) | ||
417 | goto out; | ||
418 | |||
419 | ret = wl1271_ps_elp_wakeup(wl); | ||
420 | if (ret < 0) | ||
421 | goto out; | ||
422 | |||
423 | /* In case we're already in PSM, trigger it again to switch mode | ||
424 | * immediately without waiting for re-association | ||
425 | */ | ||
426 | |||
427 | ps_mode = value ? STATION_POWER_SAVE_MODE : STATION_AUTO_PS_MODE; | ||
428 | |||
429 | wl12xx_for_each_wlvif_sta(wl, wlvif) { | ||
430 | if (test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) | ||
431 | wl1271_ps_set_mode(wl, wlvif, ps_mode); | ||
432 | } | ||
433 | |||
434 | wl1271_ps_elp_sleep(wl); | ||
435 | |||
436 | out: | ||
437 | mutex_unlock(&wl->mutex); | ||
438 | return count; | ||
439 | } | ||
440 | |||
441 | static const struct file_operations forced_ps_ops = { | ||
442 | .read = forced_ps_read, | ||
443 | .write = forced_ps_write, | ||
444 | .open = wl1271_open_file_generic, | ||
445 | .llseek = default_llseek, | ||
446 | }; | ||
447 | |||
379 | static ssize_t driver_state_read(struct file *file, char __user *user_buf, | 448 | static ssize_t driver_state_read(struct file *file, char __user *user_buf, |
380 | size_t count, loff_t *ppos) | 449 | size_t count, loff_t *ppos) |
381 | { | 450 | { |
@@ -1011,6 +1080,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl, | |||
1011 | DEBUGFS_ADD(beacon_interval, rootdir); | 1080 | DEBUGFS_ADD(beacon_interval, rootdir); |
1012 | DEBUGFS_ADD(beacon_filtering, rootdir); | 1081 | DEBUGFS_ADD(beacon_filtering, rootdir); |
1013 | DEBUGFS_ADD(dynamic_ps_timeout, rootdir); | 1082 | DEBUGFS_ADD(dynamic_ps_timeout, rootdir); |
1083 | DEBUGFS_ADD(forced_ps, rootdir); | ||
1014 | 1084 | ||
1015 | streaming = debugfs_create_dir("rx_streaming", rootdir); | 1085 | streaming = debugfs_create_dir("rx_streaming", rootdir); |
1016 | if (!streaming || IS_ERR(streaming)) | 1086 | if (!streaming || IS_ERR(streaming)) |