Skip to content

Commit

Permalink
make tx power index a module param (like rtl8812bu)
Browse files Browse the repository at this point in the history
  • Loading branch information
Consti10 committed Apr 22, 2024
1 parent 9857ab5 commit 4fe0205
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 8 additions & 4 deletions os_dep/linux/ioctl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -3691,10 +3691,13 @@ if(type == NL80211_TX_POWER_FIXED) {
// need any kernel patches to set the card to an arbitratry high power value, since they are well below the legal limit of
// every country. Note, however, that the card is now not doing what linux tells it - but honestly, someone decided
// to just map dBm values to some power index at some point anyways.
if(mbm>=0 && mbm<=63){
padapter->registrypriv.RegTxPowerIndexOverride = mbm;
RTW_WARN("OpenHD:interpreting %d mBm as tx power index override",(int)mbm);
}
// 22.April: Simplify -> use tpi override value (and dummy tx power commits)
int openhd_override_tx_power_index=get_openhd_override_tx_power_index();
if(openhd_override_tx_power_index>=0 && openhd_override_tx_power_index<=63){
padapter->registrypriv.RegTxPowerIndexOverride = openhd_override_tx_power_index;
}else{
padapter->registrypriv.RegTxPowerIndexOverride = 0;
}
RTW_INFO("OpenHD:Tx power index override is %d",padapter->registrypriv.RegTxPowerIndexOverride);

pHalData->CurrentTxPwrIdx = value;
Expand Down Expand Up @@ -5170,6 +5173,7 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy
// update if module param has been updated
padapter->registrypriv.openhd_override_channel=get_openhd_override_channel();
padapter->registrypriv.openhd_override_channel_width=get_openhd_override_channel_width();

RTW_WARN("OpenHD: override %d %d",padapter->registrypriv.openhd_override_channel,padapter->registrypriv.openhd_override_channel_width);
{
if(padapter->registrypriv.openhd_override_channel){
Expand Down
6 changes: 6 additions & 0 deletions os_dep/linux/os_intfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ MODULE_PARM_DESC(openhd_override_channel, "OpenHD easy (CRDA workaround)");
int openhd_override_channel_width = 0;
module_param(openhd_override_channel_width, int, 0644);
MODULE_PARM_DESC(openhd_override_channel_width, "OpenHD easy (CRDA workaround)");
int openhd_override_tx_power_index = 0;
module_param(openhd_override_tx_power_index, int, 0644);
MODULE_PARM_DESC(openhd_override_tx_power_index, "OpenHD easy (CRDA workaround)");
//


Expand Down Expand Up @@ -4871,3 +4874,6 @@ int get_openhd_override_channel(void){
int get_openhd_override_channel_width(void){
return openhd_override_channel_width;
}
int get_openhd_override_tx_power_index(void){
return openhd_override_tx_power_index;
}

0 comments on commit 4fe0205

Please sign in to comment.