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_PS_H_ 16 #define _PHL_PS_H_ 17 #ifdef CONFIG_POWER_SAVE 18 enum phl_ps_mode { 19 PS_MODE_NONE, 20 PS_MODE_LPS, 21 PS_MODE_IPS 22 }; 23 24 #define PS_MACID_NONE 0xFFFF 25 26 /* use to configure specific pwr mode along with pwr lvl and others */ 27 struct ps_cfg { 28 /* common */ 29 u8 ps_mode; 30 u8 cur_pwr_lvl; 31 u8 pwr_lvl; 32 u16 macid; 33 /* lps */ 34 bool pwr_cfg; /* whether to configure pwr lvl */ 35 bool proto_cfg; /* whether to configure protocol */ 36 u32 *token; 37 u8 listen_bcn_mode; 38 u8 awake_interval; 39 u8 smart_ps_mode; 40 }; 41 42 #define _get_ps_cap(_phl_info) (&_phl_info->phl_com->dev_cap.ps_cap) 43 #define _get_ps_sw_cap(_phl_info) (&_phl_info->phl_com->dev_sw_cap.ps_cap) 44 45 const char *phl_ps_op_mode_to_str(u8 op_mode); 46 const char *phl_ps_ps_mode_to_str(u8 ps_mode); 47 const char *phl_ps_pwr_lvl_to_str(u8 pwr_lvl); 48 u8 phl_ps_judge_pwr_lvl(u8 ps_cap, u8 ps_mode, u8 ps_en); 49 50 enum rtw_phl_status 51 phl_ps_ips_cfg(struct phl_info_t *phl_info, struct ps_cfg *cfg, u8 ips_en); 52 enum rtw_phl_status phl_ps_lps_cfg(struct phl_info_t *phl_info, struct ps_cfg *cfg, u8 lps_en); 53 enum rtw_phl_status phl_ps_cfg_pwr_lvl(struct phl_info_t *phl_info, u8 ps_mode, u8 cur_pwr_lvl, u8 req_pwr_lvl); 54 55 enum rtw_phl_status phl_ps_enter_ps(struct phl_info_t *phl_info, struct ps_cfg *cfg); 56 enum rtw_phl_status phl_ps_leave_ps(struct phl_info_t *phl_info, struct ps_cfg *cfg); 57 #endif 58 #endif /* _PHL_PS_H_ */ 59