// SPDX-License-Identifier: GPL-2.0 /****************************************************************************** * * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. * ******************************************************************************/ #include <drv_types.h> #include <rtw_debug.h> #include <hal_data.h> #include <linux/jiffies.h> void _ips_enter(struct adapter *padapter) { … } void ips_enter(struct adapter *padapter) { … } int _ips_leave(struct adapter *padapter) { … } int ips_leave(struct adapter *padapter) { … } static bool rtw_pwr_unassociated_idle(struct adapter *adapter) { … } /* * ATTENTION: *rtw_ps_processor() doesn't handle LPS. */ void rtw_ps_processor(struct adapter *padapter) { … } static void pwr_state_check_handler(struct timer_list *t) { … } void traffic_check_for_leave_lps(struct adapter *padapter, u8 tx, u32 tx_packets) { … } /* * Description: *This function MUST be called under power lock protect * * Parameters *padapter *pslv power state level, only could be PS_STATE_S0 ~ PS_STATE_S4 * */ void rtw_set_rpwm(struct adapter *padapter, u8 pslv) { … } static u8 PS_RDY_CHECK(struct adapter *padapter) { … } void rtw_set_ps_mode(struct adapter *padapter, u8 ps_mode, u8 smart_ps, u8 bcn_ant_mode, const char *msg) { … } /* * Return: *0: Leave OK *-1: Timeout *-2: Other error */ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms) { … } /* */ /* Description: */ /* Enter the leisure power save mode. */ /* */ void LPS_Enter(struct adapter *padapter, const char *msg) { … } /* */ /* Description: */ /* Leave the leisure power save mode. */ /* */ void LPS_Leave(struct adapter *padapter, const char *msg) { … } void LeaveAllPowerSaveModeDirect(struct adapter *Adapter) { … } /* */ /* Description: Leave all power save mode: LPS, FwLPS, IPS if needed. */ /* Move code to function by tynli. 2010.03.26. */ /* */ void LeaveAllPowerSaveMode(struct adapter *Adapter) { … } void LPS_Leave_check(struct adapter *padapter) { … } /* * Caller:ISR handler... * * This will be called when CPWM interrupt is up. * * using to update cpwn of drv; and drv willl make a decision to up or down pwr level */ void cpwm_int_hdl(struct adapter *padapter, struct reportpwrstate_parm *preportpwrstate) { … } static void cpwm_event_callback(struct work_struct *work) { … } static void rpwmtimeout_workitem_callback(struct work_struct *work) { … } /* * This function is a timer handler, can't do any IO in it. */ static void pwr_rpwm_timeout_handler(struct timer_list *t) { … } static inline void register_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag) { … } static inline void unregister_task_alive(struct pwrctrl_priv *pwrctrl, u32 tag) { … } /* * Description: *Check if the fw_pwrstate is okay for I/O. *If not (cpwm is less than S2), then the sub-routine *will raise the cpwm to be greater than or equal to S2. * *Calling Context: Passive * *Constraint: * 1. this function will request pwrctrl->lock * * Return Value: *_SUCCESS hardware is ready for I/O *_FAIL can't I/O right now */ s32 rtw_register_task_alive(struct adapter *padapter, u32 task) { … } /* * Description: *If task is done, call this func. to power down firmware again. * *Constraint: * 1. this function will request pwrctrl->lock * * Return Value: *none */ void rtw_unregister_task_alive(struct adapter *padapter, u32 task) { … } /* * Caller: rtw_xmit_thread * * Check if the fw_pwrstate is okay for xmit. * If not (cpwm is less than S3), then the sub-routine * will raise the cpwm to be greater than or equal to S3. * * Calling Context: Passive * * Return Value: * _SUCCESS rtw_xmit_thread can write fifo/txcmd afterwards. * _FAIL rtw_xmit_thread can not do anything. */ s32 rtw_register_tx_alive(struct adapter *padapter) { … } /* * Caller: rtw_cmd_thread * * Check if the fw_pwrstate is okay for issuing cmd. * If not (cpwm should be is less than S2), then the sub-routine * will raise the cpwm to be greater than or equal to S2. * * Calling Context: Passive * * Return Value: *_SUCCESS rtw_cmd_thread can issue cmds to firmware afterwards. *_FAIL rtw_cmd_thread can not do anything. */ s32 rtw_register_cmd_alive(struct adapter *padapter) { … } /* * Caller: ISR * * If ISR's txdone, * No more pkts for TX, * Then driver shall call this fun. to power down firmware again. */ void rtw_unregister_tx_alive(struct adapter *padapter) { … } /* * Caller: ISR * * If all commands have been done, * and no more command to do, * then driver shall call this fun. to power down firmware again. */ void rtw_unregister_cmd_alive(struct adapter *padapter) { … } void rtw_init_pwrctrl_priv(struct adapter *padapter) { … } void rtw_free_pwrctrl_priv(struct adapter *adapter) { … } inline void rtw_set_ips_deny(struct adapter *padapter, u32 ms) { … } /* * rtw_pwr_wakeup - Wake the NIC up from: 1)IPS. 2)USB autosuspend * @adapter: pointer to struct adapter structure * @ips_deffer_ms: the ms will prevent from falling into IPS after wakeup * Return _SUCCESS or _FAIL */ int _rtw_pwr_wakeup(struct adapter *padapter, u32 ips_deffer_ms, const char *caller) { … } int rtw_pm_set_lps(struct adapter *padapter, u8 mode) { … } int rtw_pm_set_ips(struct adapter *padapter, u8 mode) { … } /* * ATTENTION: *This function will request pwrctrl LOCK! */ void rtw_ps_deny(struct adapter *padapter, enum ps_deny_reason reason) { … } /* * ATTENTION: *This function will request pwrctrl LOCK! */ void rtw_ps_deny_cancel(struct adapter *padapter, enum ps_deny_reason reason) { … } /* * ATTENTION: *Before calling this function pwrctrl lock should be occupied already, *otherwise it may return incorrect value. */ u32 rtw_ps_deny_get(struct adapter *padapter) { … }