From fc326e6a074bffe8cc3b6ab84147151f7bb10b0d Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Mon, 17 Aug 2015 10:23:46 -0500 Subject: [PATCH] rtl8188eu: Remove CONFIG_WAKELOCK, CONFIG_HAS_EARLYSUSPEND, and CONFIG_ANDROID_POWER Signed-off-by: Larry Finger --- core/rtw_pwrctrl.c | 125 ---------------------------------------- include/osdep_service.h | 8 --- include/rtw_pwrctrl.h | 25 +------- os_dep/osdep_service.c | 54 ----------------- os_dep/usb_intf.c | 6 +- 5 files changed, 2 insertions(+), 216 deletions(-) diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index 8a37cd2..a884edc 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -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; diff --git a/include/osdep_service.h b/include/osdep_service.h index 00c7fe3..158f9de 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -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 -#elif defined(CONFIG_ANDROID_POWER) -#include -#endif - void rtw_suspend_lock_init(void); void rtw_suspend_lock_uninit(void); void rtw_lock_suspend(void); diff --git a/include/rtw_pwrctrl.h b/include/rtw_pwrctrl.h index 5cbcd6b..2b21ce5 100644 --- a/include/rtw_pwrctrl.h +++ b/include/rtw_pwrctrl.h @@ -24,12 +24,7 @@ #include #include -#ifdef CONFIG_HAS_EARLYSUSPEND -#include -#endif /* CONFIG_HAS_EARLYSUSPEND */ - - -#define FW_PWR0 0 +#define FW_PWR0 0 #define FW_PWR1 1 #define FW_PWR2 2 #define FW_PWR3 3 @@ -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); diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index e5dcea5..63ae38a 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -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) diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index a9a2d3f..c2331ca 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -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);