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: 121206 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp866598qgn; Fri, 8 Dec 2017 08:34:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMaJ60OGJR89gGDY6umA3K4BjgP5fFOLWU/PFQ9J3O/GddvP3TgZxNYe32QiCMJTYcZpjZ28 X-Received: by 10.101.96.74 with SMTP id b10mr29823439pgv.155.1512750854707; Fri, 08 Dec 2017 08:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512750854; cv=none; d=google.com; s=arc-20160816; b=L4GtHipCqaLXCoj3A7+A9yQseinmI9M7mYZYbZAYic4FAP5wK4avRaGcB5W0lD/v+3 l9KDn47NlHkznIUm7EpqvkyBq5WRv83lqXqqrjTQ4gAFBe0H14li/Y7LRRYXksG9qRKP XshuU20VjKA2UzR9jpqus98FBsQd1IuhVjKoL/MygcfrR0+WqBGeodcoxFRqjgL1aoFr TjXK+3RZbniAxAGwJwfNHzXRQC9RKN1tMkuzjTovV0ZcHBb1ImWGiDH8eBd4MJRioj46 4y7nAYH9pOkvH69fjYt7jWOB0owNaywuNBWMv3sSeK0rRfJ9RoJ35Tk+WEbi1ima/5Sj 8XBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=y2VfWrotVuBCk21T+vQsplvBTOAnTgkVqFyhVHXIPlE=; b=Ux2K5u3azGxsD4aSm3NvrSWdrJLJZngdo5Qbc4vEm0S3GvX7HfAqEDPsJs5kjG/dzH 04fq2v39q/lsv1tLmLaXpfZ/nNshzBq4beAf8lgtzPO/mk5foiuMKYDhlDP0ZAVMag7S ZoFLgozPTr7O9XMep4uYOCoL9kDlWYvchAGjss9VaYHkjLlVZvoK9g2/Knx2jTieWgG1 9cx9AMHA8IPZA0qMTA3/4/3n9/jrFHlJZ2ssiuqy6xWppbQ0Dn3meAstMsIZ3SQ2O3ri iMy4lCVDrD56qIbVhLPRW9lJqj7AjUOEqDNcWy/dPcTtgE1aOwREeLWJBK0D/dJpMO2N WAxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QlQR3VC9; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x28si5793255pgc.520.2017.12.08.08.34.14; Fri, 08 Dec 2017 08:34:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QlQR3VC9; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754110AbdLHQeN (ORCPT + 2 others); 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-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 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 --- drivers/net/wireless/ath/wcn36xx/main.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) -- 2.7.4 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);