aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReizer, Eyal <eyalr@ti.com>2017-11-28 03:02:07 -0500
committerKalle Valo <kvalo@codeaurora.org>2017-12-07 08:21:40 -0500
commit37bf241b8e7bd619a2ca98139d90166370170299 (patch)
tree604b59441deeee4cfbd519d2c85f9749b9b67a45
parent99f6996d4cba794f0d65d2e58a1b5b7341bdebda (diff)
wlcore: allow elp during wowlan suspend
when enabling wowlan and entering suspend the last write to the firmware allowing it to go into elp mode was not completing before suspend, leaving the firmware running in full active mode consuming high power. Use an immediate call instead of a work queue for this last access allowing the firmware to go into power save during wowlan uspend. Signed-off-by: Eyal Reizer <eyalr@ti.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 946a7124b09e..6ce457022dc9 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -42,6 +42,7 @@
42#include "sysfs.h" 42#include "sysfs.h"
43 43
44#define WL1271_BOOT_RETRIES 3 44#define WL1271_BOOT_RETRIES 3
45#define WL1271_SUSPEND_SLEEP 100
45 46
46static char *fwlog_param; 47static char *fwlog_param;
47static int fwlog_mem_blocks = -1; 48static int fwlog_mem_blocks = -1;
@@ -977,6 +978,24 @@ static int wlcore_fw_wakeup(struct wl1271 *wl)
977 return wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); 978 return wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP);
978} 979}
979 980
981static int wlcore_fw_sleep(struct wl1271 *wl)
982{
983 int ret;
984
985 mutex_lock(&wl->mutex);
986 ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP);
987 if (ret < 0) {
988 wl12xx_queue_recovery_work(wl);
989 goto out;
990 }
991 set_bit(WL1271_FLAG_IN_ELP, &wl->flags);
992out:
993 mutex_unlock(&wl->mutex);
994 mdelay(WL1271_SUSPEND_SLEEP);
995
996 return 0;
997}
998
980static int wl1271_setup(struct wl1271 *wl) 999static int wl1271_setup(struct wl1271 *wl)
981{ 1000{
982 wl->raw_fw_status = kzalloc(wl->fw_status_len, GFP_KERNEL); 1001 wl->raw_fw_status = kzalloc(wl->fw_status_len, GFP_KERNEL);
@@ -1747,7 +1766,6 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
1747 goto out_sleep; 1766 goto out_sleep;
1748 1767
1749out_sleep: 1768out_sleep:
1750 wl1271_ps_elp_sleep(wl);
1751 mutex_unlock(&wl->mutex); 1769 mutex_unlock(&wl->mutex);
1752 1770
1753 if (ret < 0) { 1771 if (ret < 0) {
@@ -1780,6 +1798,15 @@ out_sleep:
1780 */ 1798 */
1781 cancel_delayed_work(&wl->tx_watchdog_work); 1799 cancel_delayed_work(&wl->tx_watchdog_work);
1782 1800
1801 /*
1802 * Use an immediate call for allowing the firmware to go into power
1803 * save during suspend.
1804 * Using a workque for this last write was only hapenning on resume
1805 * leaving the firmware with power save disabled during suspend,
1806 * while consuming full power during wowlan suspend.
1807 */
1808 wlcore_fw_sleep(wl);
1809
1783 return 0; 1810 return 0;
1784} 1811}
1785 1812