162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2017 Redpine Signals Inc.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
562306a36Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
662306a36Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
962306a36Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1062306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1162306a36Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1262306a36Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1362306a36Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1462306a36Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1562306a36Sopenharmony_ci */
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#ifndef __RSI_PS_H__
1862306a36Sopenharmony_ci#define __RSI_PS_H__
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define PS_CONFIRM_INDEX	12
2162306a36Sopenharmony_ci#define RSI_DEF_DS_WAKEUP_PERIOD	200
2262306a36Sopenharmony_ci#define RSI_DEF_LISTEN_INTERVAL		200
2362306a36Sopenharmony_ci#define RSI_SLEEP_TYPE_LP		1
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_cienum ps_state {
2662306a36Sopenharmony_ci	PS_NONE = 0,
2762306a36Sopenharmony_ci	PS_ENABLE_REQ_SENT = 1,
2862306a36Sopenharmony_ci	PS_DISABLE_REQ_SENT = 2,
2962306a36Sopenharmony_ci	PS_ENABLED = 3
3062306a36Sopenharmony_ci};
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_cistruct ps_sleep_params {
3362306a36Sopenharmony_ci	u8 enable;
3462306a36Sopenharmony_ci	u8 sleep_type;
3562306a36Sopenharmony_ci	u8 connected_sleep;
3662306a36Sopenharmony_ci	u8 reserved1;
3762306a36Sopenharmony_ci	__le16 num_bcns_per_lis_int;
3862306a36Sopenharmony_ci	__le16 wakeup_type;
3962306a36Sopenharmony_ci	__le32 sleep_duration;
4062306a36Sopenharmony_ci} __packed;
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cistruct rsi_ps_info {
4362306a36Sopenharmony_ci	u8 enabled;
4462306a36Sopenharmony_ci	u8 sleep_type;
4562306a36Sopenharmony_ci	u8 tx_threshold;
4662306a36Sopenharmony_ci	u8 rx_threshold;
4762306a36Sopenharmony_ci	u8 tx_hysterisis;
4862306a36Sopenharmony_ci	u8 rx_hysterisis;
4962306a36Sopenharmony_ci	u16 monitor_interval;
5062306a36Sopenharmony_ci	u32 listen_interval;
5162306a36Sopenharmony_ci	u16 num_bcns_per_lis_int;
5262306a36Sopenharmony_ci	u32 dtim_interval_duration;
5362306a36Sopenharmony_ci	u16 num_dtims_per_sleep;
5462306a36Sopenharmony_ci	u32 deep_sleep_wakeup_period;
5562306a36Sopenharmony_ci} __packed;
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cichar *str_psstate(enum ps_state state);
5862306a36Sopenharmony_civoid rsi_enable_ps(struct rsi_hw *adapter, struct ieee80211_vif *vif);
5962306a36Sopenharmony_civoid rsi_disable_ps(struct rsi_hw *adapter, struct ieee80211_vif *vif);
6062306a36Sopenharmony_ciint rsi_handle_ps_confirm(struct rsi_hw *adapter, u8 *msg);
6162306a36Sopenharmony_civoid rsi_default_ps_params(struct rsi_hw *hw);
6262306a36Sopenharmony_civoid rsi_conf_uapsd(struct rsi_hw *adapter, struct ieee80211_vif *vif);
6362306a36Sopenharmony_ci#endif
64