From patchwork Wed May 23 12:43:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Reizer, Eyal" X-Patchwork-Id: 10421149 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 A67E06032A for ; Wed, 23 May 2018 12:43:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97DCF200E7 for ; Wed, 23 May 2018 12:43:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C9B9271FD; Wed, 23 May 2018 12:43:27 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 EE1B0200E7 for ; Wed, 23 May 2018 12:43:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932089AbeEWMnZ (ORCPT ); Wed, 23 May 2018 08:43:25 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:58783 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932070AbeEWMnY (ORCPT ); Wed, 23 May 2018 08:43:24 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w4NChJZU018070; Wed, 23 May 2018 07:43:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1527079399; bh=vwVTG/JMfo1XEjHjn+/I5f2g1EPZXQgoI8QsH4ze4pU=; h=From:To:CC:Subject:Date; b=jnaYG28DPIojk90Z9JXCuHRmgj2vZDAAVGh0wtJSp7cChRadHzUIYE/98WcSXueRJ ReEkVO2v/PpcpSE0PU3+wuv61xBpJ6TN3pDWQnajnC97vUlSY0UUSYw8KvaRwLBF5v g0mEKKYT5173UJ5u1x+NAbZmxr11KXlcvpUeKGBc= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4NChJ7I011876; Wed, 23 May 2018 07:43:19 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 23 May 2018 07:43:18 -0500 Received: from DFLE103.ent.ti.com ([fe80::7431:ea48:7659:dc14]) by DFLE103.ent.ti.com ([fe80::7431:ea48:7659:dc14%17]) with mapi id 15.01.1466.003; Wed, 23 May 2018 07:43:18 -0500 From: "Reizer, Eyal" To: Tony Lindgren CC: Kalle Valo , KISHON VIJAY ABRAHAM , "Mishol, Guy" , Luca Coelho , "Hahn, Maital" , "Altshul, Maxim" , "linux-wireless@vger.kernel.org" , "linux-omap@vger.kernel.org" , "Loewy, Chen" Subject: RE: [PATCHv2 0/5] Runtime PM support for wlcore Thread-Topic: [PATCHv2 0/5] Runtime PM support for wlcore Thread-Index: AdPyksqnNbrXov4sS3uSrxhX4NK53w== Date: Wed, 23 May 2018 12:43:18 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [137.167.25.139] x-exclaimer-md-config: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > > > > > Here's a modified version of your patch, does that put wlcore to > > idle with wowlan during suspend for you? > > > > Still no joy. > It suspends/resumes ok but leaves the firmware disabled from entering ELP. Spent some time on it today and looks like adding calls to pm_generic_runtime_suspend () And pm_generic_runtime_resume is helping and all seems to work well. See the modified version of your patch below. Let me know what you think. Best Regards, Eyal 8< ------------------------------ --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 4c297aa..9859e5a 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c @@ -1001,24 +1001,6 @@ 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); @@ -1742,6 +1724,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, { struct wl1271 *wl = hw->priv; struct wl12xx_vif *wlvif; + unsigned long flags; int ret; wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow); @@ -1800,19 +1783,6 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, /* flush any remaining work */ wl1271_debug(DEBUG_MAC80211, "flushing remaining works"); - /* - * disable and re-enable interrupts in order to flush - * the threaded_irq - */ - wlcore_disable_interrupts(wl); - - /* - * set suspended flag to avoid triggering a new threaded_irq - * work. no need for spinlock as interrupts are disabled. - */ - set_bit(WL1271_FLAG_SUSPENDED, &wl->flags); - - wlcore_enable_interrupts(wl); flush_work(&wl->tx_work); /* @@ -1822,13 +1792,14 @@ 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. + * set suspended flag to avoid triggering a new threaded_irq + * work. */ - wlcore_fw_sleep(wl); + spin_lock_irqsave(&wl->wl_lock, flags); + set_bit(WL1271_FLAG_SUSPENDED, &wl->flags); + spin_unlock_irqrestore(&wl->wl_lock, flags); + + pm_generic_runtime_suspend(wl->dev); return 0; } @@ -1845,6 +1816,8 @@ static int wl1271_op_resume(struct ieee80211_hw *hw) wl->wow_enabled); WARN_ON(!wl->wow_enabled); + pm_generic_runtime_resume(wl->dev); + /* * re-enable irq_work enqueuing, and call irq_work directly if * there is a pending work.