/* ======================================================================== Routine Description: Periodic evaluate antenna link status Arguments: pAd - Adapter pointer Return Value: None ======================================================================== */ VOID APAsicEvaluateRxAnt( IN PRTMP_ADAPTER pAd) { ULONG TxTotalCnt; #ifdef RALINK_ATE if (ATE_ON(pAd)) return; #endif /* RALINK_ATE */ #ifdef CARRIER_DETECTION_SUPPORT if(pAd->CommonCfg.CarrierDetect.CD_State == CD_SILENCE) return; #endif /* CARRIER_DETECTION_SUPPORT */ #ifdef RT8592 // TODO: shiang-6590, for 8592, this EvaaluateRxAnt still need?? if (IS_RT8592(pAd)) return; #endif /* RT8592 */ #ifdef RT65xx if (IS_MT76x0(pAd)) return; #endif /* RT65xx */ #ifdef TXBF_SUPPORT /* TODO: we didn't do RxAnt evaluate for 3x3 chips */ if (IS_RT3883(pAd) || IS_RT2883(pAd)) return; #endif /* TXBF_SUPPORT */ #ifdef DOT11_N_SUPPORT #ifdef GREENAP_SUPPORT if (pAd->ApCfg.bGreenAPActive == TRUE) rtmp_bbp_set_rxpath(pAd, 1); else #endif /* GREENAP_SUPPORT */ #endif /* DOT11_N_SUPPORT */ rtmp_bbp_set_rxpath(pAd, pAd->Antenna.field.RxPath); TxTotalCnt = pAd->RalinkCounters.OneSecTxNoRetryOkCount + pAd->RalinkCounters.OneSecTxRetryOkCount + pAd->RalinkCounters.OneSecTxFailCount; if (TxTotalCnt > 50) { RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 20); pAd->Mlme.bLowThroughput = FALSE; } else { RTMPSetTimer(&pAd->Mlme.RxAntEvalTimer, 300); pAd->Mlme.bLowThroughput = TRUE; } }
/* ======================================================================== Routine Description: After evaluation, check antenna link status Arguments: pAd - Adapter pointer Return Value: None ======================================================================== */ VOID APAsicRxAntEvalTimeout( PRTMP_ADAPTER pAd) { CHAR larger = -127, rssi0, rssi1, rssi2; #ifdef RALINK_ATE if (ATE_ON(pAd)) return; #endif /* RALINK_ATE */ /* if the traffic is low, use average rssi as the criteria */ if (pAd->Mlme.bLowThroughput == TRUE) { rssi0 = pAd->ApCfg.RssiSample.LastRssi0; rssi1 = pAd->ApCfg.RssiSample.LastRssi1; rssi2 = pAd->ApCfg.RssiSample.LastRssi2; } else { rssi0 = pAd->ApCfg.RssiSample.AvgRssi0; rssi1 = pAd->ApCfg.RssiSample.AvgRssi1; rssi2 = pAd->ApCfg.RssiSample.AvgRssi2; } if(pAd->Antenna.field.RxPath == 3) { larger = max(rssi0, rssi1); #ifdef DOT11N_SS3_SUPPORT if (pAd->CommonCfg.RxStream >= 3) pAd->Mlme.RealRxPath = 3; else #endif /* DOT11N_SS3_SUPPORT */ { if (larger > (rssi2 + 20)) pAd->Mlme.RealRxPath = 2; else pAd->Mlme.RealRxPath = 3; } } /* Disable the below to fix 1T/2R issue. It's suggested by Rory at 2007/7/11. */ #ifdef DOT11_N_SUPPORT #ifdef GREENAP_SUPPORT if (pAd->ApCfg.bGreenAPActive == TRUE) rtmp_bbp_set_rxpath(pAd, 1); else #endif /* GREENAP_SUPPORT */ #endif /* DOT11_N_SUPPORT */ rtmp_bbp_set_rxpath(pAd, pAd->Mlme.RealRxPath); }
static VOID DisableAPMIMOPSv1( IN PRTMP_ADAPTER pAd) { UCHAR BBPR3=0,BBPR1=0; ULONG TxPinCfg = 0x00050F0A; /* Gary 2007/08/09 0x050A0A */ UCHAR CentralChannel; UINT32 Value=0; if(pAd->CommonCfg.Channel>14) TxPinCfg=0x00050F05; /* Turn off unused PA or LNA when only 1T or 1R*/ if (pAd->Antenna.field.TxPath == 1) TxPinCfg &= 0xFFFFFFF3; if (pAd->Antenna.field.RxPath == 1) TxPinCfg &= 0xFFFFF3FF; pAd->ApCfg.bGreenAPActive=FALSE; if ((pAd->CommonCfg.HtCapability.HtCapInfo.ChannelWidth == BW_40) && (pAd->CommonCfg.Channel != 14)) { int ext_ch = EXTCHA_NONE; DBGPRINT(RT_DEBUG_INFO, ("Run with BW_40\n")); /* Set CentralChannel to work for BW40 */ if (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_ABOVE) { pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel + 2; ext_ch = EXTCHA_ABOVE; } else if ((pAd->CommonCfg.Channel > 2) && (pAd->CommonCfg.RegTransmitSetting.field.EXTCHA == EXTCHA_BELOW)) { pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel - 2; ext_ch = EXTCHA_BELOW; } CentralChannel = pAd->CommonCfg.CentralChannel; AsicSetChannel(pAd, CentralChannel, BW_40, ext_ch, FALSE); } /*Tx Stream*/ if (WMODE_CAP_N(pAd->CommonCfg.PhyMode) && (pAd->Antenna.field.TxPath == 2)) rtmp_bbp_set_txdac(pAd, 2); else rtmp_bbp_set_txdac(pAd, 0); /*Rx Stream*/ rtmp_bbp_set_rxpath(pAd, pAd->Antenna.field.RxPath); RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); DBGPRINT(RT_DEBUG_INFO, ("DisableAPMIMOPS, 305x/28xx reserve only one antenna\n")); }
static VOID EnableAPMIMOPSv1( IN RTMP_ADAPTER *pAd, IN BOOLEAN ReduceCorePower) { UCHAR BBPR3 = 0,BBPR1 = 0; ULONG TxPinCfg = 0x00050F0A;/*Gary 2007/08/09 0x050A0A*/ UCHAR BBPR4=0; UCHAR CentralChannel; if(pAd->CommonCfg.Channel>14) TxPinCfg=0x00050F05; TxPinCfg &= 0xFFFFFFF3; TxPinCfg &= 0xFFFFF3FF; pAd->ApCfg.bGreenAPActive=TRUE; CentralChannel = pAd->CommonCfg.CentralChannel; DBGPRINT(RT_DEBUG_INFO, ("Run with BW_20\n")); pAd->CommonCfg.CentralChannel = pAd->CommonCfg.Channel; CentralChannel = pAd->CommonCfg.Channel; /* Set BBP registers to BW20 */ rtmp_bbp_set_bw(pAd, BW_20); /* RF Bandwidth related registers would be set in AsicSwitchChannel() */ if (pAd->Antenna.field.RxPath>1||pAd->Antenna.field.TxPath>1) { /*Tx/Rx Stream*/ rtmp_bbp_set_txdac(pAd, 0); rtmp_bbp_set_rxpath(pAd, 1); RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg); } AsicSwitchChannel(pAd, CentralChannel, FALSE); DBGPRINT(RT_DEBUG_INFO, ("EnableAPMIMOPS, 305x/28xx changes the # of antenna to 1\n")); }