Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp981062ybl; Fri, 13 Dec 2019 07:39:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzJM8ziCdng0j8jA6B5f6F/e8tuQBT+m7bRgewLz4WAXZl7+t2ZIKJ/JSIHcEhkLqTrWcQg X-Received: by 2002:a05:6830:16d0:: with SMTP id l16mr15596134otr.176.1576251543822; Fri, 13 Dec 2019 07:39:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576251543; cv=none; d=google.com; s=arc-20160816; b=wbIkHXqCe/vlARuqCDPeykl0yYFT9Rt/+QFlWcgeXCRXEwgvqehR95ffjf9WlRsIa/ TWn0uqY5ao2MbozQQDL8l2NzMTpwNuw1/GlMp5+pp5QL7Y2a2unmgoG0g8frKwENE9uX XVhB65Tj8uUO8v1lQtz/OBIgamOCz1peqn3vRorr0HLs+fa5kC3os8l9n+2Sic1YDYWV XfpRhxxRRsd2tHuUG3mv+vR3VKO+kBeSrf3wgjXvWRjOYcAUKBjv4HfHwMmfhBmFB6fj t56JTrF7OhZLIRCl/alobOfglbDVM5sYGaPT/5koTDNd1ou69biGMYILdfaEJ2Mk0kmq OLSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=gecqF3q9gY35pv6oBkj4NOxTqsXz2017bh1e2BK0J6I=; b=WvPoIQ0H+A9geY7UOoPb+FxucpXUaLM8WdSq2iNhA0QNUXfP1XOxtqr/vDYZRf37/I iYun4Gyl35EqgiKZDCBxooHpUMQLHSQbBWx19AP4U1TvYd4HLDuo1bis3PqL73P1BN9X 8HznXosoSCqgUDsBs6vIA1l8BN40qU4G7Ee2R81H0l/s5PkFbRXwwfGke9Ynea2eee19 0L47f2sAec8jDTyQdksdD/sQnGcMsN4UdVryhwsxB4eg7ewFDdKsDsNkdjd9Tc5Kxwud QDCOfNnhBTgDQR+aonjjUXJ3JwkF3EOYnHCNII+nALDtcGwOLvM2z2yc7/xHAIaqOKwc H5bA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f14si1508408oto.46.2019.12.13.07.38.52; Fri, 13 Dec 2019 07:39:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727973AbfLMPio (ORCPT + 99 others); Fri, 13 Dec 2019 10:38:44 -0500 Received: from nbd.name ([46.4.11.11]:54808 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727958AbfLMPin (ORCPT ); Fri, 13 Dec 2019 10:38:43 -0500 Received: from pd95fd344.dip0.t-ipconnect.de ([217.95.211.68] helo=bertha.fritz.box) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1ifn1d-0005pC-HC; Fri, 13 Dec 2019 16:38:41 +0100 From: John Crispin To: Kalle Valo Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, John Crispin Subject: [PATCH V3 1/9] ath11k: add wmi helper for turning STA PS on/off Date: Fri, 13 Dec 2019 16:38:31 +0100 Message-Id: <20191213153839.12372-2-john@phrozen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191213153839.12372-1-john@phrozen.org> References: <20191213153839.12372-1-john@phrozen.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add a WMI call helper to set the powersave mode of a STA interface. Signed-off-by: John Crispin --- drivers/net/wireless/ath/ath11k/wmi.c | 30 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/wmi.h | 7 +++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index b05642617b78..bf3c246ce883 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -1178,6 +1178,36 @@ int ath11k_wmi_pdev_set_param(struct ath11k *ar, u32 param_id, return ret; } +int ath11k_wmi_pdev_set_ps_mode(struct ath11k *ar, int vdev_id, u32 enable) +{ + struct ath11k_pdev_wmi *wmi = ar->wmi; + struct wmi_pdev_set_ps_mode_cmd *cmd; + struct sk_buff *skb; + int ret; + + skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd)); + if (!skb) + return -ENOMEM; + + cmd = (struct wmi_pdev_set_ps_mode_cmd *)skb->data; + cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_STA_POWERSAVE_MODE_CMD) | + FIELD_PREP(WMI_TLV_LEN, sizeof(*cmd) - TLV_HDR_SIZE); + cmd->vdev_id = vdev_id; + cmd->sta_ps_mode = enable; + + ret = ath11k_wmi_cmd_send(wmi, skb, WMI_STA_POWERSAVE_MODE_CMDID); + if (ret) { + ath11k_warn(ar->ab, "failed to send WMI_PDEV_SET_PARAM cmd\n"); + dev_kfree_skb(skb); + } + + ath11k_dbg(ar->ab, ATH11K_DBG_WMI, + "WMI vdev set psmode %d vdev id %d\n", + enable, vdev_id); + + return ret; +} + int ath11k_wmi_pdev_suspend(struct ath11k *ar, u32 suspend_opt, u32 pdev_id) { diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h index 4a518d406bc5..9919d8bf297b 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.h +++ b/drivers/net/wireless/ath/ath11k/wmi.h @@ -2827,6 +2827,12 @@ struct wmi_pdev_set_param_cmd { u32 param_value; } __packed; +struct wmi_pdev_set_ps_mode_cmd { + u32 tlv_header; + u32 vdev_id; + u32 sta_ps_mode; +} __packed; + struct wmi_pdev_suspend_cmd { u32 tlv_header; u32 pdev_id; @@ -4682,6 +4688,7 @@ int ath11k_wmi_set_peer_param(struct ath11k *ar, const u8 *peer_addr, u32 vdev_id, u32 param_id, u32 param_val); int ath11k_wmi_pdev_set_param(struct ath11k *ar, u32 param_id, u32 param_value, u8 pdev_id); +int ath11k_wmi_pdev_set_ps_mode(struct ath11k *ar, int vdev_id, u32 enable); int ath11k_wmi_wait_for_unified_ready(struct ath11k_base *ab); int ath11k_wmi_cmd_init(struct ath11k_base *ab); int ath11k_wmi_wait_for_service_ready(struct ath11k_base *ab); -- 2.20.1