From patchwork Fri Dec 8 16:34:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 10102993 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 D3BC5602A0 for ; Fri, 8 Dec 2017 16:34:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEF4E28E2C for ; Fri, 8 Dec 2017 16:34:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3ADA28E2F; Fri, 8 Dec 2017 16:34:14 +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=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 53F0028E2C for ; Fri, 8 Dec 2017 16:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754110AbdLHQeN (ORCPT ); Fri, 8 Dec 2017 11:34:13 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:42879 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753260AbdLHQeK (ORCPT ); Fri, 8 Dec 2017 11:34:10 -0500 Received: by mail-wr0-f193.google.com with SMTP id s66so11347103wrc.9 for ; Fri, 08 Dec 2017 08:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=y2VfWrotVuBCk21T+vQsplvBTOAnTgkVqFyhVHXIPlE=; b=QlQR3VC9dFIfdajq4XRRSybTlzaRJJaqriCPArag7HJW9/UodH0fYTqRfc9EX6JdDE PgfIK+S7DHEzU/ifZlYbTqx6vwbs7pnc2nf+NNSCCVUn1FxMM8B145pGtC1FXgmBi7Wd twFkEy2CIOAsKeb1gWNnL0bfFjFtTww6QTBbc= 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; bh=y2VfWrotVuBCk21T+vQsplvBTOAnTgkVqFyhVHXIPlE=; b=Of+RiDcLxdcqeqIwl32G6mHA4Fym6ksOutYTlklCKOjooxHMv/8DkGBkRT1WdJ79E1 q/d0jndg4i9+T7dOw06yHhqB6Ucq4VF93A9chmSC9/k+XVWSBKiBF6KUnOIwxYiDhWx3 j3HMsotffquPDn8kobPIz3iRVGaqPxNaZvR5eUejRyPNheMf+B0ZLxktjd19G94rIvAc f0ISaZauXeppRGi8JcnNuONy+fewMdf5jhX2rWftlRkYSDw9vagEl7VMmCVNGPZK/Fc0 KuYq76LWS6ZZxye7obqyusnKzraEdWkf9Jtv1Qnjg16GCNRIXc4smckEdebiGWD6/CuK UBqA== X-Gm-Message-State: AJaThX63FLzUbSa+uzgvurP1Knz1p2KuNynpYOEsNZI7pbdix8MAHXlo Am/9tFg4+AXBASJDY4oamKyLjg== X-Google-Smtp-Source: AGs4zMZQBQ0k5GrPj9eZpX2PEFUxxwOFBx67Xyd4OPa28OBJOxhLNg73JekTsbGr3KJequNdvxhZNQ== X-Received: by 10.223.162.152 with SMTP id s24mr26344638wra.151.1512750848770; Fri, 08 Dec 2017 08:34:08 -0800 (PST) Received: from localhost.localdomain (LFbn-1-2062-11.w90-76.abo.wanadoo.fr. [90.76.129.11]) by smtp.gmail.com with ESMTPSA id x63sm2049354wma.39.2017.12.08.08.34.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Dec 2017 08:34:08 -0800 (PST) From: Loic Poulain To: kvalo@codeaurora.org Cc: wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, nicolas.dechesne@linaro.org, k.eugene.e@gmail.com, Loic Poulain Subject: [PATCH] wcn36xx: Fix dynamic power saving Date: Fri, 8 Dec 2017 17:34:06 +0100 Message-Id: <1512750846-13591-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 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 Since driver does not report hardware dynamic power saving cap, this is up to the mac80211 to manage power saving timeout and state machine, using the ieee80211 config callback to report PS changes. This patch enables/disables PS mode according to the new configuration. Remove old behaviour enabling PS mode in a static way, this make the device unusable when power save is enabled since device is forced to PS regardless RX/TX traffic. Signed-off-by: Loic Poulain Acked-by: Bjorn Andersson --- drivers/net/wireless/ath/wcn36xx/main.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index f0b4d43..436b8ea 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -384,6 +384,18 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed) } } + if (changed & IEEE80211_CONF_CHANGE_PS) { + list_for_each_entry(tmp, &wcn->vif_list, list) { + vif = wcn36xx_priv_to_vif(tmp); + if (hw->conf.flags & IEEE80211_CONF_PS) { + if (vif->bss_conf.ps) /* ps allowed ? */ + wcn36xx_pmc_enter_bmps_state(wcn, vif); + } else { + wcn36xx_pmc_exit_bmps_state(wcn, vif); + } + } + } + mutex_unlock(&wcn->conf_mutex); return 0; @@ -747,17 +759,6 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw, vif_priv->dtim_period = bss_conf->dtim_period; } - if (changed & BSS_CHANGED_PS) { - wcn36xx_dbg(WCN36XX_DBG_MAC, - "mac bss PS set %d\n", - bss_conf->ps); - if (bss_conf->ps) { - wcn36xx_pmc_enter_bmps_state(wcn, vif); - } else { - wcn36xx_pmc_exit_bmps_state(wcn, vif); - } - } - if (changed & BSS_CHANGED_BSSID) { wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss changed_bssid %pM\n", bss_conf->bssid);