From patchwork Tue Nov 28 08:02:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Reizer, Eyal" X-Patchwork-Id: 10078927 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 815BA6056A for ; Tue, 28 Nov 2017 08:02:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C60628D11 for ; Tue, 28 Nov 2017 08:02:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61364291BD; Tue, 28 Nov 2017 08:02:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E32D528D11 for ; Tue, 28 Nov 2017 08:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751900AbdK1ICP (ORCPT ); Tue, 28 Nov 2017 03:02:15 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:9742 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751872AbdK1ICN (ORCPT ); Tue, 28 Nov 2017 03:02:13 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id vAS829I0016221; Tue, 28 Nov 2017 02:02:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1511856129; bh=wlLeXrr2tDpaOwpcrsjQ+nYp7ZBhv/pR8lKMJKIpxeE=; h=From:To:Subject:Date; b=HAkgi46PDGiSo5zwosecamFcTENDYnXvl5SV953KtAHcA+e8hNKPx7fmZ86O9aXby Nxd7ndjcdLpWF2rA9NDReprL/7oZaxJw4g/T/ys9Vaew5DT6ZKMmEvqIo+Bf7tX6GW KUN3RNPeBtgx3mXkEs0hgk9Yfl9G0r3Hd6HJqQbA= Received: from DFRE71.ent.ti.com (dfre71.ent.ti.com [10.167.188.35]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAS829Is002449; Tue, 28 Nov 2017 02:02:09 -0600 Received: from DFRE01.ent.ti.com ([fe80::b027:5293:c8d8:d82a]) by DFRE71.ent.ti.com ([fe80::1d1a:fb50:7d9b:ab68%31]) with mapi id 14.03.0294.000; Tue, 28 Nov 2017 09:02:08 +0100 From: "Reizer, Eyal" To: Kalle Valo , Greg Kroah-Hartman , "linux-wireless@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH] wlcore: allow elp during wowlan suspend Thread-Topic: [PATCH] wlcore: allow elp during wowlan suspend Thread-Index: AdNoHl/bGXVkGpKqQZGnTY1jlxWGEA== Date: Tue, 28 Nov 2017 08:02:07 +0000 Message-ID: <8665E2433BC68541A24DFFCA87B70F5B364A3796@DFRE01.ent.ti.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.167.188.93] x-exclaimer-md-config: f9c360f5-3d1e-4c3c-8703-f45bf52eff6b MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/net/wireless/ti/wlcore/main.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 792cb91..1c31555 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -42,6 +42,7 @@ #include "sysfs.h" #define WL1271_BOOT_RETRIES 3 +#define WL1271_SUSPEND_SLEEP 100 static char *fwlog_param; static int fwlog_mem_blocks = -1; @@ -979,6 +980,24 @@ static int wlcore_fw_wakeup(struct wl1271 *wl) return wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_WAKE_UP); } +static int wlcore_fw_sleep(struct wl1271 *wl) +{ + int ret; + + mutex_lock(&wl->mutex); + ret = wlcore_raw_write32(wl, HW_ACCESS_ELP_CTRL_REG, ELPCTRL_SLEEP); + if (ret < 0) { + wl12xx_queue_recovery_work(wl); + goto out; + } + set_bit(WL1271_FLAG_IN_ELP, &wl->flags); +out: + mutex_unlock(&wl->mutex); + mdelay(WL1271_SUSPEND_SLEEP); + + return 0; +} + static int wl1271_setup(struct wl1271 *wl) { wl->raw_fw_status = kzalloc(wl->fw_status_len, GFP_KERNEL); @@ -1750,7 +1769,6 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, goto out_sleep; out_sleep: - wl1271_ps_elp_sleep(wl); mutex_unlock(&wl->mutex); if (ret < 0) { @@ -1783,6 +1801,15 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, */ cancel_delayed_work(&wl->tx_watchdog_work); + /* + * Use an immediate call for allowing the firmware to go into power + * save during suspend. + * Using a workque for this last write was only hapenning on resume + * leaving the firmware with power save disabled during suspend, + * while consuming full power during wowlan suspend. + */ + wlcore_fw_sleep(wl); + return 0; }