From patchwork Fri Oct 27 11:25:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitkumar Karwar X-Patchwork-Id: 10029675 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 535E2602D6 for ; Fri, 27 Oct 2017 11:33:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EEFD28D74 for ; Fri, 27 Oct 2017 11:33:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43D1328F84; Fri, 27 Oct 2017 11:33:17 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 3342528D74 for ; Fri, 27 Oct 2017 11:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932409AbdJ0LdO (ORCPT ); Fri, 27 Oct 2017 07:33:14 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:53586 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932346AbdJ0LdN (ORCPT ); Fri, 27 Oct 2017 07:33:13 -0400 Received: by mail-pg0-f67.google.com with SMTP id s2so5070251pge.10 for ; Fri, 27 Oct 2017 04:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cZ7lL4W8+Lf9qq9AMWLIZMhNZ79QP+5qEc0VP6KC0Hk=; b=ZqTmIf8LZww4yK+MpM1aCaDgEmrjbrWetlWDlwaj0BTYcqLGmXLfRdtFr+ghQjZWAv gEUI/+rflel+33LtyVw3g8KTr5fGKl5YrB+UH2E5D2zeZLAZLMa2+OYEWYpfOqyjKrbN 6KNoUvmBM+vHvm/EH8sGU50155NFnTt81W+mYX8fQa0LRzcZ1YPxLhqlxm1QlnFYBOGb ipxD6WwyQTXgKLin/bYlral2lX2VRtStfpo/DUSiF6L4ZmG28DhQ94tzMY4PQFtKl+oG LzBhBDx5Sz132P4Th7eXUJTYyVnuvUiOAymq8UZts0r88wykxlC7QvLm0CbqO1yhHf1N Ckgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cZ7lL4W8+Lf9qq9AMWLIZMhNZ79QP+5qEc0VP6KC0Hk=; b=S5xiCZIo0mJD/HS2YJnUB5LVYhRRMhntiUTV7OZK/6oukoByg6S5n/tBUgVa9eVoUn ZCN+lWue45hek6PcMXy81lFYRjyKA677Ii6L2sGnXaKYJvSPGHujtg6fjhWpkMVuFKT8 eOrisxHf8zPHlsJr/jUudVgpalnbBm7NH+x7VGMTh0tn8XBs8ZcgkTOuwj2AJoah90QB 71KWtsH0YBBkoH4EXFMk+Wm07CTVETeEbyjN1pyujSAOfvGo1RoQ5O0k1xSMSUr6Dv+u XqEui3q91gEEIRxM236nOf1uorkowlVAidGqtWnrWlHVjbyB8iu/KDAi3P+8ifRU4Go+ jy9g== X-Gm-Message-State: AMCzsaXxqT3Mez7uNj1T9D92ffKDSBQS/FIp0CUeyabSuah2z17EvP0s cTMWrbCuOi69aA8EQ0a72go= X-Google-Smtp-Source: ABhQp+R6zLs27iqXbam7FX2EGk2g1IAVda/gzv8V78nDNCjengxyY7DOTlc0chNeAz74ugvbq9M8Uw== X-Received: by 10.98.245.153 with SMTP id b25mr182352pfm.296.1509103992860; Fri, 27 Oct 2017 04:33:12 -0700 (PDT) Received: from cpu185.redpinesignals.com ([203.196.161.90]) by smtp.gmail.com with ESMTPSA id u77sm14303339pfd.168.2017.10.27.04.33.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Oct 2017 04:33:12 -0700 (PDT) From: Amitkumar Karwar To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Amitkumar Karwar , Prameela Rani Garnepudi , Karun Eagalapati Subject: [v3 3/3] rsi: sdio: Add WOWLAN support for S5 shutdown state Date: Fri, 27 Oct 2017 16:55:57 +0530 Message-Id: <1509103557-6215-4-git-send-email-amitkarwar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509103557-6215-1-git-send-email-amitkarwar@gmail.com> References: <1509103557-6215-1-git-send-email-amitkarwar@gmail.com> 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 From: Karun Eagalapati Unlike other power states, WoWLAN configuration does not come from mac80211 for shutdown. Hence configuring the WoWLAN from shut down callback it self. Remaining steps of disabling SDIO interrupts, setting 'MMC_PM_KEEP_POWER' flag are same as other power states. Signed-off-by: Karun Eagalapati Signed-off-by: Amitkumar Karwar --- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 1 + drivers/net/wireless/rsi/rsi_91x_sdio.c | 31 +++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c index 95eb5e6..36c63e9 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c +++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c @@ -1822,6 +1822,7 @@ int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan) return 0; } +EXPORT_SYMBOL(rsi_config_wowlan); #ifdef CONFIG_PM static int rsi_mac80211_suspend(struct ieee80211_hw *hw, diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c index 3f683d8..3288fb6 100644 --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c @@ -1218,12 +1218,11 @@ static int rsi_freeze(struct device *dev) common = adapter->priv; sdev = (struct rsi_91x_sdiodev *)adapter->rsi_dev; -#ifdef CONFIG_RSI_WOW if ((common->wow_flags & RSI_WOW_ENABLED) && (common->wow_flags & RSI_WOW_NO_CONNECTION)) rsi_dbg(ERR_ZONE, "##### Device can not wake up through WLAN\n"); -#endif + ret = rsi_sdio_disable_interrupts(pfunction); if (sdev->write_fail) @@ -1257,6 +1256,31 @@ static int rsi_thaw(struct device *dev) return 0; } +static void rsi_shutdown(struct device *dev) +{ + struct sdio_func *pfunction = dev_to_sdio_func(dev); + struct rsi_hw *adapter = sdio_get_drvdata(pfunction); + struct rsi_91x_sdiodev *sdev = + (struct rsi_91x_sdiodev *)adapter->rsi_dev; + struct ieee80211_hw *hw = adapter->hw; + struct cfg80211_wowlan *wowlan = hw->wiphy->wowlan_config; + + rsi_dbg(ERR_ZONE, "SDIO Bus shutdown =====>\n"); + + if (rsi_config_wowlan(adapter, wowlan)) + rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n"); + + rsi_sdio_disable_interrupts(sdev->pfunction); + + if (sdev->write_fail) + rsi_dbg(INFO_ZONE, "###### Device is not ready #######\n"); + + if (rsi_set_sdio_pm_caps(adapter)) + rsi_dbg(INFO_ZONE, "Setting power management caps failed\n"); + + rsi_dbg(INFO_ZONE, "***** RSI module shut down *****\n"); +} + int rsi_sdio_reinit_device(struct rsi_hw *adapter) { struct rsi_91x_sdiodev *sdev = adapter->rsi_dev; @@ -1297,9 +1321,7 @@ static int rsi_restore(struct device *dev) adapter->sc_nvifs = 0; ieee80211_restart_hw(adapter->hw); -#ifdef CONFIG_RSI_WOW common->wow_flags = 0; -#endif common->iface_down = false; rsi_dbg(INFO_ZONE, "RSI module restored\n"); @@ -1331,6 +1353,7 @@ static struct sdio_driver rsi_driver = { #ifdef CONFIG_PM .drv = { .pm = &rsi_pm_ops, + .shutdown = rsi_shutdown, } #endif };