xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rsi/rsi_ps.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /**
2*4882a593Smuzhiyun  * Copyright (c) 2017 Redpine Signals Inc.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Permission to use, copy, modify, and/or distribute this software for any
5*4882a593Smuzhiyun  * purpose with or without fee is hereby granted, provided that the above
6*4882a593Smuzhiyun  * copyright notice and this permission notice appear in all copies.
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*4882a593Smuzhiyun  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*4882a593Smuzhiyun  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*4882a593Smuzhiyun  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*4882a593Smuzhiyun  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*4882a593Smuzhiyun  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*4882a593Smuzhiyun  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*4882a593Smuzhiyun  */
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun #ifndef __RSI_PS_H__
18*4882a593Smuzhiyun #define __RSI_PS_H__
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun #define PS_CONFIRM_INDEX	12
21*4882a593Smuzhiyun #define RSI_DEF_DS_WAKEUP_PERIOD	200
22*4882a593Smuzhiyun #define RSI_DEF_LISTEN_INTERVAL		200
23*4882a593Smuzhiyun #define RSI_SLEEP_TYPE_LP		1
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun enum ps_state {
26*4882a593Smuzhiyun 	PS_NONE = 0,
27*4882a593Smuzhiyun 	PS_ENABLE_REQ_SENT = 1,
28*4882a593Smuzhiyun 	PS_DISABLE_REQ_SENT = 2,
29*4882a593Smuzhiyun 	PS_ENABLED = 3
30*4882a593Smuzhiyun };
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun struct ps_sleep_params {
33*4882a593Smuzhiyun 	u8 enable;
34*4882a593Smuzhiyun 	u8 sleep_type;
35*4882a593Smuzhiyun 	u8 connected_sleep;
36*4882a593Smuzhiyun 	u8 reserved1;
37*4882a593Smuzhiyun 	__le16 num_bcns_per_lis_int;
38*4882a593Smuzhiyun 	__le16 wakeup_type;
39*4882a593Smuzhiyun 	__le32 sleep_duration;
40*4882a593Smuzhiyun } __packed;
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun struct rsi_ps_info {
43*4882a593Smuzhiyun 	u8 enabled;
44*4882a593Smuzhiyun 	u8 sleep_type;
45*4882a593Smuzhiyun 	u8 tx_threshold;
46*4882a593Smuzhiyun 	u8 rx_threshold;
47*4882a593Smuzhiyun 	u8 tx_hysterisis;
48*4882a593Smuzhiyun 	u8 rx_hysterisis;
49*4882a593Smuzhiyun 	u16 monitor_interval;
50*4882a593Smuzhiyun 	u32 listen_interval;
51*4882a593Smuzhiyun 	u16 num_bcns_per_lis_int;
52*4882a593Smuzhiyun 	u32 dtim_interval_duration;
53*4882a593Smuzhiyun 	u16 num_dtims_per_sleep;
54*4882a593Smuzhiyun 	u32 deep_sleep_wakeup_period;
55*4882a593Smuzhiyun } __packed;
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun char *str_psstate(enum ps_state state);
58*4882a593Smuzhiyun void rsi_enable_ps(struct rsi_hw *adapter, struct ieee80211_vif *vif);
59*4882a593Smuzhiyun void rsi_disable_ps(struct rsi_hw *adapter, struct ieee80211_vif *vif);
60*4882a593Smuzhiyun int rsi_handle_ps_confirm(struct rsi_hw *adapter, u8 *msg);
61*4882a593Smuzhiyun void rsi_default_ps_params(struct rsi_hw *hw);
62*4882a593Smuzhiyun void rsi_conf_uapsd(struct rsi_hw *adapter, struct ieee80211_vif *vif);
63*4882a593Smuzhiyun #endif
64