From patchwork Mon Dec 11 08:52:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 121338 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2532720qgn; Mon, 11 Dec 2017 00:52:28 -0800 (PST) X-Google-Smtp-Source: ACJfBotf+tqOxnZxW2tCOHHQFLcHz1yh/dCKzZGx0JrlZvZ0nnB55wCPYKJa+7MSnKDVD162jYI6 X-Received: by 10.84.246.200 with SMTP id j8mr1124108plt.418.1512982348225; Mon, 11 Dec 2017 00:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512982348; cv=none; d=google.com; s=arc-20160816; b=aj5N0hy0ODGKCZ/SBQSuwNEInDrKASJLUcHhNI04DGeOP7r6Mtk3B6ywcAWZjvLVMb ZOqFjxGEQDaiIlDyLgH/JBfmmbi8z0eIu+vm2wcZBFySb8Ye5V+D9S/rKCP9F27kAXoD Adpz+GjPmX7Dt8whd00jOwgk4DjBwb1s5SN1/0bfaaF2/Qj+FdCNmLepV/nGpvYjYCDn ukwDn/2DRTaO3zlPqMmU1lKwfOATjRdHoV6FZJ2ADwkGvPboG5NKtYxDOoBw5uX7v7ik ksraa6I7y6Dk0XC172U6mKu8zzIJAvhP0F6MhFoTMwd4fx/Zrq7MIe/BedkdgnIIkUFn 1z5Q== 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=pZGPjvPAAU75vRQyAlb5aJNbhsl5fiJcP+oc+vsNUTE=; b=fzScfnf+EVoNjEAie6aYTW3CqbWv9JKLhMEndtm4b4ALmVcdXG7asm0E0Dmkjm6eLi VHm/MAy2tTEcWGsbSIJtZGk4s7M1hHp/brFvFyeOIrFpCB8C0xfCwJSnZvBbhVbHJSLT SaNYvTn8E06fXZiWeggSaZtxevFKOi7VNdXxnGTWfaj3QThWTzg7JeXGePyP7ujZt3B5 ehBvKGxAa1VjYkDJhBtUzI0RQd9L+ouJadLWYm6rvOqSP2ifnDI2gUep6xRtgkVlP5m+ tDBTPab8z2SsWSP5+vG4jwgz+krzupRUY/9WpAVKY2fGnLO06TtZ0t63BfWJaccwbq95 Kc3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QnJQMOOy; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 91si9734895pla.69.2017.12.11.00.52.27; Mon, 11 Dec 2017 00:52:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QnJQMOOy; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751356AbdLKIw0 (ORCPT + 10 others); Mon, 11 Dec 2017 03:52:26 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38253 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750836AbdLKIw0 (ORCPT ); Mon, 11 Dec 2017 03:52:26 -0500 Received: by mail-wm0-f68.google.com with SMTP id 64so12547441wme.3 for ; Mon, 11 Dec 2017 00:52:25 -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=eLFivrSYYVhHtSHu4xh6cT0saPR30FDsFm3039vDWYU=; b=QnJQMOOy1UXxyyMduL4uxnQudj1vZ5yat7qjdKd7PDaJvtRz8e8vkpPQssBkGQF9c0 ANYZST1Y2GYgecKBv2Ppc7xsR0EFFikP3JjuJz4dLPw6EGScPQdspbWyORDu86bCvZtX zqgujJECLF//257dSNUeGLk4wV/tZ0oTR+9Eg= 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=eLFivrSYYVhHtSHu4xh6cT0saPR30FDsFm3039vDWYU=; b=rBkOD2wRgn2sS8yagPWWRMo74cPoiLI03O4lKaMakAfUgx3BZS53V+fYYFyppmWUHH qsxDJbT9syY84nmHFOGt4SoW+lBovfzCIGJZ6W4xlKipvOfaDP++MjgvvTlQblSpxJbJ AYeqTsoQW9PLZl9ppfbRBm+nOaTrgmzUZf5IbHeYQZBOVrYVkgWc54mxm0TRcTzo4BmM 9OLOoP7hktQ2yPdup7l62/wpKSkxAS2SVHHGNy7WiFP7R+dhdc26Nd+Fki82r9h2/qFE ne1HLb+f1QEm54bg0breRPNmbZDDqEnyT4wx1RuiRE0RwZGiYAP6yCmbrfgQGOWHoxhI IarQ== X-Gm-Message-State: AKGB3mLPBJyWoJDY3lBONLpEuji4JSsBgPqS9Wdqhj3ib+11N5HdC0pc +2dUsM9H8dqSkNaqC7mXnaS53A== X-Received: by 10.28.213.79 with SMTP id m76mr73269wmg.67.1512982344796; Mon, 11 Dec 2017 00:52:24 -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 o10sm15798723wrg.5.2017.12.11.00.52.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Dec 2017 00:52:24 -0800 (PST) From: Loic Poulain To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, wcn36xx@lists.infradead.org, linux-arm-msm@vger.kernel.org, k.eugene.e@gmail.com, bjorn.andersson@linaro.org, Loic Poulain Subject: [PATCH v2] wcn36xx: Fix dynamic power saving Date: Mon, 11 Dec 2017 09:52:22 +0100 Message-Id: <1512982342-10343-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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. Acked-by: Bjorn Andersson Signed-off-by: Loic Poulain --- v2: remove error msg on unbalanced bmps exit return -EALREADY if not in bmps mode drivers/net/wireless/ath/wcn36xx/main.c | 23 ++++++++++++----------- drivers/net/wireless/ath/wcn36xx/pmc.c | 6 ++++-- 2 files changed, 16 insertions(+), 13 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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/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); diff --git a/drivers/net/wireless/ath/wcn36xx/pmc.c b/drivers/net/wireless/ath/wcn36xx/pmc.c index 589fe5f..1976b80 100644 --- a/drivers/net/wireless/ath/wcn36xx/pmc.c +++ b/drivers/net/wireless/ath/wcn36xx/pmc.c @@ -45,8 +45,10 @@ int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn, struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); if (WCN36XX_BMPS != vif_priv->pw_state) { - wcn36xx_err("Not in BMPS mode, no need to exit from BMPS mode!\n"); - return -EINVAL; + /* Unbalanced call or last BMPS enter failed */ + wcn36xx_dbg(WCN36XX_DBG_PMC, + "Not in BMPS mode, no need to exit\n"); + return -EALREADY; } wcn36xx_smd_exit_bmps(wcn, vif); vif_priv->pw_state = WCN36XX_FULL_POWER;