xref: /openbmc/linux/drivers/net/wireless/rsi/rsi_ps.h (revision 30519460)
1 /*
2  * Copyright (c) 2017 Redpine Signals Inc.
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
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef __RSI_PS_H__
18 #define __RSI_PS_H__
19 
20 #define PS_CONFIRM_INDEX	12
21 #define RSI_DEF_DS_WAKEUP_PERIOD	200
22 #define RSI_DEF_LISTEN_INTERVAL		200
23 #define RSI_SLEEP_TYPE_LP		1
24 
25 enum ps_state {
26 	PS_NONE = 0,
27 	PS_ENABLE_REQ_SENT = 1,
28 	PS_DISABLE_REQ_SENT = 2,
29 	PS_ENABLED = 3
30 };
31 
32 struct ps_sleep_params {
33 	u8 enable;
34 	u8 sleep_type;
35 	u8 connected_sleep;
36 	u8 reserved1;
37 	__le16 num_bcns_per_lis_int;
38 	__le16 wakeup_type;
39 	__le32 sleep_duration;
40 } __packed;
41 
42 struct rsi_ps_info {
43 	u8 enabled;
44 	u8 sleep_type;
45 	u8 tx_threshold;
46 	u8 rx_threshold;
47 	u8 tx_hysterisis;
48 	u8 rx_hysterisis;
49 	u16 monitor_interval;
50 	u32 listen_interval;
51 	u16 num_bcns_per_lis_int;
52 	u32 dtim_interval_duration;
53 	u16 num_dtims_per_sleep;
54 	u32 deep_sleep_wakeup_period;
55 } __packed;
56 
57 char *str_psstate(enum ps_state state);
58 void rsi_enable_ps(struct rsi_hw *adapter, struct ieee80211_vif *vif);
59 void rsi_disable_ps(struct rsi_hw *adapter, struct ieee80211_vif *vif);
60 int rsi_handle_ps_confirm(struct rsi_hw *adapter, u8 *msg);
61 void rsi_default_ps_params(struct rsi_hw *hw);
62 void rsi_conf_uapsd(struct rsi_hw *adapter, struct ieee80211_vif *vif);
63 #endif
64