xref: /OK3568_Linux_fs/external/rkwifibt/drivers/rtl8852bs/phl/phl_cmd_ps.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /******************************************************************************
2  *
3  * Copyright(c) 2021 Realtek Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  *****************************************************************************/
15 #ifndef _PHL_CMD_PS_H_
16 #define _PHL_CMD_PS_H_
17 #ifdef CONFIG_POWER_SAVE
18 enum ps_mdl_opcode {
19 	PS_MDL_OP_NONE = 0,
20 	PS_MDL_OP_CANCEL_PWR_REQ,
21 	PS_MDL_OP_CUR_PWR_LVL,
22 	PS_MDL_OP_BASIC_INFO,
23 	PS_MDL_OP_BTC_PWR_REQ
24 };
25 
26 #define MAX_CMD_PS_RSON_LENGTH 30
27 struct phl_cmd_ps_basic_info {
28 	u8 ps_mode;
29 	u8 cur_pwr_lvl;
30 	bool rej_pwr_req;
31 	bool btc_req_pwr;
32 	enum phl_ps_rt_rson rt_stop_rson;
33 	bool ap_active;
34 	bool gc_active;
35 	struct rtw_phl_stainfo_t *sta;
36 	char enter_rson[MAX_CMD_PS_RSON_LENGTH];
37 	char leave_rson[MAX_CMD_PS_RSON_LENGTH];
38 };
39 
40 enum rtw_phl_status phl_register_ps_module(struct phl_info_t *phl_info);
41 u8 phl_ps_get_cur_pwr_lvl(struct phl_info_t *phl_info);
42 bool phl_ps_is_datapath_allowed(struct phl_info_t *phl_info);
43 void phl_ps_tx_pkt_ntfy(struct phl_info_t *phl_info);
44 void rtw_phl_ps_set_rt_cap(void *phl, u8 band_idx, bool ps_allow, enum phl_ps_rt_rson rt_rson);
45 void phl_ps_dbg_set_ps(struct phl_info_t *phl_info, u8 ps_mode, bool enter);
46 
47 #endif
48 #endif /* _PHL_CMD_PS_H_ */
49