18c2ecf20Sopenharmony_ci/**
28c2ecf20Sopenharmony_ci * Copyright (c) 2017 Redpine Signals Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef __RSI_PS_H__
188c2ecf20Sopenharmony_ci#define __RSI_PS_H__
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define PS_CONFIRM_INDEX	12
218c2ecf20Sopenharmony_ci#define RSI_DEF_DS_WAKEUP_PERIOD	200
228c2ecf20Sopenharmony_ci#define RSI_DEF_LISTEN_INTERVAL		200
238c2ecf20Sopenharmony_ci#define RSI_SLEEP_TYPE_LP		1
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cienum ps_state {
268c2ecf20Sopenharmony_ci	PS_NONE = 0,
278c2ecf20Sopenharmony_ci	PS_ENABLE_REQ_SENT = 1,
288c2ecf20Sopenharmony_ci	PS_DISABLE_REQ_SENT = 2,
298c2ecf20Sopenharmony_ci	PS_ENABLED = 3
308c2ecf20Sopenharmony_ci};
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistruct ps_sleep_params {
338c2ecf20Sopenharmony_ci	u8 enable;
348c2ecf20Sopenharmony_ci	u8 sleep_type;
358c2ecf20Sopenharmony_ci	u8 connected_sleep;
368c2ecf20Sopenharmony_ci	u8 reserved1;
378c2ecf20Sopenharmony_ci	__le16 num_bcns_per_lis_int;
388c2ecf20Sopenharmony_ci	__le16 wakeup_type;
398c2ecf20Sopenharmony_ci	__le32 sleep_duration;
408c2ecf20Sopenharmony_ci} __packed;
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistruct rsi_ps_info {
438c2ecf20Sopenharmony_ci	u8 enabled;
448c2ecf20Sopenharmony_ci	u8 sleep_type;
458c2ecf20Sopenharmony_ci	u8 tx_threshold;
468c2ecf20Sopenharmony_ci	u8 rx_threshold;
478c2ecf20Sopenharmony_ci	u8 tx_hysterisis;
488c2ecf20Sopenharmony_ci	u8 rx_hysterisis;
498c2ecf20Sopenharmony_ci	u16 monitor_interval;
508c2ecf20Sopenharmony_ci	u32 listen_interval;
518c2ecf20Sopenharmony_ci	u16 num_bcns_per_lis_int;
528c2ecf20Sopenharmony_ci	u32 dtim_interval_duration;
538c2ecf20Sopenharmony_ci	u16 num_dtims_per_sleep;
548c2ecf20Sopenharmony_ci	u32 deep_sleep_wakeup_period;
558c2ecf20Sopenharmony_ci} __packed;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cichar *str_psstate(enum ps_state state);
588c2ecf20Sopenharmony_civoid rsi_enable_ps(struct rsi_hw *adapter, struct ieee80211_vif *vif);
598c2ecf20Sopenharmony_civoid rsi_disable_ps(struct rsi_hw *adapter, struct ieee80211_vif *vif);
608c2ecf20Sopenharmony_ciint rsi_handle_ps_confirm(struct rsi_hw *adapter, u8 *msg);
618c2ecf20Sopenharmony_civoid rsi_default_ps_params(struct rsi_hw *hw);
628c2ecf20Sopenharmony_civoid rsi_conf_uapsd(struct rsi_hw *adapter, struct ieee80211_vif *vif);
638c2ecf20Sopenharmony_ci#endif
64