mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-11-25 22:13:41 +00:00
rtl8188eu: Remove CONFIG_WAKELOCK, CONFIG_HAS_EARLYSUSPEND, and CONFIG_ANDROID_POWER
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
549cb92f47
commit
fc326e6a07
5 changed files with 2 additions and 216 deletions
|
@ -694,140 +694,15 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
|
|||
pwrctrlpriv->btcoex_rfon = false;
|
||||
|
||||
_init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter);
|
||||
|
||||
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
|
||||
pwrctrlpriv->early_suspend.suspend = NULL;
|
||||
rtw_register_early_suspend(pwrctrlpriv);
|
||||
#endif /* CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER */
|
||||
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void rtw_free_pwrctrl_priv(struct adapter *adapter)
|
||||
{
|
||||
struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(adapter);
|
||||
|
||||
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
|
||||
rtw_unregister_early_suspend(pwrctrlpriv);
|
||||
#endif /* CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER */
|
||||
|
||||
_free_pwrlock(&pwrctrlpriv->lock);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
|
||||
inline bool rtw_is_earlysuspend_registered(struct pwrctrl_priv *pwrpriv)
|
||||
{
|
||||
return (pwrpriv->early_suspend.suspend) ? true : false;
|
||||
}
|
||||
|
||||
inline bool rtw_is_do_late_resume(struct pwrctrl_priv *pwrpriv)
|
||||
{
|
||||
return (pwrpriv->do_late_resume) ? true : false;
|
||||
}
|
||||
|
||||
inline void rtw_set_do_late_resume(struct pwrctrl_priv *pwrpriv, bool enable)
|
||||
{
|
||||
pwrpriv->do_late_resume = enable;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
extern int rtw_resume_process(struct adapter *padapter);
|
||||
static void rtw_early_suspend(struct early_suspend *h)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = container_of(h, struct pwrctrl_priv, early_suspend);
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
|
||||
rtw_set_do_late_resume(pwrpriv, false);
|
||||
}
|
||||
|
||||
static void rtw_late_resume(struct early_suspend *h)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = container_of(h, struct pwrctrl_priv, early_suspend);
|
||||
struct dvobj_priv *dvobj = pwrctl_to_dvobj(pwrpriv);
|
||||
struct adapter *adapter = dvobj->if1;
|
||||
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
if (pwrpriv->do_late_resume) {
|
||||
rtw_set_do_late_resume(pwrpriv, false);
|
||||
rtw_resume_process(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
|
||||
{
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
|
||||
/* jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit */
|
||||
pwrpriv->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20;
|
||||
pwrpriv->early_suspend.suspend = rtw_early_suspend;
|
||||
pwrpriv->early_suspend.resume = rtw_late_resume;
|
||||
register_early_suspend(&pwrpriv->early_suspend);
|
||||
}
|
||||
|
||||
void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv)
|
||||
{
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
|
||||
rtw_set_do_late_resume(pwrpriv, false);
|
||||
|
||||
if (pwrpriv->early_suspend.suspend)
|
||||
unregister_early_suspend(&pwrpriv->early_suspend);
|
||||
|
||||
pwrpriv->early_suspend.suspend = NULL;
|
||||
pwrpriv->early_suspend.resume = NULL;
|
||||
}
|
||||
#endif /* CONFIG_HAS_EARLYSUSPEND */
|
||||
|
||||
#ifdef CONFIG_ANDROID_POWER
|
||||
extern int rtw_resume_process(struct adapter *padapter);
|
||||
static void rtw_early_suspend(android_early_suspend_t *h)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = container_of(h, struct pwrctrl_priv, early_suspend);
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
|
||||
rtw_set_do_late_resume(pwrpriv, false);
|
||||
}
|
||||
|
||||
static void rtw_late_resume(android_early_suspend_t *h)
|
||||
{
|
||||
struct pwrctrl_priv *pwrpriv = container_of(h, struct pwrctrl_priv, early_suspend);
|
||||
struct dvobj_priv *dvobj = pwrctl_to_dvobj(pwrpriv);
|
||||
struct adapter *adapter = dvobj->if1;
|
||||
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
if (pwrpriv->do_late_resume) {
|
||||
rtw_set_do_late_resume(pwrpriv, false);
|
||||
rtw_resume_process(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv)
|
||||
{
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
|
||||
/* jeff: set the early suspend level before blank screen, so we wll do late resume after scree is lit */
|
||||
pwrpriv->early_suspend.level = ANDROID_EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 20;
|
||||
pwrpriv->early_suspend.suspend = rtw_early_suspend;
|
||||
pwrpriv->early_suspend.resume = rtw_late_resume;
|
||||
android_register_early_suspend(&pwrpriv->early_suspend);
|
||||
}
|
||||
|
||||
void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv)
|
||||
{
|
||||
DBG_88E("%s\n", __FUNCTION__);
|
||||
|
||||
rtw_set_do_late_resume(pwrpriv, false);
|
||||
|
||||
if (pwrpriv->early_suspend.suspend)
|
||||
android_unregister_early_suspend(&pwrpriv->early_suspend);
|
||||
|
||||
pwrpriv->early_suspend.suspend = NULL;
|
||||
pwrpriv->early_suspend.resume = NULL;
|
||||
}
|
||||
#endif /* CONFIG_ANDROID_POWER */
|
||||
|
||||
u8 rtw_interface_ps_func(struct adapter *padapter, enum HAL_INTF_PS_FUNC efunc_id, u8* val)
|
||||
{
|
||||
u8 bResult = true;
|
||||
|
|
|
@ -672,14 +672,6 @@ __inline static u32 bitshift(u32 bitmask)
|
|||
/* limitation of path length */
|
||||
#define PATH_LENGTH_MAX PATH_MAX
|
||||
|
||||
|
||||
/* Suspend lock prevent system from going suspend */
|
||||
#ifdef CONFIG_WAKELOCK
|
||||
#include <linux/wakelock.h>
|
||||
#elif defined(CONFIG_ANDROID_POWER)
|
||||
#include <linux/android_power.h>
|
||||
#endif
|
||||
|
||||
void rtw_suspend_lock_init(void);
|
||||
void rtw_suspend_lock_uninit(void);
|
||||
void rtw_lock_suspend(void);
|
||||
|
|
|
@ -24,11 +24,6 @@
|
|||
#include <osdep_service.h>
|
||||
#include <drv_types.h>
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif /* CONFIG_HAS_EARLYSUSPEND */
|
||||
|
||||
|
||||
#define FW_PWR0 0
|
||||
#define FW_PWR1 1
|
||||
#define FW_PWR2 2
|
||||
|
@ -244,16 +239,6 @@ struct pwrctrl_priv
|
|||
u8 bkeepfwalive;
|
||||
u8 brfoffbyhw;
|
||||
unsigned long PS_BBRegBackup[PSBBREG_TOTALCNT];
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
struct early_suspend early_suspend;
|
||||
u8 do_late_resume;
|
||||
#endif /* CONFIG_HAS_EARLYSUSPEND */
|
||||
|
||||
#ifdef CONFIG_ANDROID_POWER
|
||||
android_early_suspend_t early_suspend;
|
||||
u8 do_late_resume;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define rtw_get_ips_mode_req(pwrctl) \
|
||||
|
@ -294,19 +279,11 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms);
|
|||
void LPS_Enter(struct adapter *padapter);
|
||||
void LPS_Leave(struct adapter *padapter);
|
||||
|
||||
#if defined(CONFIG_HAS_EARLYSUSPEND ) || defined(CONFIG_ANDROID_POWER)
|
||||
bool rtw_is_earlysuspend_registered(struct pwrctrl_priv *pwrpriv);
|
||||
bool rtw_is_do_late_resume(struct pwrctrl_priv *pwrpriv);
|
||||
void rtw_set_do_late_resume(struct pwrctrl_priv *pwrpriv, bool enable);
|
||||
void rtw_register_early_suspend(struct pwrctrl_priv *pwrpriv);
|
||||
void rtw_unregister_early_suspend(struct pwrctrl_priv *pwrpriv);
|
||||
#else
|
||||
#define rtw_is_earlysuspend_registered(pwrpriv) false
|
||||
#define rtw_is_do_late_resume(pwrpriv) false
|
||||
#define rtw_set_do_late_resume(pwrpriv, enable) do {} while (0)
|
||||
#define rtw_register_early_suspend(pwrpriv) do {} while (0)
|
||||
#define rtw_unregister_early_suspend(pwrpriv) do {} while (0)
|
||||
#endif /* CONFIG_HAS_EARLYSUSPEND || CONFIG_ANDROID_POWER */
|
||||
|
||||
u8 rtw_interface_ps_func(struct adapter *padapter, enum HAL_INTF_PS_FUNC efunc_id,u8* val);
|
||||
void rtw_set_ips_deny(struct adapter *padapter, u32 ms);
|
||||
|
|
|
@ -746,82 +746,28 @@ void rtw_yield_os(void)
|
|||
#define RTW_SUSPEND_EXT_LOCK_NAME "rtw_wifi_ext"
|
||||
|
||||
|
||||
#ifdef CONFIG_WAKELOCK
|
||||
static struct wake_lock rtw_suspend_lock;
|
||||
static struct wake_lock rtw_suspend_ext_lock;
|
||||
#elif defined(CONFIG_ANDROID_POWER)
|
||||
static android_suspend_lock_t rtw_suspend_lock ={
|
||||
.name = RTW_SUSPEND_LOCK_NAME
|
||||
};
|
||||
static android_suspend_lock_t rtw_suspend_ext_lock ={
|
||||
.name = RTW_SUSPEND_EXT_LOCK_NAME
|
||||
};
|
||||
#endif
|
||||
|
||||
inline void rtw_suspend_lock_init(void)
|
||||
{
|
||||
#ifdef CONFIG_WAKELOCK
|
||||
wake_lock_init(&rtw_suspend_lock, WAKE_LOCK_SUSPEND, RTW_SUSPEND_LOCK_NAME);
|
||||
wake_lock_init(&rtw_suspend_ext_lock, WAKE_LOCK_SUSPEND, RTW_SUSPEND_EXT_LOCK_NAME);
|
||||
#elif defined(CONFIG_ANDROID_POWER)
|
||||
android_init_suspend_lock(&rtw_suspend_lock);
|
||||
android_init_suspend_ext_lock(&rtw_suspend_ext_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void rtw_suspend_lock_uninit(void)
|
||||
{
|
||||
#ifdef CONFIG_WAKELOCK
|
||||
wake_lock_destroy(&rtw_suspend_lock);
|
||||
wake_lock_destroy(&rtw_suspend_ext_lock);
|
||||
#elif defined(CONFIG_ANDROID_POWER)
|
||||
android_uninit_suspend_lock(&rtw_suspend_lock);
|
||||
android_uninit_suspend_lock(&rtw_suspend_ext_lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void rtw_lock_suspend(void)
|
||||
{
|
||||
#ifdef CONFIG_WAKELOCK
|
||||
wake_lock(&rtw_suspend_lock);
|
||||
#elif defined(CONFIG_ANDROID_POWER)
|
||||
android_lock_suspend(&rtw_suspend_lock);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_WAKELOCK) || defined(CONFIG_ANDROID_POWER)
|
||||
/* DBG_88E("####%s: suspend_lock_count:%d####\n", __FUNCTION__, rtw_suspend_lock.stat.count); */
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void rtw_unlock_suspend(void)
|
||||
{
|
||||
#ifdef CONFIG_WAKELOCK
|
||||
wake_unlock(&rtw_suspend_lock);
|
||||
#elif defined(CONFIG_ANDROID_POWER)
|
||||
android_unlock_suspend(&rtw_suspend_lock);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_WAKELOCK) || defined(CONFIG_ANDROID_POWER)
|
||||
/* DBG_88E("####%s: suspend_lock_count:%d####\n", __FUNCTION__, rtw_suspend_lock.stat.count); */
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void rtw_lock_suspend_timeout(u32 timeout_ms)
|
||||
{
|
||||
#ifdef CONFIG_WAKELOCK
|
||||
wake_lock_timeout(&rtw_suspend_lock, rtw_ms_to_systime(timeout_ms));
|
||||
#elif defined(CONFIG_ANDROID_POWER)
|
||||
android_lock_suspend_auto_expire(&rtw_suspend_lock, rtw_ms_to_systime(timeout_ms));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void rtw_lock_ext_suspend_timeout(u32 timeout_ms)
|
||||
{
|
||||
#ifdef CONFIG_WAKELOCK
|
||||
wake_lock_timeout(&rtw_suspend_ext_lock, rtw_ms_to_systime(timeout_ms));
|
||||
#elif defined(CONFIG_ANDROID_POWER)
|
||||
android_lock_suspend_auto_expire(&rtw_suspend_ext_lock, rtw_ms_to_systime(timeout_ms));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void ATOMIC_SET(ATOMIC_T *v, int i)
|
||||
|
|
|
@ -1276,14 +1276,10 @@ static void rtw_dev_remove(struct usb_interface *pusb_intf)
|
|||
dvobj->processing_dev_remove = true;
|
||||
rtw_unregister_netdevs(dvobj);
|
||||
|
||||
if (usb_drv->drv_registered == true)
|
||||
{
|
||||
if (usb_drv->drv_registered == true) {
|
||||
/* DBG_88E("r871xu_dev_remove():padapter->bSurpriseRemoved == true\n"); */
|
||||
padapter->bSurpriseRemoved = true;
|
||||
}
|
||||
#if defined(CONFIG_HAS_EARLYSUSPEND) || defined(CONFIG_ANDROID_POWER)
|
||||
rtw_unregister_early_suspend(dvobj_to_pwrctl(dvobj));
|
||||
#endif
|
||||
|
||||
rtw_pm_set_ips(padapter, IPS_NONE);
|
||||
rtw_pm_set_lps(padapter, PS_MODE_ACTIVE);
|
||||
|
|
Loading…
Reference in a new issue