void Init_ODM_ComInfo(_adapter *adapter) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); PHAL_DATA_TYPE pHalData = GET_HAL_DATA(adapter); struct PHY_DM_STRUCT *pDM_Odm = &(pHalData->odmpriv); struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(adapter); int i; _rtw_memset(pDM_Odm, 0, sizeof(*pDM_Odm)); pDM_Odm->adapter = adapter; odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_PLATFORM, ODM_CE); rtw_odm_init_ic_type(adapter); if (rtw_get_intf_type(adapter) == RTW_GSPI) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_INTERFACE, ODM_ITRF_SDIO); else odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_INTERFACE, rtw_get_intf_type(adapter)); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_MP_TEST_CHIP, IS_NORMAL_CHIP(pHalData->version_id)); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_PATCH_ID, pHalData->CustomerID); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_BWIFI_TEST, adapter->registrypriv.wifi_spec); if (pHalData->rf_type == RF_1T1R) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T1R); else if (pHalData->rf_type == RF_1T2R) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T2R); else if (pHalData->rf_type == RF_2T2R) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R); else if (pHalData->rf_type == RF_2T2R_GREEN) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R_GREEN); else if (pHalData->rf_type == RF_2T3R) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T3R); else if (pHalData->rf_type == RF_2T4R) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T4R); else if (pHalData->rf_type == RF_3T3R) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_3T3R); else if (pHalData->rf_type == RF_3T4R) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_3T4R); else if (pHalData->rf_type == RF_4T4R) odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_4T4R); else odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_XTXR); { /* 1 ======= BoardType: ODM_CMNINFO_BOARD_TYPE ======= */ u8 odm_board_type = ODM_BOARD_DEFAULT; if (pHalData->ExternalLNA_2G != 0) { odm_board_type |= ODM_BOARD_EXT_LNA; odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EXT_LNA, 1); } if (pHalData->external_lna_5g != 0) { odm_board_type |= ODM_BOARD_EXT_LNA_5G; odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_5G_EXT_LNA, 1); } if (pHalData->ExternalPA_2G != 0) { odm_board_type |= ODM_BOARD_EXT_PA; odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EXT_PA, 1); } if (pHalData->external_pa_5g != 0) { odm_board_type |= ODM_BOARD_EXT_PA_5G; odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_5G_EXT_PA, 1); } if (pHalData->EEPROMBluetoothCoexist) odm_board_type |= ODM_BOARD_BT; odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_BOARD_TYPE, odm_board_type); /* 1 ============== End of BoardType ============== */ } odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_DOMAIN_CODE_2G, pHalData->Regulation2_4G); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_DOMAIN_CODE_5G, pHalData->Regulation5G); #ifdef CONFIG_DFS_MASTER odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_DFS_REGION_DOMAIN, adapter->registrypriv.dfs_region_domain); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_DFS_MASTER_ENABLE, &(adapter_to_rfctl(adapter)->dfs_master_enabled)); #endif odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_GPA, pHalData->TypeGPA); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_APA, pHalData->TypeAPA); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_GLNA, pHalData->TypeGLNA); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_ALNA, pHalData->TypeALNA); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RFE_TYPE, pHalData->rfe_type); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EXT_TRSW, 0); /*Add by YuChen for kfree init*/ odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_REGRFKFREEENABLE, adapter->registrypriv.RegPwrTrimEnable); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RFKFREEENABLE, pHalData->RfKFreeEnable); /*Antenna diversity relative parameters*/ odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ANT_DIV, &(pHalData->AntDivCfg)); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_RF_ANTENNA_TYPE, pHalData->TRxAntDivType); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_BE_FIX_TX_ANT, pHalData->b_fix_tx_ant); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_WITH_EXT_ANTENNA_SWITCH, pHalData->with_extenal_ant_switch); /* (8822B) efuse 0x3D7 & 0x3D8 for TX PA bias */ odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EFUSE0X3D7, pHalData->efuse0x3d7); odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_EFUSE0X3D8, pHalData->efuse0x3d8); /*Add by YuChen for adaptivity init*/ odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ADAPTIVITY, &(adapter->registrypriv.adaptivity_en)); phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_CARRIER_SENSE_ENABLE, (adapter->registrypriv.adaptivity_mode != 0) ? TRUE : FALSE); phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_DCBACKOFF, adapter->registrypriv.adaptivity_dc_backoff); phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_DYNAMICLINKADAPTIVITY, (adapter->registrypriv.adaptivity_dml != 0) ? TRUE : FALSE); phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_TH_L2H_INI, adapter->registrypriv.adaptivity_th_l2h_ini); phydm_adaptivity_info_init(pDM_Odm, PHYDM_ADAPINFO_TH_EDCCA_HL_DIFF, adapter->registrypriv.adaptivity_th_edcca_hl_diff); #ifdef CONFIG_IQK_PA_OFF odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_IQKPAOFF, 1); #endif odm_cmn_info_init(pDM_Odm, ODM_CMNINFO_IQKFWOFFLOAD, pHalData->RegIQKFWOffload); /* Pointer reference */ odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_TX_UNI, &(dvobj->traffic_stat.tx_bytes)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_RX_UNI, &(dvobj->traffic_stat.rx_bytes)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_WM_MODE, &(pmlmeext->cur_wireless_mode)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BAND, &(pHalData->current_band_type)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_FORCED_RATE, &(pHalData->ForcedDataRate)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_FORCED_IGI_LB, &(pHalData->u1ForcedIgiLb)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SEC_CHNL_OFFSET, &(pHalData->nCur40MhzPrimeSC)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SEC_MODE, &(adapter->securitypriv.dot11PrivacyAlgrthm)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BW, &(pHalData->current_channel_bw)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_CHNL, &(pHalData->current_channel)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_NET_CLOSED, &(adapter->net_closed)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_FORCED_IGI_LB, &(pHalData->u1ForcedIgiLb)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_SCAN, &(pmlmepriv->bScanInProcess)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_POWER_SAVING, &(pwrctl->bpower_saving)); /*Add by Yuchen for phydm beamforming*/ odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_TX_TP, &(dvobj->traffic_stat.cur_tx_tp)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_RX_TP, &(dvobj->traffic_stat.cur_rx_tp)); odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_ANT_TEST, &(pHalData->antenna_test)); #ifdef CONFIG_USB_HCI odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_HUBUSBMODE, &(dvobj->usb_speed)); #endif for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) odm_cmn_info_ptr_array_hook(pDM_Odm, ODM_CMNINFO_STA_STATUS, i, NULL); phydm_init_debug_setting(pDM_Odm); /* TODO */ /* odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BT_OPERATION, _FALSE); */ /* odm_cmn_info_hook(pDM_Odm, ODM_CMNINFO_BT_DISABLE_EDCA, _FALSE); */ }
static int _rtl_phydm_init_com_info(struct rtl_priv *rtlpriv, enum odm_ic_type ic_type, struct rtl_phydm_params *params) { struct phy_dm_struct *dm = rtlpriv_to_phydm(rtlpriv); struct rtl_hal *rtlhal = rtl_hal(rtlpriv); struct rtl_phy *rtlphy = &rtlpriv->phy; struct rtl_mac *mac = rtl_mac(rtlpriv); struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); struct rtl_efuse *rtlefuse = rtl_efuse(rtlpriv); u8 odm_board_type = ODM_BOARD_DEFAULT; u32 support_ability; int i; dm->adapter = (void *)rtlpriv; odm_cmn_info_init(dm, ODM_CMNINFO_PLATFORM, ODM_CE); odm_cmn_info_init(dm, ODM_CMNINFO_IC_TYPE, ic_type); odm_cmn_info_init(dm, ODM_CMNINFO_INTERFACE, ODM_ITRF_PCIE); odm_cmn_info_init(dm, ODM_CMNINFO_MP_TEST_CHIP, params->mp_chip); odm_cmn_info_init(dm, ODM_CMNINFO_PATCH_ID, rtlhal->oem_id); odm_cmn_info_init(dm, ODM_CMNINFO_BWIFI_TEST, 1); if (rtlphy->rf_type == RF_1T1R) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_1T1R); else if (rtlphy->rf_type == RF_1T2R) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_1T2R); else if (rtlphy->rf_type == RF_2T2R) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_2T2R); else if (rtlphy->rf_type == RF_2T2R_GREEN) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_2T2R_GREEN); else if (rtlphy->rf_type == RF_2T3R) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_2T3R); else if (rtlphy->rf_type == RF_2T4R) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_2T4R); else if (rtlphy->rf_type == RF_3T3R) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_3T3R); else if (rtlphy->rf_type == RF_3T4R) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_3T4R); else if (rtlphy->rf_type == RF_4T4R) odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_4T4R); else odm_cmn_info_init(dm, ODM_CMNINFO_RF_TYPE, ODM_XTXR); /* 1 ======= BoardType: ODM_CMNINFO_BOARD_TYPE ======= */ if (rtlhal->external_lna_2g != 0) { odm_board_type |= ODM_BOARD_EXT_LNA; odm_cmn_info_init(dm, ODM_CMNINFO_EXT_LNA, 1); } if (rtlhal->external_lna_5g != 0) { odm_board_type |= ODM_BOARD_EXT_LNA_5G; odm_cmn_info_init(dm, ODM_CMNINFO_5G_EXT_LNA, 1); } if (rtlhal->external_pa_2g != 0) { odm_board_type |= ODM_BOARD_EXT_PA; odm_cmn_info_init(dm, ODM_CMNINFO_EXT_PA, 1); } if (rtlhal->external_pa_5g != 0) { odm_board_type |= ODM_BOARD_EXT_PA_5G; odm_cmn_info_init(dm, ODM_CMNINFO_5G_EXT_PA, 1); } if (rtlpriv->cfg->ops->get_btc_status()) odm_board_type |= ODM_BOARD_BT; odm_cmn_info_init(dm, ODM_CMNINFO_BOARD_TYPE, odm_board_type); /* 1 ============== End of BoardType ============== */ odm_cmn_info_init(dm, ODM_CMNINFO_GPA, rtlhal->type_gpa); odm_cmn_info_init(dm, ODM_CMNINFO_APA, rtlhal->type_apa); odm_cmn_info_init(dm, ODM_CMNINFO_GLNA, rtlhal->type_glna); odm_cmn_info_init(dm, ODM_CMNINFO_ALNA, rtlhal->type_alna); odm_cmn_info_init(dm, ODM_CMNINFO_RFE_TYPE, rtlhal->rfe_type); odm_cmn_info_init(dm, ODM_CMNINFO_EXT_TRSW, 0); /*Add by YuChen for kfree init*/ odm_cmn_info_init(dm, ODM_CMNINFO_REGRFKFREEENABLE, 2); odm_cmn_info_init(dm, ODM_CMNINFO_RFKFREEENABLE, 0); /*Antenna diversity relative parameters*/ odm_cmn_info_hook(dm, ODM_CMNINFO_ANT_DIV, &rtlefuse->antenna_div_cfg); odm_cmn_info_init(dm, ODM_CMNINFO_RF_ANTENNA_TYPE, rtlefuse->antenna_div_type); odm_cmn_info_init(dm, ODM_CMNINFO_BE_FIX_TX_ANT, 0); odm_cmn_info_init(dm, ODM_CMNINFO_WITH_EXT_ANTENNA_SWITCH, 0); /* (8822B) efuse 0x3D7 & 0x3D8 for TX PA bias */ odm_cmn_info_init(dm, ODM_CMNINFO_EFUSE0X3D7, params->efuse0x3d7); odm_cmn_info_init(dm, ODM_CMNINFO_EFUSE0X3D8, params->efuse0x3d8); /*Add by YuChen for adaptivity init*/ odm_cmn_info_hook(dm, ODM_CMNINFO_ADAPTIVITY, &rtlpriv->phydm.adaptivity_en); phydm_adaptivity_info_init(dm, PHYDM_ADAPINFO_CARRIER_SENSE_ENABLE, false); phydm_adaptivity_info_init(dm, PHYDM_ADAPINFO_DCBACKOFF, 0); phydm_adaptivity_info_init(dm, PHYDM_ADAPINFO_DYNAMICLINKADAPTIVITY, false); phydm_adaptivity_info_init(dm, PHYDM_ADAPINFO_TH_L2H_INI, 0); phydm_adaptivity_info_init(dm, PHYDM_ADAPINFO_TH_EDCCA_HL_DIFF, 0); odm_cmn_info_init(dm, ODM_CMNINFO_IQKFWOFFLOAD, 0); /* Pointer reference */ odm_cmn_info_hook(dm, ODM_CMNINFO_TX_UNI, &rtlpriv->stats.txbytesunicast); odm_cmn_info_hook(dm, ODM_CMNINFO_RX_UNI, &rtlpriv->stats.rxbytesunicast); odm_cmn_info_hook(dm, ODM_CMNINFO_BAND, &rtlhal->current_bandtype); odm_cmn_info_hook(dm, ODM_CMNINFO_FORCED_RATE, &rtlpriv->phydm.forced_data_rate); odm_cmn_info_hook(dm, ODM_CMNINFO_FORCED_IGI_LB, &rtlpriv->phydm.forced_igi_lb); odm_cmn_info_hook(dm, ODM_CMNINFO_SEC_CHNL_OFFSET, &mac->cur_40_prime_sc); odm_cmn_info_hook(dm, ODM_CMNINFO_BW, &rtlphy->current_chan_bw); odm_cmn_info_hook(dm, ODM_CMNINFO_CHNL, &rtlphy->current_channel); odm_cmn_info_hook(dm, ODM_CMNINFO_SCAN, &mac->act_scanning); odm_cmn_info_hook(dm, ODM_CMNINFO_POWER_SAVING, &ppsc->dot11_psmode); /* may add new boolean flag */ /*Add by Yuchen for phydm beamforming*/ odm_cmn_info_hook(dm, ODM_CMNINFO_TX_TP, &rtlpriv->stats.txbytesunicast_inperiod_tp); odm_cmn_info_hook(dm, ODM_CMNINFO_RX_TP, &rtlpriv->stats.rxbytesunicast_inperiod_tp); odm_cmn_info_hook(dm, ODM_CMNINFO_ANT_TEST, &rtlpriv->phydm.antenna_test); for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) odm_cmn_info_ptr_array_hook(dm, ODM_CMNINFO_STA_STATUS, i, NULL); phydm_init_debug_setting(dm); odm_cmn_info_init(dm, ODM_CMNINFO_FAB_VER, params->fab_ver); odm_cmn_info_init(dm, ODM_CMNINFO_CUT_VER, params->cut_ver); /* after ifup, ability is updated again */ support_ability = ODM_RF_CALIBRATION | ODM_RF_TX_PWR_TRACK; odm_cmn_info_update(dm, ODM_CMNINFO_ABILITY, support_ability); return 0; }