]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - drivers/net/wireless/ath/wcn36xx/pmc.c
UBUNTU: Ubuntu-5.11.0-22.23
[mirror_ubuntu-hirsute-kernel.git] / drivers / net / wireless / ath / wcn36xx / pmc.c
CommitLineData
8e84c258
EK
1/*
2 * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
19#include "wcn36xx.h"
20
21int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn,
22 struct ieee80211_vif *vif)
23{
24 int ret = 0;
ce75877f 25 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
c6522a50
LP
26
27 if (!vif_priv->allow_bmps)
28 return -ENOTSUPP;
29
8e84c258
EK
30 ret = wcn36xx_smd_enter_bmps(wcn, vif);
31 if (!ret) {
32 wcn36xx_dbg(WCN36XX_DBG_PMC, "Entered BMPS\n");
33 vif_priv->pw_state = WCN36XX_BMPS;
fd5ad4d1 34 vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER;
8e84c258
EK
35 } else {
36 /*
37 * One of the reasons why HW will not enter BMPS is because
38 * driver is trying to enter bmps before first beacon was
39 * received just after auth complete
40 */
41 wcn36xx_err("Can not enter BMPS!\n");
42 }
43 return ret;
44}
45
46int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn,
47 struct ieee80211_vif *vif)
48{
ce75877f 49 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
8e84c258
EK
50
51 if (WCN36XX_BMPS != vif_priv->pw_state) {
0856655a
LP
52 /* Unbalanced call or last BMPS enter failed */
53 wcn36xx_dbg(WCN36XX_DBG_PMC,
54 "Not in BMPS mode, no need to exit\n");
55 return -EALREADY;
8e84c258
EK
56 }
57 wcn36xx_smd_exit_bmps(wcn, vif);
58 vif_priv->pw_state = WCN36XX_FULL_POWER;
fd5ad4d1 59 vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER;
8e84c258
EK
60 return 0;
61}
62
63int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn,
64 struct ieee80211_vif *vif)
65{
66 wcn36xx_dbg(WCN36XX_DBG_PMC, "%s\n", __func__);
67 return wcn36xx_smd_keep_alive_req(wcn, vif,
68 WCN36XX_HAL_KEEP_ALIVE_NULL_PKT);
69}