aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl/debug.c
diff options
context:
space:
mode:
authorRishi Panjwani <rpanjwan@qca.qualcomm.com>2011-10-25 22:52:41 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-11-11 05:58:55 -0500
commita24fc7c35324618ce5fe9c54baa4bc9a3881cc86 (patch)
treeab18ccdc164f0e01dd352b54d157614cb0023ec9 /drivers/net/wireless/ath/ath6kl/debug.c
parentef8f0eba5a35327a9968e2a4d2116195240512c6 (diff)
ath6kl: Implement support for power parameter control from userspace
In order to allow user space based control of power parameters, we use available debugfs infrastructure. With these features user can control power consumption by adjusting various sleep/wake up related parameters. The feature has been added for testing purposes. All 5 parameters are mandatory in correct order. They have to be written to the power_params file. These are: 1) idle_period 2) no_of_pspoll 3) dtim_policy 4) tx_wakeup_policy 5) no_tx_to_wakeup Example: echo "200 1 0 1 1" > power_params Signed-off-by: Rishi Panjwani <rpanjwan@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/debug.c')
-rw-r--r--drivers/net/wireless/ath/ath6kl/debug.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index 52149202ffb7..70ea137cc817 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -1567,6 +1567,66 @@ static const struct file_operations fops_listen_int = {
1567 .llseek = default_llseek, 1567 .llseek = default_llseek,
1568}; 1568};
1569 1569
1570static ssize_t ath6kl_power_params_write(struct file *file,
1571 const char __user *user_buf,
1572 size_t count, loff_t *ppos)
1573{
1574 struct ath6kl *ar = file->private_data;
1575 u8 buf[100];
1576 unsigned int len = 0;
1577 char *sptr, *token;
1578 u16 idle_period, ps_poll_num, dtim,
1579 tx_wakeup, num_tx;
1580
1581 len = min(count, sizeof(buf) - 1);
1582 if (copy_from_user(buf, user_buf, len))
1583 return -EFAULT;
1584 buf[len] = '\0';
1585 sptr = buf;
1586
1587 token = strsep(&sptr, " ");
1588 if (!token)
1589 return -EINVAL;
1590 if (kstrtou16(token, 0, &idle_period))
1591 return -EINVAL;
1592
1593 token = strsep(&sptr, " ");
1594 if (!token)
1595 return -EINVAL;
1596 if (kstrtou16(token, 0, &ps_poll_num))
1597 return -EINVAL;
1598
1599 token = strsep(&sptr, " ");
1600 if (!token)
1601 return -EINVAL;
1602 if (kstrtou16(token, 0, &dtim))
1603 return -EINVAL;
1604
1605 token = strsep(&sptr, " ");
1606 if (!token)
1607 return -EINVAL;
1608 if (kstrtou16(token, 0, &tx_wakeup))
1609 return -EINVAL;
1610
1611 token = strsep(&sptr, " ");
1612 if (!token)
1613 return -EINVAL;
1614 if (kstrtou16(token, 0, &num_tx))
1615 return -EINVAL;
1616
1617 ath6kl_wmi_pmparams_cmd(ar->wmi, 0, idle_period, ps_poll_num,
1618 dtim, tx_wakeup, num_tx, 0);
1619
1620 return count;
1621}
1622
1623static const struct file_operations fops_power_params = {
1624 .write = ath6kl_power_params_write,
1625 .open = ath6kl_debugfs_open,
1626 .owner = THIS_MODULE,
1627 .llseek = default_llseek,
1628};
1629
1570int ath6kl_debug_init(struct ath6kl *ar) 1630int ath6kl_debug_init(struct ath6kl *ar)
1571{ 1631{
1572 ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE); 1632 ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
@@ -1649,6 +1709,9 @@ int ath6kl_debug_init(struct ath6kl *ar)
1649 debugfs_create_file("bgscan_interval", S_IWUSR, 1709 debugfs_create_file("bgscan_interval", S_IWUSR,
1650 ar->debugfs_phy, ar, &fops_bgscan_int); 1710 ar->debugfs_phy, ar, &fops_bgscan_int);
1651 1711
1712 debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
1713 &fops_power_params);
1714
1652 return 0; 1715 return 0;
1653} 1716}
1654 1717