mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2024-11-01 03:05:34 +00:00
Enable power management (hopefully).
I mean, it does not crash, but I have no hardware to tell whether the output power actually changes.
This commit is contained in:
parent
13b9c39980
commit
30ba4de6ef
@ -460,16 +460,16 @@ void rtl8192e_init_dm_priv(IN PADAPTER Adapter)
|
|||||||
PDM_ODM_T podmpriv = &pHalData->odmpriv;
|
PDM_ODM_T podmpriv = &pHalData->odmpriv;
|
||||||
//_rtw_spinlock_init(&(pHalData->odm_stainfo_lock));
|
//_rtw_spinlock_init(&(pHalData->odm_stainfo_lock));
|
||||||
Init_ODM_ComInfo_8192e(Adapter);
|
Init_ODM_ComInfo_8192e(Adapter);
|
||||||
ODM_InitAllTimers(podmpriv );
|
ODM_InitAllTimers(podmpriv);
|
||||||
PHYDM_InitDebugSetting(podmpriv);
|
PHYDM_InitDebugSetting(podmpriv);
|
||||||
|
pHalData->CurrentTxPwrIdx = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rtl8192e_deinit_dm_priv(IN PADAPTER Adapter)
|
void rtl8192e_deinit_dm_priv(IN PADAPTER Adapter)
|
||||||
{
|
{
|
||||||
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
|
PHAL_DATA_TYPE pHalData = GET_HAL_DATA(Adapter);
|
||||||
PDM_ODM_T podmpriv = &pHalData->odmpriv;
|
PDM_ODM_T podmpriv = &pHalData->odmpriv;
|
||||||
//_rtw_spinlock_free(&pHalData->odm_stainfo_lock);
|
//_rtw_spinlock_free(&pHalData->odm_stainfo_lock);
|
||||||
ODM_CancelAllTimers(podmpriv);
|
ODM_CancelAllTimers(podmpriv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,17 +503,8 @@ PHY_GetTxPowerLevel8192E(
|
|||||||
OUT s32* powerlevel
|
OUT s32* powerlevel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if 0
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
||||||
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
|
*powerlevel = pHalData->CurrentTxPwrIdx;
|
||||||
PMGNT_INFO pMgntInfo = &(Adapter->MgntInfo);
|
|
||||||
s4Byte TxPwrDbm = 13;
|
|
||||||
RT_TRACE(COMP_TXAGC, DBG_LOUD, ("PHY_GetTxPowerLevel8192E(): TxPowerLevel: %#x\n", TxPwrDbm));
|
|
||||||
|
|
||||||
if ( pMgntInfo->ClientConfigPwrInDbm != UNSPECIFIED_PWR_DBM )
|
|
||||||
*powerlevel = pMgntInfo->ClientConfigPwrInDbm;
|
|
||||||
else
|
|
||||||
*powerlevel = TxPwrDbm;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
@ -683,29 +674,29 @@ PHY_GetTxPowerIndex_8192E(
|
|||||||
//DBG_871X("===> PHY_GetTxPowerIndex_8192E\n");
|
//DBG_871X("===> PHY_GetTxPowerIndex_8192E\n");
|
||||||
|
|
||||||
txPower = (s8) PHY_GetTxPowerIndexBase( pAdapter,RFPath, Rate, BandWidth, Channel, &bIn24G );
|
txPower = (s8) PHY_GetTxPowerIndexBase( pAdapter,RFPath, Rate, BandWidth, Channel, &bIn24G );
|
||||||
|
|
||||||
powerDiffByRate = PHY_GetTxPowerByRate( pAdapter, BAND_ON_2_4G, RFPath, txNum, Rate );
|
powerDiffByRate = PHY_GetTxPowerByRate( pAdapter, BAND_ON_2_4G, RFPath, txNum, Rate );
|
||||||
|
|
||||||
limit = PHY_GetTxPowerLimit( pAdapter, pAdapter->registrypriv.RegPwrTblSel, (u8)(!bIn24G), pHalData->CurrentChannelBW, RFPath, Rate, pHalData->CurrentChannel);
|
limit = PHY_GetTxPowerLimit( pAdapter, pAdapter->registrypriv.RegPwrTblSel, (u8)(!bIn24G), pHalData->CurrentChannelBW, RFPath, Rate, pHalData->CurrentChannel);
|
||||||
|
|
||||||
tpt_offset = PHY_GetTxPowerTrackingOffset( pAdapter, RFPath, Rate );
|
tpt_offset = PHY_GetTxPowerTrackingOffset( pAdapter, RFPath, Rate );
|
||||||
|
|
||||||
#if defined(DBG_TX_POWER_IDX)
|
#if defined(DBG_TX_POWER_IDX)
|
||||||
DBG_871X("%s (RF-%c, Channel: %d, BW:0x%02x ,Rate:0x%02x) \n==> txPower= (0x%02x),powerDiffByRate= (0x%02x),limit= (0x%02x),tpt_offset=(0x%02x)\n",
|
DBG_871X("%s (RF-%c, Channel: %d, BW:0x%02x ,Rate:0x%02x) \n==> txPower= (0x%02x),powerDiffByRate= (0x%02x),limit= (0x%02x),tpt_offset=(0x%02x)\n",
|
||||||
__FUNCTION__,((RFPath==0)?'A':'B'), Channel,BandWidth,Rate,txPower,powerDiffByRate,limit,tpt_offset);
|
__FUNCTION__,((RFPath==0)?'A':'B'), Channel,BandWidth,Rate,txPower,powerDiffByRate,limit,tpt_offset);
|
||||||
#endif
|
#endif
|
||||||
powerDiffByRate = powerDiffByRate > limit ? limit : powerDiffByRate;
|
powerDiffByRate = powerDiffByRate > limit ? limit : powerDiffByRate;
|
||||||
|
|
||||||
txPower += powerDiffByRate;
|
txPower += powerDiffByRate;
|
||||||
|
|
||||||
txPower += tpt_offset;
|
txPower += tpt_offset;
|
||||||
|
txPower += pHalData->CurrentTxPwrIdx - 20;
|
||||||
|
if (txPower > RF6052_MAX_TX_PWR) txPower = RF6052_MAX_TX_PWR;
|
||||||
|
if (txPower > MAX_POWER_INDEX) txPower = MAX_POWER_INDEX;
|
||||||
|
|
||||||
if(txPower > MAX_POWER_INDEX)
|
#if defined(DBG_TX_POWER_IDX)
|
||||||
txPower = MAX_POWER_INDEX;
|
|
||||||
#if defined(DBG_TX_POWER_IDX)
|
|
||||||
DBG_871X("Final Tx Power(RF-%c, Channel: %d) = %d(0x%X)\n\n", ((RFPath==0)?'A':'B'), Channel, txPower, txPower);
|
DBG_871X("Final Tx Power(RF-%c, Channel: %d) = %d(0x%X)\n\n", ((RFPath==0)?'A':'B'), Channel, txPower, txPower);
|
||||||
#endif
|
#endif
|
||||||
return (u8)txPower;
|
return (u8)txPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -402,6 +402,7 @@ typedef struct hal_com_data
|
|||||||
u8 CurrentOfdm24GTxPwrIdx;
|
u8 CurrentOfdm24GTxPwrIdx;
|
||||||
u8 CurrentBW2024GTxPwrIdx;
|
u8 CurrentBW2024GTxPwrIdx;
|
||||||
u8 CurrentBW4024GTxPwrIdx;
|
u8 CurrentBW4024GTxPwrIdx;
|
||||||
|
u8 CurrentTxPwrIdx;
|
||||||
|
|
||||||
// Read/write are allow for following hardware information variables
|
// Read/write are allow for following hardware information variables
|
||||||
u8 pwrGroupCnt;
|
u8 pwrGroupCnt;
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#endif /* Linux kernel >= 4.7.0 */
|
#endif /* Linux kernel >= 4.7.0 */
|
||||||
|
|
||||||
#include <rtw_wifi_regd.h>
|
#include <rtw_wifi_regd.h>
|
||||||
|
#include <hal_data.h>
|
||||||
|
|
||||||
#define RTW_MAX_MGMT_TX_CNT (8)
|
#define RTW_MAX_MGMT_TX_CNT (8)
|
||||||
#define RTW_MAX_MGMT_TX_MS_GAS (500)
|
#define RTW_MAX_MGMT_TX_MS_GAS (500)
|
||||||
@ -3464,39 +3465,28 @@ static int cfg80211_rtw_set_txpower(struct wiphy *wiphy,
|
|||||||
struct wireless_dev *wdev,
|
struct wireless_dev *wdev,
|
||||||
#endif
|
#endif
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
|
||||||
enum nl80211_tx_power_setting type, int mbm)
|
enum nl80211_tx_power_setting type,
|
||||||
#else
|
#else
|
||||||
enum tx_power_setting type, int dbm)
|
enum tx_power_setting type,
|
||||||
#endif
|
#endif
|
||||||
|
int value)
|
||||||
{
|
{
|
||||||
#if 0
|
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||||
struct iwm_priv *iwm = wiphy_to_iwm(wiphy);
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||||
int ret;
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) || defined(COMPAT_KERNEL_RELEASE)
|
||||||
|
value /= 100;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (type) {
|
if (value < 0) value = 0;
|
||||||
case NL80211_TX_POWER_AUTOMATIC:
|
if (value > 20) value = 20;
|
||||||
|
|
||||||
|
if (type == NL80211_TX_POWER_FIXED) {
|
||||||
|
pHalData->CurrentTxPwrIdx = value;
|
||||||
|
rtw_hal_set_tx_power_level(padapter, pHalData->CurrentChannel);
|
||||||
return 0;
|
return 0;
|
||||||
case NL80211_TX_POWER_FIXED:
|
} else {
|
||||||
if (mbm < 0 || (mbm % 100))
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
|
|
||||||
if (!test_bit(IWM_STATUS_READY, &iwm->status))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ret = iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX,
|
|
||||||
CFG_TX_PWR_LIMIT_USR,
|
|
||||||
MBM_TO_DBM(mbm) * 2);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
return iwm_tx_power_trigger(iwm);
|
|
||||||
default:
|
|
||||||
IWM_ERR(iwm, "Unsupported power type: %d\n", type);
|
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
DBG_8192C("%s\n", __func__);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
|
static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
|
||||||
@ -3505,10 +3495,9 @@ static int cfg80211_rtw_get_txpower(struct wiphy *wiphy,
|
|||||||
#endif
|
#endif
|
||||||
int *dbm)
|
int *dbm)
|
||||||
{
|
{
|
||||||
DBG_8192C("%s\n", __func__);
|
_adapter *padapter = wiphy_to_adapter(wiphy);
|
||||||
|
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
|
||||||
*dbm = (12);
|
*dbm = pHalData->CurrentTxPwrIdx;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user