diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2015-01-30 08:35:30 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-02-03 08:31:07 -0500 |
commit | 8b861715087fe17796fe411eff1c7f7e493d0d10 (patch) | |
tree | 560bed1b56235de0f714a508dbebe487cd720bd9 /drivers/net/wireless | |
parent | e094c3375c5179ea30505676fd35e08568a77ee2 (diff) |
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: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ath9k.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/debug.c | 68 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/wow.c | 4 |
3 files changed, 71 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 803a7d4ff1b2..20216c56e158 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -1044,6 +1044,7 @@ struct ath_softc { | |||
1044 | 1044 | ||
1045 | #ifdef CONFIG_ATH9K_WOW | 1045 | #ifdef CONFIG_ATH9K_WOW |
1046 | u32 wow_intr_before_sleep; | 1046 | u32 wow_intr_before_sleep; |
1047 | bool force_wow; | ||
1047 | #endif | 1048 | #endif |
1048 | }; | 1049 | }; |
1049 | 1050 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index dd5d3914799b..50a2e0ac3b8b 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -1043,6 +1043,69 @@ static const struct file_operations fops_ackto = { | |||
1043 | }; | 1043 | }; |
1044 | #endif | 1044 | #endif |
1045 | 1045 | ||
1046 | #ifdef CONFIG_ATH9K_WOW | ||
1047 | |||
1048 | static ssize_t read_file_wow(struct file *file, char __user *user_buf, | ||
1049 | size_t count, loff_t *ppos) | ||
1050 | { | ||
1051 | struct ath_softc *sc = file->private_data; | ||
1052 | unsigned int len = 0, size = 32; | ||
1053 | ssize_t retval; | ||
1054 | char *buf; | ||
1055 | |||
1056 | buf = kzalloc(size, GFP_KERNEL); | ||
1057 | if (!buf) | ||
1058 | return -ENOMEM; | ||
1059 | |||
1060 | len += scnprintf(buf + len, size - len, "WOW: %s\n", | ||
1061 | sc->force_wow ? "ENABLED" : "DISABLED"); | ||
1062 | |||
1063 | if (len > size) | ||
1064 | len = size; | ||
1065 | |||
1066 | retval = simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1067 | kfree(buf); | ||
1068 | |||
1069 | return retval; | ||
1070 | } | ||
1071 | |||
1072 | static ssize_t write_file_wow(struct file *file, const char __user *user_buf, | ||
1073 | size_t count, loff_t *ppos) | ||
1074 | { | ||
1075 | struct ath_softc *sc = file->private_data; | ||
1076 | unsigned long val; | ||
1077 | char buf[32]; | ||
1078 | ssize_t len; | ||
1079 | |||
1080 | len = min(count, sizeof(buf) - 1); | ||
1081 | if (copy_from_user(buf, user_buf, len)) | ||
1082 | return -EFAULT; | ||
1083 | |||
1084 | buf[len] = '\0'; | ||
1085 | if (kstrtoul(buf, 0, &val)) | ||
1086 | return -EINVAL; | ||
1087 | |||
1088 | if (val != 1) | ||
1089 | return -EINVAL; | ||
1090 | |||
1091 | if (!sc->force_wow) { | ||
1092 | sc->force_wow = true; | ||
1093 | ath9k_init_wow(sc->hw); | ||
1094 | } | ||
1095 | |||
1096 | return count; | ||
1097 | } | ||
1098 | |||
1099 | static const struct file_operations fops_wow = { | ||
1100 | .read = read_file_wow, | ||
1101 | .write = write_file_wow, | ||
1102 | .open = simple_open, | ||
1103 | .owner = THIS_MODULE, | ||
1104 | .llseek = default_llseek, | ||
1105 | }; | ||
1106 | |||
1107 | #endif | ||
1108 | |||
1046 | static ssize_t read_file_tpc(struct file *file, char __user *user_buf, | 1109 | static ssize_t read_file_tpc(struct file *file, char __user *user_buf, |
1047 | size_t count, loff_t *ppos) | 1110 | size_t count, loff_t *ppos) |
1048 | { | 1111 | { |
@@ -1313,6 +1376,11 @@ int ath9k_init_debug(struct ath_hw *ah) | |||
1313 | &fops_btcoex); | 1376 | &fops_btcoex); |
1314 | #endif | 1377 | #endif |
1315 | 1378 | ||
1379 | #ifdef CONFIG_ATH9K_WOW | ||
1380 | debugfs_create_file("wow", S_IRUSR | S_IWUSR, | ||
1381 | sc->debug.debugfs_phy, sc, &fops_wow); | ||
1382 | #endif | ||
1383 | |||
1316 | #ifdef CONFIG_ATH9K_DYNACK | 1384 | #ifdef CONFIG_ATH9K_DYNACK |
1317 | debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, | 1385 | debugfs_create_file("ack_to", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy, |
1318 | sc, &fops_ackto); | 1386 | sc, &fops_ackto); |
diff --git a/drivers/net/wireless/ath/ath9k/wow.c b/drivers/net/wireless/ath/ath9k/wow.c index d4cfbc363eb5..4b3b56563714 100644 --- a/drivers/net/wireless/ath/ath9k/wow.c +++ b/drivers/net/wireless/ath/ath9k/wow.c | |||
@@ -327,7 +327,7 @@ void ath9k_init_wow(struct ieee80211_hw *hw) | |||
327 | { | 327 | { |
328 | struct ath_softc *sc = hw->priv; | 328 | struct ath_softc *sc = hw->priv; |
329 | 329 | ||
330 | if (sc->driver_data & ATH9K_PCI_WOW) { | 330 | if ((sc->driver_data & ATH9K_PCI_WOW) || sc->force_wow) { |
331 | hw->wiphy->wowlan = &ath9k_wowlan_support; | 331 | hw->wiphy->wowlan = &ath9k_wowlan_support; |
332 | device_init_wakeup(sc->dev, 1); | 332 | device_init_wakeup(sc->dev, 1); |
333 | } | 333 | } |
@@ -337,6 +337,6 @@ void ath9k_deinit_wow(struct ieee80211_hw *hw) | |||
337 | { | 337 | { |
338 | struct ath_softc *sc = hw->priv; | 338 | struct ath_softc *sc = hw->priv; |
339 | 339 | ||
340 | if (sc->driver_data & ATH9K_PCI_WOW) | 340 | if ((sc->driver_data & ATH9K_PCI_WOW) || sc->force_wow) |
341 | device_init_wakeup(sc->dev, 0); | 341 | device_init_wakeup(sc->dev, 0); |
342 | } | 342 | } |