Commit 8b861715 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by Kalle Valo

ath9k: Add a debugfs file for WOW

This can be used to force WOW for cards that
are not present in the supported PCI ID list.
Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e094c337
...@@ -1044,6 +1044,7 @@ struct ath_softc { ...@@ -1044,6 +1044,7 @@ struct ath_softc {
#ifdef CONFIG_ATH9K_WOW #ifdef CONFIG_ATH9K_WOW
u32 wow_intr_before_sleep; u32 wow_intr_before_sleep;
bool force_wow;
#endif #endif
}; };
......
...@@ -1043,6 +1043,69 @@ static const struct file_operations fops_ackto = { ...@@ -1043,6 +1043,69 @@ static const struct file_operations fops_ackto = {
}; };
#endif #endif
#ifdef CONFIG_ATH9K_WOW
static ssize_t read_file_wow(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
unsigned int len = 0, size = 32;
ssize_t retval;
char *buf;
buf = kzalloc(size, GFP_KERNEL);
if (!buf)
return -ENOMEM;
len += scnprintf(buf + len, size - len, "WOW: %s\n",
sc->force_wow ? "ENABLED" : "DISABLED");
if (len > size)
len = size;
retval = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
return retval;
}
static ssize_t write_file_wow(struct file *file, const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
unsigned long val;
char buf[32];
ssize_t len;
len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len))
return -EFAULT;
buf[len] = '\0';
if (kstrtoul(buf, 0, &val))
return -EINVAL;
if (val != 1)
return -EINVAL;
if (!sc->force_wow) {
sc->force_wow = true;
ath9k_init_wow(sc->hw);
}
return count;
}
static const struct file_operations fops_wow = {
.read = read_file_wow,
.write = write_file_wow,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
#endif
static ssize_t read_file_tpc(struct file *file, char __user *user_buf, static ssize_t read_file_tpc(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
...@@ -1313,6 +1376,11 @@ int ath9k_init_debug(struct ath_hw *ah) ...@@ -1313,6 +1376,11 @@ int ath9k_init_debug(struct ath_hw *ah)
&fops_btcoex); &fops_btcoex);
#endif #endif
#ifdef CONFIG_ATH9K_WOW
debugfs_create_file("wow", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_wow);
#endif
#ifdef CONFIG_ATH9K_DYNACK #ifdef CONFIG_ATH9K_DYNACK
debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
sc, &fops_ackto); sc, &fops_ackto);
......
...@@ -327,7 +327,7 @@ void ath9k_init_wow(struct ieee80211_hw *hw) ...@@ -327,7 +327,7 @@ void ath9k_init_wow(struct ieee80211_hw *hw)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
if (sc->driver_data & ATH9K_PCI_WOW) { if ((sc->driver_data & ATH9K_PCI_WOW) || sc->force_wow) {
hw->wiphy->wowlan = &ath9k_wowlan_support; hw->wiphy->wowlan = &ath9k_wowlan_support;
device_init_wakeup(sc->dev, 1); device_init_wakeup(sc->dev, 1);
} }
...@@ -337,6 +337,6 @@ void ath9k_deinit_wow(struct ieee80211_hw *hw) ...@@ -337,6 +337,6 @@ void ath9k_deinit_wow(struct ieee80211_hw *hw)
{ {
struct ath_softc *sc = hw->priv; struct ath_softc *sc = hw->priv;
if (sc->driver_data & ATH9K_PCI_WOW) if ((sc->driver_data & ATH9K_PCI_WOW) || sc->force_wow)
device_init_wakeup(sc->dev, 0); device_init_wakeup(sc->dev, 0);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment