* [PATCH] ath6kl: Implement support for power parameter control from userspace
@ 2011-10-26 2:52 Rishi Panjwani
2011-10-26 2:52 ` [PATCH v2] " Rishi Panjwani
0 siblings, 1 reply; 3+ messages in thread
From: Rishi Panjwani @ 2011-10-26 2:52 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, Rishi Panjwani
The patch allows modification of parameters which alter the sleep/awake mechanism like
ps-poll, thereby allowing control of power consumption
Rishi Panjwani (1):
ath6kl: Implement support for power parameter control from userspace
drivers/net/wireless/ath/ath6kl/debug.c | 65 +++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] ath6kl: Implement support for power parameter control from userspace
2011-10-26 2:52 [PATCH] ath6kl: Implement support for power parameter control from userspace Rishi Panjwani
@ 2011-10-26 2:52 ` Rishi Panjwani
2011-10-27 8:22 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Rishi Panjwani @ 2011-10-26 2:52 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, Rishi Panjwani
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>
---
drivers/net/wireless/ath/ath6kl/debug.c | 65 +++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index 67254ca..dbf2aa6 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -1520,6 +1520,68 @@ static const struct file_operations fops_listen_int = {
.llseek = default_llseek,
};
+
+static ssize_t ath6kl_power_params_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath6kl *ar = file->private_data;
+ u8 buf[100];
+ unsigned int len = 0;
+ char *sptr, *token;
+ u16 idle_period, ps_poll_num, dtim,
+ tx_wakeup, num_tx;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+ buf[len] = '\0';
+ sptr = buf;
+
+ token = strsep(&sptr, " ");
+ if (!token)
+ return -EINVAL;
+ if (kstrtou16(token, 0, &idle_period))
+ return -EINVAL;
+
+ token = strsep(&sptr, " ");
+ if (!token)
+ return -EINVAL;
+ if (kstrtou16(token, 0, &ps_poll_num))
+ return -EINVAL;
+
+ token = strsep(&sptr, " ");
+ if (!token)
+ return -EINVAL;
+ if (kstrtou16(token, 0, &dtim))
+ return -EINVAL;
+
+ token = strsep(&sptr, " ");
+ if (!token)
+ return -EINVAL;
+ if (kstrtou16(token, 0, &tx_wakeup))
+ return -EINVAL;
+
+ token = strsep(&sptr, " ");
+ if (!token)
+ return -EINVAL;
+ if (kstrtou16(token, 0, &num_tx))
+ return -EINVAL;
+
+ ath6kl_wmi_pmparams_cmd(ar->wmi, idle_period, ps_poll_num,
+ dtim, tx_wakeup, num_tx, 0);
+
+ return count;
+}
+
+
+static const struct file_operations fops_power_params = {
+ .write = ath6kl_power_params_write,
+ .open = ath6kl_debugfs_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
int ath6kl_debug_init(struct ath6kl *ar)
{
ar->debug.fwlog_buf.buf = vmalloc(ATH6KL_FWLOG_SIZE);
@@ -1605,6 +1667,9 @@ int ath6kl_debug_init(struct ath6kl *ar)
debugfs_create_file("listen_interval", S_IWUSR, ar->debugfs_phy, ar,
&fops_listen_int);
+ debugfs_create_file("power_params", S_IWUSR, ar->debugfs_phy, ar,
+ &fops_power_params);
+
return 0;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ath6kl: Implement support for power parameter control from userspace
2011-10-26 2:52 ` [PATCH v2] " Rishi Panjwani
@ 2011-10-27 8:22 ` Kalle Valo
0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2011-10-27 8:22 UTC (permalink / raw)
To: Rishi Panjwani; +Cc: linux-wireless
On 10/26/2011 05:52 AM, Rishi Panjwani wrote:
> 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
Applied, thanks. Again I added a vif index to the wmi call, please check
that.
Kalle
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-27 8:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-26 2:52 [PATCH] ath6kl: Implement support for power parameter control from userspace Rishi Panjwani
2011-10-26 2:52 ` [PATCH v2] " Rishi Panjwani
2011-10-27 8:22 ` Kalle Valo
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).