void rf_reg_dump(void *sel, _adapter *adapter) { int i, j = 1, path; u32 value; u8 rf_type = 0; u8 path_nums = 0; rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); if((RF_1T2R == rf_type) ||(RF_1T1R ==rf_type )) path_nums = 1; else path_nums = 2; DBG_871X_SEL_NL(sel, "======= RF REG =======\n"); for (path=0;path<path_nums;path++) { DBG_871X_SEL_NL(sel, "RF_Path(%x)\n",path); for (i=0;i<0x100;i++) { //value = PHY_QueryRFReg(adapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); value = rtw_hal_read_rfreg(adapter, path, i, 0xffffffff); if(j%4==1) DBG_871X_SEL_NL(sel, "0x%02x ",i); DBG_871X_SEL(sel, " 0x%08x ",value); if((j++)%4==0) DBG_871X_SEL(sel, "\n"); } } }
int proc_get_rf_reg_dump3(char *page, char **start, off_t offset, int count, int *eof, void *data) { struct net_device *dev = data; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); int len = 0; int i,j=1,path; u32 value; len += snprintf(page + len, count - len, "\n======= RF REG =======\n"); path = 2; len += snprintf(page + len, count - len, "\nRF_Path(%x)\n",path); for(i=0;i<0xC0;i++) { //value = PHY_QueryRFReg(padapter, (RF90_RADIO_PATH_E)path,i, bMaskDWord); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); if(j%4==1) len += snprintf(page + len, count - len, "0x%02x ",i); len += snprintf(page + len, count - len, " 0x%08x ",value); if((j++)%4==0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; return len; }
void rtw_rf_set_tx_gain_offset(_adapter *adapter, u8 path, s8 offset) { u8 write_value; DBG_871X("kfree gain_offset 0x55:0x%x ", rtw_hal_read_rfreg(adapter, path, 0x55, 0xffffffff)); switch (rtw_get_chip_type(adapter)) { #ifdef CONFIG_RTL8703B case RTL8703B: write_value = RF_TX_GAIN_OFFSET_8703B(offset); rtw_hal_write_rfreg(adapter, path, 0x55, 0x0fc000, write_value); break; #endif /* CONFIG_RTL8703B */ #ifdef CONFIG_RTL8188F case RTL8188F: write_value = RF_TX_GAIN_OFFSET_8188F(offset); rtw_hal_write_rfreg(adapter, path, 0x55, 0x0fc000, write_value); break; #endif /* CONFIG_RTL8188F */ #ifdef CONFIG_RTL8192E case RTL8192E: write_value = RF_TX_GAIN_OFFSET_8192E(offset); rtw_hal_write_rfreg(adapter, path, 0x55, 0x0f8000, write_value); break; #endif /* CONFIG_RTL8188F */ #ifdef CONFIG_RTL8821A case RTL8821: write_value = RF_TX_GAIN_OFFSET_8821A(offset); rtw_hal_write_rfreg(adapter, path, 0x55, 0x0f8000, write_value); break; #endif /* CONFIG_RTL8821A */ #ifdef CONFIG_RTL8814A case RTL8814A: DBG_871X("\nkfree by PhyDM on the sw CH. path %d\n", path); break; #endif /* CONFIG_RTL8821A */ default: rtw_warn_on(1); break; } DBG_871X(" after :0x%x\n", rtw_hal_read_rfreg(adapter, path, 0x55, 0xffffffff)); }
void rtw_bb_rf_gain_offset(struct adapter *padapter) { u8 value = padapter->eeprompriv.EEPROMRFGainOffset; u32 res, i = 0; u32 *Array = Array_kfreemap; u32 v1 = 0, v2 = 0, target = 0; /* DBG_871X("+%s value: 0x%02x+\n", __func__, value); */ if (value & BIT4) { DBG_871X("Offset RF Gain.\n"); DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal = 0x%x\n", padapter->eeprompriv.EEPROMRFGainVal); if (padapter->eeprompriv.EEPROMRFGainVal != 0xff) { res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); res &= 0xfff87fff; DBG_871X("Offset RF Gain. before reg 0x7f = 0x%08x\n", res); /* res &= 0xfff87fff; */ for (i = 0; i < ARRAY_SIZE(Array_kfreemap); i += 2) { v1 = Array[i]; v2 = Array[i+1]; if (v1 == padapter->eeprompriv.EEPROMRFGainVal) { DBG_871X("Offset RF Gain. got v1 = 0x%x , v2 = 0x%x\n", v1, v2); target = v2; break; } } DBG_871X("padapter->eeprompriv.EEPROMRFGainVal = 0x%x , Gain offset Target Value = 0x%x\n", padapter->eeprompriv.EEPROMRFGainVal, target); PHY_SetRFReg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, BIT18|BIT17|BIT16|BIT15, target); /* res |= (padapter->eeprompriv.EEPROMRFGainVal & 0x0f)<< 15; */ /* rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, RF_GAIN_OFFSET_MASK, res); */ res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); DBG_871X("Offset RF Gain. After reg 0x7f = 0x%08x\n", res); } else DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal = 0x%x != 0xff, didn't run Kfree\n", padapter->eeprompriv.EEPROMRFGainVal); } else DBG_871X("Using the default RF gain.\n"); }
int proc_get_rf_reg_dump2(char *page, char **start, off_t offset, int count, int *eof, void *data) { struct net_device *dev = data; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); int len = 0; int i, j = 1, path; u32 value; len += snprintf(page + len, count - len, "\n======= RF REG =======\n"); path = 1; len += snprintf(page + len, count - len, "\nRF_Path(%x)\n", path); for (i = 0xC0; i < 0x100; i++) { value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); if (j%4 == 1) len += snprintf(page + len, count - len, "0x%02x ", i); len += snprintf(page + len, count - len, " 0x%08x ", value); if ((j++)%4 == 0) len += snprintf(page + len, count - len, "\n"); } *eof = 1; return len; }
u32 _read_rfreg(struct adapter *padapter, u8 rfpath, u32 addr, u32 bitmask) { return rtw_hal_read_rfreg(padapter, (enum rf_radio_path)rfpath, addr, bitmask); }
u32 _read_rfreg(PADAPTER padapter, u8 rfpath, u32 addr, u32 bitmask) { return rtw_hal_read_rfreg(padapter, (RF_RADIO_PATH_E)rfpath, addr, bitmask); }