linux/drivers/staging/rtl8723bs/include/rtw_pwrctrl.h

/* SPDX-License-Identifier: GPL-2.0 */
/******************************************************************************
 *
 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
 *
 ******************************************************************************/
#ifndef __RTW_PWRCTRL_H_
#define __RTW_PWRCTRL_H_

#include <linux/mutex.h>

#define XMIT_ALIVE
#define CMD_ALIVE
#define BTCOEX_ALIVE


enum {};

/*
	BIT[2:0] = HW state
	BIT[3] = Protocol PS state,   0: register active state , 1: register sleep state
	BIT[4] = sub-state
*/

#define PS_DPS
#define PS_LCLK
#define PS_RF_OFF
#define PS_ALL_ON
#define PS_ST_ACTIVE

#define PS_ACK
#define PS_TOGGLE

#define PS_STATE_MASK

#define PS_STATE(x)

#define PS_STATE_S0
#define PS_STATE_S2
#define PS_STATE_S4

struct reportpwrstate_parm {};

#define LPS_DELAY_TIME

/*  RF state. */
enum rt_rf_power_state {};

/*  RF Off Level for IPS or HW/SW radio off */
#define RT_RF_OFF_LEVL_ASPM
#define RT_RF_OFF_LEVL_CLK_REQ
#define RT_RF_OFF_LEVL_PCI_D3
#define RT_RF_OFF_LEVL_HALT_NIC
#define RT_RF_OFF_LEVL_FREE_FW
#define RT_RF_OFF_LEVL_FW_32K
#define RT_RF_PS_LEVEL_ALWAYS_ASPM
#define RT_RF_LPS_DISALBE_2R
#define RT_RF_LPS_LEVEL_ASPM

#define RT_IN_PS_LEVEL(ppsc, _PS_FLAG)
#define RT_CLEAR_PS_LEVEL(ppsc, _PS_FLAG)
#define RT_SET_PS_LEVEL(ppsc, _PS_FLAG)

/*  ASPM OSC Control bit, added by Roger, 2013.03.29. */
#define RT_PCI_ASPM_OSC_IGNORE
#define RT_PCI_ASPM_OSC_ENABLE
#define RT_PCI_ASPM_OSC_DISABLE

enum {};

enum {};

/*  Design for pwrctrl_priv.ips_deny, 32 bits for 32 reasons at most */
enum ps_deny_reason {};

struct pwrctrl_priv {};

#define rtw_ips_mode_req(pwrctl, ips_mode)

#define RTW_PWR_STATE_CHK_INTERVAL

#define _rtw_set_pwr_state_check_timer(pwrctl, ms)

extern void rtw_init_pwrctrl_priv(struct adapter *adapter);
extern void rtw_free_pwrctrl_priv(struct adapter *adapter);

s32 rtw_register_task_alive(struct adapter *, u32 task);
void rtw_unregister_task_alive(struct adapter *, u32 task);
extern s32 rtw_register_tx_alive(struct adapter *padapter);
extern void rtw_unregister_tx_alive(struct adapter *padapter);
extern s32 rtw_register_cmd_alive(struct adapter *padapter);
extern void rtw_unregister_cmd_alive(struct adapter *padapter);
extern void cpwm_int_hdl(struct adapter *padapter, struct reportpwrstate_parm *preportpwrstate);
extern void LPS_Leave_check(struct adapter *padapter);

extern void LeaveAllPowerSaveMode(struct adapter *Adapter);
extern void LeaveAllPowerSaveModeDirect(struct adapter *Adapter);
void _ips_enter(struct adapter *padapter);
void ips_enter(struct adapter *padapter);
int _ips_leave(struct adapter *padapter);
int ips_leave(struct adapter *padapter);

void rtw_ps_processor(struct adapter *padapter);

s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms);
void LPS_Enter(struct adapter *padapter, const char *msg);
void LPS_Leave(struct adapter *padapter, const char *msg);
void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets);
void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg);
void rtw_set_rpwm(struct adapter *padapter, u8 val8);

void rtw_set_ips_deny(struct adapter *padapter, u32 ms);
int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *caller);
#define rtw_pwr_wakeup(adapter)
#define rtw_pwr_wakeup_ex(adapter, ips_deffer_ms)
int rtw_pm_set_ips(struct adapter *padapter, u8 mode);
int rtw_pm_set_lps(struct adapter *padapter, u8 mode);

void rtw_ps_deny(struct adapter *padapter, enum ps_deny_reason reason);
void rtw_ps_deny_cancel(struct adapter *padapter, enum ps_deny_reason reason);
u32 rtw_ps_deny_get(struct adapter *padapter);

#endif  /* __RTL871X_PWRCTRL_H_ */