Commit 3e401185 authored by Michael Straube's avatar Michael Straube Committed by Greg Kroah-Hartman

staging: r8188eu: remove HW_VAR_INITIAL_GAIN

Remove the HW_VAR_INITIAL_GAIN case from SetHwReg8188EU() and move its
functionality to a new static function in rtw_mlme_ext.c. This is part
of the ongoing effort to get rid of the unwanted hal layer.
Signed-off-by: default avatarMichael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220409120627.10633-2-straube.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 047c7628
......@@ -5794,13 +5794,27 @@ Following are some utitity fuctions for WiFi MLME
*****************************************************************************/
static void rtw_set_initial_gain(struct adapter *adapter, u8 gain)
{
struct hal_data_8188e *haldata = &adapter->haldata;
struct odm_dm_struct *odmpriv = &haldata->odmpriv;
struct rtw_dig *digtable = &odmpriv->DM_DigTable;
if (gain == 0xff) {
/* restore rx gain */
ODM_Write_DIG(odmpriv, digtable->BackupIGValue);
} else {
digtable->BackupIGValue = digtable->CurIGValue;
ODM_Write_DIG(odmpriv, gain);
}
}
void site_survey(struct adapter *padapter)
{
unsigned char survey_channel = 0, val8;
enum rt_scan_type ScanType = SCAN_PASSIVE;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
u32 initialgain = 0;
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
if ((pwdinfo->rx_invitereq_info.scan_op_ch_only) || (pwdinfo->p2p_info.scan_op_ch_only)) {
......@@ -5878,8 +5892,8 @@ void site_survey(struct adapter *padapter)
rtw_p2p_set_state(pwdinfo, P2P_STATE_FIND_PHASE_LISTEN);
pmlmeext->sitesurvey_res.state = SCAN_DISABLE;
initialgain = 0xff; /* restore RX GAIN */
SetHwReg8188EU(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
/* restore RX GAIN */
rtw_set_initial_gain(padapter, 0xff);
/* turn on dynamic functions */
Restore_DM_Func_Flag(padapter);
/* Switch_DM_Func(padapter, DYNAMIC_FUNC_DIG|DYNAMIC_FUNC_HP|DYNAMIC_FUNC_SS, true); */
......@@ -5912,8 +5926,8 @@ void site_survey(struct adapter *padapter)
/* config MSR */
Set_MSR(padapter, (pmlmeinfo->state & 0x3));
initialgain = 0xff; /* restore RX GAIN */
SetHwReg8188EU(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
/* restore RX GAIN */
rtw_set_initial_gain(padapter, 0xff);
/* turn on dynamic functions */
Restore_DM_Func_Flag(padapter);
/* Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, true); */
......@@ -7369,7 +7383,6 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
struct sitesurvey_parm *pparm = (struct sitesurvey_parm *)pbuf;
u8 bdelayscan = false;
u8 val8;
u32 initialgain;
u32 i;
struct wifidirect_info *pwdinfo = &padapter->wdinfo;
......@@ -7418,11 +7431,10 @@ u8 sitesurvey_cmd_hdl(struct adapter *padapter, u8 *pbuf)
/* config the initial gain under scanning, need to write the BB registers */
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
initialgain = 0x1E;
rtw_set_initial_gain(padapter, 0x1e);
else
initialgain = 0x28;
rtw_set_initial_gain(padapter, 0x28);
SetHwReg8188EU(padapter, HW_VAR_INITIAL_GAIN, (u8 *)(&initialgain));
/* set MSR to no link state */
Set_MSR(padapter, _HW_STATE_NOLINK_);
......
......@@ -1146,19 +1146,6 @@ void SetHwReg8188EU(struct adapter *Adapter, u8 variable, u8 *val)
rtl8188e_set_FwPwrMode_cmd(Adapter, psmode);
}
break;
case HW_VAR_INITIAL_GAIN:
{
struct rtw_dig *pDigTable = &podmpriv->DM_DigTable;
u32 rx_gain = ((u32 *)(val))[0];
if (rx_gain == 0xff) {/* restore rx gain */
ODM_Write_DIG(podmpriv, pDigTable->BackupIGValue);
} else {
pDigTable->BackupIGValue = pDigTable->CurIGValue;
ODM_Write_DIG(podmpriv, rx_gain);
}
}
break;
case HW_VAR_FIFO_CLEARN_UP:
{
struct pwrctrl_priv *pwrpriv = &Adapter->pwrctrlpriv;
......
......@@ -22,7 +22,6 @@ enum hw_variables {
HW_VAR_AC_PARAM_BE,
HW_VAR_AMPDU_FACTOR,
HW_VAR_H2C_FW_PWRMODE,
HW_VAR_INITIAL_GAIN,
HW_VAR_FIFO_CLEARN_UP,
HW_VAR_H2C_MEDIA_STATUS_RPT,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment