Signed-off-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx> --- .../staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c | 3976 ------------------- drivers/staging/rtl8821ae/rtl8821ae/btc.h | 87 - drivers/staging/rtl8821ae/rtl8821ae/def.h | 442 --- drivers/staging/rtl8821ae/rtl8821ae/dm.c | 3045 --------------- drivers/staging/rtl8821ae/rtl8821ae/dm.h | 426 --- drivers/staging/rtl8821ae/rtl8821ae/fw.c | 1349 ------- drivers/staging/rtl8821ae/rtl8821ae/fw.h | 321 -- .../staging/rtl8821ae/rtl8821ae/hal_bt_coexist.c | 519 --- .../staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h | 169 - drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c | 2069 ---------- drivers/staging/rtl8821ae/rtl8821ae/hal_btc.h | 160 - drivers/staging/rtl8821ae/rtl8821ae/hw.c | 3346 ---------------- drivers/staging/rtl8821ae/rtl8821ae/hw.h | 75 - drivers/staging/rtl8821ae/rtl8821ae/led.c | 239 -- drivers/staging/rtl8821ae/rtl8821ae/led.h | 40 - drivers/staging/rtl8821ae/rtl8821ae/phy.h | 258 -- drivers/staging/rtl8821ae/rtl8821ae/pwrseq.c | 199 - drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c | 140 - drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.h | 71 - drivers/staging/rtl8821ae/rtl8821ae/reg.h | 2427 ------------ drivers/staging/rtl8821ae/rtl8821ae/rf.c | 464 --- drivers/staging/rtl8821ae/rtl8821ae/rf.h | 46 - drivers/staging/rtl8821ae/rtl8821ae/sw.c | 499 --- drivers/staging/rtl8821ae/rtl8821ae/sw.h | 39 - drivers/staging/rtl8821ae/rtl8821ae/table.c | 4002 -------------------- drivers/staging/rtl8821ae/rtl8821ae/table.h | 62 - drivers/staging/rtl8821ae/rtl8821ae/trx.c | 1050 ----- drivers/staging/rtl8821ae/rtl8821ae/trx.h | 641 ---- 28 files changed, 26161 deletions(-) delete mode 100644 drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/btc.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/def.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/dm.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/dm.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/fw.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/fw.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/hal_btc.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/hw.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/hw.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/led.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/led.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/phy.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/pwrseq.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/reg.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/rf.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/rf.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/sw.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/sw.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/table.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/table.h delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/trx.c delete mode 100644 drivers/staging/rtl8821ae/rtl8821ae/trx.h diff --git a/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c b/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c deleted file mode 100644 index b30f17a..0000000 --- a/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c +++ /dev/null @@ -1,3976 +0,0 @@ -//============================================================ -// Description: -// -// This file is for 8812a1ant Co-exist mechanism -// -// History -// 2012/11/15 Cosa first check in. -// -//============================================================ - -//============================================================ -// include files -//============================================================ -#include "halbt_precomp.h" -#if 1 -//============================================================ -// Global variables, these are static variables -//============================================================ -static COEX_DM_8812A_1ANT GLCoexDm8812a1Ant; -static PCOEX_DM_8812A_1ANT coex_dm=&GLCoexDm8812a1Ant; -static COEX_STA_8812A_1ANT GLCoexSta8812a1Ant; -static PCOEX_STA_8812A_1ANT coex_sta=&GLCoexSta8812a1Ant; - -const char *const GLBtInfoSrc8812a1Ant[]={ - "BT Info[wifi fw]", - "BT Info[bt rsp]", - "BT Info[bt auto report]", -}; - -//============================================================ -// local function proto type if needed -//============================================================ -//============================================================ -// local function start with halbtc8812a1ant_ -//============================================================ -#if 0 -void -halbtc8812a1ant_Reg0x550Bit3( - PBTC_COEXIST btcoexist, - BOOLEAN bSet - ) -{ - u1Byte u1tmp=0; - - u1tmp = btcoexist->btc_read_1byte(btcoexist, 0x550); - if(bSet) - { - u1tmp |= BIT3; - } - else - { - u1tmp &= ~BIT3; - } - btcoexist->btc_write_1byte(btcoexist, 0x550, u1tmp); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], set 0x550[3]=%d\n", (bSet? 1:0))); -} -#endif -u1Byte -halbtc8812a1ant_BtRssiState( - u1Byte level_num, - u1Byte rssi_thresh, - u1Byte rssi_thresh1 - ) -{ - s4Byte bt_rssi=0; - u1Byte bt_rssi_state; - - bt_rssi = coex_sta->bt_rssi; - - if(level_num == 2) - { - if( (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || - (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) - { - if(bt_rssi >= (rssi_thresh+BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT)) - { - bt_rssi_state = BTC_RSSI_STATE_HIGH; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n")); - } - else - { - bt_rssi_state = BTC_RSSI_STATE_STAY_LOW; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n")); - } - } - else - { - if(bt_rssi < rssi_thresh) - { - bt_rssi_state = BTC_RSSI_STATE_LOW; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n")); - } - else - { - bt_rssi_state = BTC_RSSI_STATE_STAY_HIGH; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n")); - } - } - } - else if(level_num == 3) - { - if(rssi_thresh > rssi_thresh1) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi thresh error!!\n")); - return coex_sta->pre_bt_rssi_state; - } - - if( (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || - (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) - { - if(bt_rssi >= (rssi_thresh+BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT)) - { - bt_rssi_state = BTC_RSSI_STATE_MEDIUM; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n")); - } - else - { - bt_rssi_state = BTC_RSSI_STATE_STAY_LOW; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n")); - } - } - else if( (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_MEDIUM) || - (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_MEDIUM)) - { - if(bt_rssi >= (rssi_thresh1+BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT)) - { - bt_rssi_state = BTC_RSSI_STATE_HIGH; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n")); - } - else if(bt_rssi < rssi_thresh) - { - bt_rssi_state = BTC_RSSI_STATE_LOW; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n")); - } - else - { - bt_rssi_state = BTC_RSSI_STATE_STAY_MEDIUM; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Medium\n")); - } - } - else - { - if(bt_rssi < rssi_thresh1) - { - bt_rssi_state = BTC_RSSI_STATE_MEDIUM; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n")); - } - else - { - bt_rssi_state = BTC_RSSI_STATE_STAY_HIGH; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n")); - } - } - } - - coex_sta->pre_bt_rssi_state = bt_rssi_state; - - return bt_rssi_state; -} - -u1Byte -halbtc8812a1ant_WifiRssiState( - PBTC_COEXIST btcoexist, - u1Byte index, - u1Byte level_num, - u1Byte rssi_thresh, - u1Byte rssi_thresh1 - ) -{ - s4Byte wifi_rssi=0; - u1Byte wifi_rssi_state; - - btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); - - if(level_num == 2) - { - if( (coex_sta->pre_wifi_rssi_state[index] == BTC_RSSI_STATE_LOW) || - (coex_sta->pre_wifi_rssi_state[index] == BTC_RSSI_STATE_STAY_LOW)) - { - if(wifi_rssi >= (rssi_thresh+BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT)) - { - wifi_rssi_state = BTC_RSSI_STATE_HIGH; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n")); - } - else - { - wifi_rssi_state = BTC_RSSI_STATE_STAY_LOW; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n")); - } - } - else - { - if(wifi_rssi < rssi_thresh) - { - wifi_rssi_state = BTC_RSSI_STATE_LOW; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n")); - } - else - { - wifi_rssi_state = BTC_RSSI_STATE_STAY_HIGH; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n")); - } - } - } - else if(level_num == 3) - { - if(rssi_thresh > rssi_thresh1) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI thresh error!!\n")); - return coex_sta->pre_wifi_rssi_state[index]; - } - - if( (coex_sta->pre_wifi_rssi_state[index] == BTC_RSSI_STATE_LOW) || - (coex_sta->pre_wifi_rssi_state[index] == BTC_RSSI_STATE_STAY_LOW)) - { - if(wifi_rssi >= (rssi_thresh+BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT)) - { - wifi_rssi_state = BTC_RSSI_STATE_MEDIUM; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n")); - } - else - { - wifi_rssi_state = BTC_RSSI_STATE_STAY_LOW; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n")); - } - } - else if( (coex_sta->pre_wifi_rssi_state[index] == BTC_RSSI_STATE_MEDIUM) || - (coex_sta->pre_wifi_rssi_state[index] == BTC_RSSI_STATE_STAY_MEDIUM)) - { - if(wifi_rssi >= (rssi_thresh1+BTC_RSSI_COEX_THRESH_TOL_8812A_1ANT)) - { - wifi_rssi_state = BTC_RSSI_STATE_HIGH; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n")); - } - else if(wifi_rssi < rssi_thresh) - { - wifi_rssi_state = BTC_RSSI_STATE_LOW; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n")); - } - else - { - wifi_rssi_state = BTC_RSSI_STATE_STAY_MEDIUM; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Medium\n")); - } - } - else - { - if(wifi_rssi < rssi_thresh1) - { - wifi_rssi_state = BTC_RSSI_STATE_MEDIUM; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n")); - } - else - { - wifi_rssi_state = BTC_RSSI_STATE_STAY_HIGH; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n")); - } - } - } - - coex_sta->pre_wifi_rssi_state[index] = wifi_rssi_state; - - return wifi_rssi_state; -} - -void -halbtc8812a1ant_MonitorBtEnableDisable( - PBTC_COEXIST btcoexist - ) -{ - static BOOLEAN pre_bt_disabled=false; - static u4Byte bt_disable_cnt=0; - BOOLEAN bt_active=true, bt_disable_by68=false, bt_disabled=false; - u4Byte u4_tmp=0; - - // This function check if bt is disabled - - if( coex_sta->high_priority_tx == 0 && - coex_sta->high_priority_rx == 0 && - coex_sta->low_priority_tx == 0 && - coex_sta->low_priority_rx == 0) - { - bt_active = false; - } - if( coex_sta->high_priority_tx == 0xffff && - coex_sta->high_priority_rx == 0xffff && - coex_sta->low_priority_tx == 0xffff && - coex_sta->low_priority_rx == 0xffff) - { - bt_active = false; - } - if(bt_active) - { - bt_disable_cnt = 0; - bt_disabled = false; - btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_DISABLE, &bt_disabled); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is enabled !!\n")); - } - else - { - bt_disable_cnt++; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], bt all counters=0, %d times!!\n", - bt_disable_cnt)); - if(bt_disable_cnt >= 2 ||bt_disable_by68) - { - bt_disabled = true; - btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_DISABLE, &bt_disabled); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is disabled !!\n")); - } - } - if(pre_bt_disabled != bt_disabled) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], BT is from %s to %s!!\n", - (pre_bt_disabled ? "disabled":"enabled"), - (bt_disabled ? "disabled":"enabled"))); - pre_bt_disabled = bt_disabled; - if(!bt_disabled) - { - } - else - { - } - } -} - -void -halbtc8812a1ant_MonitorBtCtr( - PBTC_COEXIST btcoexist - ) -{ - u4Byte reg_hp_tx_rx, reg_lp_tx_rx, u4_tmp; - u4Byte reg_hp_tx=0, reg_hp_rx=0, reg_lp_tx=0, reg_lp_rx=0; - u1Byte u1_tmp; - - reg_hp_tx_rx = 0x770; - reg_lp_tx_rx = 0x774; - - u4_tmp = btcoexist->btc_read_4byte(btcoexist, reg_hp_tx_rx); - reg_hp_tx = u4_tmp & bMaskLWord; - reg_hp_rx = (u4_tmp & bMaskHWord)>>16; - - u4_tmp = btcoexist->btc_read_4byte(btcoexist, reg_lp_tx_rx); - reg_lp_tx = u4_tmp & bMaskLWord; - reg_lp_rx = (u4_tmp & bMaskHWord)>>16; - - coex_sta->high_priority_tx = reg_hp_tx; - coex_sta->high_priority_rx = reg_hp_rx; - coex_sta->low_priority_tx = reg_lp_tx; - coex_sta->low_priority_rx = reg_lp_rx; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], High Priority Tx/Rx (reg 0x%x)=%x(%d)/%x(%d)\n", - reg_hp_tx_rx, reg_hp_tx, reg_hp_tx, reg_hp_rx, reg_hp_rx)); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Low Priority Tx/Rx (reg 0x%x)=%x(%d)/%x(%d)\n", - reg_lp_tx_rx, reg_lp_tx, reg_lp_tx, reg_lp_rx, reg_lp_rx)); - - // reset counter - btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc); -} - -void -halbtc8812a1ant_QueryBtInfo( - PBTC_COEXIST btcoexist - ) -{ - u1Byte dataLen=3; - u1Byte buf[5] = {0}; - static u4Byte btInfoCnt=0; - - if(!btInfoCnt || - (coex_sta->bt_info_c2h_cnt[BT_INFO_SRC_8812A_1ANT_BT_RSP]-btInfoCnt)>2) - { - buf[0] = dataLen; - buf[1] = 0x1; // polling enable, 1=enable, 0=disable - buf[2] = 0x2; // polling time in seconds - buf[3] = 0x1; // auto report enable, 1=enable, 0=disable - - btcoexist->btc_set(btcoexist, BTC_SET_ACT_CTRL_BT_INFO, (PVOID)&buf[0]); - } - btInfoCnt = coex_sta->bt_info_c2h_cnt[BT_INFO_SRC_8812A_1ANT_BT_RSP]; -} -u1Byte -halbtc8812a1ant_ActionAlgorithm( - PBTC_COEXIST btcoexist - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - BOOLEAN bt_hs_on=false; - u1Byte algorithm=BT_8812A_1ANT_COEX_ALGO_UNDEFINED; - u1Byte num_of_diff_profile=0; - - btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); - - if(!stack_info->bt_link_exist) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No profile exists!!!\n")); - return algorithm; - } - - if(stack_info->sco_exist) - num_of_diff_profile++; - if(stack_info->hid_exist) - num_of_diff_profile++; - if(stack_info->pan_exist) - num_of_diff_profile++; - if(stack_info->a2dp_exist) - num_of_diff_profile++; - - if(num_of_diff_profile == 1) - { - if(stack_info->sco_exist) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_SCO; - } - else - { - if(stack_info->hid_exist) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_HID; - } - else if(stack_info->a2dp_exist) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_A2DP; - } - else if(stack_info->pan_exist) - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_PANHS; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR; - } - } - } - } - else if(num_of_diff_profile == 2) - { - if(stack_info->sco_exist) - { - if(stack_info->hid_exist) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_HID; - } - else if(stack_info->a2dp_exist) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_SCO; - } - else if(stack_info->pan_exist) - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_SCO; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID; - } - } - } - else - { - if( stack_info->hid_exist && - stack_info->a2dp_exist ) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP; - } - else if( stack_info->hid_exist && - stack_info->pan_exist ) - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID; - } - } - else if( stack_info->pan_exist && - stack_info->a2dp_exist ) - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP; - } - } - } - } - else if(num_of_diff_profile == 3) - { - if(stack_info->sco_exist) - { - if( stack_info->hid_exist && - stack_info->a2dp_exist ) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_HID; - } - else if( stack_info->hid_exist && - stack_info->pan_exist ) - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID; - } - } - else if( stack_info->pan_exist && - stack_info->a2dp_exist ) - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_SCO; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID; - } - } - } - else - { - if( stack_info->hid_exist && - stack_info->pan_exist && - stack_info->a2dp_exist ) - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR; - } - } - } - } - else if(num_of_diff_profile >= 3) - { - if(stack_info->sco_exist) - { - if( stack_info->hid_exist && - stack_info->pan_exist && - stack_info->a2dp_exist ) - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n")); - - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP + PAN(EDR)==>PAN(EDR)+HID\n")); - algorithm = BT_8812A_1ANT_COEX_ALGO_PANEDR_HID; - } - } - } - } - - return algorithm; -} - -BOOLEAN -halbtc8812a1ant_NeedToDecBtPwr( - PBTC_COEXIST btcoexist - ) -{ - BOOLEAN ret=false; - BOOLEAN bt_hs_on=false, wifi_connected=false; - s4Byte bt_hs_rssi=0; - - if(!btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on)) - return false; - if(!btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected)) - return false; - if(!btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi)) - return false; - - if(wifi_connected) - { - if(bt_hs_on) - { - if(bt_hs_rssi > 37) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], Need to decrease bt power for HS mode!!\n")); - ret = true; - } - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], Need to decrease bt power for Wifi is connected!!\n")); - ret = true; - } - } - - return ret; -} - -void -halbtc8812a1ant_SetFwDacSwingLevel( - PBTC_COEXIST btcoexist, - u1Byte dac_swing_lvl - ) -{ - u1Byte h2c_parameter[1] ={0}; - - // There are several type of dacswing - // 0x18/ 0x10/ 0xc/ 0x8/ 0x4/ 0x6 - h2c_parameter[0] = dac_swing_lvl; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Set Dac Swing Level=0x%x\n", dac_swing_lvl)); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x64=0x%x\n", h2c_parameter[0])); - - btcoexist->btc_fill_h2c(btcoexist, 0x64, 1, h2c_parameter); -} - -void -halbtc8812a1ant_SetFwDecBtPwr( - PBTC_COEXIST btcoexist, - BOOLEAN dec_bt_pwr - ) -{ - u1Byte dataLen=3; - u1Byte buf[5] = {0}; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power : %s\n", - (dec_bt_pwr? "Yes!!":"No!!"))); - - buf[0] = dataLen; - buf[1] = 0x3; // OP_Code - buf[2] = 0x1; // OP_Code_Length - if(dec_bt_pwr) - buf[3] = 0x1; // OP_Code_Content - else - buf[3] = 0x0; - - btcoexist->btc_set(btcoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]); -} - -void -halbtc8812a1ant_DecBtPwr( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN dec_bt_pwr - ) -{ - return; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power = %s\n", - (force_exec? "force to":""), ((dec_bt_pwr)? "ON":"OFF"))); - coex_dm->cur_dec_bt_pwr = dec_bt_pwr; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], pre_dec_bt_pwr=%d, cur_dec_bt_pwr=%d\n", - coex_dm->pre_dec_bt_pwr, coex_dm->cur_dec_bt_pwr)); - - if(coex_dm->pre_dec_bt_pwr == coex_dm->cur_dec_bt_pwr) - return; - } - halbtc8812a1ant_SetFwDecBtPwr(btcoexist, coex_dm->cur_dec_bt_pwr); - - coex_dm->pre_dec_bt_pwr = coex_dm->cur_dec_bt_pwr; -} - -void -halbtc8812a1ant_SetFwBtLnaConstrain( - PBTC_COEXIST btcoexist, - BOOLEAN bt_lna_cons_on - ) -{ - u1Byte dataLen=3; - u1Byte buf[5] = {0}; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set BT LNA Constrain: %s\n", - (bt_lna_cons_on? "ON!!":"OFF!!"))); - - buf[0] = dataLen; - buf[1] = 0x2; // OP_Code - buf[2] = 0x1; // OP_Code_Length - if(bt_lna_cons_on) - buf[3] = 0x1; // OP_Code_Content - else - buf[3] = 0x0; - - btcoexist->btc_set(btcoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]); -} - -void -halbtc8812a1ant_SetBtLnaConstrain( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN bt_lna_cons_on - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT Constrain = %s\n", - (force_exec? "force":""), ((bt_lna_cons_on)? "ON":"OFF"))); - coex_dm->bCurBtLnaConstrain = bt_lna_cons_on; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBtLnaConstrain=%d, bCurBtLnaConstrain=%d\n", - coex_dm->bPreBtLnaConstrain, coex_dm->bCurBtLnaConstrain)); - - if(coex_dm->bPreBtLnaConstrain == coex_dm->bCurBtLnaConstrain) - return; - } - halbtc8812a1ant_SetFwBtLnaConstrain(btcoexist, coex_dm->bCurBtLnaConstrain); - - coex_dm->bPreBtLnaConstrain = coex_dm->bCurBtLnaConstrain; -} - -void -halbtc8812a1ant_SetFwBtPsdMode( - PBTC_COEXIST btcoexist, - u1Byte bt_psd_mode - ) -{ - u1Byte dataLen=3; - u1Byte buf[5] = {0}; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set BT PSD mode=0x%x\n", - bt_psd_mode)); - - buf[0] = dataLen; - buf[1] = 0x4; // OP_Code - buf[2] = 0x1; // OP_Code_Length - buf[3] = bt_psd_mode; // OP_Code_Content - - btcoexist->btc_set(btcoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]); -} - - -void -halbtc8812a1ant_SetBtPsdMode( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - u1Byte bt_psd_mode - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT PSD mode = 0x%x\n", - (force_exec? "force":""), bt_psd_mode)); - coex_dm->bCurBtPsdMode = bt_psd_mode; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreBtPsdMode=0x%x, bCurBtPsdMode=0x%x\n", - coex_dm->bPreBtPsdMode, coex_dm->bCurBtPsdMode)); - - if(coex_dm->bPreBtPsdMode == coex_dm->bCurBtPsdMode) - return; - } - halbtc8812a1ant_SetFwBtPsdMode(btcoexist, coex_dm->bCurBtPsdMode); - - coex_dm->bPreBtPsdMode = coex_dm->bCurBtPsdMode; -} - - -void -halbtc8812a1ant_SetBtAutoReport( - PBTC_COEXIST btcoexist, - BOOLEAN enable_auto_report - ) -{ -#if 0 - u1Byte h2c_parameter[1] ={0}; - - h2c_parameter[0] = 0; - - if(enable_auto_report) - { - h2c_parameter[0] |= BIT0; - } - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], BT FW auto report : %s, FW write 0x68=0x%x\n", - (enable_auto_report? "Enabled!!":"Disabled!!"), h2c_parameter[0])); - - btcoexist->btc_fill_h2c(btcoexist, 0x68, 1, h2c_parameter); -#else - -#endif -} - -void -halbtc8812a1ant_BtAutoReport( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN enable_auto_report - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s BT Auto report = %s\n", - (force_exec? "force to":""), ((enable_auto_report)? "Enabled":"Disabled"))); - coex_dm->cur_bt_auto_report = enable_auto_report; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], pre_bt_auto_report=%d, cur_bt_auto_report=%d\n", - coex_dm->pre_bt_auto_report, coex_dm->cur_bt_auto_report)); - - if(coex_dm->pre_bt_auto_report == coex_dm->cur_bt_auto_report) - return; - } - halbtc8812a1ant_SetBtAutoReport(btcoexist, coex_dm->cur_bt_auto_report); - - coex_dm->pre_bt_auto_report = coex_dm->cur_bt_auto_report; -} - -void -halbtc8812a1ant_FwDacSwingLvl( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - u1Byte fw_dac_swing_lvl - ) -{ - return; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set FW Dac Swing level = %d\n", - (force_exec? "force to":""), fw_dac_swing_lvl)); - coex_dm->cur_fw_dac_swing_lvl = fw_dac_swing_lvl; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], pre_fw_dac_swing_lvl=%d, cur_fw_dac_swing_lvl=%d\n", - coex_dm->pre_fw_dac_swing_lvl, coex_dm->cur_fw_dac_swing_lvl)); - - if(coex_dm->pre_fw_dac_swing_lvl == coex_dm->cur_fw_dac_swing_lvl) - return; - } - - halbtc8812a1ant_SetFwDacSwingLevel(btcoexist, coex_dm->cur_fw_dac_swing_lvl); - - coex_dm->pre_fw_dac_swing_lvl = coex_dm->cur_fw_dac_swing_lvl; -} - -void -halbtc8812a1ant_SetSwRfRxLpfCorner( - PBTC_COEXIST btcoexist, - BOOLEAN rx_rf_shrink_on - ) -{ - if(rx_rf_shrink_on) - { - //Shrink RF Rx LPF corner - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Shrink RF Rx LPF corner!!\n")); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1e, 0xfffff, 0xf0ff7); - } - else - { - //Resume RF Rx LPF corner - // After initialized, we can use coex_dm->bt_rf0x1e_backup - if(btcoexist->bInitilized) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Resume RF Rx LPF corner!!\n")); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1e, 0xfffff, coex_dm->bt_rf0x1e_backup); - } - } -} - -void -halbtc8812a1ant_RfShrink( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN rx_rf_shrink_on - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn Rx RF Shrink = %s\n", - (force_exec? "force to":""), ((rx_rf_shrink_on)? "ON":"OFF"))); - coex_dm->cur_rf_rx_lpf_shrink = rx_rf_shrink_on; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], pre_rf_rx_lpf_shrink=%d, cur_rf_rx_lpf_shrink=%d\n", - coex_dm->pre_rf_rx_lpf_shrink, coex_dm->cur_rf_rx_lpf_shrink)); - - if(coex_dm->pre_rf_rx_lpf_shrink == coex_dm->cur_rf_rx_lpf_shrink) - return; - } - halbtc8812a1ant_SetSwRfRxLpfCorner(btcoexist, coex_dm->cur_rf_rx_lpf_shrink); - - coex_dm->pre_rf_rx_lpf_shrink = coex_dm->cur_rf_rx_lpf_shrink; -} - -void -halbtc8812a1ant_SetSwPenaltyTxRateAdaptive( - PBTC_COEXIST btcoexist, - BOOLEAN low_penalty_ra - ) -{ - u1Byte u1_tmp; - - u1_tmp = btcoexist->btc_read_1byte(btcoexist, 0x4fd); - u1_tmp |= BIT0; - if(low_penalty_ra) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set low penalty!!\n")); - u1_tmp &= ~BIT2; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Tx rate adaptive, set normal!!\n")); - u1_tmp |= BIT2; - } - - btcoexist->btc_write_1byte(btcoexist, 0x4fd, u1_tmp); -} - -void -halbtc8812a1ant_LowPenaltyRa( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN low_penalty_ra - ) -{ - return; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn LowPenaltyRA = %s\n", - (force_exec? "force to":""), ((low_penalty_ra)? "ON":"OFF"))); - coex_dm->cur_low_penalty_ra = low_penalty_ra; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], pre_low_penalty_ra=%d, cur_low_penalty_ra=%d\n", - coex_dm->pre_low_penalty_ra, coex_dm->cur_low_penalty_ra)); - - if(coex_dm->pre_low_penalty_ra == coex_dm->cur_low_penalty_ra) - return; - } - halbtc8812a1ant_SetSwPenaltyTxRateAdaptive(btcoexist, coex_dm->cur_low_penalty_ra); - - coex_dm->pre_low_penalty_ra = coex_dm->cur_low_penalty_ra; -} - -void -halbtc8812a1ant_SetDacSwingReg( - PBTC_COEXIST btcoexist, - u4Byte level - ) -{ - u1Byte val=(u1Byte)level; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Write SwDacSwing = 0x%x\n", level)); - btcoexist->btc_write_1byte_bitmask(btcoexist, 0xc5b, 0x3e, val); -} - -void -halbtc8812a1ant_SetSwFullTimeDacSwing( - PBTC_COEXIST btcoexist, - BOOLEAN sw_dac_swing_on, - u4Byte sw_dac_swing_lvl - ) -{ - if(sw_dac_swing_on) - { - halbtc8812a1ant_SetDacSwingReg(btcoexist, sw_dac_swing_lvl); - } - else - { - halbtc8812a1ant_SetDacSwingReg(btcoexist, 0x18); - } -} - - -void -halbtc8812a1ant_DacSwing( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN dac_swing_on, - u4Byte dac_swing_lvl - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn DacSwing=%s, dac_swing_lvl=0x%x\n", - (force_exec? "force to":""), ((dac_swing_on)? "ON":"OFF"), dac_swing_lvl)); - coex_dm->cur_dac_swing_on = dac_swing_on; - coex_dm->cur_dac_swing_lvl = dac_swing_lvl; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], pre_dac_swing_on=%d, pre_dac_swing_lvl=0x%x, cur_dac_swing_on=%d, cur_dac_swing_lvl=0x%x\n", - coex_dm->pre_dac_swing_on, coex_dm->pre_dac_swing_lvl, - coex_dm->cur_dac_swing_on, coex_dm->cur_dac_swing_lvl)); - - if( (coex_dm->pre_dac_swing_on == coex_dm->cur_dac_swing_on) && - (coex_dm->pre_dac_swing_lvl == coex_dm->cur_dac_swing_lvl) ) - return; - } - delay_ms(30); - halbtc8812a1ant_SetSwFullTimeDacSwing(btcoexist, dac_swing_on, dac_swing_lvl); - - coex_dm->pre_dac_swing_on = coex_dm->cur_dac_swing_on; - coex_dm->pre_dac_swing_lvl = coex_dm->cur_dac_swing_lvl; -} - -void -halbtc8812a1ant_SetAdcBackOff( - PBTC_COEXIST btcoexist, - BOOLEAN adc_back_off - ) -{ - if(adc_back_off) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level On!\n")); - btcoexist->btc_write_1byte_bitmask(btcoexist, 0x8db, 0x60, 0x3); - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB BackOff Level Off!\n")); - btcoexist->btc_write_1byte_bitmask(btcoexist, 0x8db, 0x60, 0x1); - } -} - -void -halbtc8812a1ant_AdcBackOff( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN adc_back_off - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn AdcBackOff = %s\n", - (force_exec? "force to":""), ((adc_back_off)? "ON":"OFF"))); - coex_dm->cur_adc_back_off = adc_back_off; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], pre_adc_back_off=%d, cur_adc_back_off=%d\n", - coex_dm->pre_adc_back_off, coex_dm->cur_adc_back_off)); - - if(coex_dm->pre_adc_back_off == coex_dm->cur_adc_back_off) - return; - } - halbtc8812a1ant_SetAdcBackOff(btcoexist, coex_dm->cur_adc_back_off); - - coex_dm->pre_adc_back_off = coex_dm->cur_adc_back_off; -} - -void -halbtc8812a1ant_SetAgcTable( - PBTC_COEXIST btcoexist, - BOOLEAN agc_table_en - ) -{ - u1Byte rssi_adjust_val=0; - - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0xef, 0xfffff, 0x02000); - if(agc_table_en) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n")); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, 0xfffff, 0x3fa58); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, 0xfffff, 0x37a58); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, 0xfffff, 0x2fa58); - rssi_adjust_val = 8; - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n")); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, 0xfffff, 0x39258); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, 0xfffff, 0x31258); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, 0xfffff, 0x29258); - } - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0xef, 0xfffff, 0x0); - - // set rssi_adjust_val for wifi module. - btcoexist->btc_set(btcoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssi_adjust_val); -} - - -void -halbtc8812a1ant_AgcTable( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN agc_table_en - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s %s Agc Table\n", - (force_exec? "force to":""), ((agc_table_en)? "Enable":"Disable"))); - coex_dm->cur_agc_table_en = agc_table_en; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], pre_agc_table_en=%d, cur_agc_table_en=%d\n", - coex_dm->pre_agc_table_en, coex_dm->cur_agc_table_en)); - - if(coex_dm->pre_agc_table_en == coex_dm->cur_agc_table_en) - return; - } - halbtc8812a1ant_SetAgcTable(btcoexist, agc_table_en); - - coex_dm->pre_agc_table_en = coex_dm->cur_agc_table_en; -} - -void -halbtc8812a1ant_SetCoexTable( - PBTC_COEXIST btcoexist, - u4Byte val0x6c0, - u4Byte val0x6c4, - u4Byte val0x6c8, - u1Byte val0x6cc - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c0=0x%x\n", val0x6c0)); - btcoexist->btc_write_4byte(btcoexist, 0x6c0, val0x6c0); - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c4=0x%x\n", val0x6c4)); - btcoexist->btc_write_4byte(btcoexist, 0x6c4, val0x6c4); - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c8=0x%x\n", val0x6c8)); - btcoexist->btc_write_4byte(btcoexist, 0x6c8, val0x6c8); - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6cc=0x%x\n", val0x6cc)); - btcoexist->btc_write_1byte(btcoexist, 0x6cc, val0x6cc); -} - -void -halbtc8812a1ant_CoexTable( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - u4Byte val0x6c0, - u4Byte val0x6c4, - u4Byte val0x6c8, - u1Byte val0x6cc - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0=0x%x, 0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n", - (force_exec? "force to":""), val0x6c0, val0x6c4, val0x6c8, val0x6cc)); - coex_dm->cur_val0x6c0 = val0x6c0; - coex_dm->cur_val0x6c4 = val0x6c4; - coex_dm->cur_val0x6c8 = val0x6c8; - coex_dm->cur_val0x6cc = val0x6cc; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], pre_val0x6c0=0x%x, pre_val0x6c4=0x%x, pre_val0x6c8=0x%x, pre_val0x6cc=0x%x !!\n", - coex_dm->pre_val0x6c0, coex_dm->pre_val0x6c4, coex_dm->pre_val0x6c8, coex_dm->pre_val0x6cc)); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], cur_val0x6c0=0x%x, cur_val0x6c4=0x%x, cur_val0x6c8=0x%x, cur_val0x6cc=0x%x !!\n", - coex_dm->cur_val0x6c0, coex_dm->cur_val0x6c4, coex_dm->cur_val0x6c8, coex_dm->cur_val0x6cc)); - - if( (coex_dm->pre_val0x6c0 == coex_dm->cur_val0x6c0) && - (coex_dm->pre_val0x6c4 == coex_dm->cur_val0x6c4) && - (coex_dm->pre_val0x6c8 == coex_dm->cur_val0x6c8) && - (coex_dm->pre_val0x6cc == coex_dm->cur_val0x6cc) ) - return; - } - halbtc8812a1ant_SetCoexTable(btcoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc); - - coex_dm->pre_val0x6c0 = coex_dm->cur_val0x6c0; - coex_dm->pre_val0x6c4 = coex_dm->cur_val0x6c4; - coex_dm->pre_val0x6c8 = coex_dm->cur_val0x6c8; - coex_dm->pre_val0x6cc = coex_dm->cur_val0x6cc; -} - -void -halbtc8812a1ant_SetFwIgnoreWlanAct( - PBTC_COEXIST btcoexist, - BOOLEAN enable - ) -{ - u1Byte dataLen=3; - u1Byte buf[5] = {0}; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], %s BT Ignore Wlan_Act\n", - (enable? "Enable":"Disable"))); - - buf[0] = dataLen; - buf[1] = 0x1; // OP_Code - buf[2] = 0x1; // OP_Code_Length - if(enable) - buf[3] = 0x1; // OP_Code_Content - else - buf[3] = 0x0; - - btcoexist->btc_set(btcoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]); -} - -void -halbtc8812a1ant_IgnoreWlanAct( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN enable - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Ignore WlanAct %s\n", - (force_exec? "force to":""), (enable? "ON":"OFF"))); - coex_dm->cur_ignore_wlan_act = enable; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], pre_ignore_wlan_act = %d, cur_ignore_wlan_act = %d!!\n", - coex_dm->pre_ignore_wlan_act, coex_dm->cur_ignore_wlan_act)); - - if(coex_dm->pre_ignore_wlan_act == coex_dm->cur_ignore_wlan_act) - return; - } - halbtc8812a1ant_SetFwIgnoreWlanAct(btcoexist, enable); - - coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act; -} - -void -halbtc8812a1ant_SetFwPstdma( - PBTC_COEXIST btcoexist, - u1Byte byte1, - u1Byte byte2, - u1Byte byte3, - u1Byte byte4, - u1Byte byte5 - ) -{ - u1Byte h2c_parameter[5] ={0}; - - h2c_parameter[0] = byte1; - h2c_parameter[1] = byte2; - h2c_parameter[2] = byte3; - h2c_parameter[3] = byte4; - h2c_parameter[4] = byte5; - - coex_dm->ps_tdma_para[0] = byte1; - coex_dm->ps_tdma_para[1] = byte2; - coex_dm->ps_tdma_para[2] = byte3; - coex_dm->ps_tdma_para[3] = byte4; - coex_dm->ps_tdma_para[4] = byte5; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes)=0x%x%08x\n", - h2c_parameter[0], - h2c_parameter[1]<<24|h2c_parameter[2]<<16|h2c_parameter[3]<<8|h2c_parameter[4])); - - btcoexist->btc_fill_h2c(btcoexist, 0x60, 5, h2c_parameter); -} - -void -halbtc8812a1ant_SetLpsRpwm( - PBTC_COEXIST btcoexist, - u1Byte lps_val, - u1Byte rpwm_val - ) -{ - u1Byte lps=lps_val; - u1Byte rpwm=rpwm_val; - - btcoexist->btc_set(btcoexist, BTC_SET_U1_1ANT_LPS, &lps); - btcoexist->btc_set(btcoexist, BTC_SET_U1_1ANT_RPWM, &rpwm); - - btcoexist->btc_set(btcoexist, BTC_SET_ACT_INC_FORCE_EXEC_PWR_CMD_CNT, NULL); -} - -void -halbtc8812a1ant_LpsRpwm( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - u1Byte lps_val, - u1Byte rpwm_val - ) -{ - BOOLEAN bForceExecPwrCmd=false; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set lps/rpwm=0x%x/0x%x \n", - (force_exec? "force to":""), lps_val, rpwm_val)); - coex_dm->cur_lps = lps_val; - coex_dm->cur_rpwm = rpwm_val; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], pre_lps/cur_lps=0x%x/0x%x, pre_rpwm/cur_rpwm=0x%x/0x%x!!\n", - coex_dm->pre_lps, coex_dm->cur_lps, coex_dm->pre_rpwm, coex_dm->cur_rpwm)); - - if( (coex_dm->pre_lps == coex_dm->cur_lps) && - (coex_dm->pre_rpwm == coex_dm->cur_rpwm) ) - { - return; - } - } - halbtc8812a1ant_SetLpsRpwm(btcoexist, lps_val, rpwm_val); - - coex_dm->pre_lps = coex_dm->cur_lps; - coex_dm->pre_rpwm = coex_dm->cur_rpwm; -} - -void -halbtc8812a1ant_SwMechanism1( - PBTC_COEXIST btcoexist, - BOOLEAN shrink_rx_lpf, - BOOLEAN low_penalty_ra, - BOOLEAN limited_dig, - BOOLEAN bt_lna_constrain - ) -{ - //halbtc8812a1ant_RfShrink(btcoexist, NORMAL_EXEC, shrink_rx_lpf); - //halbtc8812a1ant_LowPenaltyRa(btcoexist, NORMAL_EXEC, low_penalty_ra); - - //no limited DIG - //halbtc8812a1ant_SetBtLnaConstrain(btcoexist, NORMAL_EXEC, bt_lna_constrain); -} - -void -halbtc8812a1ant_SwMechanism2( - PBTC_COEXIST btcoexist, - BOOLEAN agc_table_shift, - BOOLEAN adc_back_off, - BOOLEAN sw_dac_swing, - u4Byte dac_swing_lvl - ) -{ - //halbtc8812a1ant_AgcTable(btcoexist, NORMAL_EXEC, agc_table_shift); - //halbtc8812a1ant_AdcBackOff(btcoexist, NORMAL_EXEC, adc_back_off); - //halbtc8812a1ant_DacSwing(btcoexist, NORMAL_EXEC, sw_dac_swing, dac_swing_lvl); -} - -void -halbtc8812a1ant_PsTdma( - PBTC_COEXIST btcoexist, - BOOLEAN force_exec, - BOOLEAN turn_on, - u1Byte type - ) -{ - BOOLEAN bTurnOnByCnt=false; - u1Byte psTdmaTypeByCnt=0, rssi_adjust_val=0; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn %s PS TDMA, type=%d\n", - (force_exec? "force to":""), (turn_on? "ON":"OFF"), type)); - coex_dm->cur_ps_tdma_on = turn_on; - coex_dm->cur_ps_tdma = type; - - if(!force_exec) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], pre_ps_tdma_on = %d, cur_ps_tdma_on = %d!!\n", - coex_dm->pre_ps_tdma_on, coex_dm->cur_ps_tdma_on)); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], pre_ps_tdma = %d, cur_ps_tdma = %d!!\n", - coex_dm->pre_ps_tdma, coex_dm->cur_ps_tdma)); - - if( (coex_dm->pre_ps_tdma_on == coex_dm->cur_ps_tdma_on) && - (coex_dm->pre_ps_tdma == coex_dm->cur_ps_tdma) ) - return; - } - if(turn_on) - { - switch(type) - { - default: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x58); - break; - case 1: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x48); - rssi_adjust_val = 11; - break; - case 2: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xd3, 0x12, 0x12, 0x0, 0x48); - rssi_adjust_val = 14; - break; - case 3: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x93, 0x25, 0x3, 0x10, 0x40); - break; - case 4: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x93, 0x15, 0x3, 0x14, 0x0); - rssi_adjust_val = 17; - break; - case 5: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x61, 0x15, 0x3, 0x31, 0x0); - break; - case 6: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x13, 0xa, 0x3, 0x0, 0x0); - break; - case 7: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x13, 0xc, 0x5, 0x0, 0x0); - break; - case 8: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x93, 0x25, 0x3, 0x10, 0x0); - break; - case 9: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xd3, 0xa, 0xa, 0x0, 0x48); - rssi_adjust_val = 18; - break; - case 10: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x13, 0xa, 0xa, 0x0, 0x40); - break; - case 11: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xd3, 0x5, 0x5, 0x0, 0x48); - rssi_adjust_val = 20; - break; - case 12: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xeb, 0xa, 0x3, 0x31, 0x18); - break; - - case 15: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x13, 0xa, 0x3, 0x8, 0x0); - break; - case 16: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x93, 0x15, 0x3, 0x10, 0x0); - rssi_adjust_val = 18; - break; - - case 18: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x93, 0x25, 0x3, 0x10, 0x0); - rssi_adjust_val = 14; - break; - - case 20: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x13, 0x25, 0x25, 0x0, 0x0); - break; - case 21: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x93, 0x20, 0x3, 0x10, 0x40); - break; - case 22: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x13, 0x8, 0x8, 0x0, 0x40); - break; - case 23: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xe3, 0x25, 0x3, 0x31, 0x18); - rssi_adjust_val = 22; - break; - case 24: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xe3, 0x15, 0x3, 0x31, 0x18); - rssi_adjust_val = 22; - break; - case 25: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xe3, 0xa, 0x3, 0x31, 0x18); - rssi_adjust_val = 22; - break; - case 26: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xe3, 0xa, 0x3, 0x31, 0x18); - rssi_adjust_val = 22; - break; - case 27: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xe3, 0x25, 0x3, 0x31, 0x98); - rssi_adjust_val = 22; - break; - case 28: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x69, 0x25, 0x3, 0x31, 0x0); - break; - case 29: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xab, 0x1a, 0x1a, 0x1, 0x8); - break; - case 30: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x93, 0x15, 0x3, 0x14, 0x0); - break; - case 31: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xd3, 0x1a, 0x1a, 0, 0x58); - break; - case 32: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xab, 0xa, 0x3, 0x31, 0x88); - break; - case 33: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xa3, 0x25, 0x3, 0x30, 0x88); - break; - case 34: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xd3, 0x1a, 0x1a, 0x0, 0x8); - break; - case 35: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xe3, 0x1a, 0x1a, 0x0, 0x8); - break; - case 36: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0xd3, 0x12, 0x3, 0x14, 0x58); - break; - } - } - else - { - // disable PS tdma - switch(type) - { - case 8: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x8, 0x0, 0x0, 0x0, 0x0); - btcoexist->btc_write_1byte(btcoexist, 0x92c, 0x4); - break; - case 0: - default: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x0, 0x0, 0x0, 0x0, 0x0); - delay_ms(5); - btcoexist->btc_write_1byte(btcoexist, 0x92c, 0x20); - break; - case 9: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x0, 0x0, 0x0, 0x0, 0x0); - btcoexist->btc_write_1byte(btcoexist, 0x92c, 0x4); - break; - case 10: - halbtc8812a1ant_SetFwPstdma(btcoexist, 0x0, 0x0, 0x0, 0x8, 0x0); - delay_ms(5); - btcoexist->btc_write_1byte(btcoexist, 0x92c, 0x20); - break; - } - } - rssi_adjust_val =0; - btcoexist->btc_set(btcoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE, &rssi_adjust_val); - - // update pre state - coex_dm->pre_ps_tdma_on = coex_dm->cur_ps_tdma_on; - coex_dm->pre_ps_tdma = coex_dm->cur_ps_tdma; -} - -void -halbtc8812a1ant_CoexAllOff( - PBTC_COEXIST btcoexist - ) -{ - // fw all off - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - // sw all off - halbtc8812a1ant_SwMechanism1(btcoexist,false,false,false,false); - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - - - // hw all off - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); -} - -void -halbtc8812a1ant_WifiParaAdjust( - PBTC_COEXIST btcoexist, - BOOLEAN enable - ) -{ - if(enable) - { - halbtc8812a1ant_LowPenaltyRa(btcoexist, NORMAL_EXEC, true); - } - else - { - halbtc8812a1ant_LowPenaltyRa(btcoexist, NORMAL_EXEC, false); - } -} - -BOOLEAN -halbtc8812a1ant_IsCommonAction( - PBTC_COEXIST btcoexist - ) -{ - BOOLEAN common=false, wifi_connected=false, wifi_busy=false; - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); - - //halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - - if(!wifi_connected && - BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == coex_dm->bt_status) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT non connected-idle!!\n")); - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - halbtc8812a1ant_SwMechanism1(btcoexist,false,false,false,false); - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - - common = true; - } - else if(wifi_connected && - (BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == coex_dm->bt_status) ) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT non connected-idle!!\n")); - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - - halbtc8812a1ant_SwMechanism1(btcoexist,false,false,false,false); - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - - common = true; - } - else if(!wifi_connected && - (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status) ) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT connected-idle!!\n")); - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - halbtc8812a1ant_SwMechanism1(btcoexist,false,false,false,false); - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - - common = true; - } - else if(wifi_connected && - (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status) ) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n")); - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - halbtc8812a1ant_SwMechanism1(btcoexist,true,true,true,true); - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - - common = true; - } - else if(!wifi_connected && - (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE != coex_dm->bt_status) ) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi non connected-idle + BT Busy!!\n")); - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - halbtc8812a1ant_SwMechanism1(btcoexist,false,false,false,false); - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - - common = true; - } - else - { - halbtc8812a1ant_SwMechanism1(btcoexist,true,true,true,true); - - common = false; - } - - return common; -} - - -void -halbtc8812a1ant_TdmaDurationAdjustForAcl( - PBTC_COEXIST btcoexist - ) -{ - static s4Byte up,dn,m,n,wait_count; - s4Byte result; //0: no change, +1: increase WiFi duration, -1: decrease WiFi duration - u1Byte retry_count=0, bt_info_ext; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], halbtc8812a1ant_TdmaDurationAdjustForAcl()\n")); - if(coex_dm->reset_tdma_adjust) - { - coex_dm->reset_tdma_adjust = false; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n")); - - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - coex_dm->ps_tdma_du_adj_type = 2; - //============ - up = 0; - dn = 0; - m = 1; - n= 3; - result = 0; - wait_count = 0; - } - else - { - //accquire the BT TRx retry count from BT_Info byte2 - retry_count = coex_sta->bt_retry_cnt; - bt_info_ext = coex_sta->bt_info_ext; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retry_count = %d\n", retry_count)); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, wait_count=%d\n", - up, dn, m, n, wait_count)); - result = 0; - wait_count++; - - if(retry_count == 0) // no retry in the last 2-second duration - { - up++; - dn--; - - if (dn <= 0) - dn = 0; - - if(up >= n) // if �s� n ����etry count��0, �h�ռeWiFi duration - { - wait_count = 0; - n = 3; - up = 0; - dn = 0; - result = 1; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Increase wifi duration!!\n")); - } - } - else if (retry_count <= 3) // <=3 retry in the last 2-second duration - { - up--; - dn++; - - if (up <= 0) - up = 0; - - if (dn == 2) // if �s� 2 ����etry count< 3, �h�կ�WiFi duration - { - if (wait_count <= 2) - m++; // ��K�@���b��level���Ӧ^ - else - m = 1; - - if ( m >= 20) //m �̤j��= 20 ' �̤j120��echeck�O�_�վ�iFi duration. - m = 20; - - n = 3*m; - up = 0; - dn = 0; - wait_count = 0; - result = -1; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter<3!!\n")); - } - } - else //retry count > 3, �u�n1�� retry count > 3, �h�կ�WiFi duration - { - if (wait_count == 1) - m++; // ��K�@���b��level���Ӧ^ - else - m = 1; - - if ( m >= 20) //m �̤j��= 20 ' �̤j120��echeck�O�_�վ�iFi duration. - m = 20; - - n = 3*m; - up = 0; - dn = 0; - wait_count = 0; - result = -1; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter>3!!\n")); - } - - if(result == -1) - { - if( (BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(bt_info_ext)) && - ((coex_dm->cur_ps_tdma == 1) ||(coex_dm->cur_ps_tdma == 2)) ) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 9); - coex_dm->ps_tdma_du_adj_type = 9; - } - else if(coex_dm->cur_ps_tdma == 1) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - coex_dm->ps_tdma_du_adj_type = 2; - } - else if(coex_dm->cur_ps_tdma == 2) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 9); - coex_dm->ps_tdma_du_adj_type = 9; - } - else if(coex_dm->cur_ps_tdma == 9) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 11); - coex_dm->ps_tdma_du_adj_type = 11; - } - } - else if(result == 1) - { - if( (BT_INFO_8812A_1ANT_A2DP_BASIC_RATE(bt_info_ext)) && - ((coex_dm->cur_ps_tdma == 1) ||(coex_dm->cur_ps_tdma == 2)) ) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 9); - coex_dm->ps_tdma_du_adj_type = 9; - } - else if(coex_dm->cur_ps_tdma == 11) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 9); - coex_dm->ps_tdma_du_adj_type = 9; - } - else if(coex_dm->cur_ps_tdma == 9) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - coex_dm->ps_tdma_du_adj_type = 2; - } - else if(coex_dm->cur_ps_tdma == 2) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 1); - coex_dm->ps_tdma_du_adj_type = 1; - } - } - - if( coex_dm->cur_ps_tdma != 1 && - coex_dm->cur_ps_tdma != 2 && - coex_dm->cur_ps_tdma != 9 && - coex_dm->cur_ps_tdma != 11 ) - { - // recover to previous adjust type - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, coex_dm->ps_tdma_du_adj_type); - } - } -} - -u1Byte -halbtc8812a1ant_PsTdmaTypeByWifiRssi( - s4Byte wifi_rssi, - s4Byte pre_wifi_rssi, - u1Byte wifi_rssi_thresh - ) -{ - u1Byte ps_tdma_type=0; - - if(wifi_rssi > pre_wifi_rssi) - { - if(wifi_rssi > (wifi_rssi_thresh+5)) - { - ps_tdma_type = 26; - } - else - { - ps_tdma_type = 25; - } - } - else - { - if(wifi_rssi > wifi_rssi_thresh) - { - ps_tdma_type = 26; - } - else - { - ps_tdma_type = 25; - } - } - - return ps_tdma_type; -} - -void -halbtc8812a1ant_PsTdmaCheckForPowerSaveState( - PBTC_COEXIST btcoexist, - BOOLEAN new_ps_state - ) -{ - u1Byte lps_mode=0x0; - - btcoexist->btc_get(btcoexist, BTC_GET_U1_LPS_MODE, &lps_mode); - - if(lps_mode) // already under LPS state - { - if(new_ps_state) - { - // keep state under LPS, do nothing. - } - else - { - // will leave LPS state, turn off psTdma first - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 0); - } - } - else // NO PS state - { - if(new_ps_state) - { - // will enter LPS state, turn off psTdma first - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 0); - } - else - { - // keep state under NO PS state, do nothing. - } - } -} - -// SCO only or SCO+PAN(HS) -void -halbtc8812a1ant_ActionSco( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state; - u4Byte wifi_bw; - - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 4); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - - -void -halbtc8812a1ant_ActionHid( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state; - u4Byte wifi_bw; - - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,false,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - -//A2DP only / PAN(EDR) only/ A2DP+PAN(HS) -void -halbtc8812a1ant_ActionA2dp( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state; - u4Byte wifi_bw; - - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - -void -halbtc8812a1ant_ActionA2dpPanHs( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state, bt_info_ext; - u4Byte wifi_bw; - - bt_info_ext = coex_sta->bt_info_ext; - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - -void -halbtc8812a1ant_ActionPanEdr( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state; - u4Byte wifi_bw; - - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - - -//PAN(HS) only -void -halbtc8812a1ant_ActionPanHs( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state; - u4Byte wifi_bw; - - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // fw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - } - else - { - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - } - - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // fw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - } - else - { - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - } - - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - -//PAN(EDR)+A2DP -void -halbtc8812a1ant_ActionPanEdrA2dp( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state, bt_info_ext; - u4Byte wifi_bw; - - bt_info_ext = coex_sta->bt_info_ext; - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - -void -halbtc8812a1ant_ActionPanEdrHid( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state; - u4Byte wifi_bw; - - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - -// HID+A2DP+PAN(EDR) -void -halbtc8812a1ant_ActionHidA2dpPanEdr( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state, bt_info_ext; - u4Byte wifi_bw; - - bt_info_ext = coex_sta->bt_info_ext; - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, NORMAL_EXEC, 6); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - -void -halbtc8812a1ant_ActionHidA2dp( - PBTC_COEXIST btcoexist - ) -{ - u1Byte wifi_rssi_state, bt_rssi_state, bt_info_ext; - u4Byte wifi_bw; - - bt_info_ext = coex_sta->bt_info_ext; - wifi_rssi_state = halbtc8812a1ant_WifiRssiState(btcoexist, 0, 2, 25, 0); - bt_rssi_state = halbtc8812a1ant_BtRssiState(2, 50, 0); - - if(halbtc8812a1ant_NeedToDecBtPwr(btcoexist)) - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, true); - else - halbtc8812a1ant_DecBtPwr(btcoexist, NORMAL_EXEC, false); - - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - - if(BTC_WIFI_BW_HT40 == wifi_bw) - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,true,false,0x18); - } - } - else - { - // sw mechanism - if( (wifi_rssi_state == BTC_RSSI_STATE_HIGH) || - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH) ) - { - halbtc8812a1ant_SwMechanism2(btcoexist,true,true,false,0x18); - } - else - { - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - } - } -} - -void -halbtc8812a1ant_ActionHs( - PBTC_COEXIST btcoexist, - BOOLEAN hs_connecting - ) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action for HS, hs_connecting=%d!!!\n", hs_connecting)); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 8); - - if(hs_connecting) - { - halbtc8812a1ant_CoexTable(btcoexist, FORCE_EXEC, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff, 0x3); - } - else - { - if((coex_sta->high_priority_tx+coex_sta->high_priority_rx+ - coex_sta->low_priority_tx+coex_sta->low_priority_rx)<=1200) - halbtc8812a1ant_CoexTable(btcoexist, FORCE_EXEC, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff, 0x3); - else - halbtc8812a1ant_CoexTable(btcoexist, FORCE_EXEC, 0xffffffff, 0xffffffff, 0xffff, 0x3); - } -} - - -void -halbtc8812a1ant_ActionWifiNotConnected( - PBTC_COEXIST btcoexist - ) -{ - BOOLEAN hs_connecting=false; - - btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_CONNECTING, &hs_connecting); - - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - - if(hs_connecting) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HS is connecting!!!\n")); - halbtc8812a1ant_ActionHs(btcoexist, hs_connecting); - } - else - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 8); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } -} - -void -halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan( - PBTC_COEXIST btcoexist - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - BOOLEAN hs_connecting=false; - - btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_CONNECTING, &hs_connecting); - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - - if(hs_connecting) - { - halbtc8812a1ant_ActionHs(btcoexist, hs_connecting); - } - else if(btcoexist->bt_info.bt_disabled) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else if(BT_8812A_1ANT_BT_STATUS_INQ_PAGE == coex_dm->bt_status) -{ - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 30); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else if( (BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status) ) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 28); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) - { - if(stack_info->hid_exist) - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 35); - else - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 29); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status) ) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 8); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3); - } - else - { - //error condition, should not reach here, record error number for debugging. - coex_dm->error_condition = 1; - } -} - -void -halbtc8812a1ant_ActionWifiConnectedScan( - PBTC_COEXIST btcoexist - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ActionConnectedScan()===>\n")); - - if(btcoexist->bt_info.bt_disabled) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x0, 0x4); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - - // psTdma - if(BT_8812A_1ANT_BT_STATUS_INQ_PAGE == coex_dm->bt_status) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ActionConnectedScan(), bt is under inquiry/page scan\n")); - if(stack_info->sco_exist) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 32); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 30); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - } - else if( (BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status) ) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 5); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) - { - if(stack_info->hid_exist) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 34); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 4); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - } - else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status) ) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 33); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else - { - //error condition, should not reach here - coex_dm->error_condition = 2; - } - } - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ActionConnectedScan()<===\n")); -} - -void -halbtc8812a1ant_ActionWifiConnectedSpecialPacket( - PBTC_COEXIST btcoexist - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - - if(btcoexist->bt_info.bt_disabled) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else - { - if(BT_8812A_1ANT_BT_STATUS_INQ_PAGE == coex_dm->bt_status) - { - if(stack_info->sco_exist) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 32); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 30); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - } - else if( (BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status) ) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 28); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) - { - if(stack_info->hid_exist) - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 35); - else - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 29); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status) ) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 8); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3); - } - else - { - //error condition, should not reach here - coex_dm->error_condition = 3; - } - } -} - -void -halbtc8812a1ant_ActionWifiConnected( - PBTC_COEXIST btcoexist - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - BOOLEAN wifi_connected=false, wifi_busy=false, bt_hs_on=false; - BOOLEAN scan=false, link=false, roam=false; - BOOLEAN hs_connecting=false, under4way=false; - u4Byte wifi_bw; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()===>\n")); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected); - if(!wifi_connected) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi not connected<===\n")); - return; - } - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &under4way); - if(under4way) - { - halbtc8812a1ant_ActionWifiConnectedSpecialPacket(btcoexist); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under 4way<===\n")); - return; - } - - btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_CONNECTING, &hs_connecting); - btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); - if(scan || link || roam) - { - halbtc8812a1ant_ActionWifiConnectedScan(btcoexist); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect(), return for wifi is under scan<===\n")); - return; - } - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); - if(!wifi_busy) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi associated-idle!!!\n")); - if(btcoexist->bt_info.bt_disabled) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x0, 0x4); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else - { - if(BT_8812A_1ANT_BT_STATUS_INQ_PAGE == coex_dm->bt_status) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], bt is under inquiry/page scan!!!\n")); - if(stack_info->sco_exist) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 32); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x0, 0x4); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 30); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - } - else if(BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == coex_dm->bt_status) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x26, 0x0); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else if(BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x26, 0x0); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 0); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) - { - if(stack_info->hid_exist && stack_info->numOfLink==1) - { - // hid only - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 8); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x5fff5fff, 0x5fff5fff, 0xffff, 0x3); - coex_dm->reset_tdma_adjust = true; - } - else - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x0, 0x4); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - - if(stack_info->hid_exist) - { - if(stack_info->a2dp_exist) - { - // hid+a2dp - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else if(stack_info->pan_exist) - { - if(bt_hs_on) - { - // hid+hs - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - } - else - { - // hid+pan - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - } - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else - { - coex_dm->error_condition = 4; - } - coex_dm->reset_tdma_adjust = true; - } - else if(stack_info->a2dp_exist) - { - if(stack_info->pan_exist) - { - if(bt_hs_on) - { - // a2dp+hs - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - } - else - { - // a2dp+pan - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 36); - } - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - coex_dm->reset_tdma_adjust = true; - } - else - { - // a2dp only - halbtc8812a1ant_TdmaDurationAdjustForAcl(btcoexist); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - } - else if(stack_info->pan_exist) - { - // pan only - if(bt_hs_on) - { - coex_dm->error_condition = 5; - } - else - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - coex_dm->reset_tdma_adjust = true; - } - else - { - // temp state, do nothing!!! - //DbgPrint("error 6, coex_dm->bt_status=%d\n", coex_dm->bt_status); - //DbgPrint("error 6, stack_info->numOfLink=%d, stack_info->hid_exist=%d, stack_info->a2dp_exist=%d, stack_info->pan_exist=%d, stack_info->sco_exist=%d\n", - //stack_info->numOfLink, stack_info->hid_exist, stack_info->a2dp_exist, stack_info->pan_exist, stack_info->sco_exist); - //coex_dm->error_condition = 6; - } - } - } - else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status) ) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 8); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3); - } - else - { - //error condition, should not reach here - coex_dm->error_condition = 7; - } - } - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi busy!!!\n")); - if(btcoexist->bt_info.bt_disabled) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else - { - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HS is under progress!!!\n")); - //DbgPrint("coex_dm->bt_status = 0x%x\n", coex_dm->bt_status); - halbtc8812a1ant_ActionHs(btcoexist, hs_connecting); - } - else if(BT_8812A_1ANT_BT_STATUS_INQ_PAGE == coex_dm->bt_status) - { - if(stack_info->sco_exist) - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 32); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x0, 0x4); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 30); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - } - else if(BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == coex_dm->bt_status) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 5); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3); - } - else if(BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - if(bt_hs_on) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HS is under progress!!!\n")); - halbtc8812a1ant_ActionHs(btcoexist, hs_connecting); - } - else - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 5); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3); - } - } - else if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) - { - if(stack_info->hid_exist && stack_info->numOfLink==1) - { - // hid only - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 8); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x5fff5fff, 0x5fff5fff, 0xffff, 0x3); - coex_dm->reset_tdma_adjust = true; - } - else - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x0, 0x4); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - - if(stack_info->hid_exist) - { - if(stack_info->a2dp_exist) - { - // hid+a2dp - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else if(stack_info->pan_exist) - { - if(bt_hs_on) - { - // hid+hs - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - } - else - { - // hid+pan - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - } - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - else - { - coex_dm->error_condition = 8; - } - coex_dm->reset_tdma_adjust = true; - } - else if(stack_info->a2dp_exist) - { - if(stack_info->pan_exist) - { - if(bt_hs_on) - { - // a2dp+hs - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - } - else - { - // a2dp+pan - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 36); - } - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - coex_dm->reset_tdma_adjust = true; - } - else - { - // a2dp only - halbtc8812a1ant_TdmaDurationAdjustForAcl(btcoexist); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - } - else if(stack_info->pan_exist) - { - // pan only - if(bt_hs_on) - { - coex_dm->error_condition = 9; - } - else - { - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, true, 2); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x5afa5afa, 0xffff, 0x3); - } - coex_dm->reset_tdma_adjust = true; - } - else - { - //DbgPrint("error 10, stack_info->numOfLink=%d, stack_info->hid_exist=%d, stack_info->a2dp_exist=%d, stack_info->pan_exist=%d, stack_info->sco_exist=%d\n", - //stack_info->numOfLink, stack_info->hid_exist, stack_info->a2dp_exist, stack_info->pan_exist, stack_info->sco_exist); - coex_dm->error_condition = 10; - } - } - } - else if( (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status) ) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 8); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3); - } - else - { - //DbgPrint("error 11, coex_dm->bt_status=%d\n", coex_dm->bt_status); - //DbgPrint("error 11, stack_info->numOfLink=%d, stack_info->hid_exist=%d, stack_info->a2dp_exist=%d, stack_info->pan_exist=%d, stack_info->sco_exist=%d\n", - //stack_info->numOfLink, stack_info->hid_exist, stack_info->a2dp_exist, stack_info->pan_exist, stack_info->sco_exist); - //error condition, should not reach here - coex_dm->error_condition = 11; - } - } - } - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], CoexForWifiConnect()<===\n")); -} - -void -halbtc8812a1ant_RunSwCoexistMechanism( - PBTC_COEXIST btcoexist - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - BOOLEAN wifi_under5g=false, wifi_busy=false, wifi_connected=false; - u1Byte bt_info_original=0, bt_retry_cnt=0; - u1Byte algorithm=0; - - return; - if(stack_info->bProfileNotified) - { - algorithm = halbtc8812a1ant_ActionAlgorithm(btcoexist); - coex_dm->cur_algorithm = algorithm; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d \n", coex_dm->cur_algorithm)); - - if(halbtc8812a1ant_IsCommonAction(btcoexist)) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action common.\n")); - } - else - { - switch(coex_dm->cur_algorithm) - { - case BT_8812A_1ANT_COEX_ALGO_SCO: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = SCO.\n")); - halbtc8812a1ant_ActionSco(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_HID: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID.\n")); - halbtc8812a1ant_ActionHid(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_A2DP: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP.\n")); - halbtc8812a1ant_ActionA2dp(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_A2DP_PANHS: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = A2DP+PAN(HS).\n")); - halbtc8812a1ant_ActionA2dpPanHs(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_PANEDR: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR).\n")); - halbtc8812a1ant_ActionPanEdr(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_PANHS: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HS mode.\n")); - halbtc8812a1ant_ActionPanHs(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_PANEDR_A2DP: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN+A2DP.\n")); - halbtc8812a1ant_ActionPanEdrA2dp(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_PANEDR_HID: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = PAN(EDR)+HID.\n")); - halbtc8812a1ant_ActionPanEdrHid(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_HID_A2DP_PANEDR: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP+PAN.\n")); - halbtc8812a1ant_ActionHidA2dpPanEdr(btcoexist); - break; - case BT_8812A_1ANT_COEX_ALGO_HID_A2DP: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = HID+A2DP.\n")); - halbtc8812a1ant_ActionHidA2dp(btcoexist); - break; - default: - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action algorithm = coexist All Off!!\n")); - halbtc8812a1ant_CoexAllOff(btcoexist); - break; - } - coex_dm->pre_algorithm = coex_dm->cur_algorithm; - } - } -} - -void -halbtc8812a1ant_RunCoexistMechanism( - PBTC_COEXIST btcoexist - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - BOOLEAN wifi_under5g=false, wifi_busy=false, wifi_connected=false; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()===>\n")); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under5g); - - if(wifi_under5g) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for 5G <===\n")); - return; - } - - if(btcoexist->manual_control) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n")); - return; - } - - if(btcoexist->stop_coex_dm) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Stop Coex DM <===\n")); - return; - } - - halbtc8812a1ant_RunSwCoexistMechanism(btcoexist); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected); - if(btcoexist->bt_info.bt_disabled) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], bt is disabled!!!\n")); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); - if(wifi_busy) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - } - else - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, true); - halbtc8812a1ant_LpsRpwm(btcoexist, NORMAL_EXEC, 0x0, 0x4); - // power save must executed before psTdma. - btcoexist->btc_set(btcoexist, BTC_SET_ACT_ENTER_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - } - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - } - else if(coex_sta->under_ips) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n")); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 0); - halbtc8812a1ant_CoexTable(btcoexist, NORMAL_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); - halbtc8812a1ant_WifiParaAdjust(btcoexist, false); - } - else if(!wifi_connected) - { - BOOLEAN scan=false, link=false, roam=false; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is non connected-idle !!!\n")); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); - - if(scan || link || roam) - halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(btcoexist); - else - halbtc8812a1ant_ActionWifiNotConnected(btcoexist); - } - else // wifi LPS/Busy - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is NOT under IPS!!!\n")); - halbtc8812a1ant_WifiParaAdjust(btcoexist, true); - halbtc8812a1ant_ActionWifiConnected(btcoexist); - } - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism()<===\n")); -} - -void -halbtc8812a1ant_InitCoexDm( - PBTC_COEXIST btcoexist - ) -{ - BOOLEAN wifi_connected=false; - // force to reset coex mechanism - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected); - if(!wifi_connected) // non-connected scan - { - halbtc8812a1ant_ActionWifiNotConnected(btcoexist); - } - else // wifi is connected - { - halbtc8812a1ant_ActionWifiConnected(btcoexist); - } - - halbtc8812a1ant_FwDacSwingLvl(btcoexist, FORCE_EXEC, 6); - halbtc8812a1ant_DecBtPwr(btcoexist, FORCE_EXEC, false); - - // sw all off - halbtc8812a1ant_SwMechanism1(btcoexist,false,false,false,false); - halbtc8812a1ant_SwMechanism2(btcoexist,false,false,false,0x18); - - halbtc8812a1ant_CoexTable(btcoexist, FORCE_EXEC, 0x55555555, 0x55555555, 0xffff, 0x3); -} - -//============================================================ -// work around function start with wa_halbtc8812a1ant_ -//============================================================ -//============================================================ -// extern function start with EXhalbtc8812a1ant_ -//============================================================ -void -EXhalbtc8812a1ant_InitHwConfig( - PBTC_COEXIST btcoexist - ) -{ - u4Byte u4_tmp=0; - u2Byte u2Tmp=0; - u1Byte u1_tmp=0; - - BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], 1Ant Init HW Config!!\n")); - - // backup rf 0x1e value - coex_dm->bt_rf0x1e_backup = - btcoexist->btc_get_rf_reg(btcoexist, BTC_RF_A, 0x1e, 0xfffff); - - //ant sw control to BT - btcoexist->btc_write_4byte(btcoexist, 0x900, 0x00000400); - btcoexist->btc_write_1byte(btcoexist, 0x76d, 0x1); - btcoexist->btc_write_1byte(btcoexist, 0xcb3, 0x77); - btcoexist->btc_write_1byte(btcoexist, 0xcb7, 0x40); - - // 0x790[5:0]=0x5 - u1_tmp = btcoexist->btc_read_1byte(btcoexist, 0x790); - u1_tmp &= 0xc0; - u1_tmp |= 0x5; - btcoexist->btc_write_1byte(btcoexist, 0x790, u1_tmp); - - // PTA parameter - btcoexist->btc_write_1byte(btcoexist, 0x6cc, 0x0); - btcoexist->btc_write_4byte(btcoexist, 0x6c8, 0xffff); - btcoexist->btc_write_4byte(btcoexist, 0x6c4, 0x55555555); - btcoexist->btc_write_4byte(btcoexist, 0x6c0, 0x55555555); - - // coex parameters - btcoexist->btc_write_1byte(btcoexist, 0x778, 0x1); - - // enable counter statistics - btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); - - // enable PTA - btcoexist->btc_write_1byte(btcoexist, 0x40, 0x20); - - // bt clock related - u1_tmp = btcoexist->btc_read_1byte(btcoexist, 0x4); - u1_tmp |= BIT7; - btcoexist->btc_write_1byte(btcoexist, 0x4, u1_tmp); - - // bt clock related - u1_tmp = btcoexist->btc_read_1byte(btcoexist, 0x7); - u1_tmp |= BIT1; - btcoexist->btc_write_1byte(btcoexist, 0x7, u1_tmp); -} - -void -EXhalbtc8812a1ant_InitCoexDm( - PBTC_COEXIST btcoexist - ) -{ - BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n")); - - btcoexist->stop_coex_dm = false; - - halbtc8812a1ant_InitCoexDm(btcoexist); -} - -void -EXhalbtc8812a1ant_DisplayCoexInfo( - PBTC_COEXIST btcoexist - ) -{ - PBTC_BOARD_INFO board_info=&btcoexist->boardInfo; - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - pu1Byte cli_buf=btcoexist->cli_buf; - u1Byte u1_tmp[4], i, bt_info_ext, psTdmaCase=0; - u4Byte u4_tmp[4]; - BOOLEAN roam=false, scan=false, link=false, wifi_under5g=false; - BOOLEAN bt_hs_on=false, wifi_busy=false; - s4Byte wifi_rssi=0, bt_hs_rssi=0; - u4Byte wifi_bw, wifiTrafficDir; - u1Byte wifiDot11Chnl, wifiHsChnl; - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); - CL_PRINTF(cli_buf); - - if(btcoexist->manual_control) - { - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============"); - CL_PRINTF(cli_buf); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n =========================================="); - CL_PRINTF(cli_buf); - } - if(btcoexist->stop_coex_dm) - { - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n ============[Coex is STOPPED]============"); - CL_PRINTF(cli_buf); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n =========================================="); - CL_PRINTF(cli_buf); - } - - if(!board_info->bBtExist) - { - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n BT not exists !!!"); - CL_PRINTF(cli_buf); - return; - } - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ - board_info->pgAntNum, board_info->btdmAntNum); - CL_PRINTF(cli_buf); - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \ - ((stack_info->bProfileNotified)? "Yes":"No"), stack_info->hciVersion); - CL_PRINTF(cli_buf); - btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_BT_FW_VER); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on); - btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_DOT11_CHNL, &wifiDot11Chnl); - btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_HS_CHNL, &wifiHsChnl); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d(%d)", "Dot11 channel / HsChnl(HsMode)", \ - wifiDot11Chnl, wifiHsChnl, bt_hs_on); - CL_PRINTF(cli_buf); - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x ", "H2C Wifi inform bt chnl Info", \ - coex_dm->wifi_chnl_info[0], coex_dm->wifi_chnl_info[1], - coex_dm->wifi_chnl_info[2]); - CL_PRINTF(cli_buf); - - btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi); - btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "Wifi rssi/ HS rssi", \ - wifi_rssi, bt_hs_rssi); - CL_PRINTF(cli_buf); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d ", "Wifi link/ roam/ scan", \ - link, roam, scan); - CL_PRINTF(cli_buf); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under5g); - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %s/ %s ", "Wifi status", \ - (wifi_under5g? "5G":"2.4G"), - ((BTC_WIFI_BW_LEGACY==wifi_bw)? "Legacy": (((BTC_WIFI_BW_HT40==wifi_bw)? "HT40":"HT20"))), - ((!wifi_busy)? "idle": ((BTC_WIFI_TRAFFIC_TX==wifiTrafficDir)? "uplink":"downlink"))); - CL_PRINTF(cli_buf); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \ - ((coex_sta->c2h_bt_inquiry_page)?("inquiry/page scan"):((BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE == coex_dm->bt_status)? "non-connected idle": - ( (BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE == coex_dm->bt_status)? "connected-idle":"busy"))), - coex_sta->bt_rssi, coex_sta->bt_retry_cnt); - CL_PRINTF(cli_buf); - - if(stack_info->bProfileNotified) - { - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", \ - stack_info->sco_exist, stack_info->hid_exist, stack_info->pan_exist, stack_info->a2dp_exist); - CL_PRINTF(cli_buf); - - btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_BT_LINK_INFO); - } - - bt_info_ext = coex_sta->bt_info_ext; - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "BT Info A2DP rate", \ - (bt_info_ext&BIT0)? "Basic rate":"EDR rate"); - CL_PRINTF(cli_buf); - - for(i=0; i<BT_INFO_SRC_8812A_1ANT_MAX; i++) - { - if(coex_sta->bt_info_c2h_cnt[i]) - { - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8812a1Ant[i], \ - coex_sta->bt_info_c2h[i][0], coex_sta->bt_info_c2h[i][1], - coex_sta->bt_info_c2h[i][2], coex_sta->bt_info_c2h[i][3], - coex_sta->bt_info_c2h[i][4], coex_sta->bt_info_c2h[i][5], - coex_sta->bt_info_c2h[i][6], coex_sta->bt_info_c2h_cnt[i]); - CL_PRINTF(cli_buf); - } - } - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/%s, (0x%x/0x%x)", "PS state, IPS/LPS, (lps/rpwm)", \ - ((coex_sta->under_ips? "IPS ON":"IPS OFF")), - ((coex_sta->under_lps? "LPS ON":"LPS OFF")), - btcoexist->bt_info.lps1Ant, - btcoexist->bt_info.rpwm1Ant); - CL_PRINTF(cli_buf); - btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD); - - if(!btcoexist->manual_control) - { - // Sw mechanism - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw mechanism]============"); - CL_PRINTF(cli_buf); - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d/ %d ", "SM1[ShRf/ LpRA/ LimDig/ btLna]", \ - coex_dm->cur_rf_rx_lpf_shrink, coex_dm->cur_low_penalty_ra, coex_dm->limited_dig, coex_dm->bCurBtLnaConstrain); - CL_PRINTF(cli_buf); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d(0x%x) ", "SM2[AgcT/ AdcB/ SwDacSwing(lvl)]", \ - coex_dm->cur_agc_table_en, coex_dm->cur_adc_back_off, coex_dm->cur_dac_swing_on, coex_dm->cur_dac_swing_lvl); - CL_PRINTF(cli_buf); - - // Fw mechanism - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Fw mechanism]============"); - CL_PRINTF(cli_buf); - - psTdmaCase = coex_dm->cur_ps_tdma; - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d", "PS TDMA", \ - coex_dm->ps_tdma_para[0], coex_dm->ps_tdma_para[1], - coex_dm->ps_tdma_para[2], coex_dm->ps_tdma_para[3], - coex_dm->ps_tdma_para[4], psTdmaCase); - CL_PRINTF(cli_buf); - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x ", "Latest error condition(should be 0)", \ - coex_dm->error_condition); - CL_PRINTF(cli_buf); - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \ - coex_dm->cur_dec_bt_pwr, coex_dm->cur_ignore_wlan_act); - CL_PRINTF(cli_buf); - } - - // Hw setting - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============"); - CL_PRINTF(cli_buf); - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "RF-A, 0x1e initVal", \ - coex_dm->bt_rf0x1e_backup); - CL_PRINTF(cli_buf); - - u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x778); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0x778", \ - u1_tmp[0]); - CL_PRINTF(cli_buf); - - u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x92c); - u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x930); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x92c/ 0x930", \ - (u1_tmp[0]), u4_tmp[0]); - CL_PRINTF(cli_buf); - - u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x40); - u1_tmp[1] = btcoexist->btc_read_1byte(btcoexist, 0x4f); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x40/ 0x4f", \ - u1_tmp[0], u1_tmp[1]); - CL_PRINTF(cli_buf); - - u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x550); - u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x522); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522", \ - u4_tmp[0], u1_tmp[0]); - CL_PRINTF(cli_buf); - - u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xc50); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "0xc50(dig)", \ - u4_tmp[0]); - CL_PRINTF(cli_buf); - -#if 0 - u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0xf48); - u4_tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0xf4c); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xf48/ 0xf4c (FA cnt)", \ - u4_tmp[0], u4_tmp[1]); - CL_PRINTF(cli_buf); -#endif - - u4_tmp[0] = btcoexist->btc_read_4byte(btcoexist, 0x6c0); - u4_tmp[1] = btcoexist->btc_read_4byte(btcoexist, 0x6c4); - u4_tmp[2] = btcoexist->btc_read_4byte(btcoexist, 0x6c8); - u1_tmp[0] = btcoexist->btc_read_1byte(btcoexist, 0x6cc); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \ - u4_tmp[0], u4_tmp[1], u4_tmp[2], u1_tmp[0]); - CL_PRINTF(cli_buf); - - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(hp rx[31:16]/tx[15:0])", \ - coex_sta->high_priority_rx, coex_sta->high_priority_tx); - CL_PRINTF(cli_buf); - CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(lp rx[31:16]/tx[15:0])", \ - coex_sta->low_priority_rx, coex_sta->low_priority_tx); - CL_PRINTF(cli_buf); - - btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS); -} - - -void -EXhalbtc8812a1ant_IpsNotify( - PBTC_COEXIST btcoexist, - u1Byte type - ) -{ - u4Byte u4_tmp=0; - - if(btcoexist->manual_control || btcoexist->stop_coex_dm) - return; - - if(BTC_IPS_ENTER == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n")); - coex_sta->under_ips = true; - - // 0x4c[23]=1 - u4_tmp = btcoexist->btc_read_4byte(btcoexist, 0x4c); - u4_tmp |= BIT23; - btcoexist->btc_write_4byte(btcoexist, 0x4c, u4_tmp); - - halbtc8812a1ant_CoexAllOff(btcoexist); - } - else if(BTC_IPS_LEAVE == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n")); - coex_sta->under_ips = false; - //halbtc8812a1ant_InitCoexDm(btcoexist); - } -} - -void -EXhalbtc8812a1ant_LpsNotify( - PBTC_COEXIST btcoexist, - u1Byte type - ) -{ - if(btcoexist->manual_control || btcoexist->stop_coex_dm) - return; - - if(BTC_LPS_ENABLE == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS ENABLE notify\n")); - coex_sta->under_lps = true; - } - else if(BTC_IPS_LEAVE == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n")); - coex_sta->under_lps = false; - } -} - -void -EXhalbtc8812a1ant_ScanNotify( - PBTC_COEXIST btcoexist, - u1Byte type - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - BOOLEAN wifi_connected=false; - - if(btcoexist->manual_control ||btcoexist->stop_coex_dm) - return; - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected); - if(BTC_SCAN_START == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); - if(!wifi_connected) // non-connected scan - { - //set 0x550[3]=1 before PsTdma - //halbtc8812a1ant_Reg0x550Bit3(btcoexist, true); - halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(btcoexist); - } - else // wifi is connected - { - halbtc8812a1ant_ActionWifiConnectedScan(btcoexist); - } - } - else if(BTC_SCAN_FINISH == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n")); - if(!wifi_connected) // non-connected scan - { - //halbtc8812a1ant_Reg0x550Bit3(btcoexist, false); - halbtc8812a1ant_ActionWifiNotConnected(btcoexist); - } - else - { - halbtc8812a1ant_ActionWifiConnected(btcoexist); - } - } -} - -void -EXhalbtc8812a1ant_ConnectNotify( - PBTC_COEXIST btcoexist, - u1Byte type - ) -{ - PBTC_STACK_INFO stack_info=&btcoexist->stack_info; - BOOLEAN wifi_connected=false; - - if(btcoexist->manual_control ||btcoexist->stop_coex_dm) - return; - - if(BTC_ASSOCIATE_START == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); - if(btcoexist->bt_info.bt_disabled) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - } - else - { - halbtc8812a1ant_ActionWifiNotConnectedAssoAuthScan(btcoexist); - } - } - else if(BTC_ASSOCIATE_FINISH == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n")); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected); - if(!wifi_connected) // non-connected scan - { - //halbtc8812a1ant_Reg0x550Bit3(btcoexist, false); - halbtc8812a1ant_ActionWifiNotConnected(btcoexist); - } - else - { - halbtc8812a1ant_ActionWifiConnected(btcoexist); - } - } -} - -void -EXhalbtc8812a1ant_MediaStatusNotify( - PBTC_COEXIST btcoexist, - u1Byte type - ) -{ - u1Byte dataLen=5; - u1Byte buf[6] = {0}; - u1Byte h2c_parameter[3] ={0}; - BOOLEAN wifi_under5g=false; - u4Byte wifi_bw; - u1Byte wifi_central_chnl; - - if(btcoexist->manual_control ||btcoexist->stop_coex_dm) - return; - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under5g); - - // only 2.4G we need to inform bt the chnl mask - if(!wifi_under5g) - { - if(BTC_MEDIA_CONNECT == type) - { - h2c_parameter[0] = 0x1; - } - btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw); - btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, &wifi_central_chnl); - h2c_parameter[1] = wifi_central_chnl; - if(BTC_WIFI_BW_HT40 == wifi_bw) - h2c_parameter[2] = 0x30; - else - h2c_parameter[2] = 0x20; - } - - coex_dm->wifi_chnl_info[0] = h2c_parameter[0]; - coex_dm->wifi_chnl_info[1] = h2c_parameter[1]; - coex_dm->wifi_chnl_info[2] = h2c_parameter[2]; - - buf[0] = dataLen; - buf[1] = 0x5; // OP_Code - buf[2] = 0x3; // OP_Code_Length - buf[3] = h2c_parameter[0]; // OP_Code_Content - buf[4] = h2c_parameter[1]; - buf[5] = h2c_parameter[2]; - - btcoexist->btc_set(btcoexist, BTC_SET_ACT_CTRL_BT_COEX, (PVOID)&buf[0]); -} - -void -EXhalbtc8812a1ant_SpecialPacketNotify( - PBTC_COEXIST btcoexist, - u1Byte type - ) -{ - BOOLEAN bSecurityLink=false; - - if(btcoexist->manual_control ||btcoexist->stop_coex_dm) - return; - - //if(type == BTC_PACKET_DHCP) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], special Packet(%d) notify\n", type)); - if(btcoexist->bt_info.bt_disabled) - { - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - } - else - { - halbtc8812a1ant_ActionWifiConnectedSpecialPacket(btcoexist); - } - } -} - -void -EXhalbtc8812a1ant_BtInfoNotify( - PBTC_COEXIST btcoexist, - pu1Byte tmp_buf, - u1Byte length - ) -{ - u1Byte bt_info=0; - u1Byte i, rsp_source=0; - static u4Byte set_bt_lna_cnt=0, set_bt_psd_mode=0; - BOOLEAN bt_busy=false, limited_dig=false; - BOOLEAN wifi_connected=false; - BOOLEAN bRejApAggPkt=false; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify()===>\n")); - - - rsp_source = tmp_buf[0]&0xf; - if(rsp_source >= BT_INFO_SRC_8812A_1ANT_MAX) - rsp_source = BT_INFO_SRC_8812A_1ANT_WIFI_FW; - coex_sta->bt_info_c2h_cnt[rsp_source]++; - - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length=%d, hex data=[", rsp_source, length)); - for(i=0; i<length; i++) - { - coex_sta->bt_info_c2h[rsp_source][i] = tmp_buf[i]; - if(i == 1) - bt_info = tmp_buf[i]; - if(i == length-1) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%2x]\n", tmp_buf[i])); - } - else - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%2x, ", tmp_buf[i])); - } - } - - if(btcoexist->manual_control) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Manual CTRL<===\n")); - return; - } - if(btcoexist->stop_coex_dm) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Coex STOPPED!!<===\n")); - return; - } - - if(BT_INFO_SRC_8812A_1ANT_WIFI_FW != rsp_source) - { - coex_sta->bt_retry_cnt = - coex_sta->bt_info_c2h[rsp_source][2]; - - coex_sta->bt_rssi = - coex_sta->bt_info_c2h[rsp_source][3]*2+10; - - coex_sta->bt_info_ext = - coex_sta->bt_info_c2h[rsp_source][4]; - - // Here we need to resend some wifi info to BT - // because bt is reset and loss of the info. - if( (coex_sta->bt_info_ext & BIT1) ) - { - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, &wifi_connected); - if(wifi_connected) - { - EXhalbtc8812a1ant_MediaStatusNotify(btcoexist, BTC_MEDIA_CONNECT); - } - else - { - EXhalbtc8812a1ant_MediaStatusNotify(btcoexist, BTC_MEDIA_DISCONNECT); - } - - set_bt_psd_mode = 0; - } - - // test-chip bt patch doesn't support, temporary remove. - // need to add back when mp-chip. 12/20/2012 -#if 0 - if(set_bt_psd_mode <= 3) - { - halbtc8812a1ant_SetBtPsdMode(btcoexist, FORCE_EXEC, 0xd); - set_bt_psd_mode++; - } - - if(coex_dm->bCurBtLnaConstrain) - { - if( (coex_sta->bt_info_ext & BIT2) ) - { - } - else - { - if(set_bt_lna_cnt <= 3) - { - halbtc8812a1ant_SetBtLnaConstrain(btcoexist, FORCE_EXEC, true); - set_bt_lna_cnt++; - } - } - } - else - { - set_bt_lna_cnt = 0; - } -#endif - // test-chip bt patch only rsp the status for BT_RSP, - // so temporary we consider the following only under BT_RSP - if(BT_INFO_SRC_8812A_1ANT_BT_RSP == rsp_source) - { - if( (coex_sta->bt_info_ext & BIT3) ) - { - #if 0// temp disable because bt patch report the wrong value. - halbtc8812a1ant_IgnoreWlanAct(btcoexist, FORCE_EXEC, false); - #endif - } - else - { - // BT already NOT ignore Wlan active, do nothing here. - } - - if( (coex_sta->bt_info_ext & BIT4) ) - { - // BT auto report already enabled, do nothing - } - else - { - halbtc8812a1ant_BtAutoReport(btcoexist, FORCE_EXEC, true); - } - } - } - - // check BIT2 first ==> check if bt is under inquiry or page scan - if(bt_info & BT_INFO_8812A_1ANT_B_INQ_PAGE) - { - coex_sta->c2h_bt_inquiry_page = true; - coex_dm->bt_status = BT_8812A_1ANT_BT_STATUS_INQ_PAGE; - } - else - { - coex_sta->c2h_bt_inquiry_page = false; - if(!(bt_info&BT_INFO_8812A_1ANT_B_CONNECTION)) - { - coex_dm->bt_status = BT_8812A_1ANT_BT_STATUS_NON_CONNECTED_IDLE; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-connected idle!!!\n")); - } - else if(bt_info == BT_INFO_8812A_1ANT_B_CONNECTION) // connection exists but no busy - { - coex_dm->bt_status = BT_8812A_1ANT_BT_STATUS_CONNECTED_IDLE; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt connected-idle!!!\n")); - } - else if((bt_info&BT_INFO_8812A_1ANT_B_SCO_ESCO) || - (bt_info&BT_INFO_8812A_1ANT_B_SCO_BUSY)) - { - coex_dm->bt_status = BT_8812A_1ANT_BT_STATUS_SCO_BUSY; - bRejApAggPkt = true; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt sco busy!!!\n")); - } - else if(bt_info&BT_INFO_8812A_1ANT_B_ACL_BUSY) - { - if(BT_8812A_1ANT_BT_STATUS_ACL_BUSY != coex_dm->bt_status) - coex_dm->reset_tdma_adjust = true; - coex_dm->bt_status = BT_8812A_1ANT_BT_STATUS_ACL_BUSY; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt acl busy!!!\n")); - } -#if 0 - else if(bt_info&BT_INFO_8812A_1ANT_B_SCO_ESCO) - { - coex_dm->bt_status = BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt acl/sco busy!!!\n")); - } -#endif - else - { - //DbgPrint("error, undefined bt_info=0x%x\n", bt_info); - coex_dm->bt_status = BT_8812A_1ANT_BT_STATUS_MAX; - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), bt non-defined state!!!\n")); - } - - // send delete BA to disable aggregation - //btcoexist->btc_set(btcoexist, BTC_SET_BL_TO_REJ_AP_AGG_PKT, &bRejApAggPkt); - } - - if( (BT_8812A_1ANT_BT_STATUS_ACL_BUSY == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_SCO_BUSY == coex_dm->bt_status) || - (BT_8812A_1ANT_BT_STATUS_ACL_SCO_BUSY == coex_dm->bt_status) ) - { - bt_busy = true; - } - else - { - bt_busy = false; - } - btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_TRAFFIC_BUSY, &bt_busy); - - if(bt_busy) - { - limited_dig = true; - } - else - { - limited_dig = false; - } - coex_dm->limited_dig = limited_dig; - btcoexist->btc_set(btcoexist, BTC_SET_BL_BT_LIMITED_DIG, &limited_dig); - - halbtc8812a1ant_RunCoexistMechanism(btcoexist); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify()<===\n")); -} - -void -EXhalbtc8812a1ant_StackOperationNotify( - PBTC_COEXIST btcoexist, - u1Byte type - ) -{ - if(BTC_STACK_OP_INQ_PAGE_PAIR_START == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], StackOP Inquiry/page/pair start notify\n")); - } - else if(BTC_STACK_OP_INQ_PAGE_PAIR_FINISH == type) - { - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], StackOP Inquiry/page/pair finish notify\n")); - } -} - -void -EXhalbtc8812a1ant_HaltNotify( - PBTC_COEXIST btcoexist - ) -{ - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); - - halbtc8812a1ant_IgnoreWlanAct(btcoexist, FORCE_EXEC, true); - halbtc8812a1ant_PsTdma(btcoexist, FORCE_EXEC, false, 0); - btcoexist->btc_write_1byte(btcoexist, 0x4f, 0xf); - halbtc8812a1ant_WifiParaAdjust(btcoexist, false); -} - -void -EXhalbtc8812a1ant_PnpNotify( - PBTC_COEXIST btcoexist, - u1Byte pnpState - ) -{ - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); - - if(BTC_WIFI_PNP_SLEEP == pnpState) - { - btcoexist->stop_coex_dm = true; - halbtc8812a1ant_IgnoreWlanAct(btcoexist, FORCE_EXEC, true); - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - } - else if(BTC_WIFI_PNP_WAKE_UP == pnpState) - { - - } -} - -void -EXhalbtc8812a1ant_Periodical( - PBTC_COEXIST btcoexist - ) -{ - BOOLEAN wifi_under5g=false; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Periodical()===>\n")); - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], 1Ant Periodical!!\n")); - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under5g); - - if(wifi_under5g) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Periodical(), return for 5G<===\n")); - halbtc8812a1ant_CoexAllOff(btcoexist); - return; - } - - halbtc8812a1ant_QueryBtInfo(btcoexist); - halbtc8812a1ant_MonitorBtCtr(btcoexist); - halbtc8812a1ant_MonitorBtEnableDisable(btcoexist); - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Periodical()<===\n")); -} - -void -EXhalbtc8812a1ant_DbgControl( - PBTC_COEXIST btcoexist, - u1Byte opCode, - u1Byte opLen, - pu1Byte pData - ) -{ - switch(opCode) - { - case BTC_DBG_SET_COEX_NORMAL: - btcoexist->manual_control = false; - halbtc8812a1ant_InitCoexDm(btcoexist); - break; - case BTC_DBG_SET_COEX_WIFI_ONLY: - btcoexist->manual_control = true; - halbtc8812a1ant_PsTdmaCheckForPowerSaveState(btcoexist, false); - btcoexist->btc_set(btcoexist, BTC_SET_ACT_LEAVE_LPS, NULL); - halbtc8812a1ant_PsTdma(btcoexist, NORMAL_EXEC, false, 9); - break; - case BTC_DBG_SET_COEX_BT_ONLY: - // todo - break; - default: - break; - } -} -#endif - diff --git a/drivers/staging/rtl8821ae/rtl8821ae/btc.h b/drivers/staging/rtl8821ae/rtl8821ae/btc.h deleted file mode 100644 index 74ac189..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/btc.h +++ /dev/null @@ -1,87 +0,0 @@ - -/****************************************************************************** - ** - ** Copyright(c) 2009-2010 Realtek Corporation. - ** - ** This program is free software; you can redistribute it and/or modify it - ** under the terms of version 2 of the GNU General Public License as - ** published by the Free Software Foundation. - ** - ** This program is distributed in the hope that it will be useful, but WITHOUT - ** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - ** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - ** more details. - ** - ** You should have received a copy of the GNU General Public License along with - ** this program; if not, write to the Free Software Foundation, Inc., - ** 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - ** - ** The full GNU General Public License is included in this distribution in the - ** file called LICENSE. - ** - ** Contact Information: - ** wlanfae <wlanfae@xxxxxxxxxxx> - ** Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - ** Hsinchu 300, Taiwan. - ** Larry Finger <Larry.Finger@xxxxxxxxxxxx> - ** - ******************************************************************************/ - -#ifndef __RTL8821AE_BTC_H__ -#define __RTL8821AE_BTC_H__ - -#include "../wifi.h" -#include "hal_bt_coexist.h" - -struct bt_coexist_c2h_info { - u8 no_parse_c2h; - u8 has_c2h; -}; - -struct btdm_8821ae { - bool b_all_off; - bool b_agc_table_en; - bool b_adc_back_off_on; - bool b2_ant_hid_en; - bool b_low_penalty_rate_adaptive; - bool b_rf_rx_lpf_shrink; - bool b_reject_aggre_pkt; - bool b_tra_tdma_on; - u8 tra_tdma_nav; - u8 tra_tdma_ant; - bool b_tdma_on; - u8 tdma_ant; - u8 tdma_nav; - u8 tdma_dac_swing; - u8 fw_dac_swing_lvl; - bool b_ps_tdma_on; - u8 ps_tdma_byte[5]; - bool b_pta_on; - u32 val_0x6c0; - u32 val_0x6c8; - u32 val_0x6cc; - bool b_sw_dac_swing_on; - u32 sw_dac_swing_lvl; - u32 wlan_act_hi; - u32 wlan_act_lo; - u32 bt_retry_index; - bool b_dec_bt_pwr; - bool b_ignore_wlan_act; -}; - -struct bt_coexist_8821ae { - u32 high_priority_tx; - u32 high_priority_rx; - u32 low_priority_tx; - u32 low_priority_rx; - u8 c2h_bt_info; - bool b_c2h_bt_info_req_sent; - bool b_c2h_bt_inquiry_page; - u32 bt_inq_page_start_time; - u8 bt_retry_cnt; - u8 c2h_bt_info_original; - u8 bt_inquiry_page_cnt; - struct btdm_8821ae btdm; -}; - -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/def.h b/drivers/staging/rtl8821ae/rtl8821ae/def.h deleted file mode 100644 index 72ebdea..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/def.h +++ /dev/null @@ -1,442 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_DEF_H__ -#define __RTL8821AE_DEF_H__ - -/*--------------------------Define -------------------------------------------*/ -/* BIT 7 HT Rate*/ -/*TxHT = 0*/ -#define MGN_1M 0x02 -#define MGN_2M 0x04 -#define MGN_5_5M 0x0b -#define MGN_11M 0x16 - -#define MGN_6M 0x0c -#define MGN_9M 0x12 -#define MGN_12M 0x18 -#define MGN_18M 0x24 -#define MGN_24M 0x30 -#define MGN_36M 0x48 -#define MGN_48M 0x60 -#define MGN_54M 0x6c - -// TxHT = 1 -#define MGN_MCS0 0x80 -#define MGN_MCS1 0x81 -#define MGN_MCS2 0x82 -#define MGN_MCS3 0x83 -#define MGN_MCS4 0x84 -#define MGN_MCS5 0x85 -#define MGN_MCS6 0x86 -#define MGN_MCS7 0x87 -#define MGN_MCS8 0x88 -#define MGN_MCS9 0x89 -#define MGN_MCS10 0x8a -#define MGN_MCS11 0x8b -#define MGN_MCS12 0x8c -#define MGN_MCS13 0x8d -#define MGN_MCS14 0x8e -#define MGN_MCS15 0x8f -//VHT rate -#define MGN_VHT1SS_MCS0 0x90 -#define MGN_VHT1SS_MCS1 0x91 -#define MGN_VHT1SS_MCS2 0x92 -#define MGN_VHT1SS_MCS3 0x93 -#define MGN_VHT1SS_MCS4 0x94 -#define MGN_VHT1SS_MCS5 0x95 -#define MGN_VHT1SS_MCS6 0x96 -#define MGN_VHT1SS_MCS7 0x97 -#define MGN_VHT1SS_MCS8 0x98 -#define MGN_VHT1SS_MCS9 0x99 -#define MGN_VHT2SS_MCS0 0x9a -#define MGN_VHT2SS_MCS1 0x9b -#define MGN_VHT2SS_MCS2 0x9c -#define MGN_VHT2SS_MCS3 0x9d -#define MGN_VHT2SS_MCS4 0x9e -#define MGN_VHT2SS_MCS5 0x9f -#define MGN_VHT2SS_MCS6 0xa0 -#define MGN_VHT2SS_MCS7 0xa1 -#define MGN_VHT2SS_MCS8 0xa2 -#define MGN_VHT2SS_MCS9 0xa3 - -#define MGN_VHT3SS_MCS0 0xa4 -#define MGN_VHT3SS_MCS1 0xa5 -#define MGN_VHT3SS_MCS2 0xa6 -#define MGN_VHT3SS_MCS3 0xa7 -#define MGN_VHT3SS_MCS4 0xa8 -#define MGN_VHT3SS_MCS5 0xa9 -#define MGN_VHT3SS_MCS6 0xaa -#define MGN_VHT3SS_MCS7 0xab -#define MGN_VHT3SS_MCS8 0xac -#define MGN_VHT3SS_MCS9 0xad - -#define MGN_MCS0_SG 0xc0 -#define MGN_MCS1_SG 0xc1 -#define MGN_MCS2_SG 0xc2 -#define MGN_MCS3_SG 0xc3 -#define MGN_MCS4_SG 0xc4 -#define MGN_MCS5_SG 0xc5 -#define MGN_MCS6_SG 0xc6 -#define MGN_MCS7_SG 0xc7 -#define MGN_MCS8_SG 0xc8 -#define MGN_MCS9_SG 0xc9 -#define MGN_MCS10_SG 0xca -#define MGN_MCS11_SG 0xcb -#define MGN_MCS12_SG 0xcc -#define MGN_MCS13_SG 0xcd -#define MGN_MCS14_SG 0xce -#define MGN_MCS15_SG 0xcf - -#define MGN_UNKNOWN 0xff - - -/* 30 ms */ -#define WIFI_NAV_UPPER_US 30000 -#define HAL_92C_NAV_UPPER_UNIT 128 - -#define HAL_RETRY_LIMIT_INFRA 48 -#define HAL_RETRY_LIMIT_AP_ADHOC 7 - -#define RESET_DELAY_8185 20 - -#define RT_IBSS_INT_MASKS (IMR_BCNINT | IMR_TBDOK | IMR_TBDER) -#define RT_AC_INT_MASKS (IMR_VIDOK | IMR_VODOK | IMR_BEDOK|IMR_BKDOK) - -#define NUM_OF_FIRMWARE_QUEUE 10 -#define NUM_OF_PAGES_IN_FW 0x100 -#define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x07 -#define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0x0 -#define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x0 -#define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x02 -#define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0x02 -#define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x2 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0xA1 - -#define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_BE_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VI_DTM 0x048 -#define NUM_OF_PAGE_IN_FW_QUEUE_VO_DTM 0x026 -#define NUM_OF_PAGE_IN_FW_QUEUE_PUB_DTM 0x00 - -#define MAX_RX_DMA_BUFFER_SIZE 0x3E80 - - -#define MAX_LINES_HWCONFIG_TXT 1000 -#define MAX_BYTES_LINE_HWCONFIG_TXT 256 - -#define SW_THREE_WIRE 0 -#define HW_THREE_WIRE 2 - -#define BT_DEMO_BOARD 0 -#define BT_QA_BOARD 1 -#define BT_FPGA 2 - -#define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0 -#define HAL_PRIME_CHNL_OFFSET_LOWER 1 -#define HAL_PRIME_CHNL_OFFSET_UPPER 2 - -#define MAX_H2C_QUEUE_NUM 10 - -#define RX_MPDU_QUEUE 0 -#define RX_CMD_QUEUE 1 -#define RX_MAX_QUEUE 2 -#define AC2QUEUEID(_AC) (_AC) - -#define C2H_RX_CMD_HDR_LEN 8 -#define GET_C2H_CMD_CMD_LEN(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 0, 16) -#define GET_C2H_CMD_ELEMENT_ID(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 16, 8) -#define GET_C2H_CMD_CMD_SEQ(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 24, 7) -#define GET_C2H_CMD_CONTINUE(__prxhdr) \ - LE_BITS_TO_4BYTE((__prxhdr), 31, 1) -#define GET_C2H_CMD_CONTENT(__prxhdr) \ - ((u8*)(__prxhdr) + C2H_RX_CMD_HDR_LEN) - -#define GET_C2H_CMD_FEEDBACK_ELEMENT_ID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 0, 8) -#define GET_C2H_CMD_FEEDBACK_CCX_LEN(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 8, 8) -#define GET_C2H_CMD_FEEDBACK_CCX_CMD_CNT(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE((__pcmdfbhdr), 16, 16) -#define GET_C2H_CMD_FEEDBACK_CCX_MAC_ID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 0, 5) -#define GET_C2H_CMD_FEEDBACK_CCX_VALID(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 7, 1) -#define GET_C2H_CMD_FEEDBACK_CCX_RETRY_CNT(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 8, 5) -#define GET_C2H_CMD_FEEDBACK_CCX_TOK(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 15, 1) -#define GET_C2H_CMD_FEEDBACK_CCX_QSEL(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) -#define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ - LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) - -#define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3) - -#define CHIP_8812 BIT(2) -#define CHIP_8821 (BIT(0)|BIT(2)) - -#define CHIP_8821A (BIT(0)|BIT(2)) -#define NORMAL_CHIP BIT(3) -#define RF_TYPE_1T1R (~(BIT(4)|BIT(5)|BIT(6))) -#define RF_TYPE_1T2R BIT(4) -#define RF_TYPE_2T2R BIT(5) -#define CHIP_VENDOR_UMC BIT(7) -#define B_CUT_VERSION BIT(12) -#define C_CUT_VERSION BIT(13) -#define D_CUT_VERSION ((BIT(12)|BIT(13))) -#define E_CUT_VERSION BIT(14) -#define RF_RL_ID (BIT(31)|BIT(30)|BIT(29)|BIT(28)) - - - -enum version_8821ae { - VERSION_TEST_CHIP_1T1R_8812 = 0x0004, - VERSION_TEST_CHIP_2T2R_8812 = 0x0024, - VERSION_NORMAL_TSMC_CHIP_1T1R_8812 = 0x100c, - VERSION_NORMAL_TSMC_CHIP_2T2R_8812 = 0x102c, - VERSION_NORMAL_TSMC_CHIP_1T1R_8812_C_CUT = 0x200c, - VERSION_NORMAL_TSMC_CHIP_2T2R_8812_C_CUT = 0x202c, - VERSION_TEST_CHIP_8821 = 0x0005, - VERSION_NORMAL_TSMC_CHIP_8821 = 0x000d, - VERSION_NORMAL_TSMC_CHIP_8821_B_CUT = 0x100d, - VERSION_UNKNOWN = 0xFF, -}; - -enum vht_data_sc{ - VHT_DATA_SC_DONOT_CARE = 0, - VHT_DATA_SC_20_UPPER_OF_80MHZ = 1, - VHT_DATA_SC_20_LOWER_OF_80MHZ = 2, - VHT_DATA_SC_20_UPPERST_OF_80MHZ = 3, - VHT_DATA_SC_20_LOWEST_OF_80MHZ = 4, - VHT_DATA_SC_20_RECV1 = 5, - VHT_DATA_SC_20_RECV2 = 6, - VHT_DATA_SC_20_RECV3 = 7, - VHT_DATA_SC_20_RECV4 = 8, - VHT_DATA_SC_40_UPPER_OF_80MHZ = 9, - VHT_DATA_SC_40_LOWER_OF_80MHZ = 10, -}; - - -/* MASK */ -#define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2)) -#define CHIP_TYPE_MASK BIT(3) -#define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6)) -#define MANUFACTUER_MASK BIT(7) -#define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8)) -#define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12)) - -/* Get element */ -#define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK) -#define GET_CVID_CHIP_TYPE(version) ((version) & CHIP_TYPE_MASK) -#define GET_CVID_RF_TYPE(version) ((version) & RF_TYPE_MASK) -#define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK) -#define GET_CVID_ROM_VERSION(version) ((version) & ROM_VERSION_MASK) -#define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK) - -#define IS_1T1R(version) ((GET_CVID_RF_TYPE(version))? false : true) -#define IS_1T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R)\ - ? true : false) -#define IS_2T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R)\ - ? true : false) - -#define IS_8812_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8812)? \ - true : false) -#define IS_8821_SERIES(version) ((GET_CVID_IC_TYPE(version) == CHIP_8821)? \ - true : false) - -#define IS_VENDOR_8812A_TEST_CHIP(version) ((IS_8812_SERIES(version)) ? \ - ((IS_NORMAL_CHIP(version)) ? \ - false : true) : false) -#define IS_VENDOR_8812A_MP_CHIP(version) ((IS_8812_SERIES(version)) ? \ - ((IS_NORMAL_CHIP(version)) ? \ - true : false) : false) -#define IS_VENDOR_8812A_C_CUT(version) ((IS_8812_SERIES(version)) ? \ - ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? \ - true : false) : false) - -#define IS_VENDOR_8821A_TEST_CHIP(version) ((IS_8821_SERIES(version)) ? \ - ((IS_NORMAL_CHIP(version)) ? \ - false : true) : false) -#define IS_VENDOR_8821A_MP_CHIP(version) ((IS_8821_SERIES(version)) ? \ - ((IS_NORMAL_CHIP(version)) ? \ - true : false) : false) -#define IS_VENDOR_8821A_B_CUT(version) ((IS_8821_SERIES(version)) ? \ - ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? \ - true : false) : false) - - -enum rf_optype { - RF_OP_BY_SW_3WIRE = 0, - RF_OP_BY_FW, - RF_OP_MAX -}; - -enum rf_power_state { - RF_ON, - RF_OFF, - RF_SLEEP, - RF_SHUT_DOWN, -}; - -enum power_save_mode { - POWER_SAVE_MODE_ACTIVE, - POWER_SAVE_MODE_SAVE, -}; - -enum power_polocy_config { - POWERCFG_MAX_POWER_SAVINGS, - POWERCFG_GLOBAL_POWER_SAVINGS, - POWERCFG_LOCAL_POWER_SAVINGS, - POWERCFG_LENOVO, -}; - -enum interface_select_pci { - INTF_SEL1_MINICARD = 0, - INTF_SEL0_PCIE = 1, - INTF_SEL2_RSV = 2, - INTF_SEL3_RSV = 3, -}; - -enum hal_fw_c2h_cmd_id { - HAL_FW_C2H_CMD_Read_MACREG = 0, - HAL_FW_C2H_CMD_Read_BBREG = 1, - HAL_FW_C2H_CMD_Read_RFREG = 2, - HAL_FW_C2H_CMD_Read_EEPROM = 3, - HAL_FW_C2H_CMD_Read_EFUSE = 4, - HAL_FW_C2H_CMD_Read_CAM = 5, - HAL_FW_C2H_CMD_Get_BasicRate = 6, - HAL_FW_C2H_CMD_Get_DataRate = 7, - HAL_FW_C2H_CMD_Survey = 8, - HAL_FW_C2H_CMD_SurveyDone = 9, - HAL_FW_C2H_CMD_JoinBss = 10, - HAL_FW_C2H_CMD_AddSTA = 11, - HAL_FW_C2H_CMD_DelSTA = 12, - HAL_FW_C2H_CMD_AtimDone = 13, - HAL_FW_C2H_CMD_TX_Report = 14, - HAL_FW_C2H_CMD_CCX_Report = 15, - HAL_FW_C2H_CMD_DTM_Report = 16, - HAL_FW_C2H_CMD_TX_Rate_Statistics = 17, - HAL_FW_C2H_CMD_C2HLBK = 18, - HAL_FW_C2H_CMD_C2HDBG = 19, - HAL_FW_C2H_CMD_C2HFEEDBACK = 20, - HAL_FW_C2H_CMD_MAX -}; - -enum rtl_desc_qsel { - QSLT_BK = 0x2, - QSLT_BE = 0x0, - QSLT_VI = 0x5, - QSLT_VO = 0x7, - QSLT_BEACON = 0x10, - QSLT_HIGH = 0x11, - QSLT_MGNT = 0x12, - QSLT_CMD = 0x13, -}; - -enum rtl_desc8821ae_rate { - DESC_RATE1M = 0x00, - DESC_RATE2M = 0x01, - DESC_RATE5_5M = 0x02, - DESC_RATE11M = 0x03, - - DESC_RATE6M = 0x04, - DESC_RATE9M = 0x05, - DESC_RATE12M = 0x06, - DESC_RATE18M = 0x07, - DESC_RATE24M = 0x08, - DESC_RATE36M = 0x09, - DESC_RATE48M = 0x0a, - DESC_RATE54M = 0x0b, - - DESC_RATEMCS0 = 0x0c, - DESC_RATEMCS1 = 0x0d, - DESC_RATEMCS2 = 0x0e, - DESC_RATEMCS3 = 0x0f, - DESC_RATEMCS4 = 0x10, - DESC_RATEMCS5 = 0x11, - DESC_RATEMCS6 = 0x12, - DESC_RATEMCS7 = 0x13, - DESC_RATEMCS8 = 0x14, - DESC_RATEMCS9 = 0x15, - DESC_RATEMCS10 = 0x16, - DESC_RATEMCS11 = 0x17, - DESC_RATEMCS12 = 0x18, - DESC_RATEMCS13 = 0x19, - DESC_RATEMCS14 = 0x1a, - DESC_RATEMCS15 = 0x1b, - DESC_RATEVHT1SS_MCS0 = 0x1c, - DESC_RATEVHT1SS_MCS1 = 0x1d, - DESC_RATEVHT1SS_MCS2 = 0x1e, - DESC_RATEVHT1SS_MCS3 = 0x1f, - DESC_RATEVHT1SS_MCS4 = 0x20, - DESC_RATEVHT1SS_MCS5 = 0x21, - DESC_RATEVHT1SS_MCS6 = 0x22, - DESC_RATEVHT1SS_MCS7 = 0x23, - DESC_RATEVHT1SS_MCS8 = 0x24, - DESC_RATEVHT1SS_MCS9 = 0x25, - DESC_RATEVHT2SS_MCS0 = 0x26, - DESC_RATEVHT2SS_MCS1 = 0x27, - DESC_RATEVHT2SS_MCS2 = 0x28, - DESC_RATEVHT2SS_MCS3 = 0x29, - DESC_RATEVHT2SS_MCS4 = 0x2a, - DESC_RATEVHT2SS_MCS5 = 0x2b, - DESC_RATEVHT2SS_MCS6 = 0x2c, - DESC_RATEVHT2SS_MCS7 = 0x2d, - DESC_RATEVHT2SS_MCS8 = 0x2e, - DESC_RATEVHT2SS_MCS9 = 0x2f, -}; - -enum rx_packet_type{ - NORMAL_RX, - TX_REPORT1, - TX_REPORT2, - HIS_REPORT, - C2H_PACKET, -}; - -struct phy_sts_cck_8821ae_t { - u8 adc_pwdb_X[4]; - u8 sq_rpt; - u8 cck_agc_rpt; -}; - -struct h2c_cmd_8821ae { - u8 element_id; - u32 cmd_len; - u8 *p_cmdbuffer; -}; - -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/dm.c b/drivers/staging/rtl8821ae/rtl8821ae/dm.c deleted file mode 100644 index 8634206..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/dm.c +++ /dev/null @@ -1,3045 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../base.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "trx.h" -#include "../btcoexist/rtl_btc.h" - -struct dig_t dm_digtable; -static struct ps_t dm_pstable; - -static const u32 rtl8812ae_txscaling_table[TXSCALE_TABLE_SIZE] = -{ - 0x081, // 0, -12.0dB - 0x088, // 1, -11.5dB - 0x090, // 2, -11.0dB - 0x099, // 3, -10.5dB - 0x0A2, // 4, -10.0dB - 0x0AC, // 5, -9.5dB - 0x0B6, // 6, -9.0dB - 0x0C0, // 7, -8.5dB - 0x0CC, // 8, -8.0dB - 0x0D8, // 9, -7.5dB - 0x0E5, // 10, -7.0dB - 0x0F2, // 11, -6.5dB - 0x101, // 12, -6.0dB - 0x110, // 13, -5.5dB - 0x120, // 14, -5.0dB - 0x131, // 15, -4.5dB - 0x143, // 16, -4.0dB - 0x156, // 17, -3.5dB - 0x16A, // 18, -3.0dB - 0x180, // 19, -2.5dB - 0x197, // 20, -2.0dB - 0x1AF, // 21, -1.5dB - 0x1C8, // 22, -1.0dB - 0x1E3, // 23, -0.5dB - 0x200, // 24, +0 dB - 0x21E, // 25, +0.5dB - 0x23E, // 26, +1.0dB - 0x261, // 27, +1.5dB - 0x285, // 28, +2.0dB - 0x2AB, // 29, +2.5dB - 0x2D3, // 30, +3.0dB - 0x2FE, // 31, +3.5dB - 0x32B, // 32, +4.0dB - 0x35C, // 33, +4.5dB - 0x38E, // 34, +5.0dB - 0x3C4, // 35, +5.5dB - 0x3FE // 36, +6.0dB -}; - -static const u32 rtl8821ae_txscaling_table[TXSCALE_TABLE_SIZE] = { - 0x081, // 0, -12.0dB - 0x088, // 1, -11.5dB - 0x090, // 2, -11.0dB - 0x099, // 3, -10.5dB - 0x0A2, // 4, -10.0dB - 0x0AC, // 5, -9.5dB - 0x0B6, // 6, -9.0dB - 0x0C0, // 7, -8.5dB - 0x0CC, // 8, -8.0dB - 0x0D8, // 9, -7.5dB - 0x0E5, // 10, -7.0dB - 0x0F2, // 11, -6.5dB - 0x101, // 12, -6.0dB - 0x110, // 13, -5.5dB - 0x120, // 14, -5.0dB - 0x131, // 15, -4.5dB - 0x143, // 16, -4.0dB - 0x156, // 17, -3.5dB - 0x16A, // 18, -3.0dB - 0x180, // 19, -2.5dB - 0x197, // 20, -2.0dB - 0x1AF, // 21, -1.5dB - 0x1C8, // 22, -1.0dB - 0x1E3, // 23, -0.5dB - 0x200, // 24, +0 dB - 0x21E, // 25, +0.5dB - 0x23E, // 26, +1.0dB - 0x261, // 27, +1.5dB - 0x285, // 28, +2.0dB - 0x2AB, // 29, +2.5dB - 0x2D3, // 30, +3.0dB - 0x2FE, // 31, +3.5dB - 0x32B, // 32, +4.0dB - 0x35C, // 33, +4.5dB - 0x38E, // 34, +5.0dB - 0x3C4, // 35, +5.5dB - 0x3FE // 36, +6.0dB -}; - -static const u32 ofdmswing_table[] = { - 0x0b40002d, // 0, -15.0dB - 0x0c000030, // 1, -14.5dB - 0x0cc00033, // 2, -14.0dB - 0x0d800036, // 3, -13.5dB - 0x0e400039, // 4, -13.0dB - 0x0f00003c, // 5, -12.5dB - 0x10000040, // 6, -12.0dB - 0x11000044, // 7, -11.5dB - 0x12000048, // 8, -11.0dB - 0x1300004c, // 9, -10.5dB - 0x14400051, // 10, -10.0dB - 0x15800056, // 11, -9.5dB - 0x16c0005b, // 12, -9.0dB - 0x18000060, // 13, -8.5dB - 0x19800066, // 14, -8.0dB - 0x1b00006c, // 15, -7.5dB - 0x1c800072, // 16, -7.0dB - 0x1e400079, // 17, -6.5dB - 0x20000080, // 18, -6.0dB - 0x22000088, // 19, -5.5dB - 0x24000090, // 20, -5.0dB - 0x26000098, // 21, -4.5dB - 0x288000a2, // 22, -4.0dB - 0x2ac000ab, // 23, -3.5dB - 0x2d4000b5, // 24, -3.0dB - 0x300000c0, // 25, -2.5dB - 0x32c000cb, // 26, -2.0dB - 0x35c000d7, // 27, -1.5dB - 0x390000e4, // 28, -1.0dB - 0x3c8000f2, // 29, -0.5dB - 0x40000100, // 30, +0dB - 0x43c0010f, // 31, +0.5dB - 0x47c0011f, // 32, +1.0dB - 0x4c000130, // 33, +1.5dB - 0x50800142, // 34, +2.0dB - 0x55400155, // 35, +2.5dB - 0x5a400169, // 36, +3.0dB - 0x5fc0017f, // 37, +3.5dB - 0x65400195, // 38, +4.0dB - 0x6b8001ae, // 39, +4.5dB - 0x71c001c7, // 40, +5.0dB - 0x788001e2, // 41, +5.5dB - 0x7f8001fe // 42, +6.0dB -}; - -static const u8 cckswing_table_ch1ch13[CCK_TABLE_SIZE][8] = { - {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}, // 0, -16.0dB - {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01}, // 1, -15.5dB - {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01}, // 2, -15.0dB - {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01}, // 3, -14.5dB - {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01}, // 4, -14.0dB - {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01}, // 5, -13.5dB - {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01}, // 6, -13.0dB - {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01}, // 7, -12.5dB - {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01}, // 8, -12.0dB - {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01}, // 9, -11.5dB - {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 10, -11.0dB - {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01}, // 11, -10.5dB - {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 12, -10.0dB - {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01}, // 13, -9.5dB - {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01}, // 14, -9.0dB - {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02}, // 15, -8.5dB - {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01}, // 16, -8.0dB - {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02}, // 17, -7.5dB - {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02}, // 18, -7.0dB - {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02}, // 19, -6.5dB - {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02}, // 20, -6.0dB - {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02}, // 21, -5.5dB - {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02}, // 22, -5.0dB - {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02}, // 23, -4.5dB - {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02}, // 24, -4.0dB - {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03}, // 25, -3.5dB - {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03}, // 26, -3.0dB - {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03}, // 27, -2.5dB - {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03}, // 28, -2.0dB - {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03}, // 29, -1.5dB - {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03}, // 30, -1.0dB - {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04}, // 31, -0.5dB - {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} // 32, +0dB -}; - -static const u8 cckswing_table_ch14[CCK_TABLE_SIZE][8]= { - {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, // 0, -16.0dB - {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 1, -15.5dB - {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, // 2, -15.0dB - {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 3, -14.5dB - {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00}, // 4, -14.0dB - {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 5, -13.5dB - {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00}, // 6, -13.0dB - {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00}, // 7, -12.5dB - {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 8, -12.0dB - {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00}, // 9, -11.5dB - {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00}, // 10, -11.0dB - {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00}, // 11, -10.5dB - {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 12, -10.0dB - {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00}, // 13, -9.5dB - {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 14, -9.0dB - {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00}, // 15, -8.5dB - {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 16, -8.0dB - {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00}, // 17, -7.5dB - {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00}, // 18, -7.0dB - {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00}, // 19, -6.5dB - {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 20, -6.0dB - {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00}, // 21, -5.5dB - {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00}, // 22, -5.0dB - {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00}, // 23, -4.5dB - {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00}, // 24, -4.0dB - {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00}, // 25, -3.5dB - {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00}, // 26, -3.0dB - {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00}, // 27, -2.5dB - {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00}, // 28, -2.0dB - {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00}, // 29, -1.5dB - {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00}, // 30, -1.0dB - {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00}, // 31, -0.5dB - {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} // 32, +0dB -}; - -static const u32 edca_setting_dl[PEER_MAX] = { - 0xa44f, /* 0 UNKNOWN */ - 0x5ea44f, /* 1 REALTEK_90 */ - 0x5e4322, /* 2 REALTEK_92SE */ - 0x5ea42b, /* 3 BROAD */ - 0xa44f, /* 4 RAL */ - 0xa630, /* 5 ATH */ - 0x5ea630, /* 6 CISCO */ - 0x5ea42b, /* 7 MARVELL */ -}; - -static const u32 edca_setting_ul[PEER_MAX] = { - 0x5e4322, /* 0 UNKNOWN */ - 0xa44f, /* 1 REALTEK_90 */ - 0x5ea44f, /* 2 REALTEK_92SE */ - 0x5ea32b, /* 3 BROAD */ - 0x5ea422, /* 4 RAL */ - 0x5ea322, /* 5 ATH */ - 0x3ea430, /* 6 CISCO */ - 0x5ea44f, /* 7 MARV */ -}; - -static u8 rtl8818e_delta_swing_table_idx_24gb_p_txpwrtrack[] = - {0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9}; -static u8 rtl8818e_delta_swing_table_idx_24gb_n_txpwrtrack[] = - {0, 0, 0, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11}; - - -u8 rtl8812ae_delta_swing_table_idx_24gb_n_txpwrtrack[] = - {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11}; -u8 rtl8812ae_delta_swing_table_idx_24gb_p_txpwrtrack[] = - {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9}; -u8 rtl8812ae_delta_swing_table_idx_24ga_n_txpwrtrack[] = - {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11}; -u8 rtl8812ae_delta_swing_table_idx_24ga_p_txpwrtrack[] = - {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9}; -u8 rtl8812ae_delta_swing_table_idx_24gcckb_n_txpwrtrack[] = - {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11}; -u8 rtl8812ae_delta_swing_table_idx_24gcckb_p_txpwrtrack[] = - {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9}; -u8 rtl8812ae_delta_swing_table_idx_24gccka_n_txpwrtrack[] = - {0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11}; -u8 rtl8812ae_delta_swing_table_idx_24gccka_p_txpwrtrack[] = - {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9}; - -u8 rtl8812ae_delta_swing_table_idx_5gb_n_txpwrtrack[][DELTA_SWINGIDX_SIZE] = { - {0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13}, - {0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13}, - {0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 12, 13, 14, 14, 14, 15, 16, 17, 17, 17, 18, 18, 18}, -}; -u8 rtl8812ae_delta_swing_table_idx_5gb_p_txpwrtrack[][DELTA_SWINGIDX_SIZE] = { - {0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11}, - {0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11}, - {0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}, -}; -u8 rtl8812ae_delta_swing_table_idx_5ga_n_txpwrtrack[][DELTA_SWINGIDX_SIZE] = { - {0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13}, - {0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13}, - {0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 18, 18}, -}; -u8 rtl8812ae_delta_swing_table_idx_5ga_p_txpwrtrack[][DELTA_SWINGIDX_SIZE] = { - {0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11}, - {0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}, - {0, 1, 1, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11}, -}; - -u8 rtl8821ae_delta_swing_table_idx_24gb_n_txpwrtrack[] = - {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10}; -u8 rtl8821ae_delta_swing_table_idx_24gb_p_txpwrtrack[] = - {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12}; -u8 rtl8821ae_delta_swing_table_idx_24ga_n_txpwrtrack[] = - {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10}; -u8 rtl8821ae_delta_swing_table_idx_24ga_p_txpwrtrack[] = - {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12}; -u8 rtl8821ae_delta_swing_table_idx_24gcckb_n_txpwrtrack[] = - {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10}; -u8 rtl8821ae_delta_swing_table_idx_24gcckb_p_txpwrtrack[] = - {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12}; -u8 rtl8821ae_delta_swing_table_idx_24gccka_n_txpwrtrack[] = - {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10}; -u8 rtl8821ae_delta_swing_table_idx_24gccka_p_txpwrtrack[] = - {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 12, 12}; - -u8 rtl8821ae_delta_swing_table_idx_5gb_n_txpwrtrack[][DELTA_SWINGIDX_SIZE] = { - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, -}; - -u8 rtl8821ae_delta_swing_table_idx_5gb_p_txpwrtrack[][DELTA_SWINGIDX_SIZE] = { - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, -}; - -u8 rtl8821ae_delta_swing_table_idx_5ga_n_txpwrtrack[][DELTA_SWINGIDX_SIZE] = { - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, -}; - -u8 rtl8821ae_delta_swing_table_idx_5ga_p_txpwrtrack[][DELTA_SWINGIDX_SIZE] = { - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, - {0, 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16}, -}; - -void rtl8812ae_dm_read_and_config_txpower_track( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===> rtl8821ae_dm_read_and_config_txpower_track\n")); - - - memcpy(rtldm->delta_swing_table_idx_24ga_p, - rtl8812ae_delta_swing_table_idx_24ga_p_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24ga_n, - rtl8812ae_delta_swing_table_idx_24ga_n_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gb_p, - rtl8812ae_delta_swing_table_idx_24gb_p_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gb_n, - rtl8812ae_delta_swing_table_idx_24gb_n_txpwrtrack, DELTA_SWINGIDX_SIZE); - - memcpy(rtldm->delta_swing_table_idx_24gccka_p, - rtl8812ae_delta_swing_table_idx_24gccka_p_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gccka_n, - rtl8812ae_delta_swing_table_idx_24gccka_n_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gcckb_p, - rtl8812ae_delta_swing_table_idx_24gcckb_p_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gcckb_n, - rtl8812ae_delta_swing_table_idx_24gcckb_n_txpwrtrack, DELTA_SWINGIDX_SIZE); - - memcpy(rtldm->delta_swing_table_idx_5ga_p, - rtl8812ae_delta_swing_table_idx_5ga_p_txpwrtrack, DELTA_SWINGIDX_SIZE*3); - memcpy(rtldm->delta_swing_table_idx_5ga_n, - rtl8812ae_delta_swing_table_idx_5ga_n_txpwrtrack, DELTA_SWINGIDX_SIZE*3); - memcpy(rtldm->delta_swing_table_idx_5gb_p, - rtl8812ae_delta_swing_table_idx_5gb_p_txpwrtrack, DELTA_SWINGIDX_SIZE*3); - memcpy(rtldm->delta_swing_table_idx_5gb_n, - rtl8812ae_delta_swing_table_idx_5gb_n_txpwrtrack, DELTA_SWINGIDX_SIZE*3); -} - -void rtl8821ae_dm_read_and_config_txpower_track( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===> rtl8821ae_dm_read_and_config_txpower_track\n")); - - - memcpy(rtldm->delta_swing_table_idx_24ga_p, - rtl8821ae_delta_swing_table_idx_24ga_p_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24ga_n, - rtl8821ae_delta_swing_table_idx_24ga_n_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gb_p, - rtl8821ae_delta_swing_table_idx_24gb_p_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gb_n, - rtl8821ae_delta_swing_table_idx_24gb_n_txpwrtrack, DELTA_SWINGIDX_SIZE); - - memcpy(rtldm->delta_swing_table_idx_24gccka_p, - rtl8821ae_delta_swing_table_idx_24gccka_p_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gccka_n, - rtl8821ae_delta_swing_table_idx_24gccka_n_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gcckb_p, - rtl8821ae_delta_swing_table_idx_24gcckb_p_txpwrtrack, DELTA_SWINGIDX_SIZE); - memcpy(rtldm->delta_swing_table_idx_24gcckb_n, - rtl8821ae_delta_swing_table_idx_24gcckb_n_txpwrtrack, DELTA_SWINGIDX_SIZE); - - memcpy(rtldm->delta_swing_table_idx_5ga_p, - rtl8821ae_delta_swing_table_idx_5ga_p_txpwrtrack, DELTA_SWINGIDX_SIZE*3); - memcpy(rtldm->delta_swing_table_idx_5ga_n, - rtl8821ae_delta_swing_table_idx_5ga_n_txpwrtrack, DELTA_SWINGIDX_SIZE*3); - memcpy(rtldm->delta_swing_table_idx_5gb_p, - rtl8821ae_delta_swing_table_idx_5gb_p_txpwrtrack, DELTA_SWINGIDX_SIZE*3); - memcpy(rtldm->delta_swing_table_idx_5gb_n, - rtl8821ae_delta_swing_table_idx_5gb_n_txpwrtrack, DELTA_SWINGIDX_SIZE*3); -} - - - -#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _deltaThermal) \ - do {\ - for(_offset = 0; _offset < _size; _offset++)\ - {\ - if(_deltaThermal < thermal_threshold[_direction][_offset])\ - {\ - if(_offset != 0)\ - _offset--;\ - break;\ - }\ - } \ - if(_offset >= _size)\ - _offset = _size-1;\ - } while(0) - - -void rtl8821ae_dm_txpower_track_adjust(struct ieee80211_hw *hw, - u8 type,u8 *pdirection, - u32 *poutwrite_val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - u8 pwr_val = 0; - - if (type == 0){ - if (rtlpriv->dm.bb_swing_idx_ofdm[RF90_PATH_A] <= - rtlpriv->dm.bb_swing_idx_ofdm_base[RF90_PATH_A]) { - *pdirection = 1; - pwr_val = rtldm->bb_swing_idx_ofdm_base[RF90_PATH_A] - rtldm->bb_swing_idx_ofdm[RF90_PATH_A]; - } else { - *pdirection = 2; - pwr_val = rtldm->bb_swing_idx_ofdm[RF90_PATH_A] - rtldm->bb_swing_idx_ofdm_base[RF90_PATH_A]; - } - } else if (type ==1) { - if (rtldm->bb_swing_idx_cck <= rtldm->bb_swing_idx_cck_base) { - *pdirection = 1; - pwr_val = rtldm->bb_swing_idx_cck_base - rtldm->bb_swing_idx_cck; - } else { - *pdirection = 2; - pwr_val = rtldm->bb_swing_idx_cck - rtldm->bb_swing_idx_cck_base; - } - } - - if (pwr_val >= TXPWRTRACK_MAX_IDX && (*pdirection == 1)) - pwr_val = TXPWRTRACK_MAX_IDX; - - *poutwrite_val = pwr_val |(pwr_val << 8)|(pwr_val << 16) | (pwr_val << 24); -} - -void rtl8821ae_dm_clear_txpower_tracking_state(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtlpriv); - struct rtl_efuse *rtlefuse = rtl_efuse(rtlpriv); - u8 p = 0; - rtldm->bb_swing_idx_cck_base = rtldm->default_cck_index; - rtldm->bb_swing_idx_cck = rtldm->default_cck_index; - rtldm->cck_index = 0; - - for (p = RF90_PATH_A; p < MAX_RF_PATH; ++p) { - rtldm->bb_swing_idx_ofdm_base[p] = rtldm->default_ofdm_index; - rtldm->bb_swing_idx_ofdm[p] = rtldm->default_ofdm_index; - rtldm->ofdm_index[p] = rtldm->default_ofdm_index; - - rtldm->power_index_offset[p] = 0; - rtldm->delta_power_index[p] = 0; - rtldm->delta_power_index_last[p] = 0; - - rtldm->aboslute_ofdm_swing_idx[p] = 0; /*Initial Mix mode power tracking*/ - rtldm->remnant_ofdm_swing_idx[p] = 0; - } - - rtldm->modify_txagc_flag_path_a = false; /*Initial at Modify Tx Scaling Mode*/ - rtldm->modify_txagc_flag_path_b = false; /*Initial at Modify Tx Scaling Mode*/ - rtldm->remnant_cck_idx = 0; - rtldm->thermalvalue = rtlefuse->eeprom_thermalmeter; - rtldm->thermalvalue_iqk = rtlefuse->eeprom_thermalmeter; - rtldm->thermalvalue_lck = rtlefuse->eeprom_thermalmeter; -} - -u8 rtl8821ae_dm_get_swing_index(struct ieee80211_hw *hw) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 i = 0; - u32 bb_swing; - - bb_swing =rtl8821ae_phy_query_bb_reg(hw, rtlhal->current_bandtype, RF90_PATH_A); - - for (i = 0; i < TXSCALE_TABLE_SIZE; ++i) - if ( bb_swing == rtl8821ae_txscaling_table[i]) - break; - - return i; -} - -void rtl8821ae_dm_initialize_txpower_tracking_thermalmeter( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtlpriv); - struct rtl_efuse *rtlefuse = rtl_efuse(rtlpriv); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 default_swing_index = 0; - u8 p = 0; - - rtlpriv->dm.txpower_track_control = true; - rtldm->thermalvalue = rtlefuse->eeprom_thermalmeter; - rtldm->thermalvalue_iqk = rtlefuse->eeprom_thermalmeter; - rtldm->thermalvalue_lck = rtlefuse->eeprom_thermalmeter; - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtl8812ae_dm_read_and_config_txpower_track(hw); - else - rtl8821ae_dm_read_and_config_txpower_track(hw); - - default_swing_index = rtl8821ae_dm_get_swing_index(hw); - - rtldm->default_ofdm_index = (default_swing_index == TXSCALE_TABLE_SIZE) ? 24 : default_swing_index; - rtldm->default_cck_index = 24; - - rtldm->bb_swing_idx_cck_base = rtldm->default_cck_index; - rtldm->cck_index = rtldm->default_cck_index; - - for (p = RF90_PATH_A; p < MAX_RF_PATH; ++p) - { - rtldm->bb_swing_idx_ofdm_base[p] = rtldm->default_ofdm_index; - rtldm->ofdm_index[p] = rtldm->default_ofdm_index; - rtldm->delta_power_index[p] = 0; - rtldm->power_index_offset[p] = 0; - rtldm->delta_power_index_last[p] = 0; - } -} - -static void rtl8821ae_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw) -{ - dm_pstable.pre_ccastate = CCA_MAX; - dm_pstable.cur_ccasate = CCA_MAX; - dm_pstable.pre_rfstate = RF_MAX; - dm_pstable.cur_rfstate = RF_MAX; - dm_pstable.rssi_val_min = 0; - dm_pstable.initialize = 0; -} - - -static void rtl8821ae_dm_diginit(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - //dm_digtable.dig_enable_flag = true; - dm_digtable.cur_igvalue = rtl_get_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f); - /*dm_digtable.pre_igvalue = 0; - dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; - dm_digtable.presta_connectstate = DIG_STA_DISCONNECT; - dm_digtable.curmultista_connectstate = DIG_MULTISTA_DISCONNECT;*/ - dm_digtable.rssi_lowthresh = DM_DIG_THRESH_LOW; - dm_digtable.rssi_highthresh = DM_DIG_THRESH_HIGH; - dm_digtable.fa_lowthresh = DM_FALSEALARM_THRESH_LOW; - dm_digtable.fa_highthresh = DM_FALSEALARM_THRESH_HIGH; - dm_digtable.rx_gain_range_max = DM_DIG_MAX; - dm_digtable.rx_gain_range_min = DM_DIG_MIN; - dm_digtable.backoff_val = DM_DIG_BACKOFF_DEFAULT; - dm_digtable.backoff_val_range_max = DM_DIG_BACKOFF_MAX; - dm_digtable.backoff_val_range_min = DM_DIG_BACKOFF_MIN; - dm_digtable.pre_cck_cca_thres = 0xff; - dm_digtable.cur_cck_cca_thres = 0x83; - dm_digtable.forbidden_igi = DM_DIG_MIN; - dm_digtable.large_fa_hit = 0; - dm_digtable.recover_cnt = 0; - dm_digtable.dig_dynamic_min_0 = DM_DIG_MIN; - dm_digtable.dig_dynamic_min_1 = DM_DIG_MIN; - dm_digtable.b_media_connect_0 = false; - dm_digtable.b_media_connect_1 = false; - rtlpriv->dm.b_dm_initialgain_enable = true; - dm_digtable.bt30_cur_igi = 0x32; -} - -static void rtl8821ae_dm_init_dynamic_txpower(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.bdynamic_txpower_enable = false; - - rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; - rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; -} - - -void rtl8821ae_dm_init_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtlpriv->dm.bcurrent_turbo_edca = false; - rtlpriv->dm.bis_any_nonbepkts = false; - rtlpriv->dm.bis_cur_rdlstate = false; -} - - -void rtl8821ae_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rate_adaptive *p_ra = &(rtlpriv->ra); - - p_ra->ratr_state = DM_RATR_STA_INIT; - p_ra->pre_ratr_state = DM_RATR_STA_INIT; - - rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; - if (rtlpriv->dm.dm_type == DM_TYPE_BYDRIVER) - rtlpriv->dm.b_useramask = true; - else - rtlpriv->dm.b_useramask = false; - - p_ra->high_rssi_thresh_for_ra = 50; - p_ra->low_rssi_thresh_for_ra = 20; -} - - -static void rtl8821ae_dm_init_txpower_tracking(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.btxpower_tracking = true; - rtlpriv->dm.btxpower_trackinginit = false; - rtlpriv->dm.txpowercount = 0; - rtlpriv->dm.txpower_track_control = true; - rtlpriv->dm.thermalvalue = 0; - - rtlpriv->dm.ofdm_index[0] = 30; - rtlpriv->dm.cck_index = 20; - - rtlpriv->dm.bb_swing_idx_cck_base = rtlpriv->dm.cck_index; - - - rtlpriv->dm.bb_swing_idx_ofdm[RF90_PATH_A] = rtlpriv->dm.ofdm_index[0]; - rtlpriv->dm.bb_swing_idx_ofdm[RF90_PATH_B] = rtlpriv->dm.ofdm_index[0]; - rtlpriv->dm.delta_power_index[0] = 0; - rtlpriv->dm.delta_power_index_last[0] = 0; - rtlpriv->dm.power_index_offset[0] = 0; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - (" rtlpriv->dm.btxpower_tracking = %d\n", - rtlpriv->dm.btxpower_tracking)); -} - - -void rtl8821ae_dm_init_dynamic_atc_switch(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpriv->dm.crystal_cap = rtlpriv->efuse.crystalcap; - - rtlpriv->dm.atc_status = rtl_get_bbreg(hw, ROFDM1_CFOTRACKING, BIT(11)); - rtlpriv->dm.cfo_threshold = CFO_THRESHOLD_XTAL; -} - - -void rtl8821ae_dm_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - spin_lock(&rtlpriv->locks.iqk_lock); - rtlphy->b_iqk_in_progress = false; - spin_unlock(&rtlpriv->locks.iqk_lock); - - rtlpriv->dm.dm_type = DM_TYPE_BYDRIVER; - rtl8821ae_dm_diginit(hw); - rtl8821ae_dm_init_rate_adaptive_mask(hw); - rtl8812ae_dm_path_diversity_init(hw); - rtl8821ae_dm_init_edca_turbo(hw); - rtl8821ae_dm_initialize_txpower_tracking_thermalmeter(hw); -#if 1 - rtl8821ae_dm_init_dynamic_bb_powersaving(hw); - rtl8821ae_dm_init_dynamic_txpower(hw); - rtl8821ae_dm_init_txpower_tracking(hw); -#endif - rtl8821ae_dm_init_dynamic_atc_switch(hw); -} - -void rtl8821ae_dm_find_minimum_rssi(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dig *rtl_dm_dig = &(rtlpriv->dm.dm_digtable); - struct rtl_mac *mac = rtl_mac(rtlpriv); - - /* Determine the minimum RSSI */ - if ((mac->link_state < MAC80211_LINKED) && - (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { - rtl_dm_dig->min_undecorated_pwdb_for_dm = 0; - RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD, - ("Not connected to any \n")); - } - if (mac->link_state >= MAC80211_LINKED) { - if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - rtl_dm_dig->min_undecorated_pwdb_for_dm = - rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; - RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD, - ("AP Client PWDB = 0x%lx \n", - rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb)); - } else { - rtl_dm_dig->min_undecorated_pwdb_for_dm = - rtlpriv->dm.undecorated_smoothed_pwdb; - RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD, - ("STA Default Port PWDB = 0x%x \n", - rtl_dm_dig->min_undecorated_pwdb_for_dm)); - } - } else { - rtl_dm_dig->min_undecorated_pwdb_for_dm = - rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; - RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD, - ("AP Ext Port or disconnet PWDB = 0x%x \n", - rtl_dm_dig->min_undecorated_pwdb_for_dm)); - } - RT_TRACE(COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n", - rtl_dm_dig->min_undecorated_pwdb_for_dm)); -} - -#if 0 -void rtl8812ae_dm_rssi_dump_to_register( - struct ieee80211_hw *hw - ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtl_write_byte(rtlpriv, RA_RSSI_DUMP, Adapter->RxStats.RxRSSIPercentage[0]); - rtl_write_byte(rtlpriv, RB_RSSI_DUMP, Adapter->RxStats.RxRSSIPercentage[1]); - - /* Rx EVM*/ - rtl_write_byte(rtlpriv, RS1_RX_EVM_DUMP, Adapter->RxStats.RxEVMdbm[0]); - rtl_write_byte(rtlpriv, RS2_RX_EVM_DUMP, Adapter->RxStats.RxEVMdbm[1]); - - /*Rx SNR*/ - rtl_write_byte(rtlpriv, RA_RX_SNR_DUMP, (u1Byte)(Adapter->RxStats.RxSNRdB[0])); - rtl_write_byte(rtlpriv, RB_RX_SNR_DUMP, (u1Byte)(Adapter->RxStats.RxSNRdB[1])); - - /*Rx Cfo_Short*/ - rtl_write_word(rtlpriv, RA_CFO_SHORT_DUMP, Adapter->RxStats.RxCfoShort[0]); - rtl_write_word(rtlpriv, RB_CFO_SHORT_DUMP, Adapter->RxStats.RxCfoShort[1]); - - /*Rx Cfo_Tail*/ - rtl_write_word(rtlpriv, RA_CFO_LONG_DUMP, Adapter->RxStats.RxCfoTail[0]); - rtl_write_word(rtlpriv, RB_CFO_LONG_DUMP, Adapter->RxStats.RxCfoTail[1]); - -} -#endif - -static void rtl8821ae_dm_check_rssi_monitor(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_sta_info *drv_priv; - u8 h2c_parameter[3] = { 0 }; - long tmp_entry_max_pwdb = 0, tmp_entry_min_pwdb = 0xff; - - - /* AP & ADHOC & MESH */ - spin_lock_bh(&rtlpriv->locks.entry_list_lock); - list_for_each_entry(drv_priv, &rtlpriv->entry_list, list) { - if(drv_priv->rssi_stat.undecorated_smoothed_pwdb < tmp_entry_min_pwdb) - tmp_entry_min_pwdb = drv_priv->rssi_stat.undecorated_smoothed_pwdb; - if(drv_priv->rssi_stat.undecorated_smoothed_pwdb > tmp_entry_max_pwdb) - tmp_entry_max_pwdb = drv_priv->rssi_stat.undecorated_smoothed_pwdb; - - /*h2c_parameter[2] = (u8) (rtlpriv->dm.undecorated_smoothed_pwdb & 0xFF); - h2c_parameter[1] = 0x20; - h2c_parameter[0] = drv_priv->rssi_stat; - rtl8821ae_fill_h2c_cmd(hw, H2C_RSSI_REPORT, 3, h2c_parameter);*/ - } - spin_unlock_bh(&rtlpriv->locks.entry_list_lock); - - /* If associated entry is found */ - if (tmp_entry_max_pwdb != 0) { - rtlpriv->dm.entry_max_undecoratedsmoothed_pwdb = tmp_entry_max_pwdb; - RTPRINT(rtlpriv, FDM, DM_PWDB, ("EntryMaxPWDB = 0x%lx(%ld)\n", - tmp_entry_max_pwdb, tmp_entry_max_pwdb)); - } else { - rtlpriv->dm.entry_max_undecoratedsmoothed_pwdb = 0; - } - /* If associated entry is found */ - if (tmp_entry_min_pwdb != 0xff) { - rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb = tmp_entry_min_pwdb; - RTPRINT(rtlpriv, FDM, DM_PWDB, ("EntryMinPWDB = 0x%lx(%ld)\n", - tmp_entry_min_pwdb, tmp_entry_min_pwdb)); - } else { - rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb = 0; - } - /* Indicate Rx signal strength to FW. */ - if (rtlpriv->dm.b_useramask) { - h2c_parameter[2] = (u8) (rtlpriv->dm.undecorated_smoothed_pwdb & 0xFF); - h2c_parameter[1] = 0x20; - h2c_parameter[0] = 0; - rtl8821ae_fill_h2c_cmd(hw, H2C_RSSI_REPORT, 3, h2c_parameter); - } else { - rtl_write_byte(rtlpriv, 0x4fe, rtlpriv->dm.undecorated_smoothed_pwdb); - } - rtl8821ae_dm_find_minimum_rssi(hw); - dm_digtable.rssi_val_min = rtlpriv->dm.dm_digtable.min_undecorated_pwdb_for_dm; -} - -void rtl8821ae_dm_write_cck_cca_thres(struct ieee80211_hw *hw, u8 current_cca) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (dm_digtable.cur_cck_cca_thres != current_cca) - rtl_write_byte(rtlpriv, DM_REG_CCK_CCA_11AC, current_cca); - - dm_digtable.pre_cck_cca_thres = dm_digtable.cur_cck_cca_thres; - dm_digtable.cur_cck_cca_thres = current_cca; -} - -void rtl8821ae_dm_write_dig(struct ieee80211_hw *hw, u8 current_igi) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if(dm_digtable.stop_dig) - return; - - if (dm_digtable.cur_igvalue != current_igi){ - rtl_set_bbreg(hw, DM_REG_IGI_A_11AC, DM_BIT_IGI_11AC, current_igi); - if (rtlpriv->phy.rf_type != RF_1T1R) - rtl_set_bbreg(hw, DM_REG_IGI_B_11AC, DM_BIT_IGI_11AC, current_igi); - } - //dm_digtable.pre_igvalue = dm_digtable.cur_igvalue; - dm_digtable.cur_igvalue = current_igi; -} - -static void rtl8821ae_dm_dig(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 dig_dynamic_min; - u8 dig_max_of_min; - bool first_connect, first_disconnect; - u8 dm_dig_max, dm_dig_min, offset; - u8 current_igi =dm_digtable.cur_igvalue; - - - RT_TRACE(COMP_DIG, DBG_LOUD,("rtl8821ae_dm_dig()==>\n")); - - - if (mac->act_scanning == true) { - RT_TRACE(COMP_DIG, DBG_LOUD,("rtl8821ae_dm_dig() Return: In Scan Progress \n")); - return; - } - - /*add by Neil Chen to avoid PSD is processing*/ - dig_dynamic_min = dm_digtable.dig_dynamic_min_0; - first_connect = (mac->link_state >= MAC80211_LINKED) && - (dm_digtable.b_media_connect_0 == false); - first_disconnect = (mac->link_state < MAC80211_LINKED) && - (dm_digtable.b_media_connect_0 == true); - - /*1 Boundary Decision*/ - - - dm_dig_max = 0x5A; - - if (rtlhal->hw_type != HARDWARE_TYPE_RTL8821AE) - dm_dig_min = DM_DIG_MIN; - else - dm_dig_min = 0x1C; - - dig_max_of_min = DM_DIG_MAX_AP; - - if (mac->link_state >= MAC80211_LINKED) { - if (rtlhal->hw_type != HARDWARE_TYPE_RTL8821AE) - offset = 20; - else - offset = 10; - - if ((dm_digtable.rssi_val_min + offset) > dm_dig_max) - dm_digtable.rx_gain_range_max = dm_dig_max; - else if ((dm_digtable.rssi_val_min + offset) < dm_dig_min) - dm_digtable.rx_gain_range_max = dm_dig_min; - else - dm_digtable.rx_gain_range_max = dm_digtable.rssi_val_min + offset; - - if(rtlpriv->dm.b_one_entry_only){ - offset = 0; - - if (dm_digtable.rssi_val_min - offset < dm_dig_min) - dig_dynamic_min = dm_dig_min; - else if (dm_digtable.rssi_val_min - offset > dig_max_of_min) - dig_dynamic_min = dig_max_of_min; - else - dig_dynamic_min = dm_digtable.rssi_val_min - offset; - - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig() : bOneEntryOnly=TRUE, dig_dynamic_min=0x%x\n", - dig_dynamic_min)); - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig() : dm_digtable.rssi_val_min=%d",dm_digtable. - rssi_val_min)); - } else { - dig_dynamic_min = dm_dig_min; - } - } else { - dm_digtable.rx_gain_range_max = dm_dig_max; - dig_dynamic_min = dm_dig_min; - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig() : No Link\n")); - } - - if (rtlpriv->falsealm_cnt.cnt_all > 10000) { - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): Abnornally false alarm case. \n")); - - if (dm_digtable.large_fa_hit != 3) - dm_digtable.large_fa_hit++; - if (dm_digtable.forbidden_igi < current_igi) { - dm_digtable.forbidden_igi = current_igi; - dm_digtable.large_fa_hit = 1; - } - - if (dm_digtable.large_fa_hit >= 3) { - if((dm_digtable.forbidden_igi + 1) > dm_digtable.rx_gain_range_max) - dm_digtable.rx_gain_range_min = dm_digtable.rx_gain_range_max; - else - dm_digtable.rx_gain_range_min = (dm_digtable.forbidden_igi + 1); - dm_digtable.recover_cnt = 3600; - } - - } else { - /*Recovery mechanism for IGI lower bound*/ - if (dm_digtable.recover_cnt != 0) - dm_digtable.recover_cnt --; - else { - if (dm_digtable.large_fa_hit < 3) { - if ((dm_digtable.forbidden_igi -1) < dig_dynamic_min) { - dm_digtable.forbidden_igi = dig_dynamic_min; - dm_digtable.rx_gain_range_min = dig_dynamic_min; - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): Normal Case: At Lower Bound\n")); - } else { - dm_digtable.forbidden_igi --; - dm_digtable.rx_gain_range_min = (dm_digtable.forbidden_igi + 1); - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): Normal Case: Approach Lower Bound\n")); - } - } else { - dm_digtable.large_fa_hit = 0; - } - } - } - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): pDM_DigTable->LargeFAHit=%d\n", - dm_digtable.large_fa_hit)); - - if (rtlpriv->dm.dbginfo.num_qry_beacon_pkt < 10) - dm_digtable.rx_gain_range_min = dm_dig_min; - - if (dm_digtable.rx_gain_range_min > dm_digtable.rx_gain_range_max) - dm_digtable.rx_gain_range_min = dm_digtable.rx_gain_range_max; - - /*Adjust initial gain by false alarm*/ - if (mac->link_state >= MAC80211_LINKED) { - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): DIG AfterLink\n")); - if (first_connect) { - if (dm_digtable.rssi_val_min <= dig_max_of_min) - current_igi = dm_digtable.rssi_val_min; - else - current_igi = dig_max_of_min; - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig: First Connect\n")); - } else { - if(rtlpriv->falsealm_cnt.cnt_all > DM_DIG_FA_TH2) - current_igi = current_igi + 4; - else if (rtlpriv->falsealm_cnt.cnt_all > DM_DIG_FA_TH1) - current_igi = current_igi + 2; - else if(rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH0) - current_igi = current_igi - 2; - - if((rtlpriv->dm.dbginfo.num_qry_beacon_pkt < 10) - &&(rtlpriv->falsealm_cnt.cnt_all < DM_DIG_FA_TH1)) { - current_igi = dm_digtable.rx_gain_range_min; - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): Beacon is less than 10 and FA is less than 768, IGI GOES TO 0x1E!!!!!!!!!!!!\n")); - } - } - } else{ - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): DIG BeforeLink\n")); - if (first_disconnect){ - current_igi = dm_digtable.rx_gain_range_min; - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): First DisConnect \n")); - } else { - /*2012.03.30 LukeLee: enable DIG before link but with very high thresholds*/ - if (rtlpriv->falsealm_cnt.cnt_all > 2000) - current_igi = current_igi + 4; - else if (rtlpriv->falsealm_cnt.cnt_all > 600) - current_igi = current_igi + 2; - else if(rtlpriv->falsealm_cnt.cnt_all < 300) - current_igi = current_igi - 2; - if (current_igi >= 0x3e) - current_igi = 0x3e; - RT_TRACE(COMP_DIG, DBG_LOUD,("rtl8821ae_dm_dig(): England DIG \n")); - } - } - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): DIG End Adjust IGI\n")); - /* Check initial gain by upper/lower bound*/ - - if (current_igi > dm_digtable.rx_gain_range_max) - current_igi = dm_digtable.rx_gain_range_max; - if (current_igi < dm_digtable.rx_gain_range_min) - current_igi = dm_digtable.rx_gain_range_min; - - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): rx_gain_range_max=0x%x, rx_gain_range_min=0x%x\n", - dm_digtable.rx_gain_range_max, dm_digtable.rx_gain_range_min)); - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): TotalFA=%d\n", rtlpriv->falsealm_cnt.cnt_all)); - RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): CurIGValue=0x%x\n", current_igi)); - - rtl8821ae_dm_write_dig(hw, current_igi); - dm_digtable.b_media_connect_0= ((mac->link_state >= MAC80211_LINKED) ? true :false); - dm_digtable.dig_dynamic_min_0 = dig_dynamic_min; -} - -static void rtl8821ae_dm_common_info_self_update(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 cnt = 0; - struct rtl_sta_info *drv_priv; - - rtlpriv->dm.b_one_entry_only = false; - - if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_STATION && - rtlpriv->mac80211.link_state >= MAC80211_LINKED) { - rtlpriv->dm.b_one_entry_only = true; - return; - } - - if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP || - rtlpriv->mac80211.opmode == NL80211_IFTYPE_ADHOC || - rtlpriv->mac80211.opmode == NL80211_IFTYPE_MESH_POINT) { - spin_lock_bh(&rtlpriv->locks.entry_list_lock); - list_for_each_entry(drv_priv, &rtlpriv->entry_list, list) { - cnt ++; - } - spin_unlock_bh(&rtlpriv->locks.entry_list_lock); - - if (cnt == 1) - rtlpriv->dm.b_one_entry_only = true; - } -} - - -static void rtl8821ae_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct false_alarm_statistics *falsealm_cnt = &(rtlpriv->falsealm_cnt); - u32 cck_enable =0; - - /*read OFDM FA counter*/ - falsealm_cnt->cnt_ofdm_fail = rtl_get_bbreg(hw, ODM_REG_OFDM_FA_11AC, BMASKLWORD); - falsealm_cnt->cnt_cck_fail = rtl_get_bbreg(hw, ODM_REG_CCK_FA_11AC, BMASKLWORD); - - cck_enable = rtl_get_bbreg(hw, ODM_REG_BB_RX_PATH_11AC, BIT(28)); - if (cck_enable) /*if(pDM_Odm->pBandType == ODM_BAND_2_4G)*/ - falsealm_cnt->cnt_all = falsealm_cnt->cnt_ofdm_fail + falsealm_cnt->cnt_cck_fail; - else - falsealm_cnt->cnt_all = falsealm_cnt->cnt_ofdm_fail; - - /*reset OFDM FA coutner*/ - rtl_set_bbreg(hw, ODM_REG_OFDM_FA_RST_11AC, BIT(17), 1); - rtl_set_bbreg(hw, ODM_REG_OFDM_FA_RST_11AC, BIT(17), 0); - /* reset CCK FA counter*/ - rtl_set_bbreg(hw, ODM_REG_CCK_FA_RST_11AC, BIT(15), 0); - rtl_set_bbreg(hw, ODM_REG_CCK_FA_RST_11AC, BIT(15), 1); - - RT_TRACE(COMP_DIG, DBG_LOUD, ("Cnt_Cck_fail=%d\n", - falsealm_cnt->cnt_cck_fail)); - RT_TRACE(COMP_DIG, DBG_LOUD, ("cnt_ofdm_fail=%d\n", - falsealm_cnt->cnt_ofdm_fail)); - RT_TRACE(COMP_DIG, DBG_LOUD, ("Total False Alarm=%d\n", - falsealm_cnt->cnt_all)); -} - -void rtl8812ae_dm_check_txpower_tracking_thermalmeter( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - static u8 tm_trigger = 0; - - if (!rtlpriv->dm.btxpower_tracking) - return; - - if (!tm_trigger) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER_88E, BIT(17)|BIT(16), 0x03); - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Trigger 8812 Thermal Meter!!\n")); - tm_trigger = 1; - return; - } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Schedule TxPowerTracking direct call!!\n")); - rtl8812ae_dm_txpower_tracking_callback_thermalmeter(hw); - tm_trigger = 0; - } -} - -static void rtl8821ae_dm_iq_calibrate(struct ieee80211_hw *hw) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (mac->link_state >= MAC80211_LINKED) { - /*if ((*rtldm->p_channel != rtldm->pre_channel ) - && (!mac->act_scanning)) { - rtldm->pre_channel = *rtldm->p_channel; - rtldm->linked_interval = 0; - }*/ - - if(rtldm->linked_interval < 3) - rtldm->linked_interval ++; - - if(rtldm->linked_interval == 2) - { - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtl8812ae_phy_iq_calibrate(hw, false); - else - rtl8821ae_phy_iq_calibrate(hw, false); - } - } else { - rtldm->linked_interval = 0; - } -} - - -void rtl8812ae_get_delta_swing_table( - struct ieee80211_hw *hw, - u8 **temperature_up_a, - u8 **temperature_down_a, - u8 **temperature_up_b, - u8 **temperature_down_b - ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - u8 channel = rtlphy->current_channel; - u8 rate = rtldm->tx_rate; - - - if ( 1 <= channel && channel <= 14) { - if (RX_HAL_IS_CCK_RATE(rate)) { - *temperature_up_a = rtldm->delta_swing_table_idx_24gccka_p; - *temperature_down_a = rtldm->delta_swing_table_idx_24gccka_n; - *temperature_up_b = rtldm->delta_swing_table_idx_24gcckb_p; - *temperature_down_b = rtldm->delta_swing_table_idx_24gcckb_n; - } else { - *temperature_up_a = rtldm->delta_swing_table_idx_24ga_p; - *temperature_down_a = rtldm->delta_swing_table_idx_24ga_n; - *temperature_up_b = rtldm->delta_swing_table_idx_24gb_p; - *temperature_down_b = rtldm->delta_swing_table_idx_24gb_n; - } - } else if ( 36 <= channel && channel <= 64) { - *temperature_up_a = rtldm->delta_swing_table_idx_5ga_p[0]; - *temperature_down_a = rtldm->delta_swing_table_idx_5ga_n[0]; - *temperature_up_b = rtldm->delta_swing_table_idx_5gb_p[0]; - *temperature_down_b = rtldm->delta_swing_table_idx_5gb_n[0]; - } else if ( 100 <= channel && channel <= 140) { - *temperature_up_a = rtldm->delta_swing_table_idx_5ga_p[1]; - *temperature_down_a = rtldm->delta_swing_table_idx_5ga_n[1]; - *temperature_up_b = rtldm->delta_swing_table_idx_5gb_p[1]; - *temperature_down_b = rtldm->delta_swing_table_idx_5gb_n[1]; - } else if ( 149 <= channel && channel <= 173) { - *temperature_up_a = rtldm->delta_swing_table_idx_5ga_p[2]; - *temperature_down_a = rtldm->delta_swing_table_idx_5ga_n[2]; - *temperature_up_b = rtldm->delta_swing_table_idx_5gb_p[2]; - *temperature_down_b = rtldm->delta_swing_table_idx_5gb_n[2]; - } else { - *temperature_up_a = (u8*)rtl8818e_delta_swing_table_idx_24gb_p_txpwrtrack; - *temperature_down_a =(u8*)rtl8818e_delta_swing_table_idx_24gb_n_txpwrtrack; - *temperature_up_b = (u8*)rtl8818e_delta_swing_table_idx_24gb_p_txpwrtrack; - *temperature_down_b = (u8*)rtl8818e_delta_swing_table_idx_24gb_n_txpwrtrack; - } - - return; -} - -void rtl8812ae_phy_lccalibrate( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("===> rtl8812ae_phy_lccalibrate\n")); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("<=== rtl8812ae_phy_lccalibrate\n")); - -} - -void rtl8812ae_dm_update_init_rate( - struct ieee80211_hw *hw, - u8 rate - ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 p = 0; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Get C2H Command! Rate=0x%x\n", rate)); - - rtldm->tx_rate = rate; - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE){ - rtl8821ae_dm_txpwr_track_set_pwr(hw, MIX_MODE, RF90_PATH_A, 0); - } - else - { - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8812A; p++) - { - rtl8812ae_dm_txpwr_track_set_pwr(hw, BBSWING, p, 0); - } - } - -} - -u8 rtl8812ae_hw_rate_to_mrate( - struct ieee80211_hw *hw, - u8 rate - ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 ret_rate = MGN_1M; - - - switch(rate) - { - case DESC_RATE1M: ret_rate = MGN_1M; break; - case DESC_RATE2M: ret_rate = MGN_2M; break; - case DESC_RATE5_5M: ret_rate = MGN_5_5M; break; - case DESC_RATE11M: ret_rate = MGN_11M; break; - case DESC_RATE6M: ret_rate = MGN_6M; break; - case DESC_RATE9M: ret_rate = MGN_9M; break; - case DESC_RATE12M: ret_rate = MGN_12M; break; - case DESC_RATE18M: ret_rate = MGN_18M; break; - case DESC_RATE24M: ret_rate = MGN_24M; break; - case DESC_RATE36M: ret_rate = MGN_36M; break; - case DESC_RATE48M: ret_rate = MGN_48M; break; - case DESC_RATE54M: ret_rate = MGN_54M; break; - case DESC_RATEMCS0: ret_rate = MGN_MCS0; break; - case DESC_RATEMCS1: ret_rate = MGN_MCS1; break; - case DESC_RATEMCS2: ret_rate = MGN_MCS2; break; - case DESC_RATEMCS3: ret_rate = MGN_MCS3; break; - case DESC_RATEMCS4: ret_rate = MGN_MCS4; break; - case DESC_RATEMCS5: ret_rate = MGN_MCS5; break; - case DESC_RATEMCS6: ret_rate = MGN_MCS6; break; - case DESC_RATEMCS7: ret_rate = MGN_MCS7; break; - case DESC_RATEMCS8: ret_rate = MGN_MCS8; break; - case DESC_RATEMCS9: ret_rate = MGN_MCS9; break; - case DESC_RATEMCS10: ret_rate = MGN_MCS10; break; - case DESC_RATEMCS11: ret_rate = MGN_MCS11; break; - case DESC_RATEMCS12: ret_rate = MGN_MCS12; break; - case DESC_RATEMCS13: ret_rate = MGN_MCS13; break; - case DESC_RATEMCS14: ret_rate = MGN_MCS14; break; - case DESC_RATEMCS15: ret_rate = MGN_MCS15; break; - case DESC_RATEVHT1SS_MCS0: ret_rate = MGN_VHT1SS_MCS0; break; - case DESC_RATEVHT1SS_MCS1: ret_rate = MGN_VHT1SS_MCS1; break; - case DESC_RATEVHT1SS_MCS2: ret_rate = MGN_VHT1SS_MCS2; break; - case DESC_RATEVHT1SS_MCS3: ret_rate = MGN_VHT1SS_MCS3; break; - case DESC_RATEVHT1SS_MCS4: ret_rate = MGN_VHT1SS_MCS4; break; - case DESC_RATEVHT1SS_MCS5: ret_rate = MGN_VHT1SS_MCS5; break; - case DESC_RATEVHT1SS_MCS6: ret_rate = MGN_VHT1SS_MCS6; break; - case DESC_RATEVHT1SS_MCS7: ret_rate = MGN_VHT1SS_MCS7; break; - case DESC_RATEVHT1SS_MCS8: ret_rate = MGN_VHT1SS_MCS8; break; - case DESC_RATEVHT1SS_MCS9: ret_rate = MGN_VHT1SS_MCS9; break; - case DESC_RATEVHT2SS_MCS0: ret_rate = MGN_VHT2SS_MCS0; break; - case DESC_RATEVHT2SS_MCS1: ret_rate = MGN_VHT2SS_MCS1; break; - case DESC_RATEVHT2SS_MCS2: ret_rate = MGN_VHT2SS_MCS2; break; - case DESC_RATEVHT2SS_MCS3: ret_rate = MGN_VHT2SS_MCS3; break; - case DESC_RATEVHT2SS_MCS4: ret_rate = MGN_VHT2SS_MCS4; break; - case DESC_RATEVHT2SS_MCS5: ret_rate = MGN_VHT2SS_MCS5; break; - case DESC_RATEVHT2SS_MCS6: ret_rate = MGN_VHT2SS_MCS6; break; - case DESC_RATEVHT2SS_MCS7: ret_rate = MGN_VHT2SS_MCS7; break; - case DESC_RATEVHT2SS_MCS8: ret_rate = MGN_VHT2SS_MCS8; break; - case DESC_RATEVHT2SS_MCS9: ret_rate = MGN_VHT2SS_MCS9; break; - - default: - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("HwRateToMRate8812(): Non supported Rate [%x]!!!\n",rate )); - break; - } - return ret_rate; -} - -/*----------------------------------------------------------------------------- - * Function: odm_TxPwrTrackSetPwr88E() - * - * Overview: 88E change all channel tx power accordign to flag. - * OFDM & CCK are all different. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 04/23/2012 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -void rtl8812ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, - enum pwr_track_control_method method, u8 rf_path, u8 channel_mapped_index) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 final_bb_swing_idx[2]; - u8 pwr_tracking_limit = 26; /*+1.0dB*/ - u8 tx_rate = 0xFF; - s8 final_ofdm_swing_index = 0; - - if(rtldm->tx_rate != 0xFF) - tx_rate = rtl8812ae_hw_rate_to_mrate(hw, rtldm->tx_rate); - - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===>rtl8812ae_dm_txpwr_track_set_pwr\n")); - - if(tx_rate != 0xFF) { /*20130429 Mimic Modify High Rate BBSwing Limit.*/ - /*CCK*/ - if((tx_rate >= MGN_1M) && (tx_rate <= MGN_11M)) - pwr_tracking_limit = 32; /*+4dB*/ - /*OFDM*/ - else if((tx_rate >= MGN_6M) && (tx_rate <= MGN_48M)) - pwr_tracking_limit = 30; /*+3dB*/ - else if(tx_rate == MGN_54M) - pwr_tracking_limit = 28; /*+2dB*/ - /*HT*/ - else if((tx_rate >= MGN_MCS0) && (tx_rate <= MGN_MCS2)) /*QPSK/BPSK*/ - pwr_tracking_limit = 34; /*+5dB*/ - else if((tx_rate >= MGN_MCS3) && (tx_rate <= MGN_MCS4)) /*16QAM*/ - pwr_tracking_limit = 30; /*+3dB*/ - else if((tx_rate >= MGN_MCS5) && (tx_rate <= MGN_MCS7)) /*64QAM*/ - pwr_tracking_limit = 28; /*+2dB*/ - - else if((tx_rate >= MGN_MCS8) && (tx_rate <= MGN_MCS10)) /*QPSK/BPSK*/ - pwr_tracking_limit = 34; /*+5dB*/ - else if((tx_rate >= MGN_MCS11) && (tx_rate <= MGN_MCS12)) /*16QAM*/ - pwr_tracking_limit = 30; /*+3dB*/ - else if((tx_rate >= MGN_MCS13) && (tx_rate <= MGN_MCS15)) /*64QAM*/ - pwr_tracking_limit = 28; /*+2dB*/ - - /*2 VHT*/ - else if((tx_rate >= MGN_VHT1SS_MCS0) && (tx_rate <= MGN_VHT1SS_MCS2)) /*QPSK/BPSK*/ - pwr_tracking_limit = 34; /*+5dB*/ - else if((tx_rate >= MGN_VHT1SS_MCS3) && (tx_rate <= MGN_VHT1SS_MCS4)) /*16QAM*/ - pwr_tracking_limit = 30; /*+3dB*/ - else if((tx_rate >= MGN_VHT1SS_MCS5)&&(tx_rate <= MGN_VHT1SS_MCS6)) /*64QAM*/ - pwr_tracking_limit = 28; /*+2dB*/ - else if(tx_rate == MGN_VHT1SS_MCS7) /*64QAM*/ - pwr_tracking_limit = 26; /*+1dB*/ - else if(tx_rate == MGN_VHT1SS_MCS8) /*256QAM*/ - pwr_tracking_limit = 24; /*+0dB*/ - else if(tx_rate == MGN_VHT1SS_MCS9) /*256QAM*/ - pwr_tracking_limit = 22; /*-1dB*/ - - else if((tx_rate >= MGN_VHT2SS_MCS0)&&(tx_rate <= MGN_VHT2SS_MCS2)) /*QPSK/BPSK*/ - pwr_tracking_limit = 34; /*+5dB*/ - else if((tx_rate >= MGN_VHT2SS_MCS3)&&(tx_rate <= MGN_VHT2SS_MCS4)) /*16QAM*/ - pwr_tracking_limit = 30; /*+3dB*/ - else if((tx_rate >= MGN_VHT2SS_MCS5)&&(tx_rate <= MGN_VHT2SS_MCS6)) /*64QAM*/ - pwr_tracking_limit = 28; /*+2dB*/ - else if(tx_rate == MGN_VHT2SS_MCS7) /*64QAM*/ - pwr_tracking_limit = 26; /*+1dB*/ - else if(tx_rate == MGN_VHT2SS_MCS8) /*256QAM*/ - pwr_tracking_limit = 24; /*+0dB*/ - else if(tx_rate == MGN_VHT2SS_MCS9) /*256QAM*/ - pwr_tracking_limit = 22; /*-1dB*/ - else - pwr_tracking_limit = 24; - } - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("TxRate=0x%x, PwrTrackingLimit=%d\n", tx_rate, pwr_tracking_limit)); - - - if (method == BBSWING) { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===>rtl8812ae_dm_txpwr_track_set_pwr\n")); - - if (rf_path == RF90_PATH_A) { - final_bb_swing_idx[RF90_PATH_A] = - (rtldm->ofdm_index[RF90_PATH_A] > pwr_tracking_limit) ? - pwr_tracking_limit : rtldm->ofdm_index[RF90_PATH_A]; - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("pDM_Odm->RFCalibrateInfo.OFDM_index[ODM_RF_PATH_A]=%d, \ - pDM_Odm->RealBbSwingIdx[ODM_RF_PATH_A]=%d\n", - rtldm->ofdm_index[RF90_PATH_A], final_bb_swing_idx[RF90_PATH_A])); - - rtl_set_bbreg(hw, RA_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[final_bb_swing_idx[RF90_PATH_A]]); - } else { - final_bb_swing_idx[RF90_PATH_B] = - rtldm->ofdm_index[RF90_PATH_B] > pwr_tracking_limit ? \ - pwr_tracking_limit : rtldm->ofdm_index[RF90_PATH_B]; - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("pDM_Odm->RFCalibrateInfo.OFDM_index[ODM_RF_PATH_B]=%d, \ - pDM_Odm->RealBbSwingIdx[ODM_RF_PATH_B]=%d\n", - rtldm->ofdm_index[RF90_PATH_B], final_bb_swing_idx[RF90_PATH_B])); - - rtl_set_bbreg(hw, RB_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[final_bb_swing_idx[RF90_PATH_B]]); - } - } else if (method == MIX_MODE) { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("pDM_Odm->DefaultOfdmIndex=%d, \ - pDM_Odm->Aboslute_OFDMSwingIdx[RFPath]=%d, RF_Path = %d\n", - rtldm->default_ofdm_index, rtldm->aboslute_ofdm_swing_idx[rf_path], - rf_path )); - - - final_ofdm_swing_index = rtldm->default_ofdm_index + rtldm->aboslute_ofdm_swing_idx[rf_path]; - - if (rf_path == RF90_PATH_A) { - if(final_ofdm_swing_index > pwr_tracking_limit) { /*BBSwing higher then Limit*/ - - rtldm->remnant_cck_idx = final_ofdm_swing_index - pwr_tracking_limit; - /* CCK Follow the same compensate value as Path A*/ - rtldm->remnant_ofdm_swing_idx[rf_path] = final_ofdm_swing_index - pwr_tracking_limit; - - rtl_set_bbreg(hw, RA_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[pwr_tracking_limit]); - - rtldm->modify_txagc_flag_path_a = true; - - /*Set TxAGC Page C{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_A); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_A Over BBSwing Limit , PwrTrackingLimit = %d , Remnant TxAGC Value = %d \n", - pwr_tracking_limit, rtldm->remnant_ofdm_swing_idx[rf_path])); - } else if (final_ofdm_swing_index < 0) { - rtldm->remnant_cck_idx = final_ofdm_swing_index; - /* CCK Follow the same compensate value as Path A*/ - rtldm->remnant_ofdm_swing_idx[rf_path] = final_ofdm_swing_index; - - rtl_set_bbreg(hw, RA_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[0]); - - rtldm->modify_txagc_flag_path_a = true; - - /*Set TxAGC Page C{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_A); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_A Lower then BBSwing lower bound 0 , Remnant TxAGC Value = %d \n", - rtldm->remnant_ofdm_swing_idx[rf_path])); - } else { - rtl_set_bbreg(hw, RA_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[final_ofdm_swing_index]); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_A Compensate with BBSwing , Final_OFDM_Swing_Index = %d \n", - final_ofdm_swing_index)); - - if(rtldm->modify_txagc_flag_path_a) { /*If TxAGC has changed, reset TxAGC again*/ - rtldm->remnant_cck_idx = 0; - rtldm->remnant_ofdm_swing_idx[rf_path] = 0; - - /*Set TxAGC Page C{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_A); - - rtldm->modify_txagc_flag_path_a = false; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_A pDM_Odm->Modify_TxAGC_Flag = FALSE \n")); - } - } - } - - if (rf_path == RF90_PATH_B) { - if(final_ofdm_swing_index > pwr_tracking_limit) { /*BBSwing higher then Limit*/ - rtldm->remnant_ofdm_swing_idx[rf_path] = final_ofdm_swing_index - pwr_tracking_limit; - - rtl_set_bbreg(hw, RB_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[pwr_tracking_limit]); - - rtldm->modify_txagc_flag_path_b = true; - - /*Set TxAGC Page E{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_B); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_B Over BBSwing Limit , PwrTrackingLimit = %d , Remnant TxAGC Value = %d \n", - pwr_tracking_limit, rtldm->remnant_ofdm_swing_idx[rf_path])); - } else if (final_ofdm_swing_index < 0) { - rtldm->remnant_ofdm_swing_idx[rf_path] = final_ofdm_swing_index; - - rtl_set_bbreg(hw, RB_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[0]); - - rtldm->modify_txagc_flag_path_b = true; - - /*Set TxAGC Page E{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_B); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_B Lower then BBSwing lower bound 0 , Remnant TxAGC Value = %d \n", - rtldm->remnant_ofdm_swing_idx[rf_path] )); - } else { - rtl_set_bbreg(hw, RB_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[final_ofdm_swing_index]); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_B Compensate with BBSwing , Final_OFDM_Swing_Index = %d \n", - final_ofdm_swing_index)); - - if(rtldm->modify_txagc_flag_path_b) { /*If TxAGC has changed, reset TxAGC again*/ - rtldm->remnant_ofdm_swing_idx[rf_path] = 0; - - /*Set TxAGC Page E{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_B); - - rtldm->modify_txagc_flag_path_b = false; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_B pDM_Odm->Modify_TxAGC_Flag = FALSE \n")); - } - } - } - - } else { - return; - } -} - -void rtl8812ae_dm_txpower_tracking_callback_thermalmeter - (struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - u8 thermal_value = 0, delta, delta_lck, delta_iqk, p = 0, i = 0; - u8 thermal_value_avg_count = 0; - u32 thermal_value_avg = 0; - - u8 ofdm_min_index = 6; /*OFDM BB Swing should be less than +3.0dB, which is required by Arthur*/ - u8 index_for_channel = 0; /* GetRightChnlPlaceforIQK(pHalData->CurrentChannel)*/ - - /* 1. The following TWO tables decide the final index of OFDM/CCK swing table.*/ - u8 *delta_swing_table_idx_tup_a; - u8 *delta_swing_table_idx_tdown_a; - u8 *delta_swing_table_idx_tup_b; - u8 *delta_swing_table_idx_tdown_b; - - /*2. Initilization ( 7 steps in total )*/ - rtl8812ae_get_delta_swing_table(hw, (u8**)&delta_swing_table_idx_tup_a, - (u8**)&delta_swing_table_idx_tdown_a, - (u8**)&delta_swing_table_idx_tup_b, - (u8**)&delta_swing_table_idx_tdown_b); - - rtldm->btxpower_trackinginit = true; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===>rtl8812ae_dm_txpower_tracking_callback_thermalmeter, \ - \n pDM_Odm->BbSwingIdxCckBase: %d, pDM_Odm->BbSwingIdxOfdmBase[A]:\ - %d, pDM_Odm->DefaultOfdmIndex: %d\n", - rtldm->bb_swing_idx_cck_base, - rtldm->bb_swing_idx_ofdm_base[RF90_PATH_A], - rtldm->default_ofdm_index)); - - thermal_value = (u8)rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER_8812A, 0xfc00); /*0x42: RF Reg[15:10] 88E*/ - if( ! rtldm->txpower_track_control || rtlefuse->eeprom_thermalmeter == 0 || - rtlefuse->eeprom_thermalmeter == 0xFF) - return; - - - /* 3. Initialize ThermalValues of RFCalibrateInfo*/ - - if(rtlhal->reloadtxpowerindex) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("reload ofdm index for band switch\n")); - } - - /*4. Calculate average thermal meter*/ - rtldm->thermalvalue_avg[rtldm->thermalvalue_avg_index] = thermal_value; - rtldm->thermalvalue_avg_index++; - if(rtldm->thermalvalue_avg_index == AVG_THERMAL_NUM_8812A) - /*Average times = c.AverageThermalNum*/ - rtldm->thermalvalue_avg_index = 0; - - for(i = 0; i < AVG_THERMAL_NUM_8812A; i++) - { - if(rtldm->thermalvalue_avg[i]) - { - thermal_value_avg += rtldm->thermalvalue_avg[i]; - thermal_value_avg_count++; - } - } - - if(thermal_value_avg_count) /*Calculate Average ThermalValue after average enough times*/ - { - thermal_value = (u8)(thermal_value_avg / thermal_value_avg_count); - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("AVG Thermal Meter = 0x%X, EFUSE Thermal Base = 0x%X\n", - thermal_value, rtlefuse->eeprom_thermalmeter)); - } - - /*5. Calculate delta, delta_LCK, delta_IQK.*/ - /*"delta" here is used to determine whether thermal value changes or not.*/ - delta = (thermal_value > rtldm->thermalvalue) ? \ - (thermal_value - rtldm->thermalvalue): \ - (rtldm->thermalvalue - thermal_value); - delta_lck = (thermal_value > rtldm->thermalvalue_lck) ? \ - (thermal_value - rtldm->thermalvalue_lck) : \ - (rtldm->thermalvalue_lck - thermal_value); - delta_iqk = (thermal_value > rtldm->thermalvalue_iqk) ? \ - (thermal_value - rtldm->thermalvalue_iqk) : \ - (rtldm->thermalvalue_iqk - thermal_value); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("(delta, delta_LCK, delta_IQK) = (%d, %d, %d)\n", - delta, delta_lck, delta_iqk)); - - /* 6. If necessary, do LCK. */ - - if (delta_lck >= IQK_THRESHOLD) /*Delta temperature is equal to or larger than 20 centigrade.*/ - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("delta_LCK(%d) >= Threshold_IQK(%d)\n", - delta_lck, IQK_THRESHOLD)); - rtldm->thermalvalue_lck = thermal_value; - rtl8812ae_phy_lccalibrate(hw); - } - - /*7. If necessary, move the index of swing table to adjust Tx power.*/ - - if (delta > 0 && rtldm->txpower_track_control) - { - /*"delta" here is used to record the absolute value of differrence.*/ - delta = thermal_value > rtlefuse->eeprom_thermalmeter ? \ - (thermal_value - rtlefuse->eeprom_thermalmeter) : \ - (rtlefuse->eeprom_thermalmeter - thermal_value); - - if (delta >= TXPWR_TRACK_TABLE_SIZE) - delta = TXPWR_TRACK_TABLE_SIZE - 1; - - /*7.1 The Final Power Index = BaseIndex + PowerIndexOffset*/ - - if(thermal_value > rtlefuse->eeprom_thermalmeter) { - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("delta_swing_table_idx_tup_a[%d] = %d\n", - delta, delta_swing_table_idx_tup_a[delta])); - rtldm->delta_power_index_last[RF90_PATH_A] = rtldm->delta_power_index[RF90_PATH_A]; - rtldm->delta_power_index[RF90_PATH_A] = delta_swing_table_idx_tup_a[delta]; - - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_A] = delta_swing_table_idx_tup_a[delta]; - /*Record delta swing for mix mode power tracking*/ - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Temp is higher and pDM_Odm->Aboslute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_A])); - - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("delta_swing_table_idx_tup_b[%d] = %d\n", - delta, delta_swing_table_idx_tup_b[delta])); - rtldm->delta_power_index_last[RF90_PATH_B] = rtldm->delta_power_index[RF90_PATH_B]; - rtldm->delta_power_index[RF90_PATH_B] = delta_swing_table_idx_tup_b[delta]; - - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_B] = delta_swing_table_idx_tup_b[delta]; - /*Record delta swing for mix mode power tracking*/ - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Temp is higher and pDM_Odm->Aboslute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_B])); - - } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("delta_swing_table_idx_tdown_a[%d] = %d\n", - delta, delta_swing_table_idx_tdown_a[delta])); - - rtldm->delta_power_index_last[RF90_PATH_A] = rtldm->delta_power_index[RF90_PATH_A]; - rtldm->delta_power_index[RF90_PATH_A] = -1 * delta_swing_table_idx_tdown_a[delta]; - - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_A] = -1 * delta_swing_table_idx_tdown_a[delta]; - /* Record delta swing for mix mode power tracking*/ - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Temp is lower and pDM_Odm->Aboslute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_A])); - - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("deltaSwingTableIdx_TDOWN_B[%d] = %d\n", - delta, delta_swing_table_idx_tdown_b[delta])); - - rtldm->delta_power_index_last[RF90_PATH_B] = rtldm->delta_power_index[RF90_PATH_B]; - rtldm->delta_power_index[RF90_PATH_B] = -1 * delta_swing_table_idx_tdown_b[delta]; - - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_B] = -1 * delta_swing_table_idx_tdown_b[delta]; - /*Record delta swing for mix mode power tracking*/ - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Temp is lower and pDM_Odm->Aboslute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_B])); - } - - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8812A; p++) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("\n\n================================ [Path-%c] \ - Calculating PowerIndexOffset ================================\n", - (p == RF90_PATH_A ? 'A' : 'B'))); - - if (rtldm->delta_power_index[p] == rtldm->delta_power_index_last[p]) - /*If Thermal value changes but lookup table value still the same*/ - rtldm->power_index_offset[p] = 0; - else - rtldm->power_index_offset[p] = - rtldm->delta_power_index[p] - rtldm->delta_power_index_last[p]; - /*Power Index Diff between 2 times Power Tracking*/ - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("[Path-%c] PowerIndexOffset(%d) = DeltaPowerIndex(%d) - DeltaPowerIndexLast(%d)\n", - (p == RF90_PATH_A ? 'A' : 'B'), - rtldm->power_index_offset[p], - rtldm->delta_power_index[p] , - rtldm->delta_power_index_last[p])); - - rtldm->ofdm_index[p] = - rtldm->bb_swing_idx_ofdm_base[p] + rtldm->power_index_offset[p]; - rtldm->cck_index = - rtldm->bb_swing_idx_cck_base + rtldm->power_index_offset[p]; - - rtldm->bb_swing_idx_cck = rtldm->cck_index; - rtldm->bb_swing_idx_ofdm[p] = rtldm->ofdm_index[p]; - - /*************Print BB Swing Base and Index Offset*************/ - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("The 'CCK' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", - rtldm->bb_swing_idx_cck, - rtldm->bb_swing_idx_cck_base, - rtldm->power_index_offset[p])); - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("The 'OFDM' final index(%d) = BaseIndex[%c](%d) + PowerIndexOffset(%d)\n", - rtldm->bb_swing_idx_ofdm[p], - (p == RF90_PATH_A ? 'A' : 'B'), - rtldm->bb_swing_idx_ofdm_base[p], - rtldm->power_index_offset[p])); - - /*7.1 Handle boundary conditions of index.*/ - - - if(rtldm->ofdm_index[p] > TXSCALE_TABLE_SIZE -1) - { - rtldm->ofdm_index[p] = TXSCALE_TABLE_SIZE -1; - } - else if (rtldm->ofdm_index[p] < ofdm_min_index) - { - rtldm->ofdm_index[p] = ofdm_min_index; - } - } - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("\n\n======================================================\ - ==================================================\n")); - if(rtldm->cck_index > TXSCALE_TABLE_SIZE -1) - rtldm->cck_index = TXSCALE_TABLE_SIZE -1; - else if (rtldm->cck_index < 0) - rtldm->cck_index = 0; - } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("The thermal meter is unchanged or TxPowerTracking OFF(%d): \ - ThermalValue: %d , pDM_Odm->RFCalibrateInfo.ThermalValue: %d\n", - rtldm->txpower_track_control, - thermal_value, - rtldm->thermalvalue)); - - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8812A; p++) - rtldm->power_index_offset[p] = 0; - } - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n", - rtldm->cck_index, rtldm->bb_swing_idx_cck_base)); /*Print Swing base & current*/ - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8812A; p++) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index[%c]: %d\n", - rtldm->ofdm_index[p], - (p == RF90_PATH_A ? 'A' : 'B'), - rtldm->bb_swing_idx_ofdm_base[p])); - } - - if ((rtldm->power_index_offset[RF90_PATH_A] != 0 || - rtldm->power_index_offset[RF90_PATH_B] != 0 ) && - rtldm->txpower_track_control) - { - /*7.2 Configure the Swing Table to adjust Tx Power.*/ - /*Always TRUE after Tx Power is adjusted by power tracking.*/ - /* - 2012/04/23 MH According to Luke's suggestion, we can not write BB digital - to increase TX power. Otherwise, EVM will be bad. - - 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. - */ - if (thermal_value > rtldm->thermalvalue) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature Increasing(A): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", - rtldm->power_index_offset[RF90_PATH_A], - delta, thermal_value, - rtlefuse->eeprom_thermalmeter, - rtldm->thermalvalue)); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature Increasing(B): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", - rtldm->power_index_offset[RF90_PATH_B], - delta, thermal_value, - rtlefuse->eeprom_thermalmeter, - rtldm->thermalvalue)); - - } else if (thermal_value < rtldm->thermalvalue) { /*Low temperature*/ - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature Decreasing(A): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", - rtldm->power_index_offset[RF90_PATH_A], - delta, thermal_value, - rtlefuse->eeprom_thermalmeter, - rtldm->thermalvalue)); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature Decreasing(B): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", - rtldm->power_index_offset[RF90_PATH_B], - delta, thermal_value, - rtlefuse->eeprom_thermalmeter, - rtldm->thermalvalue)); - } - - if (thermal_value > rtlefuse->eeprom_thermalmeter) { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature(%d) higher than PG value(%d)\n", - thermal_value, rtlefuse->eeprom_thermalmeter)); - - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("**********Enter POWER Tracking MIX_MODE**********\n")); - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8812A; p++) - rtl8812ae_dm_txpwr_track_set_pwr(hw, MIX_MODE, p, 0); - - } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature(%d) lower than PG value(%d)\n", - thermal_value, rtlefuse->eeprom_thermalmeter)); - - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("**********Enter POWER Tracking MIX_MODE**********\n")); - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8812A; p++) - rtl8812ae_dm_txpwr_track_set_pwr(hw, MIX_MODE, p, index_for_channel); - - } - - rtldm->bb_swing_idx_cck_base = rtldm->bb_swing_idx_cck; /*Record last time Power Tracking result as base.*/ - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8812A; p++) - rtldm->bb_swing_idx_ofdm_base[p] = rtldm->bb_swing_idx_ofdm[p]; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("pDM_Odm->RFCalibrateInfo.ThermalValue = %d ThermalValue= %d\n", - rtldm->thermalvalue, thermal_value)); - - rtldm->thermalvalue = thermal_value; /*Record last Power Tracking Thermal Value*/ - - } - /*Delta temperature is equal to or larger than 20 centigrade (When threshold is 8).*/ - if ((delta_iqk >= IQK_THRESHOLD)) { - - if ( !rtlphy->b_iqk_in_progress) { - - spin_lock(&rtlpriv->locks.iqk_lock); - rtlphy->b_iqk_in_progress = true; - spin_unlock(&rtlpriv->locks.iqk_lock); - - rtl8812ae_do_iqk(hw, delta_iqk, thermal_value, 8); - - spin_lock(&rtlpriv->locks.iqk_lock); - rtlphy->b_iqk_in_progress = false; - spin_unlock(&rtlpriv->locks.iqk_lock); - } - } - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("<===rtl8812ae_dm_txpower_tracking_callback_thermalmeter\n")); -} - - -void rtl8821ae_get_delta_swing_table( - struct ieee80211_hw *hw, - u8 **temperature_up_a, - u8 **temperature_down_a, - u8 **temperature_up_b, - u8 **temperature_down_b - ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - u8 channel = rtlphy->current_channel; - u8 rate = rtldm->tx_rate; - - - if ( 1 <= channel && channel <= 14) { - if (RX_HAL_IS_CCK_RATE(rate)) { - *temperature_up_a = rtldm->delta_swing_table_idx_24gccka_p; - *temperature_down_a = rtldm->delta_swing_table_idx_24gccka_n; - *temperature_up_b = rtldm->delta_swing_table_idx_24gcckb_p; - *temperature_down_b = rtldm->delta_swing_table_idx_24gcckb_n; - } else { - *temperature_up_a = rtldm->delta_swing_table_idx_24ga_p; - *temperature_down_a = rtldm->delta_swing_table_idx_24ga_n; - *temperature_up_b = rtldm->delta_swing_table_idx_24gb_p; - *temperature_down_b = rtldm->delta_swing_table_idx_24gb_n; - } - } else if ( 36 <= channel && channel <= 64) { - *temperature_up_a = rtldm->delta_swing_table_idx_5ga_p[0]; - *temperature_down_a = rtldm->delta_swing_table_idx_5ga_n[0]; - *temperature_up_b = rtldm->delta_swing_table_idx_5gb_p[0]; - *temperature_down_b = rtldm->delta_swing_table_idx_5gb_n[0]; - } else if ( 100 <= channel && channel <= 140) { - *temperature_up_a = rtldm->delta_swing_table_idx_5ga_p[1]; - *temperature_down_a = rtldm->delta_swing_table_idx_5ga_n[1]; - *temperature_up_b = rtldm->delta_swing_table_idx_5gb_p[1]; - *temperature_down_b = rtldm->delta_swing_table_idx_5gb_n[1]; - } else if ( 149 <= channel && channel <= 173) { - *temperature_up_a = rtldm->delta_swing_table_idx_5ga_p[2]; - *temperature_down_a = rtldm->delta_swing_table_idx_5ga_n[2]; - *temperature_up_b = rtldm->delta_swing_table_idx_5gb_p[2]; - *temperature_down_b = rtldm->delta_swing_table_idx_5gb_n[2]; - } else { - *temperature_up_a = (u8*)rtl8818e_delta_swing_table_idx_24gb_p_txpwrtrack; - *temperature_down_a =(u8*)rtl8818e_delta_swing_table_idx_24gb_n_txpwrtrack; - *temperature_up_b = (u8*)rtl8818e_delta_swing_table_idx_24gb_p_txpwrtrack; - *temperature_down_b = (u8*)rtl8818e_delta_swing_table_idx_24gb_n_txpwrtrack; - } - - return; -} - -void rtl8821ae_phy_lccalibrate( - struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("===> rtl8812ae_phy_lccalibrate\n")); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, ("<=== rtl8812ae_phy_lccalibrate\n")); - -} - -/*----------------------------------------------------------------------------- - * Function: odm_TxPwrTrackSetPwr88E() - * - * Overview: 88E change all channel tx power accordign to flag. - * OFDM & CCK are all different. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 04/23/2012 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, - enum pwr_track_control_method method, u8 rf_path, u8 channel_mapped_index) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 final_bb_swing_idx[1]; - u8 pwr_tracking_limit = 26; /*+1.0dB*/ - u8 tx_rate = 0xFF; - s8 final_ofdm_swing_index = 0; - - if(rtldm->tx_rate != 0xFF) - tx_rate = rtl8812ae_hw_rate_to_mrate(hw, rtldm->tx_rate); - - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===>rtl8812ae_dm_txpwr_track_set_pwr\n")); - - if(tx_rate != 0xFF) { /*20130429 Mimic Modify High Rate BBSwing Limit.*/ - /*CCK*/ - if((tx_rate >= MGN_1M) && (tx_rate <= MGN_11M)) - pwr_tracking_limit = 32; /*+4dB*/ - /*OFDM*/ - else if((tx_rate >= MGN_6M) && (tx_rate <= MGN_48M)) - pwr_tracking_limit = 30; /*+3dB*/ - else if(tx_rate == MGN_54M) - pwr_tracking_limit = 28; /*+2dB*/ - /*HT*/ - else if((tx_rate >= MGN_MCS0) && (tx_rate <= MGN_MCS2)) /*QPSK/BPSK*/ - pwr_tracking_limit = 34; /*+5dB*/ - else if((tx_rate >= MGN_MCS3) && (tx_rate <= MGN_MCS4)) /*16QAM*/ - pwr_tracking_limit = 30; /*+3dB*/ - else if((tx_rate >= MGN_MCS5) && (tx_rate <= MGN_MCS7)) /*64QAM*/ - pwr_tracking_limit = 28; /*+2dB*/ -#if 0 - else if((tx_rate >= MGN_MCS8) && (tx_rate <= MGN_MCS10)) /*QPSK/BPSK*/ - pwr_tracking_limit = 34; /*+5dB*/ - else if((tx_rate >= MGN_MCS11) && (tx_rate <= MGN_MCS12)) /*16QAM*/ - pwr_tracking_limit = 30; /*+3dB*/ - else if((tx_rate >= MGN_MCS13) && (tx_rate <= MGN_MCS15)) /*64QAM*/ - pwr_tracking_limit = 28; /*+2dB*/ -#endif - /*2 VHT*/ - else if((tx_rate >= MGN_VHT1SS_MCS0) && (tx_rate <= MGN_VHT1SS_MCS2)) /*QPSK/BPSK*/ - pwr_tracking_limit = 34; /*+5dB*/ - else if((tx_rate >= MGN_VHT1SS_MCS3) && (tx_rate <= MGN_VHT1SS_MCS4)) /*16QAM*/ - pwr_tracking_limit = 30; /*+3dB*/ - else if((tx_rate >= MGN_VHT1SS_MCS5)&&(tx_rate <= MGN_VHT1SS_MCS6)) /*64QAM*/ - pwr_tracking_limit = 28; /*+2dB*/ - else if(tx_rate == MGN_VHT1SS_MCS7) /*64QAM*/ - pwr_tracking_limit = 26; /*+1dB*/ - else if(tx_rate == MGN_VHT1SS_MCS8) /*256QAM*/ - pwr_tracking_limit = 24; /*+0dB*/ - else if(tx_rate == MGN_VHT1SS_MCS9) /*256QAM*/ - pwr_tracking_limit = 22; /*-1dB*/ - else - pwr_tracking_limit = 24; - } - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("TxRate=0x%x, PwrTrackingLimit=%d\n", tx_rate, pwr_tracking_limit)); - - - if (method == BBSWING) { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===>rtl8812ae_dm_txpwr_track_set_pwr\n")); - - if (rf_path == RF90_PATH_A) { - final_bb_swing_idx[RF90_PATH_A] = - (rtldm->ofdm_index[RF90_PATH_A] > pwr_tracking_limit) ? - pwr_tracking_limit : rtldm->ofdm_index[RF90_PATH_A]; - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("pDM_Odm->RFCalibrateInfo.OFDM_index[ODM_RF_PATH_A]=%d, \ - pDM_Odm->RealBbSwingIdx[ODM_RF_PATH_A]=%d\n", - rtldm->ofdm_index[RF90_PATH_A], final_bb_swing_idx[RF90_PATH_A])); - - rtl_set_bbreg(hw, RA_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[final_bb_swing_idx[RF90_PATH_A]]); - } - } else if (method == MIX_MODE) { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("pDM_Odm->DefaultOfdmIndex=%d, \ - pDM_Odm->Aboslute_OFDMSwingIdx[RFPath]=%d, RF_Path = %d\n", - rtldm->default_ofdm_index, rtldm->aboslute_ofdm_swing_idx[rf_path], - rf_path )); - - - final_ofdm_swing_index = rtldm->default_ofdm_index + rtldm->aboslute_ofdm_swing_idx[rf_path]; - - if (rf_path == RF90_PATH_A) { - if(final_ofdm_swing_index > pwr_tracking_limit) { /*BBSwing higher then Limit*/ - - rtldm->remnant_cck_idx = final_ofdm_swing_index - pwr_tracking_limit; - /* CCK Follow the same compensate value as Path A*/ - rtldm->remnant_ofdm_swing_idx[rf_path] = final_ofdm_swing_index - pwr_tracking_limit; - - rtl_set_bbreg(hw, RA_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[pwr_tracking_limit]); - - rtldm->modify_txagc_flag_path_a = true; - - /*Set TxAGC Page C{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_A); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_A Over BBSwing Limit , PwrTrackingLimit = %d , Remnant TxAGC Value = %d \n", - pwr_tracking_limit, rtldm->remnant_ofdm_swing_idx[rf_path])); - } else if (final_ofdm_swing_index < 0) { - rtldm->remnant_cck_idx = final_ofdm_swing_index; - /* CCK Follow the same compensate value as Path A*/ - rtldm->remnant_ofdm_swing_idx[rf_path] = final_ofdm_swing_index; - - rtl_set_bbreg(hw, RA_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[0]); - - rtldm->modify_txagc_flag_path_a = true; - - /*Set TxAGC Page C{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_A); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_A Lower then BBSwing lower bound 0 , Remnant TxAGC Value = %d \n", - rtldm->remnant_ofdm_swing_idx[rf_path])); - } else { - rtl_set_bbreg(hw, RA_TXSCALE, 0xFFE00000, rtl8812ae_txscaling_table[final_ofdm_swing_index]); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_A Compensate with BBSwing , Final_OFDM_Swing_Index = %d \n", - final_ofdm_swing_index)); - - if(rtldm->modify_txagc_flag_path_a) { /*If TxAGC has changed, reset TxAGC again*/ - rtldm->remnant_cck_idx = 0; - rtldm->remnant_ofdm_swing_idx[rf_path] = 0; - - /*Set TxAGC Page C{};*/ - rtl8821ae_phy_set_txpower_level_by_path(hw, rtlphy->current_channel, RF90_PATH_A); - - rtldm->modify_txagc_flag_path_a = false; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_A pDM_Odm->Modify_TxAGC_Flag = FALSE \n")); - } - } - } - - } else { - return; - } -} - - -void rtl8821ae_dm_txpower_tracking_callback_thermalmeter - (struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - u8 thermal_value = 0, delta, delta_lck, delta_iqk, p = 0, i = 0; - u8 thermal_value_avg_count = 0; - u32 thermal_value_avg = 0; - - u8 ofdm_min_index = 6; /*OFDM BB Swing should be less than +3.0dB, which is required by Arthur*/ - u8 index_for_channel = 0; /* GetRightChnlPlaceforIQK(pHalData->CurrentChannel)*/ - - /* 1. The following TWO tables decide the final index of OFDM/CCK swing table.*/ - u8 *delta_swing_table_idx_tup_a; - u8 *delta_swing_table_idx_tdown_a; - u8 *delta_swing_table_idx_tup_b; - u8 *delta_swing_table_idx_tdown_b; - - /*2. Initilization ( 7 steps in total )*/ - rtl8821ae_get_delta_swing_table(hw, (u8**)&delta_swing_table_idx_tup_a, - (u8**)&delta_swing_table_idx_tdown_a, - (u8**)&delta_swing_table_idx_tup_b, - (u8**)&delta_swing_table_idx_tdown_b); - - rtldm->btxpower_trackinginit = true; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("===>rtl8812ae_dm_txpower_tracking_callback_thermalmeter, \ - \n pDM_Odm->BbSwingIdxCckBase: %d, pDM_Odm->BbSwingIdxOfdmBase[A]:\ - %d, pDM_Odm->DefaultOfdmIndex: %d\n", - rtldm->bb_swing_idx_cck_base, - rtldm->bb_swing_idx_ofdm_base[RF90_PATH_A], - rtldm->default_ofdm_index)); - - thermal_value = (u8)rtl_get_rfreg(hw, RF90_PATH_A, RF_T_METER_8812A, 0xfc00); /*0x42: RF Reg[15:10] 88E*/ - if( ! rtldm->txpower_track_control || rtlefuse->eeprom_thermalmeter == 0 || - rtlefuse->eeprom_thermalmeter == 0xFF) - return; - - - /* 3. Initialize ThermalValues of RFCalibrateInfo*/ - - if(rtlhal->reloadtxpowerindex) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("reload ofdm index for band switch\n")); - } - - /*4. Calculate average thermal meter*/ - rtldm->thermalvalue_avg[rtldm->thermalvalue_avg_index] = thermal_value; - rtldm->thermalvalue_avg_index++; - if(rtldm->thermalvalue_avg_index == AVG_THERMAL_NUM_8812A) - /*Average times = c.AverageThermalNum*/ - rtldm->thermalvalue_avg_index = 0; - - for(i = 0; i < AVG_THERMAL_NUM_8812A; i++) - { - if(rtldm->thermalvalue_avg[i]) - { - thermal_value_avg += rtldm->thermalvalue_avg[i]; - thermal_value_avg_count++; - } - } - - if(thermal_value_avg_count) /*Calculate Average ThermalValue after average enough times*/ - { - thermal_value = (u8)(thermal_value_avg / thermal_value_avg_count); - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("AVG Thermal Meter = 0x%X, EFUSE Thermal Base = 0x%X\n", - thermal_value, rtlefuse->eeprom_thermalmeter)); - } - - /*5. Calculate delta, delta_LCK, delta_IQK.*/ - /*"delta" here is used to determine whether thermal value changes or not.*/ - delta = (thermal_value > rtldm->thermalvalue) ? \ - (thermal_value - rtldm->thermalvalue): \ - (rtldm->thermalvalue - thermal_value); - delta_lck = (thermal_value > rtldm->thermalvalue_lck) ? \ - (thermal_value - rtldm->thermalvalue_lck) : \ - (rtldm->thermalvalue_lck - thermal_value); - delta_iqk = (thermal_value > rtldm->thermalvalue_iqk) ? \ - (thermal_value - rtldm->thermalvalue_iqk) : \ - (rtldm->thermalvalue_iqk - thermal_value); - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("(delta, delta_LCK, delta_IQK) = (%d, %d, %d)\n", - delta, delta_lck, delta_iqk)); - - /* 6. If necessary, do LCK. */ - - if (delta_lck >= IQK_THRESHOLD) /*Delta temperature is equal to or larger than 20 centigrade.*/ - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("delta_LCK(%d) >= Threshold_IQK(%d)\n", - delta_lck, IQK_THRESHOLD)); - rtldm->thermalvalue_lck = thermal_value; - rtl8821ae_phy_lccalibrate(hw); - } - - /*7. If necessary, move the index of swing table to adjust Tx power.*/ - - if (delta > 0 && rtldm->txpower_track_control) - { - /*"delta" here is used to record the absolute value of differrence.*/ - delta = thermal_value > rtlefuse->eeprom_thermalmeter ? \ - (thermal_value - rtlefuse->eeprom_thermalmeter) : \ - (rtlefuse->eeprom_thermalmeter - thermal_value); - - if (delta >= TXSCALE_TABLE_SIZE) - delta = TXSCALE_TABLE_SIZE - 1; - - /*7.1 The Final Power Index = BaseIndex + PowerIndexOffset*/ - - if(thermal_value > rtlefuse->eeprom_thermalmeter) { - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("delta_swing_table_idx_tup_a[%d] = %d\n", - delta, delta_swing_table_idx_tup_a[delta])); - rtldm->delta_power_index_last[RF90_PATH_A] = rtldm->delta_power_index[RF90_PATH_A]; - rtldm->delta_power_index[RF90_PATH_A] = delta_swing_table_idx_tup_a[delta]; - - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_A] = delta_swing_table_idx_tup_a[delta]; - /*Record delta swing for mix mode power tracking*/ - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Temp is higher and pDM_Odm->Aboslute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_A])); - - } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("delta_swing_table_idx_tdown_a[%d] = %d\n", - delta, delta_swing_table_idx_tdown_a[delta])); - - rtldm->delta_power_index_last[RF90_PATH_A] = rtldm->delta_power_index[RF90_PATH_A]; - rtldm->delta_power_index[RF90_PATH_A] = -1 * delta_swing_table_idx_tdown_a[delta]; - - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_A] = -1 * delta_swing_table_idx_tdown_a[delta]; - /* Record delta swing for mix mode power tracking*/ - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Temp is lower and pDM_Odm->Aboslute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", - rtldm->aboslute_ofdm_swing_idx[RF90_PATH_A])); - } - - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8821A; p++) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("\n\n================================ [Path-%c] \ - Calculating PowerIndexOffset ================================\n", - (p == RF90_PATH_A ? 'A' : 'B'))); - - if (rtldm->delta_power_index[p] == rtldm->delta_power_index_last[p]) - /*If Thermal value changes but lookup table value still the same*/ - rtldm->power_index_offset[p] = 0; - else - rtldm->power_index_offset[p] = - rtldm->delta_power_index[p] - rtldm->delta_power_index_last[p]; - /*Power Index Diff between 2 times Power Tracking*/ - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("[Path-%c] PowerIndexOffset(%d) = DeltaPowerIndex(%d) - DeltaPowerIndexLast(%d)\n", - (p == RF90_PATH_A ? 'A' : 'B'), - rtldm->power_index_offset[p], - rtldm->delta_power_index[p] , - rtldm->delta_power_index_last[p])); - - rtldm->ofdm_index[p] = - rtldm->bb_swing_idx_ofdm_base[p] + rtldm->power_index_offset[p]; - rtldm->cck_index = - rtldm->bb_swing_idx_cck_base + rtldm->power_index_offset[p]; - - rtldm->bb_swing_idx_cck = rtldm->cck_index; - rtldm->bb_swing_idx_ofdm[p] = rtldm->ofdm_index[p]; - - /*************Print BB Swing Base and Index Offset*************/ - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("The 'CCK' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", - rtldm->bb_swing_idx_cck, - rtldm->bb_swing_idx_cck_base, - rtldm->power_index_offset[p])); - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("The 'OFDM' final index(%d) = BaseIndex[%c](%d) + PowerIndexOffset(%d)\n", - rtldm->bb_swing_idx_ofdm[p], - (p == RF90_PATH_A ? 'A' : 'B'), - rtldm->bb_swing_idx_ofdm_base[p], - rtldm->power_index_offset[p])); - - /*7.1 Handle boundary conditions of index.*/ - - - if(rtldm->ofdm_index[p] > TXSCALE_TABLE_SIZE -1) - { - rtldm->ofdm_index[p] = TXSCALE_TABLE_SIZE -1; - } - else if (rtldm->ofdm_index[p] < ofdm_min_index) - { - rtldm->ofdm_index[p] = ofdm_min_index; - } - } - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("\n\n======================================================\ - ==================================================\n")); - if(rtldm->cck_index > TXSCALE_TABLE_SIZE -1) - rtldm->cck_index = TXSCALE_TABLE_SIZE -1; - else if (rtldm->cck_index < 0) - rtldm->cck_index = 0; - } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("The thermal meter is unchanged or TxPowerTracking OFF(%d): \ - ThermalValue: %d , pDM_Odm->RFCalibrateInfo.ThermalValue: %d\n", - rtldm->txpower_track_control, - thermal_value, - rtldm->thermalvalue)); - - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8821A; p++) - rtldm->power_index_offset[p] = 0; - } - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n", - rtldm->cck_index, rtldm->bb_swing_idx_cck_base)); /*Print Swing base & current*/ - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8821A; p++) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index[%c]: %d\n", - rtldm->ofdm_index[p], - (p == RF90_PATH_A ? 'A' : 'B'), - rtldm->bb_swing_idx_ofdm_base[p])); - } - - if ((rtldm->power_index_offset[RF90_PATH_A] != 0 || - rtldm->power_index_offset[RF90_PATH_B] != 0 ) && - rtldm->txpower_track_control) - { - /*7.2 Configure the Swing Table to adjust Tx Power.*/ - /*Always TRUE after Tx Power is adjusted by power tracking.*/ - /* - 2012/04/23 MH According to Luke's suggestion, we can not write BB digital - to increase TX power. Otherwise, EVM will be bad. - - 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. - */ - if (thermal_value > rtldm->thermalvalue) - { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature Increasing(A): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", - rtldm->power_index_offset[RF90_PATH_A], - delta, thermal_value, - rtlefuse->eeprom_thermalmeter, - rtldm->thermalvalue)); - } else if (thermal_value < rtldm->thermalvalue) { /*Low temperature*/ - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature Decreasing(A): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", - rtldm->power_index_offset[RF90_PATH_A], - delta, thermal_value, - rtlefuse->eeprom_thermalmeter, - rtldm->thermalvalue)); - } - - if (thermal_value > rtlefuse->eeprom_thermalmeter) { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature(%d) higher than PG value(%d)\n", - thermal_value, rtlefuse->eeprom_thermalmeter)); - - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("**********Enter POWER Tracking MIX_MODE**********\n")); - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8821A; p++) - rtl8821ae_dm_txpwr_track_set_pwr(hw, MIX_MODE, p, index_for_channel); - - } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Temperature(%d) lower than PG value(%d)\n", - thermal_value, rtlefuse->eeprom_thermalmeter)); - - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("**********Enter POWER Tracking MIX_MODE**********\n")); - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8821A; p++) - rtl8812ae_dm_txpwr_track_set_pwr(hw, MIX_MODE, p, index_for_channel); - - } - - rtldm->bb_swing_idx_cck_base = rtldm->bb_swing_idx_cck; /*Record last time Power Tracking result as base.*/ - for (p = RF90_PATH_A; p < MAX_PATH_NUM_8821A; p++) - rtldm->bb_swing_idx_ofdm_base[p] = rtldm->bb_swing_idx_ofdm[p]; - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("pDM_Odm->RFCalibrateInfo.ThermalValue = %d ThermalValue= %d\n", - rtldm->thermalvalue, thermal_value)); - - rtldm->thermalvalue = thermal_value; /*Record last Power Tracking Thermal Value*/ - - } - /*Delta temperature is equal to or larger than 20 centigrade (When threshold is 8).*/ - if ((delta_iqk >= IQK_THRESHOLD)) { - - if ( !rtlphy->b_iqk_in_progress) { - - spin_lock(&rtlpriv->locks.iqk_lock); - rtlphy->b_iqk_in_progress = true; - spin_unlock(&rtlpriv->locks.iqk_lock); - - rtl8821ae_do_iqk(hw, delta_iqk, thermal_value, 8); - - spin_lock(&rtlpriv->locks.iqk_lock); - rtlphy->b_iqk_in_progress = false; - spin_unlock(&rtlpriv->locks.iqk_lock); - } - } - - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("<===rtl8812ae_dm_txpower_tracking_callback_thermalmeter\n")); -} - - -void rtl8821ae_dm_check_txpower_tracking_thermalmeter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - static u8 tm_trigger = 0; - - //if (!rtlpriv->dm.btxpower_tracking) - // return; - - if (!tm_trigger) { - rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER_88E, BIT(17)|BIT(16), - 0x03); - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Trigger 8821ae Thermal Meter!!\n")); - tm_trigger = 1; - return; - } else { - RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("Schedule TxPowerTracking !!\n")); - - rtl8821ae_dm_txpower_tracking_callback_thermalmeter(hw); - tm_trigger = 0; - } -} - - -void rtl8821ae_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rate_adaptive *p_ra = &(rtlpriv->ra); - u32 low_rssithresh_for_ra = p_ra->low2high_rssi_thresh_for_ra; - u32 high_rssithresh_for_ra = p_ra->high_rssi_thresh_for_ra; - u8 go_up_gap = 5; - struct ieee80211_sta *sta = NULL; - - if (is_hal_stop(rtlhal)) { - RT_TRACE(COMP_RATE, DBG_LOUD, - ("driver is going to unload\n")); - return; - } - - if (!rtlpriv->dm.b_useramask) { - RT_TRACE(COMP_RATE, DBG_LOUD, - ("driver does not control rate adaptive mask\n")); - return; - } - - if (mac->link_state == MAC80211_LINKED && - mac->opmode == NL80211_IFTYPE_STATION) { - - switch (p_ra->pre_ratr_state) { - case DM_RATR_STA_MIDDLE: - high_rssithresh_for_ra += go_up_gap; - break; - case DM_RATR_STA_LOW: - high_rssithresh_for_ra += go_up_gap; - low_rssithresh_for_ra += go_up_gap; - break; - default: - break; - } - - if (rtlpriv->dm.undecorated_smoothed_pwdb > - (long)high_rssithresh_for_ra) - p_ra->ratr_state = DM_RATR_STA_HIGH; - else if (rtlpriv->dm.undecorated_smoothed_pwdb > - (long)low_rssithresh_for_ra) - p_ra->ratr_state = DM_RATR_STA_MIDDLE; - else - p_ra->ratr_state = DM_RATR_STA_LOW; - - if (p_ra->pre_ratr_state != p_ra->ratr_state ) { - RT_TRACE(COMP_RATE, DBG_LOUD, - ("RSSI = %ld\n", - rtlpriv->dm.undecorated_smoothed_pwdb)); - RT_TRACE(COMP_RATE, DBG_LOUD, - ("RSSI_LEVEL = %d\n", p_ra->ratr_state)); - RT_TRACE(COMP_RATE, DBG_LOUD, - ("PreState = %d, CurState = %d\n", - p_ra->pre_ratr_state, p_ra->ratr_state)); - - rcu_read_lock(); - sta = rtl_find_sta(hw, mac->bssid); - if (sta) - rtlpriv->cfg->ops->update_rate_tbl(hw, sta, p_ra->ratr_state); - rcu_read_unlock(); - - p_ra->pre_ratr_state = p_ra->ratr_state; - } - } -} - -bool rtl8821ae_dm_is_edca_turbo_disable(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->btcoexist.btc_ops->btc_is_disable_edca_turbo(rtlpriv)) - return true; - if (rtlpriv->mac80211.mode == WIRELESS_MODE_B) - return true; - - return false; -} - -void rtl8821ae_dm_edca_choose_traffic_idx( - struct ieee80211_hw *hw, u64 cur_tx_bytes, u64 cur_rx_bytes, bool b_bias_on_rx, - bool *pb_is_cur_rdl_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if(b_bias_on_rx) - { - if (cur_tx_bytes > (cur_rx_bytes*4)) { - *pb_is_cur_rdl_state = false; - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("Uplink Traffic\n ")); - } else { - *pb_is_cur_rdl_state = true; - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("Balance Traffic\n")); - } - } else { - if (cur_rx_bytes > (cur_tx_bytes*4)) { - *pb_is_cur_rdl_state = true; - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("Downlink Traffic\n")); - } else { - *pb_is_cur_rdl_state = false; - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("Balance Traffic\n")); - } - } - return ; -} - -static void rtl8821ae_dm_check_edca_turbo(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - - /*Keep past Tx/Rx packet count for RT-to-RT EDCA turbo.*/ - unsigned long cur_tx_ok_cnt = 0; - unsigned long cur_rx_ok_cnt = 0; - u32 edca_be_ul = 0x5ea42b; - u32 edca_be_dl = 0x5ea42b; - u32 edca_be = 0x5ea42b; - u8 iot_peer = 0; - bool *pb_is_cur_rdl_state = NULL; - bool b_last_is_cur_rdl_state = false; - bool b_bias_on_rx = false; - bool b_edca_turbo_on = false; - - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("rtl8821ae_dm_check_edca_turbo=====>")); - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("Orginial BE PARAM: 0x%x\n", - rtl_read_dword(rtlpriv, DM_REG_EDCA_BE_11N))); - - /*=============================== - list paramter for different platform - ===============================*/ - b_last_is_cur_rdl_state = rtlpriv->dm.bis_cur_rdlstate; - pb_is_cur_rdl_state = &( rtlpriv->dm.bis_cur_rdlstate); - - cur_tx_ok_cnt = rtlpriv->stats.txbytesunicast - rtldm->last_tx_ok_cnt; - cur_rx_ok_cnt = rtlpriv->stats.rxbytesunicast - rtldm->last_rx_ok_cnt; - - rtldm->last_tx_ok_cnt = rtlpriv->stats.txbytesunicast; - rtldm->last_rx_ok_cnt = rtlpriv->stats.rxbytesunicast; - - iot_peer = rtlpriv->mac80211.vendor; - b_bias_on_rx = (iot_peer == PEER_RAL || iot_peer == PEER_ATH) ? - true : false; - b_edca_turbo_on = ((!rtlpriv->dm.bis_any_nonbepkts) && - (!rtlpriv->dm.b_disable_framebursting)) ? - true : false; - - /*if (rtl8821ae_dm_is_edca_turbo_disable(hw)) - goto dm_CheckEdcaTurbo_EXIT;*/ - - if ((iot_peer == PEER_CISCO) && (mac->mode == WIRELESS_MODE_N_24G)) - { - edca_be_dl = edca_setting_dl[iot_peer]; - edca_be_ul = edca_setting_ul[iot_peer]; - } - - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("bIsAnyNonBEPkts : 0x%x bDisableFrameBursting : 0x%x \n", - rtlpriv->dm.bis_any_nonbepkts, rtlpriv->dm.b_disable_framebursting)); - - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("bEdcaTurboOn : 0x%x bBiasOnRx : 0x%x\n", - b_edca_turbo_on, b_bias_on_rx)); - - if (b_edca_turbo_on) { - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("curTxOkCnt : 0x%lx \n",cur_tx_ok_cnt)); - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("curRxOkCnt : 0x%lx \n",cur_rx_ok_cnt)); - if(b_bias_on_rx) - rtl8821ae_dm_edca_choose_traffic_idx(hw, cur_tx_ok_cnt, - cur_rx_ok_cnt, true, pb_is_cur_rdl_state); - else - rtl8821ae_dm_edca_choose_traffic_idx(hw, cur_tx_ok_cnt, - cur_rx_ok_cnt, false, pb_is_cur_rdl_state); - - edca_be = ((*pb_is_cur_rdl_state) == true) ? edca_be_dl : edca_be_ul; - - rtl_write_dword(rtlpriv, DM_REG_EDCA_BE_11N, edca_be); - - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("EDCA Turbo on: EDCA_BE:0x%x\n", edca_be)); - - rtlpriv->dm.bcurrent_turbo_edca = true; - - RT_TRACE(COMP_TURBO, DBG_LOUD, - ("EDCA_BE_DL : 0x%x EDCA_BE_UL : 0x%x EDCA_BE : 0x%x \n", - edca_be_dl, edca_be_ul, edca_be)); - } else { - if (rtlpriv->dm.bcurrent_turbo_edca) { - u8 tmp = AC0_BE; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AC_PARAM, - (u8 *) (&tmp)); - } - rtlpriv->dm.bcurrent_turbo_edca = false; - } - -/* dm_CheckEdcaTurbo_EXIT: */ - rtlpriv->dm.bis_any_nonbepkts = false; - rtldm->last_tx_ok_cnt = rtlpriv->stats.txbytesunicast; - rtldm->last_rx_ok_cnt = rtlpriv->stats.rxbytesunicast; -} - -static void rtl8821ae_dm_cck_packet_detection_thresh(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 cur_cck_cca_thresh; - - if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) { - /*dm_digtable.rssi_val_min = rtl8821ae_dm_initial_gain_min_pwdb(hw);*/ - if (dm_digtable.rssi_val_min > 25) - cur_cck_cca_thresh = 0xcd; - else if ((dm_digtable.rssi_val_min <= 25) && (dm_digtable.rssi_val_min > 10)) - cur_cck_cca_thresh = 0x83; - else { - if (rtlpriv->falsealm_cnt.cnt_cck_fail > 1000) - cur_cck_cca_thresh = 0x83; - else - cur_cck_cca_thresh = 0x40; - } - - } else { - if (rtlpriv->falsealm_cnt.cnt_cck_fail > 1000) - cur_cck_cca_thresh = 0x83; - else - cur_cck_cca_thresh = 0x40; - } - - if (dm_digtable.cur_cck_cca_thres != cur_cck_cca_thresh) { - rtl_set_bbreg(hw, RCCK0_CCA, MASKBYTE2, cur_cck_cca_thresh); - } - - dm_digtable.pre_cck_cca_thres = dm_digtable.cur_cck_cca_thres; - dm_digtable.cur_cck_cca_thres = cur_cck_cca_thresh; - RT_TRACE(COMP_DIG, DBG_TRACE, - ("CCK cca thresh hold =%x\n", dm_digtable.cur_cck_cca_thres)); - -} - -void rtl8821ae_dm_dynamic_edcca(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool b_fw_current_in_ps_mode = false; - - rtlpriv->cfg->ops->get_hw_reg(hw,HW_VAR_FW_PSMODE_STATUS, \ - (u8*)(&b_fw_current_in_ps_mode)); - if (b_fw_current_in_ps_mode) - return; -} - -void rtl8812ae_dm_update_txpath(struct ieee80211_hw *hw, u8 path) -{ - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtldm->resp_tx_path != path) { - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("Need to Update Tx Path\n")); - if (path == RF90_PATH_A) { - /*Tx by Reg*/ - rtl_set_bbreg(hw, 0x80c, 0xFFF0, 0x111); - /*Resp Tx by Txinfo*/ - rtl_set_bbreg(hw, 0x6d8, BIT(7) | BIT(6), 1); - } else { - /*Tx by Reg*/ - rtl_set_bbreg(hw, 0x80c, 0xFFF0, 0x222); - /*Resp Tx by Txinfo*/ - rtl_set_bbreg(hw, 0x6d8, BIT(7) |BIT(6), 2); - } - } - rtldm->resp_tx_path = path; - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("Path=%s\n",(path == RF90_PATH_A) ? \ - "RF90_PATH_A":"RF90_PATH_A")); -} - -void rtl8812ae_dm_path_diversity_init(struct ieee80211_hw *hw) -{ - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - - //rtl_set_bbreg(hw, 0x80c , BIT(29), 1); /*Tx path from Reg*/ - rtl_set_bbreg(hw, 0x80c , 0xFFF0, 0x111); /*Tx by Reg*/ - rtl_set_bbreg(hw, 0x6d8 , BIT(7) | BIT(6), 1); /*Resp Tx by Txinfo*/ - rtl8812ae_dm_update_txpath(hw, RF90_PATH_A); - - rtldm->path_sel = 1; /* TxInfo default at path-A*/ -} - -void rtl812ae_dm_set_txpath_by_txinfo(struct ieee80211_hw *hw, - u8 *pdesc) -{ - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - - SET_TX_DESC_TX_ANT(pdesc, rtldm->path_sel); -} - -void rtl8812ae_dm_path_statistics(struct ieee80211_hw *hw, - u32 rssi_a, u32 rssi_b) -{ - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - - rtldm->patha_sum += rssi_a; - rtldm->patha_cnt ++; - - rtldm->pathb_sum += rssi_b; - rtldm->pathb_cnt ++; -} - -void rtl8812ae_dm_path_diversity(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u32 rssi_avg_a = 0; - u32 rssi_avg_b = 0; - u32 local_min_rssi = 0; - u32 min_rssi = 0xFF; - u8 tx_resp_path=0, target_path; - struct ieee80211_sta *sta = NULL; - - sta = rtl_find_sta(hw, mac->bssid); - if (sta) { - /*Caculate RSSI per Path*/ - rssi_avg_a = (rtldm->patha_cnt != 0) ? \ - (rtldm->patha_sum / rtldm->patha_cnt) : 0; - rssi_avg_b = (rtldm->pathb_cnt != 0) ? \ - (rtldm->pathb_sum / rtldm->pathb_cnt) : 0; - - target_path = (rssi_avg_a == rssi_avg_b) ? rtldm->resp_tx_path : \ - ((rssi_avg_a>=rssi_avg_b) ? RF90_PATH_A : RF90_PATH_B); - - RT_TRACE(COMP_DIG, DBG_TRACE, \ - ("assoc_id=%d, PathA_Sum=%d, PathA_Cnt=%d\n", \ - mac->assoc_id, rtldm->patha_sum, rtldm->patha_cnt)); - RT_TRACE(COMP_DIG, DBG_TRACE, \ - ("assoc_id=%d, PathB_Sum=%d, PathB_Cnt=%d\n", \ - mac->assoc_id, rtldm->pathb_sum, rtldm->pathb_cnt)); - RT_TRACE(COMP_DIG, DBG_TRACE, \ - ("assoc_id=%d, RssiAvgA= %d, RssiAvgB= %d\n", \ - mac->assoc_id, rssi_avg_a, rssi_avg_b)); - - /*Select Resp Tx Path*/ - local_min_rssi = (rssi_avg_a > rssi_avg_b) ? rssi_avg_b : rssi_avg_a; - if(local_min_rssi < min_rssi) - { - min_rssi = local_min_rssi; - tx_resp_path = target_path; - } - - /*Select Tx DESC*/ - if(target_path == RF90_PATH_A) - rtldm->path_sel = 1; - else - rtldm->path_sel = 2; - - RT_TRACE(COMP_DIG, DBG_TRACE, \ - ("Tx from TxInfo, TargetPath=%s\n", \ - (target_path==RF90_PATH_A) ? \ - "ODM_RF_PATH_A":"ODM_RF_PATH_B")); - RT_TRACE(COMP_DIG, DBG_TRACE, \ - ("pDM_PathDiv->PathSel= %d\n", \ - rtldm->path_sel)); - } - rtldm->patha_cnt = 0; - rtldm->patha_sum = 0; - rtldm->pathb_cnt = 0; - rtldm->pathb_sum = 0; -} - -void rtl8821ae_dm_dynamic_atc_switch(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - u8 crystal_cap; - u32 packet_count; - int cfo_khz_a,cfo_khz_b,cfo_ave = 0, adjust_xtal = 0; - int cfo_ave_diff; - - if (rtlpriv->mac80211.link_state < MAC80211_LINKED){ - /*1.Enable ATC*/ - if (rtldm->atc_status == ATC_STATUS_OFF) - { - rtl_set_bbreg(hw, RFC_AREA, BIT(14), ATC_STATUS_ON); - rtldm->atc_status = ATC_STATUS_ON; - } - - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): No link!!\n")); - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): atc_status = %d\n", \ - rtldm->atc_status)); - - if (rtldm->crystal_cap != rtlpriv->efuse.crystalcap) - { - rtldm->crystal_cap = rtlpriv->efuse.crystalcap; - crystal_cap = rtldm->crystal_cap & 0x3f; - crystal_cap = crystal_cap & 0x3f; - rtl_set_bbreg(hw, REG_MAC_PHY_CTRL, \ - 0x7ff80000, (crystal_cap | (crystal_cap << 6))); - } - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): crystal_cap = 0x%x\n", \ - rtldm->crystal_cap)); - }else{ - /*1. Calculate CFO for path-A & path-B*/ - cfo_khz_a = (int)(rtldm->cfo_tail[0] * 3125) / 1280; - cfo_khz_b = (int)(rtldm->cfo_tail[1] * 3125) / 1280; - packet_count = rtldm->packet_count; - - /*2.No new packet*/ - if (packet_count == rtldm->packet_count_pre) { - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): packet counter doesn't change\n")); - return; - } - - rtldm->packet_count_pre = packet_count; - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): packet counter = %d\n", \ - rtldm->packet_count)); - - /*3.Average CFO*/ - if (rtlpriv->phy.rf_type == RF_1T1R) - cfo_ave = cfo_khz_a; - else - cfo_ave = (cfo_khz_a + cfo_khz_b) >> 1; - - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch():" - "cfo_khz_a = %dkHz, cfo_khz_b = %dkHz, cfo_ave = %dkHz\n", - cfo_khz_a, cfo_khz_b, cfo_ave)); - - /*4.Avoid abnormal large CFO*/ - cfo_ave_diff = (rtldm->cfo_ave_pre >= cfo_ave)? - (rtldm->cfo_ave_pre - cfo_ave): - (cfo_ave - rtldm->cfo_ave_pre); - - if (cfo_ave_diff > 20 && rtldm->large_cfo_hit == 0){ - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): first large CFO hit\n")); - rtldm->large_cfo_hit = 1; - return; - } - else - rtldm->large_cfo_hit = 0; - - rtldm->cfo_ave_pre = cfo_ave; - - /*CFO tracking by adjusting Xtal cap.*/ - - /*1.Dynamic Xtal threshold*/ - if (cfo_ave >= -rtldm->cfo_threshold && - cfo_ave <= rtldm->cfo_threshold && - rtldm->is_freeze == 0){ - if (rtldm->cfo_threshold == CFO_THRESHOLD_XTAL){ - rtldm->cfo_threshold = CFO_THRESHOLD_XTAL + 10; - rtldm->is_freeze = 1; - } - else - rtldm->cfo_threshold = CFO_THRESHOLD_XTAL; - } - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): Dynamic threshold = %d\n", \ - rtldm->cfo_threshold)); - - /* 2.Calculate Xtal offset*/ - if (cfo_ave > rtldm->cfo_threshold && rtldm->crystal_cap < 0x3f) - adjust_xtal = ((cfo_ave - CFO_THRESHOLD_XTAL) >> 2) + 1; - else if ((cfo_ave < -rtlpriv->dm.cfo_threshold) && rtlpriv->dm.crystal_cap > 0) - adjust_xtal = ((cfo_ave + CFO_THRESHOLD_XTAL) >> 2) - 1; - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): " - "Crystal cap = 0x%x, Crystal cap offset = %d\n", - rtldm->crystal_cap, adjust_xtal)); - - /*3.Adjudt Crystal Cap.*/ - if (adjust_xtal != 0){ - rtldm->is_freeze = 0; - rtldm->crystal_cap += adjust_xtal; - - if (rtldm->crystal_cap > 0x3f) - rtldm->crystal_cap = 0x3f; - else if (rtldm->crystal_cap < 0) - rtldm->crystal_cap = 0; - - crystal_cap = rtldm->crystal_cap & 0x3f; - crystal_cap = crystal_cap & 0x3f; - rtl_set_bbreg(hw, REG_MAC_PHY_CTRL, \ - 0x7ff80000, (crystal_cap | (crystal_cap << 6))); - RT_TRACE(COMP_DIG, DBG_LOUD, \ - ("rtl8821ae_dm_dynamic_atc_switch(): New crystal cap = 0x%x \n", \ - rtldm->crystal_cap)); - } - } - -} - -void rtl8821ae_dm_watchdog(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool b_fw_current_inpsmode = false; - bool b_fw_ps_awake = true; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *) (&b_fw_current_inpsmode)); - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FWLPS_RF_ON, - (u8 *) (&b_fw_ps_awake)); - - if(ppsc->p2p_ps_info.p2p_ps_mode) - b_fw_ps_awake = false; - - if((ppsc->rfpwr_state == ERFON) && - ((!b_fw_current_inpsmode) && b_fw_ps_awake) && - (!ppsc->rfchange_inprogress)) { - rtl8821ae_dm_common_info_self_update(hw); - rtl8821ae_dm_false_alarm_counter_statistics(hw); - rtl8821ae_dm_check_rssi_monitor(hw); - rtl8821ae_dm_dig(hw); - rtl8821ae_dm_dynamic_edcca(hw); - rtl8821ae_dm_cck_packet_detection_thresh(hw); - rtl8821ae_dm_refresh_rate_adaptive_mask(hw); - rtl8821ae_dm_check_edca_turbo(hw); - rtl8821ae_dm_dynamic_atc_switch(hw); - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtl8812ae_dm_check_txpower_tracking_thermalmeter(hw); - else - rtl8821ae_dm_check_txpower_tracking_thermalmeter(hw); - rtl8821ae_dm_iq_calibrate(hw); - if (rtlpriv->cfg->ops->get_btc_status()){ - rtlpriv->btcoexist.btc_ops->btc_periodical(rtlpriv); - } - } - - rtlpriv->dm.dbginfo.num_qry_beacon_pkt = 0; -} - -void rtl8821ae_dm_set_tx_ant_by_tx_info(struct ieee80211_hw *hw, - u8 *pdesc, u32 mac_id) -{ - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - struct fast_ant_trainning *pfat_table= &(rtldm->fat_table); - - if (rtlhal->hw_type != HARDWARE_TYPE_RTL8812AE) - return; - - if ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) || - (rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV)){ - SET_TX_DESC_TX_ANT(pdesc, pfat_table->antsel_a[mac_id]); - } -} diff --git a/drivers/staging/rtl8821ae/rtl8821ae/dm.h b/drivers/staging/rtl8821ae/rtl8821ae/dm.h deleted file mode 100644 index ebbff9b..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/dm.h +++ /dev/null @@ -1,426 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_DM_H__ -#define __RTL8821AE_DM_H__ - -#define MAIN_ANT 0 -#define AUX_ANT 1 -#define MAIN_ANT_CG_TRX 1 -#define AUX_ANT_CG_TRX 0 -#define MAIN_ANT_CGCS_RX 0 -#define AUX_ANT_CGCS_RX 1 - -#define TXSCALE_TABLE_SIZE 37 - -/*RF REG LIST*/ -#define DM_REG_RF_MODE_11N 0x00 -#define DM_REG_RF_0B_11N 0x0B -#define DM_REG_CHNBW_11N 0x18 -#define DM_REG_T_METER_11N 0x24 -#define DM_REG_RF_25_11N 0x25 -#define DM_REG_RF_26_11N 0x26 -#define DM_REG_RF_27_11N 0x27 -#define DM_REG_RF_2B_11N 0x2B -#define DM_REG_RF_2C_11N 0x2C -#define DM_REG_RXRF_A3_11N 0x3C -#define DM_REG_T_METER_92D_11N 0x42 -#define DM_REG_T_METER_88E_11N 0x42 - - - -/*BB REG LIST*/ -/*PAGE 8 */ -#define DM_REG_BB_CTRL_11N 0x800 -#define DM_REG_RF_PIN_11N 0x804 -#define DM_REG_PSD_CTRL_11N 0x808 -#define DM_REG_TX_ANT_CTRL_11N 0x80C -#define DM_REG_BB_PWR_SAV5_11N 0x818 -#define DM_REG_CCK_RPT_FORMAT_11N 0x824 -#define DM_REG_RX_DEFUALT_A_11N 0x858 -#define DM_REG_RX_DEFUALT_B_11N 0x85A -#define DM_REG_BB_PWR_SAV3_11N 0x85C -#define DM_REG_ANTSEL_CTRL_11N 0x860 -#define DM_REG_RX_ANT_CTRL_11N 0x864 -#define DM_REG_PIN_CTRL_11N 0x870 -#define DM_REG_BB_PWR_SAV1_11N 0x874 -#define DM_REG_ANTSEL_PATH_11N 0x878 -#define DM_REG_BB_3WIRE_11N 0x88C -#define DM_REG_SC_CNT_11N 0x8C4 -#define DM_REG_PSD_DATA_11N 0x8B4 -/*PAGE 9*/ -#define DM_REG_ANT_MAPPING1_11N 0x914 -#define DM_REG_ANT_MAPPING2_11N 0x918 -/*PAGE A*/ -#define DM_REG_CCK_ANTDIV_PARA1_11N 0xA00 -#define DM_REG_CCK_CCA_11N 0xA0A -#define DM_REG_CCK_CCA_11AC 0xA0A -#define DM_REG_CCK_ANTDIV_PARA2_11N 0xA0C -#define DM_REG_CCK_ANTDIV_PARA3_11N 0xA10 -#define DM_REG_CCK_ANTDIV_PARA4_11N 0xA14 -#define DM_REG_CCK_FILTER_PARA1_11N 0xA22 -#define DM_REG_CCK_FILTER_PARA2_11N 0xA23 -#define DM_REG_CCK_FILTER_PARA3_11N 0xA24 -#define DM_REG_CCK_FILTER_PARA4_11N 0xA25 -#define DM_REG_CCK_FILTER_PARA5_11N 0xA26 -#define DM_REG_CCK_FILTER_PARA6_11N 0xA27 -#define DM_REG_CCK_FILTER_PARA7_11N 0xA28 -#define DM_REG_CCK_FILTER_PARA8_11N 0xA29 -#define DM_REG_CCK_FA_RST_11N 0xA2C -#define DM_REG_CCK_FA_MSB_11N 0xA58 -#define DM_REG_CCK_FA_LSB_11N 0xA5C -#define DM_REG_CCK_CCA_CNT_11N 0xA60 -#define DM_REG_BB_PWR_SAV4_11N 0xA74 -/*PAGE B */ -#define DM_REG_LNA_SWITCH_11N 0xB2C -#define DM_REG_PATH_SWITCH_11N 0xB30 -#define DM_REG_RSSI_CTRL_11N 0xB38 -#define DM_REG_CONFIG_ANTA_11N 0xB68 -#define DM_REG_RSSI_BT_11N 0xB9C -/*PAGE C */ -#define DM_REG_OFDM_FA_HOLDC_11N 0xC00 -#define DM_REG_RX_PATH_11N 0xC04 -#define DM_REG_TRMUX_11N 0xC08 -#define DM_REG_OFDM_FA_RSTC_11N 0xC0C -#define DM_REG_RXIQI_MATRIX_11N 0xC14 -#define DM_REG_TXIQK_MATRIX_LSB1_11N 0xC4C -#define DM_REG_IGI_A_11N 0xC50 -#define DM_REG_IGI_A_11AC 0xC50 -#define DM_REG_ANTDIV_PARA2_11N 0xC54 -#define DM_REG_IGI_B_11N 0xC58 -#define DM_REG_IGI_B_11AC 0xE50 -#define DM_REG_ANTDIV_PARA3_11N 0xC5C -#define DM_REG_BB_PWR_SAV2_11N 0xC70 -#define DM_REG_RX_OFF_11N 0xC7C -#define DM_REG_TXIQK_MATRIXA_11N 0xC80 -#define DM_REG_TXIQK_MATRIXB_11N 0xC88 -#define DM_REG_TXIQK_MATRIXA_LSB2_11N 0xC94 -#define DM_REG_TXIQK_MATRIXB_LSB2_11N 0xC9C -#define DM_REG_RXIQK_MATRIX_LSB_11N 0xCA0 -#define DM_REG_ANTDIV_PARA1_11N 0xCA4 -#define DM_REG_OFDM_FA_TYPE1_11N 0xCF0 -/*PAGE D */ -#define DM_REG_OFDM_FA_RSTD_11N 0xD00 -#define DM_REG_OFDM_FA_TYPE2_11N 0xDA0 -#define DM_REG_OFDM_FA_TYPE3_11N 0xDA4 -#define DM_REG_OFDM_FA_TYPE4_11N 0xDA8 -/*PAGE E */ -#define DM_REG_TXAGC_A_6_18_11N 0xE00 -#define DM_REG_TXAGC_A_24_54_11N 0xE04 -#define DM_REG_TXAGC_A_1_MCS32_11N 0xE08 -#define DM_REG_TXAGC_A_MCS0_3_11N 0xE10 -#define DM_REG_TXAGC_A_MCS4_7_11N 0xE14 -#define DM_REG_TXAGC_A_MCS8_11_11N 0xE18 -#define DM_REG_TXAGC_A_MCS12_15_11N 0xE1C -#define DM_REG_FPGA0_IQK_11N 0xE28 -#define DM_REG_TXIQK_TONE_A_11N 0xE30 -#define DM_REG_RXIQK_TONE_A_11N 0xE34 -#define DM_REG_TXIQK_PI_A_11N 0xE38 -#define DM_REG_RXIQK_PI_A_11N 0xE3C -#define DM_REG_TXIQK_11N 0xE40 -#define DM_REG_RXIQK_11N 0xE44 -#define DM_REG_IQK_AGC_PTS_11N 0xE48 -#define DM_REG_IQK_AGC_RSP_11N 0xE4C -#define DM_REG_BLUETOOTH_11N 0xE6C -#define DM_REG_RX_WAIT_CCA_11N 0xE70 -#define DM_REG_TX_CCK_RFON_11N 0xE74 -#define DM_REG_TX_CCK_BBON_11N 0xE78 -#define DM_REG_OFDM_RFON_11N 0xE7C -#define DM_REG_OFDM_BBON_11N 0xE80 -#define DM_REG_TX2RX_11N 0xE84 -#define DM_REG_TX2TX_11N 0xE88 -#define DM_REG_RX_CCK_11N 0xE8C -#define DM_REG_RX_OFDM_11N 0xED0 -#define DM_REG_RX_WAIT_RIFS_11N 0xED4 -#define DM_REG_RX2RX_11N 0xED8 -#define DM_REG_STANDBY_11N 0xEDC -#define DM_REG_SLEEP_11N 0xEE0 -#define DM_REG_PMPD_ANAEN_11N 0xEEC - - -/*MAC REG LIST*/ -#define DM_REG_BB_RST_11N 0x02 -#define DM_REG_ANTSEL_PIN_11N 0x4C -#define DM_REG_EARLY_MODE_11N 0x4D0 -#define DM_REG_RSSI_MONITOR_11N 0x4FE -#define DM_REG_EDCA_VO_11N 0x500 -#define DM_REG_EDCA_VI_11N 0x504 -#define DM_REG_EDCA_BE_11N 0x508 -#define DM_REG_EDCA_BK_11N 0x50C -#define DM_REG_TXPAUSE_11N 0x522 -#define DM_REG_RESP_TX_11N 0x6D8 -#define DM_REG_ANT_TRAIN_PARA1_11N 0x7b0 -#define DM_REG_ANT_TRAIN_PARA2_11N 0x7b4 - - -/*DIG Related*/ -#define DM_BIT_IGI_11N 0x0000007F -#define DM_BIT_IGI_11AC 0xFFFFFFFF - - - -#define HAL_DM_DIG_DISABLE BIT(0) -#define HAL_DM_HIPWR_DISABLE BIT(1) - -#define OFDM_TABLE_LENGTH 43 -#define CCK_TABLE_LENGTH 33 - -#define OFDM_TABLE_SIZE 37 -#define CCK_TABLE_SIZE 33 - -#define BW_AUTO_SWITCH_HIGH_LOW 25 -#define BW_AUTO_SWITCH_LOW_HIGH 30 - -#define DM_DIG_THRESH_HIGH 40 -#define DM_DIG_THRESH_LOW 35 - -#define DM_FALSEALARM_THRESH_LOW 400 -#define DM_FALSEALARM_THRESH_HIGH 1000 - -#define DM_DIG_MAX 0x3e -#define DM_DIG_MIN 0x1e - -#define DM_DIG_MAX_AP 0x32 -#define DM_DIG_MIN_AP 0x20 - -#define DM_DIG_FA_UPPER 0x3e -#define DM_DIG_FA_LOWER 0x1e -#define DM_DIG_FA_TH0 0x200 -#define DM_DIG_FA_TH1 0x300 -#define DM_DIG_FA_TH2 0x400 - -#define DM_DIG_BACKOFF_MAX 12 -#define DM_DIG_BACKOFF_MIN -4 -#define DM_DIG_BACKOFF_DEFAULT 10 - -#define RXPATHSELECTION_SS_TH_lOW 30 -#define RXPATHSELECTION_DIFF_TH 18 - -#define DM_RATR_STA_INIT 0 -#define DM_RATR_STA_HIGH 1 -#define DM_RATR_STA_MIDDLE 2 -#define DM_RATR_STA_LOW 3 - -#define CTS2SELF_THVAL 30 -#define REGC38_TH 20 - -#define WAIOTTHVal 25 - -#define TXHIGHPWRLEVEL_NORMAL 0 -#define TXHIGHPWRLEVEL_LEVEL1 1 -#define TXHIGHPWRLEVEL_LEVEL2 2 -#define TXHIGHPWRLEVEL_BT1 3 -#define TXHIGHPWRLEVEL_BT2 4 - -#define DM_TYPE_BYFW 0 -#define DM_TYPE_BYDRIVER 1 - -#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74 -#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 -#define TXPWRTRACK_MAX_IDX 6 - -/* Dynamic ATC switch */ -#define ATC_STATUS_OFF 0x0 /* enable */ -#define ATC_STATUS_ON 0x1 /* disable */ -#define CFO_THRESHOLD_XTAL 10 /* kHz */ -#define CFO_THRESHOLD_ATC 80 /* kHz */ - -#define AVG_THERMAL_NUM_8812A 4 -#define TXPWR_TRACK_TABLE_SIZE 30 -#define MAX_PATH_NUM_8812A 2 -#define MAX_PATH_NUM_8821A 1 - - -struct ps_t { - u8 pre_ccastate; - u8 cur_ccasate; - u8 pre_rfstate; - u8 cur_rfstate; - u8 initialize; - long rssi_val_min; - -}; - -struct dig_t { - u8 dig_enable_flag; - u8 dig_ext_port_stage; - u32 rssi_lowthresh; - u32 rssi_highthresh; - - u32 fa_lowthresh; - u32 fa_highthresh; - - u8 cursta_connectctate; - u8 presta_connectstate; - u8 curmultista_connectstate; - - u8 pre_igvalue; - u8 cur_igvalue; - u8 bt30_cur_igi; - u8 backup_igvalue; - u8 stop_dig; - - char backoff_val; - char backoff_val_range_max; - char backoff_val_range_min; - u8 rx_gain_range_max; - u8 rx_gain_range_min; - u8 rssi_val_min; - - u8 pre_cck_cca_thres; - u8 cur_cck_cca_thres; - u8 pre_cck_pd_state; - u8 cur_cck_pd_state; - - u8 large_fa_hit; - u8 forbidden_igi; - u32 recover_cnt; - - u8 dig_dynamic_min_0; - u8 dig_dynamic_min_1; - bool b_media_connect_0; - bool b_media_connect_1; - - u32 antdiv_rssi_max; - u32 rssi_max; -}; - - -enum FAT_STATE { - FAT_NORMAL_STATE = 0, - FAT_TRAINING_STATE = 1, -}; - -enum tag_dynamic_init_gain_operation_type_definition { - DIG_TYPE_THRESH_HIGH = 0, - DIG_TYPE_THRESH_LOW = 1, - DIG_TYPE_BACKOFF = 2, - DIG_TYPE_RX_GAIN_MIN = 3, - DIG_TYPE_RX_GAIN_MAX = 4, - DIG_TYPE_ENABLE = 5, - DIG_TYPE_DISABLE = 6, - DIG_OP_TYPE_MAX -}; - -enum tag_cck_packet_detection_threshold_type_definition { - CCK_PD_STAGE_LowRssi = 0, - CCK_PD_STAGE_HighRssi = 1, - CCK_FA_STAGE_Low = 2, - CCK_FA_STAGE_High = 3, - CCK_PD_STAGE_MAX = 4, -}; - -enum dm_1r_cca_e { - CCA_1R = 0, - CCA_2R = 1, - CCA_MAX = 2, -}; - -enum dm_rf_e { - RF_SAVE = 0, - RF_NORMAL = 1, - RF_MAX = 2, -}; - -enum dm_sw_ant_switch_e { - ANS_ANTENNA_B = 1, - ANS_ANTENNA_A = 2, - ANS_ANTENNA_MAX = 3, -}; - -enum dm_dig_ext_port_alg_e { - DIG_EXT_PORT_STAGE_0 = 0, - DIG_EXT_PORT_STAGE_1 = 1, - DIG_EXT_PORT_STAGE_2 = 2, - DIG_EXT_PORT_STAGE_3 = 3, - DIG_EXT_PORT_STAGE_MAX = 4, -}; - -enum dm_dig_connect_e { - DIG_STA_DISCONNECT = 0, - DIG_STA_CONNECT = 1, - DIG_STA_BEFORE_CONNECT = 2, - DIG_MULTISTA_DISCONNECT = 3, - DIG_MULTISTA_CONNECT = 4, - DIG_CONNECT_MAX -}; - -enum pwr_track_control_method { - BBSWING, - TXAGC, - MIX_MODE -}; - -#define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) -#define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1) -#define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) -#define BT_RSSI_STATE_BG_EDCA_LOW BIT_OFFSET_LEN_MASK_32(3, 1) -#define BT_RSSI_STATE_TXPOWER_LOW BIT_OFFSET_LEN_MASK_32(4, 1) -#define GET_UNDECORATED_AVERAGE_RSSI(_priv) \ - (((struct rtl_priv *)(_priv))->mac80211.opmode == NL80211_IFTYPE_ADHOC)? \ - (((struct rtl_priv *)(_priv))->dm.entry_min_undecoratedsmoothed_pwdb): \ - (((struct rtl_priv *)(_priv))->dm.undecorated_smoothed_pwdb) - -extern struct dig_t dm_digtable; -void rtl8821ae_dm_set_tx_ant_by_tx_info(struct ieee80211_hw *hw, - u8 *pdesc, u32 mac_id); -void rtl8821ae_dm_ant_sel_statistics(struct ieee80211_hw *hw, - u8 antsel_tr_mux, u32 mac_id, - u32 rx_pwdb_all); -void rtl8821ae_dm_fast_antenna_trainning_callback(unsigned long data); -void rtl8821ae_dm_init(struct ieee80211_hw *hw); -void rtl8821ae_dm_watchdog(struct ieee80211_hw *hw); -void rtl8821ae_dm_write_dig(struct ieee80211_hw *hw, u8 current_igi); -void rtl8821ae_dm_init_edca_turbo(struct ieee80211_hw *hw); -void rtl8821ae_dm_check_txpower_tracking_thermalmeter(struct ieee80211_hw *hw); -void rtl8821ae_dm_init_rate_adaptive_mask(struct ieee80211_hw *hw); -void rtl8821ae_dm_txpower_track_adjust(struct ieee80211_hw *hw, - u8 type,u8 *pdirection, - u32 *poutwrite_val); -void rtl8821ae_dm_clear_txpower_tracking_state(struct ieee80211_hw *hw); -void rtl8821ae_dm_write_cck_cca_thres(struct ieee80211_hw *hw, u8 current_cca); -void rtl8821ae_dm_initialize_txpower_tracking_thermalmeter(struct ieee80211_hw *hw); -void rtl8812ae_dm_path_diversity(struct ieee80211_hw *hw); -void rtl8812ae_dm_path_diversity_init(struct ieee80211_hw *hw); -void rtl8812ae_dm_path_statistics(struct ieee80211_hw *hw, - u32 rssi_a, u32 rssi_b); -void rtl812ae_dm_set_txpath_by_txinfo(struct ieee80211_hw *hw, - u8 *pdesc); -void rtl8812ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, - enum pwr_track_control_method method, - u8 rf_path, - u8 channel_mapped_index); -void rtl8821ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, - enum pwr_track_control_method method, u8 rf_path, u8 channel_mapped_index); - -void rtl8812ae_dm_update_init_rate(struct ieee80211_hw *hw, u8 rate); -u8 rtl8812ae_hw_rate_to_mrate(struct ieee80211_hw *hw, u8 rate); -void rtl8812ae_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw *hw); -void rtl8821ae_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw *hw); -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/fw.c b/drivers/staging/rtl8821ae/rtl8821ae/fw.c deleted file mode 100644 index 4083cab..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/fw.c +++ /dev/null @@ -1,1349 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "reg.h" -#include "def.h" -#include "fw.h" -#include "dm.h" - -static void _rtl8821ae_enable_fw_download(struct ieee80211_hw *hw, bool enable) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp; - - if (enable) { - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x05); - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL + 2); - rtl_write_byte(rtlpriv, REG_MCUFWDL + 2, tmp & 0xf7); - - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - //printk("0x80=%02x.\n",tmp); - } else { - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - rtl_write_byte(rtlpriv, REG_MCUFWDL, tmp & 0xfe); - tmp = rtl_read_byte(rtlpriv, REG_MCUFWDL); - //printk("0x80=%02x.\n",tmp); - } - -} - -static void _rtl8821ae_fw_block_write(struct ieee80211_hw *hw, - const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 blockSize = sizeof(u32); - u8 *bufferPtr = (u8 *) buffer; - u32 *pu4BytePtr = (u32 *) buffer; - u32 i, offset, blockCount, remainSize; - - blockCount = size / blockSize; - remainSize = size % blockSize; - - for (i = 0; i < blockCount; i++) { - offset = i * blockSize; - rtl_write_dword(rtlpriv, (FW_8821AE_START_ADDRESS + offset), - *(pu4BytePtr + i)); - } - - if (remainSize) { - offset = blockCount * blockSize; - bufferPtr += offset; - for (i = 0; i < remainSize; i++) { - rtl_write_byte(rtlpriv, (FW_8821AE_START_ADDRESS + - offset + i), *(bufferPtr + i)); - } - } -} - -static void _rtl8821ae_fw_page_write(struct ieee80211_hw *hw, - u32 page, const u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value8; - u8 u8page = (u8) (page & 0x07); - - value8 = (rtl_read_byte(rtlpriv, REG_MCUFWDL + 2) & 0xF8) | u8page; - - rtl_write_byte(rtlpriv, (REG_MCUFWDL + 2), value8); - _rtl8821ae_fw_block_write(hw, buffer, size); -} - -static void _rtl8821ae_fill_dummy(u8 *pfwbuf, u32 *pfwlen) -{ - u32 fwlen = *pfwlen; - u8 remain = (u8) (fwlen % 4); - - remain = (remain == 0) ? 0 : (4 - remain); - - while (remain > 0) { - pfwbuf[fwlen] = 0; - fwlen++; - remain--; - } - - *pfwlen = fwlen; -} - -static void _rtl8821ae_write_fw(struct ieee80211_hw *hw, - enum version_8821ae version, - u8 *buffer, u32 size) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 *bufferPtr = (u8 *) buffer; - u32 pageNums, remainSize; - u32 page, offset; - - RT_TRACE(COMP_FW, DBG_LOUD, ("FW size is %d bytes,\n", size)); - - _rtl8821ae_fill_dummy(bufferPtr, &size); - - pageNums = size / FW_8821AE_PAGE_SIZE; - remainSize = size % FW_8821AE_PAGE_SIZE; - - if (pageNums > 8) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("Page numbers should not greater then 8\n")); - } - - for (page = 0; page < pageNums; page++) { - offset = page * FW_8821AE_PAGE_SIZE; - _rtl8821ae_fw_page_write(hw, page, (bufferPtr + offset), - FW_8821AE_PAGE_SIZE); - } - - if (remainSize) { - offset = pageNums * FW_8821AE_PAGE_SIZE; - page = pageNums; - _rtl8821ae_fw_page_write(hw, page, (bufferPtr + offset), - remainSize); - } - -} - -static int _rtl8821ae_fw_free_to_go(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - int err = -EIO; - u32 counter = 0; - u32 value32; - - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - } while ((counter++ < FW_8821AE_POLLING_TIMEOUT_COUNT) && - (!(value32 & FWDL_CHKSUM_RPT))); - - if (counter >= FW_8821AE_POLLING_TIMEOUT_COUNT) { - RT_TRACE(COMP_ERR, DBG_LOUD, - ("chksum report faill ! REG_MCUFWDL:0x%08x .\n", - value32)); - goto exit; - } - - RT_TRACE(COMP_FW, DBG_EMERG, - ("Checksum report OK ! REG_MCUFWDL:0x%08x .\n", value32)); - - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - value32 |= MCUFWDL_RDY; - value32 &= ~WINTINI_RDY; - rtl_write_dword(rtlpriv, REG_MCUFWDL, value32); - - rtl8821ae_firmware_selfreset(hw); - - counter = 0; - do { - value32 = rtl_read_dword(rtlpriv, REG_MCUFWDL); - if (value32 & WINTINI_RDY) { - RT_TRACE(COMP_FW, DBG_LOUD, - ("Polling FW ready success!! REG_MCUFWDL:0x%08x .\n", - value32)); - err = 0; - goto exit; - } - - udelay(FW_8821AE_POLLING_DELAY); - - } while (counter++ < FW_8821AE_POLLING_TIMEOUT_COUNT); - - RT_TRACE(COMP_ERR, DBG_EMERG, - ("Polling FW ready fail!! REG_MCUFWDL:0x%08x .\n", value32)); - -exit: - return err; -} - -int rtl8821ae_download_fw(struct ieee80211_hw *hw, - bool buse_wake_on_wlan_fw - ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl8821a_firmware_header *pfwheader; - u8 *pfwdata; - u32 fwsize; - int err; - enum version_8821ae version = rtlhal->version; - - if(!rtlhal->pfirmware) - return 1; - - pfwheader = (struct rtl8821a_firmware_header *)rtlhal->pfirmware; - pfwdata = (u8 *) rtlhal->pfirmware; - fwsize = rtlhal->fwsize; - RT_TRACE(COMP_FW, DBG_DMESG, - ("normal Firmware SIZE %d \n",fwsize)); - - if (IS_FW_HEADER_EXIST_8812(pfwheader) || IS_FW_HEADER_EXIST_8821(pfwheader)) { - RT_TRACE(COMP_FW, DBG_DMESG, - ("Firmware Version(%d), Signature(%#x),Size(%d)\n", - pfwheader->version, pfwheader->signature, - (int)sizeof(struct rtl8821a_firmware_header))); - - pfwdata = pfwdata + sizeof(struct rtl8821a_firmware_header); - fwsize = fwsize - sizeof(struct rtl8821a_firmware_header); - } - - if(rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)){ - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); - rtl8821ae_firmware_selfreset(hw); - } - _rtl8821ae_enable_fw_download(hw, true); - _rtl8821ae_write_fw(hw, version, pfwdata, fwsize); - _rtl8821ae_enable_fw_download(hw, false); - - err = _rtl8821ae_fw_free_to_go(hw); - if (err) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("Firmware is not ready to run!\n")); - } else { - RT_TRACE(COMP_FW, DBG_LOUD, - ("Firmware is ready to run!\n")); - } - - return 0; -} - -static bool _rtl8821ae_check_fw_read_last_h2c(struct ieee80211_hw *hw, u8 boxnum) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 val_hmetfr; - bool result = false; - - val_hmetfr = rtl_read_byte(rtlpriv, REG_HMETFR); - if (((val_hmetfr >> boxnum) & BIT(0)) == 0) - result = true; - return result; -} - -static void _rtl8821ae_fill_h2c_command(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *p_cmdbuffer) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 boxnum =0; - u16 box_reg = 0, box_extreg = 0; - u8 u1b_tmp = 0; - bool isfw_read = false; - u8 buf_index = 0; - bool bwrite_sucess = false; - u8 wait_h2c_limmit = 100; - /*u8 wait_writeh2c_limmit = 100;*/ - u8 boxcontent[4], boxextcontent[4]; - u32 h2c_waitcounter = 0; - unsigned long flag =0; - u8 idx =0; - - RT_TRACE(COMP_CMD, DBG_LOUD, ("come in\n")); - - while (true) { - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - if (rtlhal->b_h2c_setinprogress) { - RT_TRACE(COMP_CMD, DBG_LOUD, - ("H2C set in progress! Wait to set.." - "element_id(%d).\n", element_id)); - - while (rtlhal->b_h2c_setinprogress) { - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, - flag); - h2c_waitcounter++; - RT_TRACE(COMP_CMD, DBG_LOUD, - ("Wait 100 us (%d times)...\n", - h2c_waitcounter)); - udelay(100); - - if (h2c_waitcounter > 1000) - return; - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, - flag); - } - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - } else { - rtlhal->b_h2c_setinprogress = true; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - break; - } - } - - while (!bwrite_sucess) { - /*cosa remove this because never reach this.*/ -#if 0 - wait_writeh2c_limmit--; - if (wait_writeh2c_limmit == 0) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("Write H2C fail because no trigger " - "for FW INT!\n")); - break; - } -#endif - - boxnum = rtlhal->last_hmeboxnum; - switch (boxnum) { - case 0: - box_reg = REG_HMEBOX_0; - box_extreg = REG_HMEBOX_EXT_0; - break; - case 1: - box_reg = REG_HMEBOX_1; - box_extreg = REG_HMEBOX_EXT_1; - break; - case 2: - box_reg = REG_HMEBOX_2; - box_extreg = REG_HMEBOX_EXT_2; - break; - case 3: - box_reg = REG_HMEBOX_3; - box_extreg = REG_HMEBOX_EXT_3; - break; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, - ("switch case not process \n")); - break; - } - - isfw_read = false; - u1b_tmp = rtl_read_byte(rtlpriv, REG_CR); - - if (u1b_tmp != 0xEA) - isfw_read = true; - else { - if( rtl_read_byte(rtlpriv, REG_TXDMA_STATUS) == 0xEA || - rtl_read_byte(rtlpriv, REG_TXPKT_EMPTY) == 0xEA) - rtl_write_byte(rtlpriv, REG_SYS_CFG1 + 3, 0xFF); - } - - if (isfw_read == true) { - wait_h2c_limmit = 100; - isfw_read = _rtl8821ae_check_fw_read_last_h2c(hw, boxnum); - while (!isfw_read) { - /*wait until Fw read*/ - wait_h2c_limmit--; - if (wait_h2c_limmit == 0) { - RT_TRACE(COMP_CMD, DBG_LOUD, - ("Wating too long for FW read " - "clear HMEBox(%d)!\n", boxnum)); - break; - } - - udelay(10); - - isfw_read = _rtl8821ae_check_fw_read_last_h2c(hw, boxnum); - u1b_tmp = rtl_read_byte(rtlpriv, 0x130); - RT_TRACE(COMP_CMD, DBG_LOUD, - ("Wating for FW read clear HMEBox(%d)!!! " - "0x130 = %2x\n", boxnum, u1b_tmp)); - } - } - - if (!isfw_read) { - RT_TRACE(COMP_CMD, DBG_LOUD, - ("Write H2C register BOX[%d] fail!!!!! " - "Fw do not read. \n", boxnum)); - break; - } - - memset(boxcontent, 0, sizeof(boxcontent)); - memset(boxextcontent, 0, sizeof(boxextcontent)); - boxcontent[0] = element_id; - RT_TRACE(COMP_CMD, DBG_LOUD, - ("Write element_id box_reg(%4x) = %2x \n", - box_reg, element_id)); - - switch (cmd_len) { - case 1: - case 2: - case 3: - /*boxcontent[0] &= ~(BIT(7));*/ - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer + buf_index, cmd_len); - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - case 4: - case 5: - case 6: - case 7: - /*boxcontent[0] |= (BIT(7));*/ - memcpy((u8 *) (boxextcontent), - p_cmdbuffer + buf_index+3, cmd_len-3); - memcpy((u8 *) (boxcontent) + 1, - p_cmdbuffer + buf_index, 3); - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_extreg + idx, - boxextcontent[idx]); - } - - for (idx = 0; idx < 4; idx++) { - rtl_write_byte(rtlpriv, box_reg + idx, - boxcontent[idx]); - } - break; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, - ("switch case not process \n")); - break; - } - - bwrite_sucess = true; - - rtlhal->last_hmeboxnum = boxnum + 1; - if (rtlhal->last_hmeboxnum == 4) - rtlhal->last_hmeboxnum = 0; - - RT_TRACE(COMP_CMD, DBG_LOUD, - ("pHalData->last_hmeboxnum = %d\n", - rtlhal->last_hmeboxnum)); - } - - spin_lock_irqsave(&rtlpriv->locks.h2c_lock, flag); - rtlhal->b_h2c_setinprogress = false; - spin_unlock_irqrestore(&rtlpriv->locks.h2c_lock, flag); - - RT_TRACE(COMP_CMD, DBG_LOUD, ("go out\n")); -} - -void rtl8821ae_fill_h2c_cmd(struct ieee80211_hw *hw, - u8 element_id, u32 cmd_len, u8 *p_cmdbuffer) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 tmp_cmdbuf[2]; - - if (rtlhal->bfw_ready == false) { - RT_ASSERT(false, ("return H2C cmd because of Fw " - "download fail!!!\n")); - return; - } - - memset(tmp_cmdbuf, 0, 8); - memcpy(tmp_cmdbuf, p_cmdbuffer, cmd_len); - _rtl8821ae_fill_h2c_command(hw, element_id, cmd_len, (u8 *) & tmp_cmdbuf); - - return; -} - -void rtl8821ae_firmware_selfreset(struct ieee80211_hw *hw) -{ - u8 u1b_tmp; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - { - u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(3)))); - }else { - u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(0)))); - } - - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp & (~BIT(2)))); - udelay(50); - - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - { - u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp | BIT(3))); - }else { - u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp | BIT(0))); - } - - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp | BIT(2))); - - RT_TRACE(COMP_INIT, DBG_LOUD, (" _8051Reset8812ae(): 8051 reset success .\n")); - -} - -void rtl8821ae_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 u1_h2c_set_pwrmode[H2C_8821AE_PWEMODE_LENGTH] = { 0 }; - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - u8 rlbm,power_state = 0; - RT_TRACE(COMP_POWER, DBG_LOUD, ("FW LPS mode = %d\n", mode)); - - SET_H2CCMD_PWRMODE_PARM_MODE(u1_h2c_set_pwrmode, ((mode) ? 1 : 0)); - rlbm = 0;/*YJ,temp,120316. FW now not support RLBM=2.*/ - SET_H2CCMD_PWRMODE_PARM_RLBM(u1_h2c_set_pwrmode, rlbm); - SET_H2CCMD_PWRMODE_PARM_SMART_PS(u1_h2c_set_pwrmode, (rtlpriv->mac80211.p2p) ? ppsc->smart_ps : 1); - SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(u1_h2c_set_pwrmode, ppsc->reg_max_lps_awakeintvl); - SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(u1_h2c_set_pwrmode, 0); - if(mode == FW_PS_ACTIVE_MODE) - { - power_state |= FW_PWR_STATE_ACTIVE; - } - else - { - power_state |= FW_PWR_STATE_RF_OFF; - } - SET_H2CCMD_PWRMODE_PARM_PWR_STATE(u1_h2c_set_pwrmode, power_state); - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl92c_set_fw_pwrmode(): u1_h2c_set_pwrmode \n", - u1_h2c_set_pwrmode, H2C_8821AE_PWEMODE_LENGTH); - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_SETPWRMODE, H2C_8821AE_PWEMODE_LENGTH, u1_h2c_set_pwrmode); - -} - -void rtl8821ae_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus) -{ - u8 u1_joinbssrpt_parm[1] = { 0 }; - - SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(u1_joinbssrpt_parm, mstatus); - - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_JOINBSSRPT, 1, u1_joinbssrpt_parm); -} - -void rtl8821ae_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw, u8 ap_offload_enable) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u8 u1_apoffload_parm[H2C_8821AE_AP_OFFLOAD_LENGTH] = { 0 }; - - SET_H2CCMD_AP_OFFLOAD_ON(u1_apoffload_parm, ap_offload_enable); - SET_H2CCMD_AP_OFFLOAD_HIDDEN(u1_apoffload_parm, mac->bhiddenssid); - SET_H2CCMD_AP_OFFLOAD_DENYANY(u1_apoffload_parm, 0); - - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_AP_OFFLOAD, H2C_8821AE_AP_OFFLOAD_LENGTH, u1_apoffload_parm); - -} - -static bool _rtl8821ae_cmd_send_packet(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring; - struct rtl_tx_desc *pdesc; - u8 own; - unsigned long flags; - struct sk_buff *pskb = NULL; - - ring = &rtlpci->tx_ring[BEACON_QUEUE]; - - pskb = __skb_dequeue(&ring->queue); - if (pskb) - kfree_skb(pskb); - - spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); - - pdesc = &ring->desc[0]; - own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, true, HW_DESC_OWN); - - rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb); - - __skb_queue_tail(&ring->queue, skb); - - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - - rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE); - - return true; -} - -#define BEACON_PG 0 /* ->1 */ -#define PSPOLL_PG 2 -#define NULL_PG 3 -#define PROBERSP_PG 4 /* ->5 */ - -#define BEACON_PG_8812 0 -#define PSPOLL_PG_8812 1 -#define NULL_PG_8812 2 -#define PROBERSP_PG_8812 3 - -#define BEACON_PG_8821 0 -#define PSPOLL_PG_8821 1 -#define NULL_PG_8821 2 -#define PROBERSP_PG_8821 3 - -#define TOTAL_RESERVED_PKT_LEN_8812 2048 -#define TOTAL_RESERVED_PKT_LEN_8821 1024 - - -static u8 reserved_page_packet_8821[TOTAL_RESERVED_PKT_LEN_8821] = { - /* page 0 */ - 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x00, 0xe0, 0x4c, 0x02, 0xe2, 0x64, - 0x40, 0x16, 0x9f, 0x23, 0xd4, 0x46, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x64, 0x00, 0x20, 0x04, 0x00, 0x06, 0x64, 0x6c, - 0x69, 0x6e, 0x6b, 0x31, 0x01, 0x08, 0x82, 0x84, - 0x8b, 0x96, 0x0c, 0x18, 0x30, 0x48, 0x03, 0x01, - 0x0b, 0x06, 0x02, 0x00, 0x00, 0x2a, 0x01, 0x8b, - 0x32, 0x04, 0x12, 0x24, 0x60, 0x6c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x28, 0x8c, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* page 1 */ - 0xa4, 0x10, 0x01, 0xc0, 0x40, 0x16, 0x9f, 0x23, - 0xd4, 0x46, 0x00, 0xe0, 0x4c, 0x02, 0xe2, 0x64, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x28, 0x8c, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* page 2 */ - 0x48, 0x01, 0x00, 0x00, 0x40, 0x16, 0x9f, 0x23, - 0xd4, 0x46, 0x00, 0xe0, 0x4c, 0x02, 0xe2, 0x64, - 0x40, 0x16, 0x9f, 0x23, 0xd4, 0x46, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1a, 0x00, 0x28, 0x8c, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* page 3 */ - 0xc8, 0x01, 0x00, 0x00, 0x40, 0x16, 0x9f, 0x23, - 0xd4, 0x46, 0x00, 0xe0, 0x4c, 0x02, 0xe2, 0x64, - 0x40, 0x16, 0x9f, 0x23, 0xd4, 0x46, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - - -static u8 reserved_page_packet_8812[TOTAL_RESERVED_PKT_LEN_8812] = { - 0x80, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0x00, 0xE0, 0x4C, 0x02, 0x53, 0xE5, - 0xE0, 0x46, 0x9A, 0x57, 0x71, 0x30, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x64, 0x00, 0x30, 0x04, 0x00, 0x0C, 0x4E, 0x45, - 0x54, 0x47, 0x45, 0x41, 0x52, 0x5F, 0x31, 0x35, - 0x30, 0x4E, 0x01, 0x08, 0x82, 0x84, 0x8B, 0x96, - 0x0C, 0x12, 0x18, 0x24, 0x03, 0x01, 0x03, 0x06, - 0x02, 0x00, 0x00, 0x2A, 0x01, 0x8A, 0x32, 0x04, - 0x30, 0x48, 0x60, 0x6C, 0xDD, 0x18, 0x00, 0x50, - 0xF2, 0x01, 0x01, 0x00, 0x00, 0x50, 0xF2, 0x02, - 0x01, 0x00, 0x00, 0x50, 0xF2, 0x02, 0x01, 0x00, - 0x00, 0x50, 0xF2, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x28, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0xA4, 0x10, 0x02, 0xC0, 0xE0, 0x46, 0x9A, 0x57, - 0x71, 0x30, 0x00, 0xE0, 0x4C, 0x02, 0x53, 0xE5, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x28, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0x48, 0x01, 0x00, 0x00, 0xE0, 0x46, 0x9A, 0x57, - 0x71, 0x30, 0x00, 0xE0, 0x4C, 0x02, 0x53, 0xE5, - 0xE0, 0x46, 0x9A, 0x57, 0x71, 0x30, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1A, 0x00, 0x28, 0x8C, 0x00, 0x12, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0xC8, 0x01, 0x00, 0x00, 0xE0, 0x46, 0x9A, 0x57, - 0x71, 0x30, 0x00, 0xE0, 0x4C, 0x02, 0x53, 0xE5, - 0xE0, 0x46, 0x9A, 0x57, 0x71, 0x30, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct sk_buff *skb = NULL; - - u32 totalpacketlen; - bool rtstatus; - u8 u1RsvdPageLoc[5] = { 0 }; - bool b_dlok = false; - - u8* beacon; - u8* p_pspoll; - u8* nullfunc; - u8* p_probersp; - /*--------------------------------------------------------- - (1) beacon - ---------------------------------------------------------*/ - beacon = &reserved_page_packet_8812[BEACON_PG_8812 * 512]; - SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr); - SET_80211_HDR_ADDRESS3(beacon, mac->bssid); - - /*------------------------------------------------------- - (2) ps-poll - --------------------------------------------------------*/ - p_pspoll = &reserved_page_packet_8812[PSPOLL_PG_8812 * 512]; - SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000)); - SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid); - SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr); - - SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG_8812); - - /*-------------------------------------------------------- - (3) null data - ---------------------------------------------------------*/ - nullfunc = &reserved_page_packet_8812[NULL_PG_8812* 512]; - SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid); - SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); - SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG_8812); - - /*--------------------------------------------------------- - (4) probe response - ----------------------------------------------------------*/ - p_probersp = &reserved_page_packet_8812[PROBERSP_PG_8812 * 512]; - SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid); - SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr); - SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG_8812); - - totalpacketlen = TOTAL_RESERVED_PKT_LEN_8812; - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "rtl8821ae_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL \n", - &reserved_page_packet_8812[0], totalpacketlen); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl8821ae_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL \n", - u1RsvdPageLoc, 3); - - - skb = dev_alloc_skb(totalpacketlen); - memcpy((u8 *) skb_put(skb, totalpacketlen), - &reserved_page_packet_8812, totalpacketlen); - - rtstatus = _rtl8821ae_cmd_send_packet(hw, skb); - - if (rtstatus) - b_dlok = true; - - if (b_dlok) { - RT_TRACE(COMP_POWER, DBG_LOUD, - ("Set RSVD page location to Fw.\n")); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "H2C_RSVDPAGE:\n", - u1RsvdPageLoc, 3); - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE, - sizeof(u1RsvdPageLoc), u1RsvdPageLoc); - } else - RT_TRACE(COMP_ERR, DBG_WARNING, - ("Set RSVD page location to Fw FAIL!!!!!!.\n")); -} - -void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct sk_buff *skb = NULL; - - u32 totalpacketlen; - bool rtstatus; - u8 u1RsvdPageLoc[5] = { 0 }; - bool b_dlok = false; - - u8* beacon; - u8* p_pspoll; - u8* nullfunc; - u8* p_probersp; - /*--------------------------------------------------------- - (1) beacon - ---------------------------------------------------------*/ - beacon = &reserved_page_packet_8821[BEACON_PG_8821 * 256]; - SET_80211_HDR_ADDRESS2(beacon, mac->mac_addr); - SET_80211_HDR_ADDRESS3(beacon, mac->bssid); - - /*------------------------------------------------------- - (2) ps-poll - --------------------------------------------------------*/ - p_pspoll = &reserved_page_packet_8821[PSPOLL_PG_8821 * 256]; - SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000)); - SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid); - SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr); - - SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG_8821); - - /*-------------------------------------------------------- - (3) null data - ---------------------------------------------------------*/ - nullfunc = &reserved_page_packet_8821[NULL_PG_8821 * 256]; - SET_80211_HDR_ADDRESS1(nullfunc, mac->bssid); - SET_80211_HDR_ADDRESS2(nullfunc, mac->mac_addr); - SET_80211_HDR_ADDRESS3(nullfunc, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(u1RsvdPageLoc, NULL_PG_8821); - - /*--------------------------------------------------------- - (4) probe response - ----------------------------------------------------------*/ - p_probersp = &reserved_page_packet_8821[PROBERSP_PG_8821 * 256]; - SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid); - SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr); - SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid); - - SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG_8821); - - totalpacketlen = TOTAL_RESERVED_PKT_LEN_8821; - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "rtl8821ae_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL \n", - &reserved_page_packet_8821[0], totalpacketlen); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "rtl8821ae_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL \n", - u1RsvdPageLoc, 3); - - - skb = dev_alloc_skb(totalpacketlen); - memcpy((u8 *) skb_put(skb, totalpacketlen), - &reserved_page_packet_8821, totalpacketlen); - - rtstatus = _rtl8821ae_cmd_send_packet(hw, skb); - - if (rtstatus) - b_dlok = true; - - if (b_dlok) { - RT_TRACE(COMP_POWER, DBG_LOUD, - ("Set RSVD page location to Fw.\n")); - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, - "H2C_RSVDPAGE:\n", - u1RsvdPageLoc, 3); - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RSVDPAGE, - sizeof(u1RsvdPageLoc), u1RsvdPageLoc); - } else - RT_TRACE(COMP_ERR, DBG_WARNING, - ("Set RSVD page location to Fw FAIL!!!!!!.\n")); -} - -/*Shoud check FW support p2p or not.*/ -void rtl8821ae_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow) -{ - u8 u1_ctwindow_period[1] ={ ctwindow}; - - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_P2P_PS_CTW_CMD, 1, u1_ctwindow_period); - -} - -void rtl8821ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_p2p_ps_info *p2pinfo = &(rtlps->p2p_ps_info); - struct p2p_ps_offload_t *p2p_ps_offload = &rtlhal->p2p_ps_offload; - u8 i; - u16 ctwindow; - u32 start_time, tsf_low; - - switch(p2p_ps_state) - { - case P2P_PS_DISABLE: - RT_TRACE(COMP_FW, DBG_LOUD,("P2P_PS_DISABLE \n")); - memset(p2p_ps_offload, 0, 1); - break; - case P2P_PS_ENABLE: - RT_TRACE(COMP_FW, DBG_LOUD,("P2P_PS_ENABLE \n")); - /* update CTWindow value. */ - if( p2pinfo->ctwindow > 0 ) - { - p2p_ps_offload->CTWindow_En = 1; - ctwindow = p2pinfo->ctwindow; - rtl8821ae_set_p2p_ctw_period_cmd(hw, ctwindow); - } - - /* hw only support 2 set of NoA */ - for( i=0 ; i<p2pinfo->noa_num ; i++) - { - /* To control the register setting for which NOA*/ - rtl_write_byte(rtlpriv, 0x5cf, (i << 4)); - if(i == 0) - p2p_ps_offload->NoA0_En = 1; - else - p2p_ps_offload->NoA1_En = 1; - - /* config P2P NoA Descriptor Register */ - rtl_write_dword(rtlpriv, 0x5E0, p2pinfo->noa_duration[i]); - rtl_write_dword(rtlpriv, 0x5E4, p2pinfo->noa_interval[i]); - - /*Get Current TSF value */ - tsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - - start_time = p2pinfo->noa_start_time[i]; - if(p2pinfo->noa_count_type[i] != 1) - { - while( start_time <= (tsf_low+(50*1024) ) ) { - start_time += p2pinfo->noa_interval[i]; - if(p2pinfo->noa_count_type[i] != 255) - p2pinfo->noa_count_type[i]--; - } - } - rtl_write_dword(rtlpriv, 0x5E8, start_time); - rtl_write_dword(rtlpriv, 0x5EC, p2pinfo->noa_count_type[i] ); - - } - - if( (p2pinfo->opp_ps == 1) || (p2pinfo->noa_num > 0) ) - { - /* rst p2p circuit */ - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, BIT(4)); - - p2p_ps_offload->Offload_En = 1; - - if(P2P_ROLE_GO == rtlpriv->mac80211.p2p) - { - p2p_ps_offload->role= 1; - p2p_ps_offload->AllStaSleep = 0; - } - else - { - p2p_ps_offload->role= 0; - } - - p2p_ps_offload->discovery = 0; - } - break; - case P2P_PS_SCAN: - RT_TRACE(COMP_FW, DBG_LOUD,("P2P_PS_SCAN \n")); - p2p_ps_offload->discovery = 1; - break; - case P2P_PS_SCAN_DONE: - RT_TRACE(COMP_FW, DBG_LOUD,("P2P_PS_SCAN_DONE \n")); - p2p_ps_offload->discovery = 0; - p2pinfo->p2p_ps_state = P2P_PS_ENABLE; - break; - default: - break; - } - - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_P2P_PS_OFFLOAD, 1, (u8 *)p2p_ps_offload); - -} - -void rtl8812ae_c2h_ra_report_handler( - struct ieee80211_hw *hw, - u8 *cmd_buf, - u8 cmd_len -) -{ - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 rate = cmd_buf[0] & 0x3F; - - rtlhal->current_ra_rate= rtl8812ae_hw_rate_to_mrate(hw, rate); - - rtl8812ae_dm_update_init_rate(hw, rate); -} - - -void _rtl8812ae_c2h_content_parsing( - struct ieee80211_hw *hw, - u8 c2h_cmd_id, - u8 c2h_cmd_len, - u8 *tmp_buf -) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - switch (c2h_cmd_id) { - case C2H_8812_DBG: - RT_TRACE(COMP_FW, DBG_LOUD,("[C2H], C2H_8812_DBG!!\n")); - break; - - case C2H_8812_RA_RPT: - rtl8812ae_c2h_ra_report_handler(hw, tmp_buf, c2h_cmd_len); - break; - - default: - break; - } - -} - -void rtl8812ae_c2h_packet_handler( - struct ieee80211_hw *hw, - u8 *buffer, - u8 length - ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 c2h_cmd_id=0, c2h_cmd_seq=0, c2h_cmd_len=0; - u8 *tmp_buf=NULL; - - c2h_cmd_id = buffer[0]; - c2h_cmd_seq = buffer[1]; - c2h_cmd_len = length -2; - tmp_buf = buffer + 2; - - RT_TRACE(COMP_FW, DBG_LOUD, - ("[C2H packet], c2hCmdId=0x%x, c2hCmdSeq=0x%x, c2hCmdLen=%d\n", - c2h_cmd_id, c2h_cmd_seq, c2h_cmd_len)); - - RT_PRINT_DATA(rtlpriv, COMP_FW, DBG_LOUD, - "[C2H packet], Content Hex:\n", tmp_buf, c2h_cmd_len); - _rtl8812ae_c2h_content_parsing(hw, c2h_cmd_id, c2h_cmd_len, tmp_buf); -} - - diff --git a/drivers/staging/rtl8821ae/rtl8821ae/fw.h b/drivers/staging/rtl8821ae/rtl8821ae/fw.h deleted file mode 100644 index 30eec88..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/fw.h +++ /dev/null @@ -1,321 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE__FW__H__ -#define __RTL8821AE__FW__H__ - -#define FW_8821AE_SIZE 0x8000 -#define FW_8821AE_START_ADDRESS 0x1000 -#define FW_8821AE_END_ADDRESS 0x5FFF -#define FW_8821AE_PAGE_SIZE 4096 -#define FW_8821AE_POLLING_DELAY 5 -#define FW_8821AE_POLLING_TIMEOUT_COUNT 6000 - -#define IS_FW_HEADER_EXIST_8812(_pfwhdr) \ - ((_pfwhdr->signature&0xFFF0) == 0x9500 ) - -#define IS_FW_HEADER_EXIST_8821(_pfwhdr) \ - ((_pfwhdr->signature&0xFFF0) == 0x2100 ) - -#define USE_OLD_WOWLAN_DEBUG_FW 0 - -#define H2C_8821AE_RSVDPAGE_LOC_LEN 5 -#define H2C_8821AE_PWEMODE_LENGTH 5 -#define H2C_8821AE_JOINBSSRPT_LENGTH 1 -#define H2C_8821AE_AP_OFFLOAD_LENGTH 3 -#define H2C_8821AE_WOWLAN_LENGTH 3 -#define H2C_8821AE_KEEP_ALIVE_CTRL_LENGTH 3 -#if(USE_OLD_WOWLAN_DEBUG_FW == 0) -#define H2C_8821AE_REMOTE_WAKE_CTRL_LEN 1 -#else -#define H2C_8821AE_REMOTE_WAKE_CTRL_LEN 3 -#endif -#define H2C_8821AE_AOAC_GLOBAL_INFO_LEN 2 -#define H2C_8821AE_AOAC_RSVDPAGE_LOC_LEN 7 - - -/* Fw PS state for RPWM. -*BIT[2:0] = HW state -*BIT[3] = Protocol PS state, 1: register active state , 0: register sleep state -*BIT[4] = sub-state -*/ -#define FW_PS_GO_ON BIT(0) -#define FW_PS_TX_NULL BIT(1) -#define FW_PS_RF_ON BIT(2) -#define FW_PS_REGISTER_ACTIVE BIT(3) - -#define FW_PS_DPS BIT(0) -#define FW_PS_LCLK (FW_PS_DPS) -#define FW_PS_RF_OFF BIT(1) -#define FW_PS_ALL_ON BIT(2) -#define FW_PS_ST_ACTIVE BIT(3) -#define FW_PS_ISR_ENABLE BIT(4) -#define FW_PS_IMR_ENABLE BIT(5) - - -#define FW_PS_ACK BIT(6) -#define FW_PS_TOGGLE BIT(7) - - /* 8821AE RPWM value*/ - /* BIT[0] = 1: 32k, 0: 40M*/ -#define FW_PS_CLOCK_OFF BIT(0) /* 32k*/ -#define FW_PS_CLOCK_ON 0 /*40M*/ - -#define FW_PS_STATE_MASK (0x0F) -#define FW_PS_STATE_HW_MASK (0x07) -#define FW_PS_STATE_INT_MASK (0x3F) /*ISR_ENABLE, IMR_ENABLE, and PS mode should be inherited.*/ - -#define FW_PS_STATE(x) (FW_PS_STATE_MASK & (x)) -#define FW_PS_STATE_HW(x) (FW_PS_STATE_HW_MASK & (x)) -#define FW_PS_STATE_INT(x) (FW_PS_STATE_INT_MASK & (x)) -#define FW_PS_ISR_VAL(x) ((x) & 0x70) -#define FW_PS_IMR_MASK(x) ((x) & 0xDF) -#define FW_PS_KEEP_IMR(x) ((x) & 0x20) - - -#define FW_PS_STATE_S0 (FW_PS_DPS) -#define FW_PS_STATE_S1 (FW_PS_LCLK) -#define FW_PS_STATE_S2 (FW_PS_RF_OFF) -#define FW_PS_STATE_S3 (FW_PS_ALL_ON) -#define FW_PS_STATE_S4 ((FW_PS_ST_ACTIVE) | (FW_PS_ALL_ON)) - -#define FW_PS_STATE_ALL_ON_8821AE (FW_PS_CLOCK_ON) /* ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE))*/ -#define FW_PS_STATE_RF_ON_8821AE (FW_PS_CLOCK_ON) /* (FW_PS_RF_ON)*/ -#define FW_PS_STATE_RF_OFF_8821AE (FW_PS_CLOCK_ON) /* 0x0*/ -#define FW_PS_STATE_RF_OFF_LOW_PWR_8821AE (FW_PS_CLOCK_OFF) /* (FW_PS_STATE_RF_OFF)*/ - -#define FW_PS_STATE_ALL_ON_92C (FW_PS_STATE_S4) -#define FW_PS_STATE_RF_ON_92C (FW_PS_STATE_S3) -#define FW_PS_STATE_RF_OFF_92C (FW_PS_STATE_S2) -#define FW_PS_STATE_RF_OFF_LOW_PWR_92C (FW_PS_STATE_S1) - - -/* For 8821AE H2C PwrMode Cmd ID 5.*/ -#define FW_PWR_STATE_ACTIVE ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE)) -#define FW_PWR_STATE_RF_OFF 0 - -#define FW_PS_IS_ACK(x) ((x) & FW_PS_ACK ) -#define FW_PS_IS_CLK_ON(x) ((x) & (FW_PS_RF_OFF |FW_PS_ALL_ON )) -#define FW_PS_IS_RF_ON(x) ((x) & (FW_PS_ALL_ON)) -#define FW_PS_IS_ACTIVE(x) ((x) & (FW_PS_ST_ACTIVE)) -#define FW_PS_IS_CPWM_INT(x) ((x) & 0x40) - -#define FW_CLR_PS_STATE(x) ((x) = ((x) & (0xF0))) - -#define IS_IN_LOW_POWER_STATE_8821AE(FwPSState) \ - (FW_PS_STATE(FwPSState) == FW_PS_CLOCK_OFF) - -#define FW_PWR_STATE_ACTIVE ((FW_PS_RF_ON) | (FW_PS_REGISTER_ACTIVE)) -#define FW_PWR_STATE_RF_OFF 0 - -struct rtl8821a_firmware_header { - u16 signature; - u8 category; - u8 function; - u16 version; - u8 subversion; - u8 rsvd1; - u8 month; - u8 date; - u8 hour; - u8 minute; - u16 ramcodeSize; - u16 rsvd2; - u32 svnindex; - u32 rsvd3; - u32 rsvd4; - u32 rsvd5; -}; - -enum rtl8812_c2h_evt{ - C2H_8812_DBG = 0, - C2H_8812_LB = 1, - C2H_8812_TXBF = 2, - C2H_8812_TX_REPORT = 3, - C2H_8812_BT_INFO = 9, - C2H_8812_BT_MP = 11, - C2H_8812_RA_RPT=12, - - C2H_8812_FW_SWCHNL = 0x10, - C2H_8812_IQK_FINISH = 0x11, - MAX_8812_C2HEVENT -}; - -enum rtl8821a_h2c_cmd { - H2C_8821AE_RSVDPAGE = 0, - H2C_8821AE_JOINBSSRPT = 1, - H2C_8821AE_SCAN = 2, - H2C_8821AE_KEEP_ALIVE_CTRL = 3, - H2C_8821AE_DISCONNECT_DECISION = 4, -#if(USE_OLD_WOWLAN_DEBUG_FW == 1) - H2C_8821AE_WO_WLAN = 5, -#endif - H2C_8821AE_INIT_OFFLOAD = 6, -#if(USE_OLD_WOWLAN_DEBUG_FW == 1) - H2C_8821AE_REMOTE_WAKE_CTRL = 7, -#endif - H2C_8821AE_AP_OFFLOAD = 8, - H2C_8821AE_BCN_RSVDPAGE = 9, - H2C_8821AE_PROBERSP_RSVDPAGE = 10, - - H2C_8821AE_SETPWRMODE = 0x20, - H2C_8821AE_PS_TUNING_PARA = 0x21, - H2C_8821AE_PS_TUNING_PARA2 = 0x22, - H2C_8821AE_PS_LPS_PARA = 0x23, - H2C_8821AE_P2P_PS_OFFLOAD = 024, - -#if(USE_OLD_WOWLAN_DEBUG_FW == 0) - H2C_8821AE_WO_WLAN = 0x80, - H2C_8821AE_REMOTE_WAKE_CTRL = 0x81, - H2C_8821AE_AOAC_GLOBAL_INFO = 0x82, - H2C_8821AE_AOAC_RSVDPAGE = 0x83, -#endif - H2C_RSSI_REPORT = 0x42, - H2C_8821AE_RA_MASK = 0x40, - H2C_8821AE_SELECTIVE_SUSPEND_ROF_CMD, - H2C_8821AE_P2P_PS_MODE, - H2C_8821AE_PSD_RESULT, - /*Not defined CTW CMD for P2P yet*/ - H2C_8821AE_P2P_PS_CTW_CMD, - MAX_8821AE_H2CCMD -}; - -#define pagenum_128(_len) (u32)(((_len)>>7) + ((_len)&0x7F ? 1:0)) - -#define SET_8821AE_H2CCMD_WOWLAN_FUNC_ENABLE(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_PATTERN_MATCH_ENABLE(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_MAGIC_PKT_ENABLE(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 2, 1, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_UNICAST_PKT_ENABLE(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 3, 1, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_ALL_PKT_DROP(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 4, 1, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_GPIO_ACTIVE(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 5, 1, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_REKEY_WAKE_UP(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 6, 1, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_DISCONNECT_WAKE_UP(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 7, 1, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_GPIONUM(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) -#define SET_8821AE_H2CCMD_WOWLAN_GPIO_DURATION(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value) - - -#define SET_H2CCMD_PWRMODE_PARM_MODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_PWRMODE_PARM_RLBM(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 4, __Value) -#define SET_H2CCMD_PWRMODE_PARM_SMART_PS(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 4, 4, __Value) -#define SET_H2CCMD_PWRMODE_PARM_AWAKE_INTERVAL(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value) -#define SET_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 0, 8, __Value) -#define SET_H2CCMD_PWRMODE_PARM_PWR_STATE(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+4, 0, 8, __Value) -#define GET_8821AE_H2CCMD_PWRMODE_PARM_MODE(__pH2CCmd) \ - LE_BITS_TO_1BYTE(__pH2CCmd, 0, 8) - -#define SET_H2CCMD_JOINBSSRPT_PARM_OPMODE(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE(__ph2ccmd, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+1, 0, 8, __val) -#define SET_H2CCMD_RSVDPAGE_LOC_NULL_DATA(__ph2ccmd, __val) \ - SET_BITS_TO_LE_1BYTE((__ph2ccmd)+2, 0, 8, __val) - -/* AP_OFFLOAD */ -#define SET_H2CCMD_AP_OFFLOAD_ON(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value) -#define SET_H2CCMD_AP_OFFLOAD_HIDDEN(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) -#define SET_H2CCMD_AP_OFFLOAD_DENYANY(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value) -#define SET_H2CCMD_AP_OFFLOAD_WAKEUP_EVT_RPT(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 0, 8, __Value) - -/* Keep Alive Control*/ -#define SET_8821AE_H2CCMD_KEEP_ALIVE_ENABLE(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value) -#define SET_8821AE_H2CCMD_KEEP_ALIVE_ACCPEPT_USER_DEFINED(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value) -#define SET_8821AE_H2CCMD_KEEP_ALIVE_PERIOD(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) - -/*REMOTE_WAKE_CTRL */ -#define SET_8821AE_H2CCMD_REMOTE_WAKE_CTRL_EN(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 1, __Value) -#if(USE_OLD_WOWLAN_DEBUG_FW == 0) -#define SET_8821AE_H2CCMD_REMOTE_WAKE_CTRL_ARP_OFFLOAD_EN(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 1, 1, __Value) -#define SET_8821AE_H2CCMD_REMOTE_WAKE_CTRL_NDP_OFFLOAD_EN(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 2, 1, __Value) -#define SET_8821AE_H2CCMD_REMOTE_WAKE_CTRL_GTK_OFFLOAD_EN(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 3, 1, __Value) -#else -#define SET_8821AE_H2CCMD_REMOTE_WAKE_CTRL_PAIRWISE_ENC_ALG(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) -#define SET_8821AE_H2CCMD_REMOTE_WAKE_CTRL_GROUP_ENC_ALG(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value) -#endif - -/* GTK_OFFLOAD */ -#define SET_8821AE_H2CCMD_AOAC_GLOBAL_INFO_PAIRWISE_ENC_ALG(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE(__pH2CCmd, 0, 8, __Value) -#define SET_8821AE_H2CCMD_AOAC_GLOBAL_INFO_GROUP_ENC_ALG(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) - -/* AOAC_RSVDPAGE_LOC */ -#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_REMOTE_WAKE_CTRL_INFO(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd), 0, 8, __Value) -#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_ARP_RSP(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+1, 0, 8, __Value) -#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_NEIGHBOR_ADV(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+2, 0, 8, __Value) -#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_RSP(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+3, 0, 8, __Value) -#define SET_8821AE_H2CCMD_AOAC_RSVDPAGE_LOC_GTK_INFO(__pH2CCmd, __Value) \ - SET_BITS_TO_LE_1BYTE((__pH2CCmd)+4, 0, 8, __Value) - -int rtl8821ae_download_fw(struct ieee80211_hw *hw, - bool buse_wake_on_wlan_fw); -void rtl8821ae_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, - u32 cmd_len, u8 *p_cmdbuffer); -void rtl8821ae_firmware_selfreset(struct ieee80211_hw *hw); -void rtl8821ae_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); -void rtl8821ae_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); -void rtl8821ae_set_fw_ap_off_load_cmd(struct ieee80211_hw *hw, u8 ap_offload_enable); -void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); -void rtl8812ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); -void rtl8821ae_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); -void rtl8812ae_c2h_packet_handler(struct ieee80211_hw *hw, u8 *buffer, u8 length); -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.c b/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.c deleted file mode 100644 index 8bee772..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.c +++ /dev/null @@ -1,519 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "hal_bt_coexist.h" -#include "../pci.h" -#include "dm.h" -#include "fw.h" -#include "phy.h" -#include "reg.h" -#include "hal_btc.h" - -static bool bt_operation_on = false; - -void rtl8821ae_dm_bt_reject_ap_aggregated_packet(struct ieee80211_hw *hw, bool b_reject) -{ -#if 0 - struct rtl_priv rtlpriv = rtl_priv(hw); - PRX_TS_RECORD pRxTs = NULL; - - if(b_reject){ - // Do not allow receiving A-MPDU aggregation. - if (rtlpriv->mac80211.vendor == PEER_CISCO) { - if (pHTInfo->bAcceptAddbaReq) { - RTPRINT(FBT, BT_TRACE, ("BT_Disallow AMPDU \n")); - pHTInfo->bAcceptAddbaReq = FALSE; - if(GetTs(Adapter, (PTS_COMMON_INFO*)(&pRxTs), pMgntInfo->Bssid, 0, RX_DIR, FALSE)) - TsInitDelBA(Adapter, (PTS_COMMON_INFO)pRxTs, RX_DIR); - } - } else { - if (!pHTInfo->bAcceptAddbaReq) { - RTPRINT(FBT, BT_TRACE, ("BT_Allow AMPDU BT Idle\n")); - pHTInfo->bAcceptAddbaReq = TRUE; - } - } - } else { - if(rtlpriv->mac80211.vendor == PEER_CISCO) { - if (!pHTInfo->bAcceptAddbaReq) { - RTPRINT(FBT, BT_TRACE, ("BT_Allow AMPDU \n")); - pHTInfo->bAcceptAddbaReq = TRUE; - } - } - } -#endif -} - -void _rtl8821ae_dm_bt_check_wifi_state(struct ieee80211_hw *hw) -{ -struct rtl_priv *rtlpriv = rtl_priv(hw); -struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); -struct rtl_phy *rtlphy = &(rtlpriv->phy); - -if (rtlpriv->link_info.b_busytraffic) { - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_IDLE; - - if(rtlpriv->link_info.b_tx_busy_traffic) { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_UPLINK; - } else { - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_UPLINK; - } - - if(rtlpriv->link_info.b_rx_busy_traffic) { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_DOWNLINK; - } else { - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_DOWNLINK; - } -} else { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_IDLE; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_UPLINK; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_DOWNLINK; -} - -if (rtlpriv->mac80211.mode == WIRELESS_MODE_G - || rtlpriv->mac80211.mode == WIRELESS_MODE_B) { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_LEGACY; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_HT20; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_HT40; -} else { - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_LEGACY; - if(rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_HT40; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_HT20; - } else { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_HT20; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_HT40; - } -} - -if (bt_operation_on) { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_BT30; -} else { - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_BT30; -} -} - - -u8 rtl8821ae_dm_bt_check_coex_rssi_state1(struct ieee80211_hw *hw, - u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) - -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - long undecoratedsmoothed_pwdb = 0; - u8 bt_rssi_state = 0; - - undecoratedsmoothed_pwdb = rtl8821ae_dm_bt_get_rx_ss(hw); - - if(level_num == 2) { - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - - if( (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_LOW) || - (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_STAY_LOW)) { - if(undecoratedsmoothed_pwdb >= (rssi_thresh + BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_HIGH; - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_RSSI_1_HIGH; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_LOW; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state switch to High\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_LOW; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state stay at Low\n")); - } - } else { - if(undecoratedsmoothed_pwdb < rssi_thresh) { - bt_rssi_state = BT_RSSI_STATE_LOW; - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_RSSI_1_LOW; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_HIGH; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state switch to Low\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_HIGH; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state stay at High\n")); - } - } - } else if(level_num == 3) { - if(rssi_thresh > rssi_thresh1) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 thresh error!!\n")); - return rtlpcipriv->btcoexist.bt_pre_rssi_state; - } - - if( (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_LOW) || - (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_STAY_LOW)) { - if(undecoratedsmoothed_pwdb >= (rssi_thresh+BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_MEDIUM; - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_LOW; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_HIGH; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state switch to Medium\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_LOW; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state stay at Low\n")); - } - } else if( (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_MEDIUM) || - (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_STAY_MEDIUM)) { - if(undecoratedsmoothed_pwdb >= (rssi_thresh1 + BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_HIGH; - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_RSSI_1_HIGH; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_LOW; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state switch to High\n")); - } else if(undecoratedsmoothed_pwdb < rssi_thresh) { - bt_rssi_state = BT_RSSI_STATE_LOW; - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_RSSI_1_LOW; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_HIGH; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state switch to Low\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_MEDIUM; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state stay at Medium\n")); - } - } else { - if(undecoratedsmoothed_pwdb < rssi_thresh1) { - bt_rssi_state = BT_RSSI_STATE_MEDIUM; - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_WIFI_RSSI_1_MEDIUM; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_HIGH; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_1_LOW; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE,("[DM][BT], RSSI_1 state switch to Medium\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_HIGH; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[DM][BT], RSSI_1 state stay at High\n")); - } - } - } - - rtlpcipriv->btcoexist.bt_pre_rssi_state1 = bt_rssi_state; - - return bt_rssi_state; -} - -u8 rtl8821ae_dm_bt_check_coex_rssi_state(struct ieee80211_hw *hw, - u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - long undecoratedsmoothed_pwdb = 0; - u8 bt_rssi_state = 0; - - undecoratedsmoothed_pwdb = rtl8821ae_dm_bt_get_rx_ss(hw); - - if (level_num == 2) { - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_WIFI_RSSI_MEDIUM; - - if ((rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_LOW) || - (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_STAY_LOW)){ - if (undecoratedsmoothed_pwdb - >= (rssi_thresh + BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_HIGH; - rtlpcipriv->btcoexist.current_state - |= BT_COEX_STATE_WIFI_RSSI_HIGH; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_LOW; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state switch to High\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_LOW; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state stay at Low\n")); - } - } else { - if (undecoratedsmoothed_pwdb < rssi_thresh) { - bt_rssi_state = BT_RSSI_STATE_LOW; - rtlpcipriv->btcoexist.current_state - |= BT_COEX_STATE_WIFI_RSSI_LOW; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_HIGH; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state switch to Low\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_HIGH; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state stay at High\n")); - } - } - } - else if (level_num == 3) { - if (rssi_thresh > rssi_thresh1) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI thresh error!!\n")); - return rtlpcipriv->btcoexist.bt_pre_rssi_state; - } - if ((rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_LOW) || - (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_STAY_LOW)) { - if(undecoratedsmoothed_pwdb - >= (rssi_thresh + BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_MEDIUM; - rtlpcipriv->btcoexist.current_state - |= BT_COEX_STATE_WIFI_RSSI_MEDIUM; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_LOW; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_HIGH; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state switch to Medium\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_LOW; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state stay at Low\n")); - } - } else if ((rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_MEDIUM) || - (rtlpcipriv->btcoexist.bt_pre_rssi_state == BT_RSSI_STATE_STAY_MEDIUM)) { - if (undecoratedsmoothed_pwdb - >= (rssi_thresh1 + BT_FW_COEX_THRESH_TOL)) { - bt_rssi_state = BT_RSSI_STATE_HIGH; - rtlpcipriv->btcoexist.current_state - |= BT_COEX_STATE_WIFI_RSSI_HIGH; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_LOW; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_MEDIUM; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state switch to High\n")); - } else if(undecoratedsmoothed_pwdb < rssi_thresh) - { - bt_rssi_state = BT_RSSI_STATE_LOW; - rtlpcipriv->btcoexist.current_state - |= BT_COEX_STATE_WIFI_RSSI_LOW; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_HIGH; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_MEDIUM; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state switch to Low\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_MEDIUM; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state stay at Medium\n")); - } - } else { - if(undecoratedsmoothed_pwdb < rssi_thresh1) { - bt_rssi_state = BT_RSSI_STATE_MEDIUM; - rtlpcipriv->btcoexist.current_state - |= BT_COEX_STATE_WIFI_RSSI_MEDIUM; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_HIGH; - rtlpcipriv->btcoexist.current_state - &= ~BT_COEX_STATE_WIFI_RSSI_LOW; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state switch to Medium\n")); - } else { - bt_rssi_state = BT_RSSI_STATE_STAY_HIGH; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], RSSI state stay at High\n")); - } - } - } - - rtlpcipriv->btcoexist.bt_pre_rssi_state = bt_rssi_state; - return bt_rssi_state; -} -long rtl8821ae_dm_bt_get_rx_ss(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - long undecoratedsmoothed_pwdb = 0; - - if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) { - undecoratedsmoothed_pwdb = GET_UNDECORATED_AVERAGE_RSSI(rtlpriv); - } else { - undecoratedsmoothed_pwdb - = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; - } - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("rtl8821ae_dm_bt_get_rx_ss() = %ld\n", undecoratedsmoothed_pwdb)); - - return undecoratedsmoothed_pwdb; -} - -void rtl8821ae_dm_bt_balance(struct ieee80211_hw *hw, - bool b_balance_on, u8 ms0, u8 ms1) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[3] ={0}; - - if (b_balance_on) { - h2c_parameter[2] = 1; - h2c_parameter[1] = ms1; - h2c_parameter[0] = ms0; - rtlpcipriv->btcoexist.b_fw_coexist_all_off = false; - } else { - h2c_parameter[2] = 0; - h2c_parameter[1] = 0; - h2c_parameter[0] = 0; - } - rtlpcipriv->btcoexist.b_balance_on = b_balance_on; - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[DM][BT], Balance=[%s:%dms:%dms], write 0xc=0x%x\n", - b_balance_on?"ON":"OFF", ms0, ms1, - h2c_parameter[0]<<16 | h2c_parameter[1]<<8 | h2c_parameter[2])); - - rtl8821ae_fill_h2c_cmd(hw, 0xc, 3, h2c_parameter); -} - - -void rtl8821ae_dm_bt_agc_table(struct ieee80211_hw *hw, u8 type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - if (type == BT_AGCTABLE_OFF) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BT]AGCTable Off!\n")); - rtl_write_dword(rtlpriv, 0xc78,0x641c0001); - rtl_write_dword(rtlpriv, 0xc78,0x631d0001); - rtl_write_dword(rtlpriv, 0xc78,0x621e0001); - rtl_write_dword(rtlpriv, 0xc78,0x611f0001); - rtl_write_dword(rtlpriv, 0xc78,0x60200001); - - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x32000); - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x71000); - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0xb0000); - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0xfc000); - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_G1, 0xfffff, 0x30355); - } else if (type == BT_AGCTABLE_ON) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BT]AGCTable On!\n")); - rtl_write_dword(rtlpriv, 0xc78,0x4e1c0001); - rtl_write_dword(rtlpriv, 0xc78,0x4d1d0001); - rtl_write_dword(rtlpriv, 0xc78,0x4c1e0001); - rtl_write_dword(rtlpriv, 0xc78,0x4b1f0001); - rtl_write_dword(rtlpriv, 0xc78,0x4a200001); - - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0xdc000); - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x90000); - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x51000); - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_AGC_HP, 0xfffff, 0x12000); - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, - RF_RX_G1, 0xfffff, 0x00355); - - rtlpcipriv->btcoexist.b_sw_coexist_all_off = false; - } -} - -void rtl8821ae_dm_bt_bb_back_off_level(struct ieee80211_hw *hw, u8 type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - if (type == BT_BB_BACKOFF_OFF) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BT]BBBackOffLevel Off!\n")); - rtl_write_dword(rtlpriv, 0xc04,0x3a05611); - } else if (type == BT_BB_BACKOFF_ON) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BT]BBBackOffLevel On!\n")); - rtl_write_dword(rtlpriv, 0xc04,0x3a07611); - rtlpcipriv->btcoexist.b_sw_coexist_all_off = false; - } -} - -void rtl8821ae_dm_bt_fw_coex_all_off(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("rtl8821ae_dm_bt_fw_coex_all_off()\n")); - - if(rtlpcipriv->btcoexist.b_fw_coexist_all_off) - return; - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("rtl8821ae_dm_bt_fw_coex_all_off(), real Do\n")); - rtl8821ae_dm_bt_fw_coex_all_off_8723a(hw); - rtlpcipriv->btcoexist.b_fw_coexist_all_off = true; -} - -void rtl8821ae_dm_bt_sw_coex_all_off(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("rtl8821ae_dm_bt_sw_coex_all_off()\n")); - - if(rtlpcipriv->btcoexist.b_sw_coexist_all_off) - return; - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("rtl8821ae_dm_bt_sw_coex_all_off(), real Do\n")); - rtl8821ae_dm_bt_sw_coex_all_off_8723a(hw); - rtlpcipriv->btcoexist.b_sw_coexist_all_off = true; -} - -void rtl8821ae_dm_bt_hw_coex_all_off(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("rtl8821ae_dm_bt_hw_coex_all_off()\n")); - - if(rtlpcipriv->btcoexist.b_hw_coexist_all_off) - return; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("rtl8821ae_dm_bt_hw_coex_all_off(), real Do\n")); - - rtl8821ae_dm_bt_hw_coex_all_off_8723a(hw); - - rtlpcipriv->btcoexist.b_hw_coexist_all_off = true; -} - -void rtl8821ae_btdm_coex_all_off(struct ieee80211_hw *hw) -{ - rtl8821ae_dm_bt_fw_coex_all_off(hw); - rtl8821ae_dm_bt_sw_coex_all_off(hw); - rtl8821ae_dm_bt_hw_coex_all_off(hw); -} - -bool rtl8821ae_dm_bt_is_coexist_state_changed(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - if((rtlpcipriv->btcoexist.previous_state - == rtlpcipriv->btcoexist.current_state) - && (rtlpcipriv->btcoexist.previous_state_h - == rtlpcipriv->btcoexist.current_state_h)) - return false; - else - return true; -} - -bool rtl8821ae_dm_bt_is_wifi_up_link(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->link_info.b_tx_busy_traffic) - return true; - else - return false; -} - diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h b/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h deleted file mode 100644 index 799cc6f..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h +++ /dev/null @@ -1,169 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_HAL_BT_COEXIST_H__ -#define __RTL8821AE_HAL_BT_COEXIST_H__ - -#include "../wifi.h" - -/* The reg define is for 8723 */ -#define REG_HIGH_PRIORITY_TXRX 0x770 -#define REG_LOW_PRIORITY_TXRX 0x774 - -#define BT_FW_COEX_THRESH_TOL 6 -#define BT_FW_COEX_THRESH_20 20 -#define BT_FW_COEX_THRESH_23 23 -#define BT_FW_COEX_THRESH_25 25 -#define BT_FW_COEX_THRESH_30 30 -#define BT_FW_COEX_THRESH_35 35 -#define BT_FW_COEX_THRESH_40 40 -#define BT_FW_COEX_THRESH_45 45 -#define BT_FW_COEX_THRESH_47 47 -#define BT_FW_COEX_THRESH_50 50 -#define BT_FW_COEX_THRESH_55 55 - -#define BT_COEX_STATE_BT30 BIT(0) -#define BT_COEX_STATE_WIFI_HT20 BIT(1) -#define BT_COEX_STATE_WIFI_HT40 BIT(2) -#define BT_COEX_STATE_WIFI_LEGACY BIT(3) - -#define BT_COEX_STATE_WIFI_RSSI_LOW BIT(4) -#define BT_COEX_STATE_WIFI_RSSI_MEDIUM BIT(5) -#define BT_COEX_STATE_WIFI_RSSI_HIGH BIT(6) -#define BT_COEX_STATE_DEC_BT_POWER BIT(7) - -#define BT_COEX_STATE_WIFI_IDLE BIT(8) -#define BT_COEX_STATE_WIFI_UPLINK BIT(9) -#define BT_COEX_STATE_WIFI_DOWNLINK BIT(10) - -#define BT_COEX_STATE_BT_INQ_PAGE BIT(11) -#define BT_COEX_STATE_BT_IDLE BIT(12) -#define BT_COEX_STATE_BT_UPLINK BIT(13) -#define BT_COEX_STATE_BT_DOWNLINK BIT(14) - -#define BT_COEX_STATE_HOLD_FOR_BT_OPERATION BIT(15) -#define BT_COEX_STATE_BT_RSSI_LOW BIT(19) - -#define BT_COEX_STATE_PROFILE_HID BIT(20) -#define BT_COEX_STATE_PROFILE_A2DP BIT(21) -#define BT_COEX_STATE_PROFILE_PAN BIT(22) -#define BT_COEX_STATE_PROFILE_SCO BIT(23) - -#define BT_COEX_STATE_WIFI_RSSI_1_LOW BIT(24) -#define BT_COEX_STATE_WIFI_RSSI_1_MEDIUM BIT(25) -#define BT_COEX_STATE_WIFI_RSSI_1_HIGH BIT(26) - -#define BT_COEX_STATE_BTINFO_COMMON BIT(30) -#define BT_COEX_STATE_BTINFO_B_HID_SCOESCO BIT(31) -#define BT_COEX_STATE_BTINFO_B_FTP_A2DP BIT(29) - -#define BT_COEX_STATE_BT_CNT_LEVEL_0 BIT(0) -#define BT_COEX_STATE_BT_CNT_LEVEL_1 BIT(1) -#define BT_COEX_STATE_BT_CNT_LEVEL_2 BIT(2) -#define BT_COEX_STATE_BT_CNT_LEVEL_3 BIT(3) - -#define BT_RSSI_STATE_HIGH 0 -#define BT_RSSI_STATE_MEDIUM 1 -#define BT_RSSI_STATE_LOW 2 -#define BT_RSSI_STATE_STAY_HIGH 3 -#define BT_RSSI_STATE_STAY_MEDIUM 4 -#define BT_RSSI_STATE_STAY_LOW 5 - -#define BT_AGCTABLE_OFF 0 -#define BT_AGCTABLE_ON 1 -#define BT_BB_BACKOFF_OFF 0 -#define BT_BB_BACKOFF_ON 1 -#define BT_FW_NAV_OFF 0 -#define BT_FW_NAV_ON 1 - -#define BT_COEX_MECH_NONE 0 -#define BT_COEX_MECH_SCO 1 -#define BT_COEX_MECH_HID 2 -#define BT_COEX_MECH_A2DP 3 -#define BT_COEX_MECH_PAN 4 -#define BT_COEX_MECH_HID_A2DP 5 -#define BT_COEX_MECH_HID_PAN 6 -#define BT_COEX_MECH_PAN_A2DP 7 -#define BT_COEX_MECH_HID_SCO_ESCO 8 -#define BT_COEX_MECH_FTP_A2DP 9 -#define BT_COEX_MECH_COMMON 10 -#define BT_COEX_MECH_MAX 11 - -#define BT_DBG_PROFILE_NONE 0 -#define BT_DBG_PROFILE_SCO 1 -#define BT_DBG_PROFILE_HID 2 -#define BT_DBG_PROFILE_A2DP 3 -#define BT_DBG_PROFILE_PAN 4 -#define BT_DBG_PROFILE_HID_A2DP 5 -#define BT_DBG_PROFILE_HID_PAN 6 -#define BT_DBG_PROFILE_PAN_A2DP 7 -#define BT_DBG_PROFILE_MAX 9 - -#define BTINFO_B_FTP BIT(7) -#define BTINFO_B_A2DP BIT(6) -#define BTINFO_B_HID BIT(5) -#define BTINFO_B_SCO_BUSY BIT(4) -#define BTINFO_B_ACL_BUSY BIT(3) -#define BTINFO_B_INQ_PAGE BIT(2) -#define BTINFO_B_SCO_ESCO BIT(1) -#define BTINFO_B_CONNECTION BIT(0) - - -void rtl8821ae_btdm_coex_all_off(struct ieee80211_hw *hw); -void rtl8821ae_dm_bt_fw_coex_all_off(struct ieee80211_hw *hw); - -void rtl8821ae_dm_bt_sw_coex_all_off(struct ieee80211_hw *hw); -void rtl8821ae_dm_bt_hw_coex_all_off(struct ieee80211_hw *hw); -long rtl8821ae_dm_bt_get_rx_ss(struct ieee80211_hw *hw); -void rtl8821ae_dm_bt_balance(struct ieee80211_hw *hw, - bool b_balance_on, u8 ms0, u8 ms1); -void rtl8821ae_dm_bt_agc_table(struct ieee80211_hw *hw, u8 tyep); -void rtl8821ae_dm_bt_bb_back_off_level(struct ieee80211_hw *hw, u8 type); -u8 rtl8821ae_dm_bt_check_coex_rssi_state(struct ieee80211_hw *hw, - u8 level_num, u8 rssi_thresh, u8 rssi_thresh1); -u8 rtl8821ae_dm_bt_check_coex_rssi_state1(struct ieee80211_hw *hw, - u8 level_num, u8 rssi_thresh, u8 rssi_thresh1); -void _rtl8821ae_dm_bt_check_wifi_state(struct ieee80211_hw *hw); -void rtl8821ae_dm_bt_reject_ap_aggregated_packet(struct ieee80211_hw *hw, - bool b_reject); - -#if 0 -VOID -BTDM_PWDBMonitor( - PADAPTER Adapter - ); - -BOOLEAN -BTDM_DIGByBTRSSI( - PADAPTER Adapter - ); -#endif -bool rtl8821ae_dm_bt_is_coexist_state_changed(struct ieee80211_hw *hw); -bool rtl8821ae_dm_bt_is_wifi_up_link(struct ieee80211_hw *hw); -#endif - diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c b/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c deleted file mode 100644 index 79386ee..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c +++ /dev/null @@ -1,2069 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ -#include "hal_btc.h" -#include "../pci.h" -#include "phy.h" -#include "fw.h" -#include "reg.h" -#include "def.h" -#include "../btcoexist/rtl_btc.h" - -static struct bt_coexist_8821ae hal_coex_8821ae; - -void rtl8821ae_dm_bt_turn_off_bt_coexist_before_enter_lps(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if(!rtlpcipriv->btcoexist.bt_coexistence) - return; - - if(ppsc->b_inactiveps) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG,("[BT][DM], Before enter IPS, turn off all Coexist DM\n")); - rtlpcipriv->btcoexist.current_state = 0; - rtlpcipriv->btcoexist.previous_state = 0; - rtlpcipriv->btcoexist.current_state_h = 0; - rtlpcipriv->btcoexist.previous_state_h = 0; - rtl8821ae_btdm_coex_all_off(hw); - } -} - - -enum rt_media_status mgnt_link_status_query(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - enum rt_media_status m_status = RT_MEDIA_DISCONNECT; - - u8 bibss = (mac->opmode == NL80211_IFTYPE_ADHOC) ? 1 : 0; - - if(bibss || rtlpriv->mac80211.link_state >= MAC80211_LINKED) { - m_status = RT_MEDIA_CONNECT; - } - - return m_status; -} - -void rtl_8821ae_bt_wifi_media_status_notify(struct ieee80211_hw *hw, bool mstatus) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 h2c_parameter[3] ={0}; - u8 chnl; - - if(!rtlpcipriv->btcoexist.bt_coexistence) - return; - - if(RT_MEDIA_CONNECT == mstatus) - h2c_parameter[0] = 0x1; // 0: disconnected, 1:connected - else - h2c_parameter[0] = 0x0; - - if(mgnt_link_status_query(hw)) { - chnl = rtlphy->current_channel; - h2c_parameter[1] = chnl; - } - - if(rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40){ - h2c_parameter[2] = 0x30; - } else { - h2c_parameter[2] = 0x20; - } - - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG,("[BTCoex], FW write 0x19=0x%x\n", - h2c_parameter[0]<<16|h2c_parameter[1]<<8|h2c_parameter[2])); - - rtl8821ae_fill_h2c_cmd(hw, 0x19, 3, h2c_parameter); - -} - - -bool rtl8821ae_dm_bt_is_wifi_busy(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if(rtlpriv->link_info.b_busytraffic || - rtlpriv->link_info.b_rx_busy_traffic || - rtlpriv->link_info.b_tx_busy_traffic) - return true; - else - return false; -} -void rtl8821ae_dm_bt_set_fw_3a(struct ieee80211_hw *hw, - u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[5] ={0}; - h2c_parameter[0] = byte1; - h2c_parameter[1] = byte2; - h2c_parameter[2] = byte3; - h2c_parameter[3] = byte4; - h2c_parameter[4] = byte5; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], FW write 0x3a(4bytes)=0x%x%8x\n", - h2c_parameter[0], h2c_parameter[1]<<24 | h2c_parameter[2]<<16 | h2c_parameter[3]<<8 | h2c_parameter[4])); - rtl8821ae_fill_h2c_cmd(hw, 0x3a, 5, h2c_parameter); -} - -bool rtl8821ae_dm_bt_need_to_dec_bt_pwr(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (mgnt_link_status_query(hw) == RT_MEDIA_CONNECT) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Need to decrease bt power\n")); - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_DEC_BT_POWER; - return true; - } - - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_DEC_BT_POWER; - return false; -} - - -bool rtl8821ae_dm_bt_is_same_coexist_state(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - if ((rtlpcipriv->btcoexist.previous_state - == rtlpcipriv->btcoexist.current_state) - &&(rtlpcipriv->btcoexist.previous_state_h - == rtlpcipriv->btcoexist.current_state_h)) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[DM][BT], Coexist state do not chang!!\n")); - return true; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[DM][BT], Coexist state changed!!\n")); - return false; - } -} - -void rtl8821ae_dm_bt_set_coex_table(struct ieee80211_hw *hw, - u32 val_0x6c0, u32 val_0x6c8, u32 val_0x6cc) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("set coex table, set 0x6c0=0x%x\n", val_0x6c0)); - rtl_write_dword(rtlpriv, 0x6c0, val_0x6c0); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("set coex table, set 0x6c8=0x%x\n", val_0x6c8)); - rtl_write_dword(rtlpriv, 0x6c8, val_0x6c8); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("set coex table, set 0x6cc=0x%x\n", val_0x6cc)); - rtl_write_byte(rtlpriv, 0x6cc, val_0x6cc); -} - -void rtl8821ae_dm_bt_set_hw_pta_mode(struct ieee80211_hw *hw, bool b_mode) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (BT_PTA_MODE_ON == b_mode) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("PTA mode on, ")); - /* Enable GPIO 0/1/2/3/8 pins for bt */ - rtl_write_byte(rtlpriv, 0x40, 0x20); - rtlpcipriv->btcoexist.b_hw_coexist_all_off = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("PTA mode off\n")); - rtl_write_byte(rtlpriv, 0x40, 0x0); - } -} - -void rtl8821ae_dm_bt_set_sw_rf_rx_lpf_corner(struct ieee80211_hw *hw, u8 type) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (BT_RF_RX_LPF_CORNER_SHRINK == type) { - /* Shrink RF Rx LPF corner, 0x1e[7:4]=1111 ==> [11:4] by Jenyu */ - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Shrink RF Rx LPF corner!!\n")); - /* PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)PathA, 0x1e, 0xf0, 0xf); */ - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, 0x1e, 0xfffff, 0xf0ff7); - rtlpcipriv->btcoexist.b_sw_coexist_all_off = false; - } else if(BT_RF_RX_LPF_CORNER_RESUME == type) { - /*Resume RF Rx LPF corner*/ - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Resume RF Rx LPF corner!!\n")); - /* PHY_SetRFReg(Adapter, (RF_RADIO_PATH_E)PathA, 0x1e, 0xf0, - * pHalData->btcoexist.BtRfRegOrigin1E); */ - rtl8821ae_phy_set_rf_reg(hw, RF90_PATH_A, 0x1e, 0xfffff, - rtlpcipriv->btcoexist.bt_rfreg_origin_1e); - } -} - -void rtl8821ae_dm_bt_set_sw_penalty_tx_rate_adaptive(struct ieee80211_hw *hw, - u8 ra_type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 tmp_u1; - - tmp_u1 = rtl_read_byte(rtlpriv, 0x4fd); - tmp_u1 |= BIT(0); - if (BT_TX_RATE_ADAPTIVE_LOW_PENALTY == ra_type) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Tx rate adaptive, set low penalty!!\n")); - tmp_u1 &= ~BIT(2); - rtlpcipriv->btcoexist.b_sw_coexist_all_off = false; - } else if(BT_TX_RATE_ADAPTIVE_NORMAL == ra_type) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Tx rate adaptive, set normal!!\n")); - tmp_u1 |= BIT(2); - } - - rtl_write_byte(rtlpriv, 0x4fd, tmp_u1); -} - -void rtl8821ae_dm_bt_btdm_structure_reload(struct ieee80211_hw *hw, - struct btdm_8821ae *p_btdm) -{ - p_btdm->b_all_off = false; - p_btdm->b_agc_table_en = false; - p_btdm->b_adc_back_off_on = false; - p_btdm->b2_ant_hid_en = false; - p_btdm->b_low_penalty_rate_adaptive = false; - p_btdm->b_rf_rx_lpf_shrink = false; - p_btdm->b_reject_aggre_pkt= false; - - p_btdm->b_tdma_on = false; - p_btdm->tdma_ant = TDMA_2ANT; - p_btdm->tdma_nav = TDMA_NAV_OFF; - p_btdm->tdma_dac_swing = TDMA_DAC_SWING_OFF; - p_btdm->fw_dac_swing_lvl = 0x20; - - p_btdm->b_tra_tdma_on = false; - p_btdm->tra_tdma_ant = TDMA_2ANT; - p_btdm->tra_tdma_nav = TDMA_NAV_OFF; - p_btdm->b_ignore_wlan_act = false; - - p_btdm->b_ps_tdma_on = false; - p_btdm->ps_tdma_byte[0] = 0x0; - p_btdm->ps_tdma_byte[1] = 0x0; - p_btdm->ps_tdma_byte[2] = 0x0; - p_btdm->ps_tdma_byte[3] = 0x8; - p_btdm->ps_tdma_byte[4] = 0x0; - - p_btdm->b_pta_on = true; - p_btdm->val_0x6c0 = 0x5a5aaaaa; - p_btdm->val_0x6c8 = 0xcc; - p_btdm->val_0x6cc = 0x3; - - p_btdm->b_sw_dac_swing_on = false; - p_btdm->sw_dac_swing_lvl = 0xc0; - p_btdm->wlan_act_hi = 0x20; - p_btdm->wlan_act_lo = 0x10; - p_btdm->bt_retry_index = 2; - - p_btdm->b_dec_bt_pwr = false; -} - -void rtl8821ae_dm_bt_btdm_structure_reload_all_off(struct ieee80211_hw *hw, - struct btdm_8821ae *p_btdm) -{ - rtl8821ae_dm_bt_btdm_structure_reload(hw, p_btdm); - p_btdm->b_all_off = true; - p_btdm->b_pta_on = false; - p_btdm->wlan_act_hi = 0x10; -} - -bool rtl8821ae_dm_bt_is_2_ant_common_action(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct btdm_8821ae btdm8821ae; - bool b_common = false; - - rtl8821ae_dm_bt_btdm_structure_reload(hw, &btdm8821ae); - - if(!rtl8821ae_dm_bt_is_wifi_busy(hw) - && !rtlpcipriv->btcoexist.b_bt_busy) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("Wifi idle + Bt idle, bt coex mechanism always off!!\n")); - rtl8821ae_dm_bt_btdm_structure_reload_all_off(hw, &btdm8821ae); - b_common = true; - } else if (rtl8821ae_dm_bt_is_wifi_busy(hw) - && !rtlpcipriv->btcoexist.b_bt_busy) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("Wifi non-idle + Bt disabled/idle!!\n")); - btdm8821ae.b_low_penalty_rate_adaptive = true; - btdm8821ae.b_rf_rx_lpf_shrink = false; - btdm8821ae.b_reject_aggre_pkt = false; - - /* sw mechanism */ - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - - btdm8821ae.b_pta_on = true; - btdm8821ae.val_0x6c0 = 0x5a5aaaaa; - btdm8821ae.val_0x6c8 = 0xcccc; - btdm8821ae.val_0x6cc = 0x3; - - btdm8821ae.b_tdma_on = false; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_OFF; - btdm8821ae.b2_ant_hid_en = false; - - b_common = true; - }else if (rtlpcipriv->btcoexist.b_bt_busy) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("Bt non-idle!\n")); - if(mgnt_link_status_query(hw) == RT_MEDIA_CONNECT){ - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi connection exist\n")) - b_common = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("No Wifi connection!\n")); - btdm8821ae.b_rf_rx_lpf_shrink = true; - btdm8821ae.b_low_penalty_rate_adaptive = false; - btdm8821ae.b_reject_aggre_pkt = false; - - /* sw mechanism */ - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - - btdm8821ae.b_pta_on = true; - btdm8821ae.val_0x6c0 = 0x55555555; - btdm8821ae.val_0x6c8 = 0x0000ffff; - btdm8821ae.val_0x6cc = 0x3; - - btdm8821ae.b_tdma_on = false; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_OFF; - btdm8821ae.b2_ant_hid_en = false; - - b_common = true; - } - } - - if (rtl8821ae_dm_bt_need_to_dec_bt_pwr(hw)) { - btdm8821ae.b_dec_bt_pwr = true; - } - - if(b_common) - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_BTINFO_COMMON; - - if (b_common && rtl8821ae_dm_bt_is_coexist_state_changed(hw)) - rtl8821ae_dm_bt_set_bt_dm(hw, &btdm8821ae); - - return b_common; -} - -void rtl8821ae_dm_bt_set_sw_full_time_dac_swing( - struct ieee80211_hw * hw, bool b_sw_dac_swing_on, u32 sw_dac_swing_lvl) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (b_sw_dac_swing_on) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], SwDacSwing = 0x%x\n", sw_dac_swing_lvl)); - rtl8821ae_phy_set_bb_reg(hw, 0x880, 0xff000000, sw_dac_swing_lvl); - rtlpcipriv->btcoexist.b_sw_coexist_all_off = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], SwDacSwing Off!\n")); - rtl8821ae_phy_set_bb_reg(hw, 0x880, 0xff000000, 0xc0); - } -} - -void rtl8821ae_dm_bt_set_fw_dec_bt_pwr( - struct ieee80211_hw *hw, bool b_dec_bt_pwr) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] ={0}; - - h2c_parameter[0] = 0; - - if (b_dec_bt_pwr) { - h2c_parameter[0] |= BIT(1); - rtlpcipriv->btcoexist.b_fw_coexist_all_off = false; - } - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], decrease Bt Power : %s, write 0x21=0x%x\n", - (b_dec_bt_pwr? "Yes!!":"No!!"), h2c_parameter[0])); - - rtl8821ae_fill_h2c_cmd(hw, 0x21, 1, h2c_parameter); -} - - -void rtl8821ae_dm_bt_set_fw_2_ant_hid(struct ieee80211_hw *hw, - bool b_enable, bool b_dac_swing_on) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] ={0}; - - if (b_enable) { - h2c_parameter[0] |= BIT(0); - rtlpcipriv->btcoexist.b_fw_coexist_all_off = false; - } - if (b_dac_swing_on) { - h2c_parameter[0] |= BIT(1); /* Dac Swing default enable */ - } - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], turn 2-Ant+HID mode %s, DACSwing:%s, write 0x15=0x%x\n", - (b_enable ? "ON!!":"OFF!!"), (b_dac_swing_on ? "ON":"OFF"), - h2c_parameter[0])); - - rtl8821ae_fill_h2c_cmd(hw, 0x15, 1, h2c_parameter); -} - -void rtl8821ae_dm_bt_set_fw_tdma_ctrl(struct ieee80211_hw *hw, - bool b_enable, u8 ant_num, u8 nav_en, u8 dac_swing_en) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 h2c_parameter[1] ={0}; - u8 h2c_parameter1[1] = {0}; - - h2c_parameter[0] = 0; - h2c_parameter1[0] = 0; - - if(b_enable) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], set BT PTA update manager to trigger update!!\n")); - h2c_parameter1[0] |= BIT(0); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], turn TDMA mode ON!!\n")); - h2c_parameter[0] |= BIT(0); /* function enable */ - if (TDMA_1ANT == ant_num) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], TDMA_1ANT\n")); - h2c_parameter[0] |= BIT(1); - } else if(TDMA_2ANT == ant_num) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], TDMA_2ANT\n")); - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], Unknown Ant\n")); - } - - if (TDMA_NAV_OFF == nav_en) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], TDMA_NAV_OFF\n")); - } else if (TDMA_NAV_ON == nav_en) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], TDMA_NAV_ON\n")); - h2c_parameter[0] |= BIT(2); - } - - if (TDMA_DAC_SWING_OFF == dac_swing_en) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], TDMA_DAC_SWING_OFF\n")); - } else if(TDMA_DAC_SWING_ON == dac_swing_en) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], TDMA_DAC_SWING_ON\n")); - h2c_parameter[0] |= BIT(4); - } - rtlpcipriv->btcoexist.b_fw_coexist_all_off = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], set BT PTA update manager to no update!!\n")); - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], turn TDMA mode OFF!!\n")); - } - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], FW2AntTDMA, write 0x26=0x%x\n", h2c_parameter1[0])); - rtl8821ae_fill_h2c_cmd(hw, 0x26, 1, h2c_parameter1); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], FW2AntTDMA, write 0x14=0x%x\n", h2c_parameter[0])); - rtl8821ae_fill_h2c_cmd(hw, 0x14, 1, h2c_parameter); - - if (!b_enable) { - /* delay_ms(2); - * PlatformEFIOWrite1Byte(Adapter, 0x778, 0x1); */ - } -} - - -void rtl8821ae_dm_bt_set_fw_ignore_wlan_act( struct ieee80211_hw *hw, bool b_enable) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 h2c_parameter[1] ={0}; - - if (b_enable) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], BT Ignore Wlan_Act !!\n")); - h2c_parameter[0] |= BIT(0); // function enable - rtlpcipriv->btcoexist.b_fw_coexist_all_off = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], BT don't ignore Wlan_Act !!\n")); - } - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], set FW for BT Ignore Wlan_Act, write 0x25=0x%x\n", - h2c_parameter[0])); - - rtl8821ae_fill_h2c_cmd(hw, 0x25, 1, h2c_parameter); -} - - -void rtl8821ae_dm_bt_set_fw_tra_tdma_ctrl(struct ieee80211_hw *hw, - bool b_enable, u8 ant_num, u8 nav_en - ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - //struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - u8 h2c_parameter[2] ={0}; - - - if (b_enable) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], turn TTDMA mode ON!!\n")); - h2c_parameter[0] |= BIT(0); // function enable - if (TDMA_1ANT == ant_num) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], TTDMA_1ANT\n")); - h2c_parameter[0] |= BIT(1); - } else if (TDMA_2ANT == ant_num) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], TTDMA_2ANT\n")); - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], Unknown Ant\n")); - } - - if (TDMA_NAV_OFF == nav_en) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], TTDMA_NAV_OFF\n")); - } else if (TDMA_NAV_ON == nav_en) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], TTDMA_NAV_ON\n")); - h2c_parameter[1] |= BIT(0); - } - - rtlpcipriv->btcoexist.b_fw_coexist_all_off = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], turn TTDMA mode OFF!!\n")); - } - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], FW Traditional TDMA, write 0x33=0x%x\n", - h2c_parameter[0] << 8| h2c_parameter[1])); - - rtl8821ae_fill_h2c_cmd(hw, 0x33, 2, h2c_parameter); -} - - -void rtl8821ae_dm_bt_set_fw_dac_swing_level(struct ieee80211_hw *hw, - u8 dac_swing_lvl) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] ={0}; - h2c_parameter[0] = dac_swing_lvl; - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], Set Dac Swing Level=0x%x\n", dac_swing_lvl)); - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], write 0x29=0x%x\n", h2c_parameter[0])); - - rtl8821ae_fill_h2c_cmd(hw, 0x29, 1, h2c_parameter); -} - -void rtl8821ae_dm_bt_set_fw_bt_hid_info(struct ieee80211_hw *hw, bool b_enable) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] ={0}; - h2c_parameter[0] = 0; - - if(b_enable){ - h2c_parameter[0] |= BIT(0); - rtlpcipriv->btcoexist.b_fw_coexist_all_off = false; - } - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], Set BT HID information=0x%x\n", b_enable)); - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], write 0x24=0x%x\n", h2c_parameter[0])); - - rtl8821ae_fill_h2c_cmd(hw, 0x24, 1, h2c_parameter); -} - -void rtl8821ae_dm_bt_set_fw_bt_retry_index(struct ieee80211_hw *hw, - u8 retry_index) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] ={0}; - h2c_parameter[0] = retry_index; - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], Set BT Retry Index=%d\n", retry_index)); - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], write 0x23=0x%x\n", h2c_parameter[0])); - - rtl8821ae_fill_h2c_cmd(hw, 0x23, 1, h2c_parameter); -} - -void rtl8821ae_dm_bt_set_fw_wlan_act(struct ieee80211_hw *hw, - u8 wlan_act_hi, u8 wlan_act_lo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter_hi[1] ={0}; - u8 h2c_parameter_lo[1] ={0}; - h2c_parameter_hi[0] = wlan_act_hi; - h2c_parameter_lo[0] = wlan_act_lo; - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], Set WLAN_ACT Hi:Lo=0x%x/0x%x\n", wlan_act_hi, wlan_act_lo)); - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], write 0x22=0x%x\n", h2c_parameter_hi[0])); - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], write 0x11=0x%x\n", h2c_parameter_lo[0])); - - /* WLAN_ACT = High duration, unit:ms */ - rtl8821ae_fill_h2c_cmd(hw, 0x22, 1, h2c_parameter_hi); - /* WLAN_ACT = Low duration, unit:3*625us */ - rtl8821ae_fill_h2c_cmd(hw, 0x11, 1, h2c_parameter_lo); -} - -void rtl8821ae_dm_bt_set_bt_dm(struct ieee80211_hw *hw, struct btdm_8821ae *p_btdm) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct btdm_8821ae *p_btdm_8821ae = &hal_coex_8821ae.btdm; - u8 i; - - bool b_fw_current_inpsmode = false; - bool b_fw_ps_awake = true; - - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *) (&b_fw_current_inpsmode)); - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_FWLPS_RF_ON, - (u8 *) (&b_fw_ps_awake)); - - // check new setting is different with the old one, - // if all the same, don't do the setting again. - if (memcmp(p_btdm_8821ae, p_btdm, sizeof(struct btdm_8821ae)) == 0) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], the same coexist setting, return!!\n")); - return; - } else { //save the new coexist setting - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], UPDATE TO NEW COEX SETTING!!\n")); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new bAllOff=0x%x/ 0x%x \n", - p_btdm_8821ae->b_all_off, p_btdm->b_all_off)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new b_agc_table_en=0x%x/ 0x%x \n", - p_btdm_8821ae->b_agc_table_en, p_btdm->b_agc_table_en)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new b_adc_back_off_on=0x%x/ 0x%x \n", - p_btdm_8821ae->b_adc_back_off_on, p_btdm->b_adc_back_off_on)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new b2_ant_hid_en=0x%x/ 0x%x \n", - p_btdm_8821ae->b2_ant_hid_en, p_btdm->b2_ant_hid_en)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new bLowPenaltyRateAdaptive=0x%x/ 0x%x \n", - p_btdm_8821ae->b_low_penalty_rate_adaptive, - p_btdm->b_low_penalty_rate_adaptive)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new bRfRxLpfShrink=0x%x/ 0x%x \n", - p_btdm_8821ae->b_rf_rx_lpf_shrink, p_btdm->b_rf_rx_lpf_shrink)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new bRejectAggrePkt=0x%x/ 0x%x \n", - p_btdm_8821ae->b_reject_aggre_pkt, p_btdm->b_reject_aggre_pkt)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new b_tdma_on=0x%x/ 0x%x \n", - p_btdm_8821ae->b_tdma_on, p_btdm->b_tdma_on)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new tdmaAnt=0x%x/ 0x%x \n", - p_btdm_8821ae->tdma_ant, p_btdm->tdma_ant)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new tdmaNav=0x%x/ 0x%x \n", - p_btdm_8821ae->tdma_nav, p_btdm->tdma_nav)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new tdma_dac_swing=0x%x/ 0x%x \n", - p_btdm_8821ae->tdma_dac_swing, p_btdm->tdma_dac_swing)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new fw_dac_swing_lvl=0x%x/ 0x%x \n", - p_btdm_8821ae->fw_dac_swing_lvl, p_btdm->fw_dac_swing_lvl)); - - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new bTraTdmaOn=0x%x/ 0x%x \n", - p_btdm_8821ae->b_tra_tdma_on, p_btdm->b_tra_tdma_on)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new traTdmaAnt=0x%x/ 0x%x \n", - p_btdm_8821ae->tra_tdma_ant, p_btdm->tra_tdma_ant)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new traTdmaNav=0x%x/ 0x%x \n", - p_btdm_8821ae->tra_tdma_nav, p_btdm->tra_tdma_nav)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new bPsTdmaOn=0x%x/ 0x%x \n", - p_btdm_8821ae->b_ps_tdma_on, p_btdm->b_ps_tdma_on)); - for(i=0; i<5; i++) - { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new psTdmaByte[i]=0x%x/ 0x%x \n", - p_btdm_8821ae->ps_tdma_byte[i], p_btdm->ps_tdma_byte[i])); - } - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new bIgnoreWlanAct=0x%x/ 0x%x \n", - p_btdm_8821ae->b_ignore_wlan_act, p_btdm->b_ignore_wlan_act)); - - - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new bPtaOn=0x%x/ 0x%x \n", - p_btdm_8821ae->b_pta_on, p_btdm->b_pta_on)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new val_0x6c0=0x%x/ 0x%x \n", - p_btdm_8821ae->val_0x6c0, p_btdm->val_0x6c0)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new val_0x6c8=0x%x/ 0x%x \n", - p_btdm_8821ae->val_0x6c8, p_btdm->val_0x6c8)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new val_0x6cc=0x%x/ 0x%x \n", - p_btdm_8821ae->val_0x6cc, p_btdm->val_0x6cc)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new b_sw_dac_swing_on=0x%x/ 0x%x \n", - p_btdm_8821ae->b_sw_dac_swing_on, p_btdm->b_sw_dac_swing_on)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new sw_dac_swing_lvl=0x%x/ 0x%x \n", - p_btdm_8821ae->sw_dac_swing_lvl, p_btdm->sw_dac_swing_lvl)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new wlanActHi=0x%x/ 0x%x \n", - p_btdm_8821ae->wlan_act_hi, p_btdm->wlan_act_hi)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new wlanActLo=0x%x/ 0x%x \n", - p_btdm_8821ae->wlan_act_lo, p_btdm->wlan_act_lo)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], original/new btRetryIndex=0x%x/ 0x%x \n", - p_btdm_8821ae->bt_retry_index, p_btdm->bt_retry_index)); - - memcpy(p_btdm_8821ae, p_btdm, sizeof(struct btdm_8821ae)); - } - /* - * Here we only consider when Bt Operation - * inquiry/paging/pairing is ON - * we only need to turn off TDMA */ - - if (rtlpcipriv->btcoexist.b_hold_for_bt_operation) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], set to ignore wlanAct for BT OP!!\n")); - rtl8821ae_dm_bt_set_fw_ignore_wlan_act(hw, true); - return; - } - - if (p_btdm->b_all_off) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex], disable all coexist mechanism !!\n")); - rtl8821ae_btdm_coex_all_off(hw); - return; - } - - rtl8821ae_dm_bt_reject_ap_aggregated_packet(hw, p_btdm->b_reject_aggre_pkt); - - if(p_btdm->b_low_penalty_rate_adaptive) - rtl8821ae_dm_bt_set_sw_penalty_tx_rate_adaptive(hw, - BT_TX_RATE_ADAPTIVE_LOW_PENALTY); - else - rtl8821ae_dm_bt_set_sw_penalty_tx_rate_adaptive(hw, - BT_TX_RATE_ADAPTIVE_NORMAL); - - if(p_btdm->b_rf_rx_lpf_shrink) - rtl8821ae_dm_bt_set_sw_rf_rx_lpf_corner(hw, BT_RF_RX_LPF_CORNER_SHRINK); - else - rtl8821ae_dm_bt_set_sw_rf_rx_lpf_corner(hw, BT_RF_RX_LPF_CORNER_RESUME); - - if(p_btdm->b_agc_table_en) - rtl8821ae_dm_bt_agc_table(hw, BT_AGCTABLE_ON); - else - rtl8821ae_dm_bt_agc_table(hw, BT_AGCTABLE_OFF); - - if(p_btdm->b_adc_back_off_on) - rtl8821ae_dm_bt_bb_back_off_level(hw, BT_BB_BACKOFF_ON); - else - rtl8821ae_dm_bt_bb_back_off_level(hw, BT_BB_BACKOFF_OFF); - - rtl8821ae_dm_bt_set_fw_bt_retry_index(hw, p_btdm->bt_retry_index); - - rtl8821ae_dm_bt_set_fw_dac_swing_level(hw, p_btdm->fw_dac_swing_lvl); - rtl8821ae_dm_bt_set_fw_wlan_act(hw, p_btdm->wlan_act_hi, p_btdm->wlan_act_lo); - - rtl8821ae_dm_bt_set_coex_table(hw, p_btdm->val_0x6c0, - p_btdm->val_0x6c8, p_btdm->val_0x6cc); - rtl8821ae_dm_bt_set_hw_pta_mode(hw, p_btdm->b_pta_on); - - /* - * Note: There is a constraint between TDMA and 2AntHID - * Only one of 2AntHid and tdma can be turn on - * We should turn off those mechanisms should be turned off first - * and then turn on those mechanisms should be turned on. - */ -#if 1 - if(p_btdm->b2_ant_hid_en) { - // turn off tdma - rtl8821ae_dm_bt_set_fw_tra_tdma_ctrl(hw, p_btdm->b_tra_tdma_on, - p_btdm->tra_tdma_ant, p_btdm->tra_tdma_nav); - rtl8821ae_dm_bt_set_fw_tdma_ctrl(hw, false, p_btdm->tdma_ant, - p_btdm->tdma_nav, p_btdm->tdma_dac_swing); - - // turn off Pstdma - rtl8821ae_dm_bt_set_fw_ignore_wlan_act(hw, p_btdm->b_ignore_wlan_act); - rtl8821ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); // Antenna control by PTA, 0x870 = 0x300. - - // turn on 2AntHid - rtl8821ae_dm_bt_set_fw_bt_hid_info(hw, true); - rtl8821ae_dm_bt_set_fw_2_ant_hid(hw, true, true); - } else if(p_btdm->b_tdma_on) { - // turn off 2AntHid - rtl8821ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8821ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - - // turn off pstdma - rtl8821ae_dm_bt_set_fw_ignore_wlan_act(hw, p_btdm->b_ignore_wlan_act); - rtl8821ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); // Antenna control by PTA, 0x870 = 0x300. - - // turn on tdma - rtl8821ae_dm_bt_set_fw_tra_tdma_ctrl(hw, p_btdm->b_tra_tdma_on, p_btdm->tra_tdma_ant, p_btdm->tra_tdma_nav); - rtl8821ae_dm_bt_set_fw_tdma_ctrl(hw, true, p_btdm->tdma_ant, p_btdm->tdma_nav, p_btdm->tdma_dac_swing); - } else if(p_btdm->b_ps_tdma_on) { - // turn off 2AntHid - rtl8821ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8821ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - - // turn off tdma - rtl8821ae_dm_bt_set_fw_tra_tdma_ctrl(hw, p_btdm->b_tra_tdma_on, p_btdm->tra_tdma_ant, p_btdm->tra_tdma_nav); - rtl8821ae_dm_bt_set_fw_tdma_ctrl(hw, false, p_btdm->tdma_ant, p_btdm->tdma_nav, p_btdm->tdma_dac_swing); - - // turn on pstdma - rtl8821ae_dm_bt_set_fw_ignore_wlan_act(hw, p_btdm->b_ignore_wlan_act); - rtl8821ae_dm_bt_set_fw_3a(hw, - p_btdm->ps_tdma_byte[0], - p_btdm->ps_tdma_byte[1], - p_btdm->ps_tdma_byte[2], - p_btdm->ps_tdma_byte[3], - p_btdm->ps_tdma_byte[4]); - } else { - // turn off 2AntHid - rtl8821ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8821ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - - // turn off tdma - rtl8821ae_dm_bt_set_fw_tra_tdma_ctrl(hw, p_btdm->b_tra_tdma_on, p_btdm->tra_tdma_ant, p_btdm->tra_tdma_nav); - rtl8821ae_dm_bt_set_fw_tdma_ctrl(hw, false, p_btdm->tdma_ant, p_btdm->tdma_nav, p_btdm->tdma_dac_swing); - - // turn off pstdma - rtl8821ae_dm_bt_set_fw_ignore_wlan_act(hw, p_btdm->b_ignore_wlan_act); - rtl8821ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); // Antenna control by PTA, 0x870 = 0x300. - } -#else - if (p_btdm->b_tdma_on) { - if(p_btdm->b_ps_tdma_on) { - } else { - rtl8821ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); - } - /* Turn off 2AntHID first then turn tdma ON */ - rtl8821ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8821ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - rtl8821ae_dm_bt_set_fw_tra_tdma_ctrl(hw, p_btdm->b_tra_tdma_on, p_btdm->tra_tdma_ant, p_btdm->tra_tdma_nav); - rtl8821ae_dm_bt_set_fw_tdma_ctrl(hw, true, - p_btdm->tdma_ant, p_btdm->tdma_nav, p_btdm->tdma_dac_swing); - } else { - /* Turn off tdma first then turn 2AntHID ON if need */ - rtl8821ae_dm_bt_set_fw_tra_tdma_ctrl(hw, p_btdm->b_tra_tdma_on, p_btdm->tra_tdma_ant, p_btdm->tra_tdma_nav); - rtl8821ae_dm_bt_set_fw_tdma_ctrl(hw, false, p_btdm->tdma_ant, - p_btdm->tdma_nav, p_btdm->tdma_dac_swing); - if (p_btdm->b2_ant_hid_en) { - rtl8821ae_dm_bt_set_fw_bt_hid_info(hw, true); - rtl8821ae_dm_bt_set_fw_2_ant_hid(hw, true, true); - } else { - rtl8821ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8821ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - } - if(p_btdm->b_ps_tdma_on) { - rtl8821ae_dm_bt_set_fw_3a(hw, p_btdm->ps_tdma_byte[0], p_btdm->ps_tdma_byte[1], - p_btdm->ps_tdma_byte[2], p_btdm->ps_tdma_byte[3], p_btdm->ps_tdma_byte[4]); - } else { - rtl8821ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); - } - } -#endif - - /* - * Note: - * We should add delay for making sure sw DacSwing can be set sucessfully. - * because of that rtl8821ae_dm_bt_set_fw_2_ant_hid() and rtl8821ae_dm_bt_set_fw_tdma_ctrl() - * will overwrite the reg 0x880. - */ - mdelay(30); - rtl8821ae_dm_bt_set_sw_full_time_dac_swing(hw, - p_btdm->b_sw_dac_swing_on, p_btdm->sw_dac_swing_lvl); - rtl8821ae_dm_bt_set_fw_dec_bt_pwr(hw, p_btdm->b_dec_bt_pwr); -} - -void rtl8821ae_dm_bt_bt_state_update_2_ant_hid(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], HID busy!!\n")); - rtlpcipriv->btcoexist.b_bt_busy = true; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_BT_IDLE; -} - -void rtl8821ae_dm_bt_bt_state_update_2_ant_pan(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - bool b_idle = false; - - if (hal_coex_8821ae.low_priority_tx >= - hal_coex_8821ae.low_priority_rx) { - if((hal_coex_8821ae.low_priority_tx/ - hal_coex_8821ae.low_priority_rx) > 10) { - b_idle = true; - } - } else { - if((hal_coex_8821ae.low_priority_rx/ - hal_coex_8821ae.low_priority_tx) > 10) { - b_idle = true; - } - } - - if(!b_idle) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], PAN busy!!\n")); - rtlpcipriv->btcoexist.b_bt_busy = true; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_BT_IDLE; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], PAN idle!!\n")); - } -} - -void rtl8821ae_dm_bt_2_ant_sco_action(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct btdm_8821ae btdm8821ae; - u8 bt_rssi_state; - - rtl8821ae_dm_bt_btdm_structure_reload(hw, &btdm8821ae); - btdm8821ae.b_rf_rx_lpf_shrink = true; - btdm8821ae.b_low_penalty_rate_adaptive = true; - btdm8821ae.b_reject_aggre_pkt = false; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("HT40\n")); - /* coex table */ - btdm8821ae.val_0x6c0 = 0x5a5aaaaa; - btdm8821ae.val_0x6c8 = 0xcc; - btdm8821ae.val_0x6cc = 0x3; - /* sw mechanism */ - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - /* fw mechanism */ - btdm8821ae.b_tdma_on = false; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_OFF; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("HT20 or Legacy\n")); - bt_rssi_state - = rtl8821ae_dm_bt_check_coex_rssi_state(hw, 2, BT_FW_COEX_THRESH_47, 0); - - /* coex table */ - btdm8821ae.val_0x6c0 = 0x5a5aaaaa; - btdm8821ae.val_0x6c8 = 0xcc; - btdm8821ae.val_0x6cc = 0x3; - /* sw mechanism */ - if ((bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH) ) { - btdm8821ae.b_agc_table_en = true; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - } else { - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - } - /* fw mechanism */ - btdm8821ae.b_tdma_on = false; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_OFF; - } - - if (rtl8821ae_dm_bt_need_to_dec_bt_pwr(hw)) { - btdm8821ae.b_dec_bt_pwr = true; - } - - if(rtl8821ae_dm_bt_is_coexist_state_changed(hw)) - rtl8821ae_dm_bt_set_bt_dm(hw, &btdm8821ae); -} - -void rtl8821ae_dm_bt_2_ant_hid_action(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct btdm_8821ae btdm8821ae; - u8 bt_rssi_state; - - rtl8821ae_dm_bt_btdm_structure_reload(hw, &btdm8821ae); - - btdm8821ae.b_rf_rx_lpf_shrink = true; - btdm8821ae.b_low_penalty_rate_adaptive = true; - btdm8821ae.b_reject_aggre_pkt = false; - - // coex table - btdm8821ae.val_0x6c0 = 0x55555555; - btdm8821ae.val_0x6c8 = 0xffff; - btdm8821ae.val_0x6cc = 0x3; - btdm8821ae.b_ignore_wlan_act = true; - - if(rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("HT40\n")); - // sw mechanism - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - - // fw mechanism - btdm8821ae.b_ps_tdma_on = true; - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xf; - btdm8821ae.ps_tdma_byte[2] = 0xf; - btdm8821ae.ps_tdma_byte[3] = 0x0; - btdm8821ae.ps_tdma_byte[4] = 0x80; - - btdm8821ae.b_tra_tdma_on = false; - btdm8821ae.b_tdma_on = false; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_OFF; - btdm8821ae.b2_ant_hid_en = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("HT20 or Legacy\n")); - bt_rssi_state = - rtl8821ae_dm_bt_check_coex_rssi_state(hw, 2, 47, 0); - - if( (bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH) ) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi high \n")); - // sw mechanism - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = true; - btdm8821ae.sw_dac_swing_lvl = 0x20; - - // fw mechanism - btdm8821ae.b_ps_tdma_on = false; - btdm8821ae.b_tdma_on = false; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_OFF; - btdm8821ae.b2_ant_hid_en = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi low \n")); - // sw mechanism - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - - // fw mechanism - btdm8821ae.b_ps_tdma_on = false; - btdm8821ae.b_tdma_on = false; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_OFF; - btdm8821ae.b2_ant_hid_en = true; - btdm8821ae.fw_dac_swing_lvl = 0x20; - } - } - - if (rtl8821ae_dm_bt_need_to_dec_bt_pwr(hw)) { - btdm8821ae.b_dec_bt_pwr = true; - } - - if (rtl8821ae_dm_bt_is_coexist_state_changed(hw)) { - rtl8821ae_dm_bt_set_bt_dm(hw, &btdm8821ae); - } -} - - -void rtl8821ae_dm_bt_2_ant_2_dp_action_no_profile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct btdm_8821ae btdm8821ae; - u8 bt_rssi_state; - - rtl8821ae_dm_bt_btdm_structure_reload(hw, &btdm8821ae); - - btdm8821ae.b_rf_rx_lpf_shrink = true; - btdm8821ae.b_low_penalty_rate_adaptive = true; - btdm8821ae.b_reject_aggre_pkt = false; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("HT40\n")); - if (rtl8821ae_dm_bt_is_wifi_up_link(hw)) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Wifi Uplink\n")); - /* coex table */ - btdm8821ae.val_0x6c0 = 0x5a5a5a5a; - btdm8821ae.val_0x6c8 = 0xcccc; - btdm8821ae.val_0x6cc = 0x3; - // sw mechanism - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - // fw mechanism - btdm8821ae.b_tra_tdma_on = true; - btdm8821ae.b_tdma_on = true; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_ON; - btdm8821ae.b2_ant_hid_en = false; - //btSpec = BTHCI_GetBTCoreSpecByProf(Adapter, BT_PROFILE_A2DP); - //if(btSpec >= BT_SPEC_2_1_EDR) - { - btdm8821ae.wlan_act_hi = 0x10; - btdm8821ae.wlan_act_lo = 0x10; - } - //else - //{ - //btdm8821ae.wlanActHi = 0x20; - //btdm8821ae.wlanActLo = 0x20; - //} - btdm8821ae.bt_retry_index = 2; - btdm8821ae.fw_dac_swing_lvl = 0x18; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Wifi Downlink\n")); - // coex table - btdm8821ae.val_0x6c0 = 0x5a5a5a5a; - btdm8821ae.val_0x6c8 = 0xcc; - btdm8821ae.val_0x6cc = 0x3; - // sw mechanism - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - // fw mechanism - btdm8821ae.b_tra_tdma_on = true; - btdm8821ae.b_tdma_on = true; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_ON; - btdm8821ae.b2_ant_hid_en = false; - //btSpec = BTHCI_GetBTCoreSpecByProf(Adapter, BT_PROFILE_A2DP); - //if(btSpec >= BT_SPEC_2_1_EDR) - { - btdm8821ae.wlan_act_hi = 0x10; - btdm8821ae.wlan_act_lo = 0x10; - } - //else - //{ - // btdm8821ae.wlanActHi = 0x20; - // btdm8821ae.wlanActLo = 0x20; - //} - btdm8821ae.bt_retry_index = 2; - btdm8821ae.fw_dac_swing_lvl = 0x40; - } - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("HT20 or Legacy\n")); - bt_rssi_state = rtl8821ae_dm_bt_check_coex_rssi_state(hw, 2, BT_FW_COEX_THRESH_47, 0); - - if(rtl8821ae_dm_bt_is_wifi_up_link(hw)) - { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Wifi Uplink\n")); - // coex table - btdm8821ae.val_0x6c0 = 0x5a5a5a5a; - btdm8821ae.val_0x6c8 = 0xcccc; - btdm8821ae.val_0x6cc = 0x3; - // sw mechanism - if( (bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH) ) - { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Wifi rssi high \n")); - btdm8821ae.b_agc_table_en = true; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Wifi rssi low \n")); - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - } - // fw mechanism - btdm8821ae.b_tra_tdma_on = true; - btdm8821ae.b_tdma_on = true; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_ON; - btdm8821ae.b2_ant_hid_en = false; - //btSpec = BTHCI_GetBTCoreSpecByProf(Adapter, BT_PROFILE_A2DP); - //if(btSpec >= BT_SPEC_2_1_EDR) - { - btdm8821ae.wlan_act_hi = 0x10; - btdm8821ae.wlan_act_lo = 0x10; - } - //else - //{ - //btdm8821ae.wlanActHi = 0x20; - //btdm8821ae.wlanActLo = 0x20; - //} - btdm8821ae.bt_retry_index = 2; - btdm8821ae.fw_dac_swing_lvl = 0x18; - } - else - { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Wifi Downlink\n")); - // coex table - btdm8821ae.val_0x6c0 = 0x5a5a5a5a; - btdm8821ae.val_0x6c8 = 0xcc; - btdm8821ae.val_0x6cc = 0x3; - // sw mechanism - if( (bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH) ) - { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Wifi rssi high \n")); - btdm8821ae.b_agc_table_en = true; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - } - else - { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("Wifi rssi low \n")); - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - } - // fw mechanism - btdm8821ae.b_tra_tdma_on = true; - btdm8821ae.b_tdma_on = true; - btdm8821ae.tdma_dac_swing = TDMA_DAC_SWING_ON; - btdm8821ae.b2_ant_hid_en = false; - //btSpec = BTHCI_GetBTCoreSpecByProf(Adapter, BT_PROFILE_A2DP); - //if(btSpec >= BT_SPEC_2_1_EDR) - { - btdm8821ae.wlan_act_hi = 0x10; - btdm8821ae.wlan_act_lo = 0x10; - } - //else - //{ - //btdm8821ae.wlanActHi = 0x20; - //btdm8821ae.wlanActLo = 0x20; - //} - btdm8821ae.bt_retry_index = 2; - btdm8821ae.fw_dac_swing_lvl = 0x40; - } - } - - if (rtl8821ae_dm_bt_need_to_dec_bt_pwr(hw)) { - btdm8821ae.b_dec_bt_pwr = true; - } - - if (rtl8821ae_dm_bt_is_coexist_state_changed(hw)) { - rtl8821ae_dm_bt_set_bt_dm(hw, &btdm8821ae); - } -} - - -//============================================================ -// extern function start with BTDM_ -//============================================================ -u32 rtl8821ae_dm_bt_tx_rx_couter_h(struct ieee80211_hw *hw) -{ - u32 counters=0; - - counters = hal_coex_8821ae.high_priority_tx + hal_coex_8821ae.high_priority_rx ; - return counters; -} - -u32 rtl8821ae_dm_bt_tx_rx_couter_l(struct ieee80211_hw *hw) -{ - u32 counters=0; - - counters = hal_coex_8821ae.low_priority_tx + hal_coex_8821ae.low_priority_rx ; - return counters; -} - -u8 rtl8821ae_dm_bt_bt_tx_rx_counter_level(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u32 bt_tx_rx_cnt = 0; - u8 bt_tx_rx_cnt_lvl = 0; - - bt_tx_rx_cnt = rtl8821ae_dm_bt_tx_rx_couter_h(hw) - + rtl8821ae_dm_bt_tx_rx_couter_l(hw); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT TxRx Counters = %d\n", bt_tx_rx_cnt)); - - rtlpcipriv->btcoexist.current_state_h &= ~\ - (BT_COEX_STATE_BT_CNT_LEVEL_0 | BT_COEX_STATE_BT_CNT_LEVEL_1| - BT_COEX_STATE_BT_CNT_LEVEL_2); - - if (bt_tx_rx_cnt >= BT_TXRX_CNT_THRES_3) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT TxRx Counters at level 3\n")); - bt_tx_rx_cnt_lvl = BT_TXRX_CNT_LEVEL_3; - rtlpcipriv->btcoexist.current_state_h |= BT_COEX_STATE_BT_CNT_LEVEL_3; - } else if(bt_tx_rx_cnt >= BT_TXRX_CNT_THRES_2) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT TxRx Counters at level 2\n")); - bt_tx_rx_cnt_lvl = BT_TXRX_CNT_LEVEL_2; - rtlpcipriv->btcoexist.current_state_h |= BT_COEX_STATE_BT_CNT_LEVEL_2; - } else if(bt_tx_rx_cnt >= BT_TXRX_CNT_THRES_1) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT TxRx Counters at level 1\n")); - bt_tx_rx_cnt_lvl = BT_TXRX_CNT_LEVEL_1; - rtlpcipriv->btcoexist.current_state_h |= BT_COEX_STATE_BT_CNT_LEVEL_1; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT TxRx Counters at level 0\n")); - bt_tx_rx_cnt_lvl = BT_TXRX_CNT_LEVEL_0; - rtlpcipriv->btcoexist.current_state_h |= BT_COEX_STATE_BT_CNT_LEVEL_0; - } - return bt_tx_rx_cnt_lvl; -} - - -void rtl8821ae_dm_bt_2_ant_hid_sco_esco(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct btdm_8821ae btdm8821ae; - - u8 bt_rssi_state, bt_rssi_state1; - u8 bt_tx_rx_cnt_lvl = 0; - - rtl8821ae_dm_bt_btdm_structure_reload(hw, &btdm8821ae); - - - btdm8821ae.b_rf_rx_lpf_shrink = true; - btdm8821ae.b_low_penalty_rate_adaptive = true; - btdm8821ae.b_reject_aggre_pkt = false; - - bt_tx_rx_cnt_lvl = rtl8821ae_dm_bt_bt_tx_rx_counter_level(hw); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters = %d\n", bt_tx_rx_cnt_lvl)); - - if(rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) - { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("HT40\n")); - // coex table - btdm8821ae.val_0x6c0 = 0x55555555; - btdm8821ae.val_0x6c8 = 0xffff; - btdm8821ae.val_0x6cc = 0x3; - - // sw mechanism - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - - // fw mechanism - btdm8821ae.b_ps_tdma_on = true; - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x2; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1200 && < 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xa; - btdm8821ae.ps_tdma_byte[2] = 0xa; - btdm8821ae.ps_tdma_byte[3] = 0x2; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters < 1200\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xf; - btdm8821ae.ps_tdma_byte[2] = 0xf; - btdm8821ae.ps_tdma_byte[3] = 0x2; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("HT20 or Legacy\n")); - bt_rssi_state = rtl8821ae_dm_bt_check_coex_rssi_state(hw, 2, 47, 0); - bt_rssi_state1 = rtl8821ae_dm_bt_check_coex_rssi_state1(hw, 2, 27, 0); - - // coex table - btdm8821ae.val_0x6c0 = 0x55555555; - btdm8821ae.val_0x6c8 = 0xffff; - btdm8821ae.val_0x6cc = 0x3; - - // sw mechanism - if( (bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH) ) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi high \n")); - btdm8821ae.b_agc_table_en = true; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi low \n")); - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - } - - // fw mechanism - btdm8821ae.b_ps_tdma_on = true; - if( (bt_rssi_state1 == BT_RSSI_STATE_HIGH) || - (bt_rssi_state1 == BT_RSSI_STATE_STAY_HIGH) ) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG,("Wifi rssi-1 high \n")); - // only rssi high we need to do this, - // when rssi low, the value will modified by fw - rtl_write_byte(rtlpriv, 0x883, 0x40); - if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x83; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1200 && < 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xa; - btdm8821ae.ps_tdma_byte[2] = 0xa; - btdm8821ae.ps_tdma_byte[3] = 0x83; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters < 1200\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xf; - btdm8821ae.ps_tdma_byte[2] = 0xf; - btdm8821ae.ps_tdma_byte[3] = 0x83; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi-1 low \n")); - if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) - { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x2; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1200 && < 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xa; - btdm8821ae.ps_tdma_byte[2] = 0xa; - btdm8821ae.ps_tdma_byte[3] = 0x2; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters < 1200\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xf; - btdm8821ae.ps_tdma_byte[2] = 0xf; - btdm8821ae.ps_tdma_byte[3] = 0x2; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - } - } - - if (rtl8821ae_dm_bt_need_to_dec_bt_pwr(hw)) { - btdm8821ae.b_dec_bt_pwr = true; - } - - // Always ignore WlanAct if bHid|bSCOBusy|bSCOeSCO - - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT btInqPageStartTime = 0x%x, btTxRxCntLvl = %d\n", - hal_coex_8821ae.bt_inq_page_start_time, bt_tx_rx_cnt_lvl)); - if( (hal_coex_8821ae.bt_inq_page_start_time) || - (BT_TXRX_CNT_LEVEL_3 == bt_tx_rx_cnt_lvl) ) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], Set BT inquiry / page scan 0x3a setting\n")); - btdm8821ae.b_ps_tdma_on = true; - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x2; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - - if(rtl8821ae_dm_bt_is_coexist_state_changed(hw)) { - rtl8821ae_dm_bt_set_bt_dm(hw, &btdm8821ae); - } -} - -void rtl8821ae_dm_bt_2_ant_ftp_a2dp(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct btdm_8821ae btdm8821ae; - - u8 bt_rssi_state, bt_rssi_state1; - u32 bt_tx_rx_cnt_lvl = 0; - - rtl8821ae_dm_bt_btdm_structure_reload(hw, &btdm8821ae); - - btdm8821ae.b_rf_rx_lpf_shrink = true; - btdm8821ae.b_low_penalty_rate_adaptive = true; - btdm8821ae.b_reject_aggre_pkt = false; - - bt_tx_rx_cnt_lvl = rtl8821ae_dm_bt_bt_tx_rx_counter_level(hw); - - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters = %d\n", bt_tx_rx_cnt_lvl)); - - if(rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) - { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("HT40\n")); - bt_rssi_state = rtl8821ae_dm_bt_check_coex_rssi_state(hw, 2, 37, 0); - - // coex table - btdm8821ae.val_0x6c0 = 0x55555555; - btdm8821ae.val_0x6c8 = 0xffff; - btdm8821ae.val_0x6cc = 0x3; - - // sw mechanism - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - - // fw mechanism - btdm8821ae.b_ps_tdma_on = true; - if ((bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH) ) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi high \n")); - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x81; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1200 && < 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xa; - btdm8821ae.ps_tdma_byte[2] = 0xa; - btdm8821ae.ps_tdma_byte[3] = 0x81; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters < 1200\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xf; - btdm8821ae.ps_tdma_byte[2] = 0xf; - btdm8821ae.ps_tdma_byte[3] = 0x81; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi low \n")); - if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x0; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1200 && < 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xa; - btdm8821ae.ps_tdma_byte[2] = 0xa; - btdm8821ae.ps_tdma_byte[3] = 0x0; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters < 1200\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xf; - btdm8821ae.ps_tdma_byte[2] = 0xf; - btdm8821ae.ps_tdma_byte[3] = 0x0; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - } - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("HT20 or Legacy\n")); - bt_rssi_state = rtl8821ae_dm_bt_check_coex_rssi_state(hw, 2, 47, 0); - bt_rssi_state1 = rtl8821ae_dm_bt_check_coex_rssi_state1(hw, 2, 27, 0); - - // coex table - btdm8821ae.val_0x6c0 = 0x55555555; - btdm8821ae.val_0x6c8 = 0xffff; - btdm8821ae.val_0x6cc = 0x3; - - // sw mechanism - if( (bt_rssi_state == BT_RSSI_STATE_HIGH) || - (bt_rssi_state == BT_RSSI_STATE_STAY_HIGH) ) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi high \n")); - btdm8821ae.b_agc_table_en = true; - btdm8821ae.b_adc_back_off_on = true; - btdm8821ae.b_sw_dac_swing_on = false; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi low \n")); - btdm8821ae.b_agc_table_en = false; - btdm8821ae.b_adc_back_off_on = false; - btdm8821ae.b_sw_dac_swing_on = false; - } - - // fw mechanism - btdm8821ae.b_ps_tdma_on = true; - if( (bt_rssi_state1 == BT_RSSI_STATE_HIGH) || - (bt_rssi_state1 == BT_RSSI_STATE_STAY_HIGH) ) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi-1 high \n")); - // only rssi high we need to do this, - // when rssi low, the value will modified by fw - rtl_write_byte(rtlpriv, 0x883, 0x40); - if (bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x81; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1200 && < 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xa; - btdm8821ae.ps_tdma_byte[2] = 0xa; - btdm8821ae.ps_tdma_byte[3] = 0x81; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters < 1200\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xf; - btdm8821ae.ps_tdma_byte[2] = 0xf; - btdm8821ae.ps_tdma_byte[3] = 0x81; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Wifi rssi-1 low \n")); - if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_2) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x0; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else if(bt_tx_rx_cnt_lvl == BT_TXRX_CNT_LEVEL_1) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters >= 1200 && < 1400\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xa; - btdm8821ae.ps_tdma_byte[2] = 0xa; - btdm8821ae.ps_tdma_byte[3] = 0x0; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT TxRx Counters < 1200\n")); - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0xf; - btdm8821ae.ps_tdma_byte[2] = 0xf; - btdm8821ae.ps_tdma_byte[3] = 0x0; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - } - } - - if(rtl8821ae_dm_bt_need_to_dec_bt_pwr(hw)) { - btdm8821ae.b_dec_bt_pwr = true; - } - - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT btInqPageStartTime = 0x%x, btTxRxCntLvl = %d\n", - hal_coex_8821ae.bt_inq_page_start_time, bt_tx_rx_cnt_lvl)); - - if( (hal_coex_8821ae.bt_inq_page_start_time) || - (BT_TXRX_CNT_LEVEL_3 == bt_tx_rx_cnt_lvl) ) - { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], Set BT inquiry / page scan 0x3a setting\n")); - btdm8821ae.b_ps_tdma_on = true; - btdm8821ae.ps_tdma_byte[0] = 0xa3; - btdm8821ae.ps_tdma_byte[1] = 0x5; - btdm8821ae.ps_tdma_byte[2] = 0x5; - btdm8821ae.ps_tdma_byte[3] = 0x83; - btdm8821ae.ps_tdma_byte[4] = 0x80; - } - - if(rtl8821ae_dm_bt_is_coexist_state_changed(hw)){ - rtl8821ae_dm_bt_set_bt_dm(hw, &btdm8821ae); - } -} - -void rtl8821ae_dm_bt_inq_page_monitor(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 cur_time; - cur_time = jiffies; - if (hal_coex_8821ae.b_c2h_bt_inquiry_page) { - //pHalData->btcoexist.halCoex8821ae.btInquiryPageCnt++; - // bt inquiry or page is started. - if(hal_coex_8821ae.bt_inq_page_start_time == 0){ - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_BT_INQ_PAGE; - hal_coex_8821ae.bt_inq_page_start_time = cur_time; - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT Inquiry/page is started at time : 0x%x \n", - hal_coex_8821ae.bt_inq_page_start_time)); - } - } - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], BT Inquiry/page started time : 0x%x, cur_time : 0x%x \n", - hal_coex_8821ae.bt_inq_page_start_time, cur_time)); - - if (hal_coex_8821ae.bt_inq_page_start_time) { - if ((((long)cur_time - (long)hal_coex_8821ae.bt_inq_page_start_time) / HZ) >= 10) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BT Inquiry/page >= 10sec!!!")); - hal_coex_8821ae.bt_inq_page_start_time = 0; - rtlpcipriv->btcoexist.current_state &=~ BT_COEX_STATE_BT_INQ_PAGE; - } - } - -#if 0 - if (hal_coex_8821ae.b_c2h_bt_inquiry_page) { - hal_coex_8821ae.b_c2h_bt_inquiry_page++; - // bt inquiry or page is started. - } if(hal_coex_8821ae.b_c2h_bt_inquiry_page) { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_BT_INQ_PAGE; - if(hal_coex_8821ae.bt_inquiry_page_cnt >= 4) - hal_coex_8821ae.bt_inquiry_page_cnt = 0; - hal_coex_8821ae.bt_inquiry_page_cnt++; - } else { - rtlpcipriv->btcoexist.current_state &=~ BT_COEX_STATE_BT_INQ_PAGE; - } -#endif -} - -void rtl8821ae_dm_bt_reset_action_profile_state(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - rtlpcipriv->btcoexist.current_state &= ~\ - (BT_COEX_STATE_PROFILE_HID | BT_COEX_STATE_PROFILE_A2DP| - BT_COEX_STATE_PROFILE_PAN | BT_COEX_STATE_PROFILE_SCO); - - rtlpcipriv->btcoexist.current_state &= ~\ - (BT_COEX_STATE_BTINFO_COMMON | BT_COEX_STATE_BTINFO_B_HID_SCOESCO| - BT_COEX_STATE_BTINFO_B_FTP_A2DP); -} - -void _rtl8821ae_dm_bt_coexist_2_ant(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 bt_retry_cnt; - u8 bt_info_original; - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex] Get bt info by fw!!\n")); - - _rtl8821ae_dm_bt_check_wifi_state(hw); - - if (hal_coex_8821ae.b_c2h_bt_info_req_sent) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("[BTCoex] c2h for bt_info not rcvd yet!!\n")); - } - - bt_retry_cnt = hal_coex_8821ae.bt_retry_cnt; - bt_info_original = hal_coex_8821ae.c2h_bt_info_original; - - // when bt inquiry or page scan, we have to set h2c 0x25 - // ignore wlanact for continuous 4x2secs - rtl8821ae_dm_bt_inq_page_monitor(hw); - rtl8821ae_dm_bt_reset_action_profile_state(hw); - - if(rtl8821ae_dm_bt_is_2_ant_common_action(hw)) { - rtlpcipriv->btcoexist.bt_profile_case = BT_COEX_MECH_COMMON; - rtlpcipriv->btcoexist.bt_profile_action= BT_COEX_MECH_COMMON; - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("Action 2-Ant common.\n")); - } else { - if( (bt_info_original & BTINFO_B_HID) || - (bt_info_original & BTINFO_B_SCO_BUSY) || - (bt_info_original & BTINFO_B_SCO_ESCO) ) { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_BTINFO_B_HID_SCOESCO; - rtlpcipriv->btcoexist.bt_profile_case = BT_COEX_MECH_HID_SCO_ESCO; - rtlpcipriv->btcoexist.bt_profile_action = BT_COEX_MECH_HID_SCO_ESCO; - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BTInfo: bHid|bSCOBusy|bSCOeSCO\n")); - rtl8821ae_dm_bt_2_ant_hid_sco_esco(hw); - } else if( (bt_info_original & BTINFO_B_FTP) || - (bt_info_original & BTINFO_B_A2DP) ) { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_BTINFO_B_FTP_A2DP; - rtlpcipriv->btcoexist.bt_profile_case = BT_COEX_MECH_FTP_A2DP; - rtlpcipriv->btcoexist.bt_profile_action = BT_COEX_MECH_FTP_A2DP; - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("BTInfo: bFTP|bA2DP\n")); - rtl8821ae_dm_bt_2_ant_ftp_a2dp(hw); - } else { - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_BTINFO_B_HID_SCOESCO; - rtlpcipriv->btcoexist.bt_profile_case = BT_COEX_MECH_NONE; - rtlpcipriv->btcoexist.bt_profile_action= BT_COEX_MECH_NONE; - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], BTInfo: undefined case!!!!\n")); - rtl8821ae_dm_bt_2_ant_hid_sco_esco(hw); - } - } -} - -void _rtl8821ae_dm_bt_coexist_1_ant(struct ieee80211_hw *hw) -{ - return; -} - -void rtl8821ae_dm_bt_hw_coex_all_off_8723a(struct ieee80211_hw *hw) -{ - rtl8821ae_dm_bt_set_coex_table(hw, 0x5a5aaaaa, 0xcc, 0x3); - rtl8821ae_dm_bt_set_hw_pta_mode(hw, true); -} - -void rtl8821ae_dm_bt_fw_coex_all_off_8723a(struct ieee80211_hw *hw) -{ - rtl8821ae_dm_bt_set_fw_ignore_wlan_act(hw, false); - rtl8821ae_dm_bt_set_fw_3a(hw, 0x0, 0x0, 0x0, 0x8, 0x0); - rtl8821ae_dm_bt_set_fw_2_ant_hid(hw, false, false); - rtl8821ae_dm_bt_set_fw_tra_tdma_ctrl(hw, false, TDMA_2ANT, TDMA_NAV_OFF); - rtl8821ae_dm_bt_set_fw_tdma_ctrl(hw, false, TDMA_2ANT, - TDMA_NAV_OFF, TDMA_DAC_SWING_OFF); - rtl8821ae_dm_bt_set_fw_dac_swing_level(hw, 0); - rtl8821ae_dm_bt_set_fw_bt_hid_info(hw, false); - rtl8821ae_dm_bt_set_fw_bt_retry_index(hw, 2); - rtl8821ae_dm_bt_set_fw_wlan_act(hw, 0x10, 0x10); - rtl8821ae_dm_bt_set_fw_dec_bt_pwr(hw, false); -} - -void rtl8821ae_dm_bt_sw_coex_all_off_8723a(struct ieee80211_hw *hw) -{ - rtl8821ae_dm_bt_agc_table(hw, BT_AGCTABLE_OFF); - rtl8821ae_dm_bt_bb_back_off_level(hw, BT_BB_BACKOFF_OFF); - rtl8821ae_dm_bt_reject_ap_aggregated_packet(hw, false); - - rtl8821ae_dm_bt_set_sw_penalty_tx_rate_adaptive(hw, - BT_TX_RATE_ADAPTIVE_NORMAL); - rtl8821ae_dm_bt_set_sw_rf_rx_lpf_corner(hw, BT_RF_RX_LPF_CORNER_RESUME); - rtl8821ae_dm_bt_set_sw_full_time_dac_swing(hw, false, 0xc0); -} - -void rtl8821ae_dm_bt_query_bt_information(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 h2c_parameter[1] = {0}; - - hal_coex_8821ae.b_c2h_bt_info_req_sent = true; - - h2c_parameter[0] |= BIT(0); - - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("Query Bt information, write 0x38=0x%x\n", h2c_parameter[0])); - - rtl8821ae_fill_h2c_cmd(hw, 0x38, 1, h2c_parameter); -} - -void rtl8821ae_dm_bt_bt_hw_counters_monitor(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u32 reg_hp_tx_rx, reg_lp_tx_rx, u32_tmp; - u32 reg_hp_tx=0, reg_hp_rx=0, reg_lp_tx=0, reg_lp_rx=0; - - reg_hp_tx_rx = REG_HIGH_PRIORITY_TXRX; - reg_lp_tx_rx = REG_LOW_PRIORITY_TXRX; - - u32_tmp = rtl_read_dword(rtlpriv, reg_hp_tx_rx); - reg_hp_tx = u32_tmp & MASKLWORD; - reg_hp_rx = (u32_tmp & MASKHWORD)>>16; - - u32_tmp = rtl_read_dword(rtlpriv, reg_lp_tx_rx); - reg_lp_tx = u32_tmp & MASKLWORD; - reg_lp_rx = (u32_tmp & MASKHWORD)>>16; - - if(rtlpcipriv->btcoexist.lps_counter > 1) { - reg_hp_tx %= rtlpcipriv->btcoexist.lps_counter; - reg_hp_rx %= rtlpcipriv->btcoexist.lps_counter; - reg_lp_tx %= rtlpcipriv->btcoexist.lps_counter; - reg_lp_rx %= rtlpcipriv->btcoexist.lps_counter; - } - - hal_coex_8821ae.high_priority_tx = reg_hp_tx; - hal_coex_8821ae.high_priority_rx = reg_hp_rx; - hal_coex_8821ae.low_priority_tx = reg_lp_tx; - hal_coex_8821ae.low_priority_rx = reg_lp_rx; - - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("High Priority Tx/Rx (reg 0x%x)=%x(%d)/%x(%d)\n", - reg_hp_tx_rx, reg_hp_tx, reg_hp_tx, reg_hp_rx, reg_hp_rx)); - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("Low Priority Tx/Rx (reg 0x%x)=%x(%d)/%x(%d)\n", - reg_lp_tx_rx, reg_lp_tx, reg_lp_tx, reg_lp_rx, reg_lp_rx)); - rtlpcipriv->btcoexist.lps_counter = 0; - //rtl_write_byte(rtlpriv, 0x76e, 0xc); -} - -void rtl8821ae_dm_bt_bt_enable_disable_check(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - bool bt_alife = true; - - if (hal_coex_8821ae.high_priority_tx == 0 && - hal_coex_8821ae.high_priority_rx == 0 && - hal_coex_8821ae.low_priority_tx == 0 && - hal_coex_8821ae.low_priority_rx == 0) { - bt_alife = false; - } - if (hal_coex_8821ae.high_priority_tx == 0xeaea && - hal_coex_8821ae.high_priority_rx == 0xeaea && - hal_coex_8821ae.low_priority_tx == 0xeaea && - hal_coex_8821ae.low_priority_rx == 0xeaea) { - bt_alife = false; - } - if (hal_coex_8821ae.high_priority_tx == 0xffff && - hal_coex_8821ae.high_priority_rx == 0xffff && - hal_coex_8821ae.low_priority_tx == 0xffff && - hal_coex_8821ae.low_priority_rx == 0xffff) { - bt_alife = false; - } - if (bt_alife) { - rtlpcipriv->btcoexist.bt_active_zero_cnt = 0; - rtlpcipriv->btcoexist.b_cur_bt_disabled = false; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("8821AE BT is enabled !!\n")); - } else { - rtlpcipriv->btcoexist.bt_active_zero_cnt++; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, - ("8821AE bt all counters=0, %d times!!\n", - rtlpcipriv->btcoexist.bt_active_zero_cnt)); - if (rtlpcipriv->btcoexist.bt_active_zero_cnt >= 2) { - rtlpcipriv->btcoexist.b_cur_bt_disabled = true; - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("8821AE BT is disabled !!\n")); - } - } - if (rtlpcipriv->btcoexist.b_pre_bt_disabled != - rtlpcipriv->btcoexist.b_cur_bt_disabled) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("8821AE BT is from %s to %s!!\n", - (rtlpcipriv->btcoexist.b_pre_bt_disabled ? "disabled":"enabled"), - (rtlpcipriv->btcoexist.b_cur_bt_disabled ? "disabled":"enabled"))); - rtlpcipriv->btcoexist.b_pre_bt_disabled - = rtlpcipriv->btcoexist.b_cur_bt_disabled; - } -} - - -void rtl8821ae_dm_bt_coexist(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - rtl8821ae_dm_bt_query_bt_information(hw); - rtl8821ae_dm_bt_bt_hw_counters_monitor(hw); - rtl8821ae_dm_bt_bt_enable_disable_check(hw); - - if (rtlpcipriv->btcoexist.bt_ant_num == ANT_X2) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTCoex], 2 Ant mechanism\n")); - _rtl8821ae_dm_bt_coexist_2_ant(hw); - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("[BTCoex], 1 Ant mechanism\n")); - _rtl8821ae_dm_bt_coexist_1_ant(hw); - } - - if (!rtl8821ae_dm_bt_is_same_coexist_state(hw)) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[BTCoex], Coexist State[bitMap] change from 0x%x%8x to 0x%x%8x\n", - rtlpcipriv->btcoexist.previous_state_h, - rtlpcipriv->btcoexist.previous_state, - rtlpcipriv->btcoexist.current_state_h, - rtlpcipriv->btcoexist.current_state)); - rtlpcipriv->btcoexist.previous_state - = rtlpcipriv->btcoexist.current_state; - rtlpcipriv->btcoexist.previous_state_h - = rtlpcipriv->btcoexist.current_state_h; - } -} - -void rtl8821ae_dm_bt_parse_bt_info(struct ieee80211_hw *hw, u8 * tmp_buf, u8 len) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - u8 bt_info; - u8 i; - - hal_coex_8821ae.b_c2h_bt_info_req_sent = false; - hal_coex_8821ae.bt_retry_cnt = 0; - for (i = 0; i < len; i++) { - if (i == 0) { - hal_coex_8821ae.c2h_bt_info_original = tmp_buf[i]; - } else if (i == 1) { - hal_coex_8821ae.bt_retry_cnt = tmp_buf[i]; - } - if(i == len-1) { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("0x%2x]", tmp_buf[i])); - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_TRACE, ("0x%2x, ", tmp_buf[i])); - } - } - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("BT info bt_info (Data)= 0x%x\n",hal_coex_8821ae.c2h_bt_info_original)); - bt_info = hal_coex_8821ae.c2h_bt_info_original; - - if(bt_info & BIT(2)){ - hal_coex_8821ae.b_c2h_bt_inquiry_page = true; - } else { - hal_coex_8821ae.b_c2h_bt_inquiry_page = false; - } - - if (bt_info & BTINFO_B_CONNECTION) { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTC2H], BTInfo: bConnect=true\n")); - rtlpcipriv->btcoexist.b_bt_busy = true; - rtlpcipriv->btcoexist.current_state &= ~BT_COEX_STATE_BT_IDLE; - } else { - RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, ("[BTC2H], BTInfo: bConnect=false\n")); - rtlpcipriv->btcoexist.b_bt_busy = false; - rtlpcipriv->btcoexist.current_state |= BT_COEX_STATE_BT_IDLE; - } -} -void rtl_8821ae_c2h_command_handle(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct c2h_evt_hdr c2h_event; - u8 * ptmp_buf = NULL; - u8 index = 0; - u8 u1b_tmp = 0; - memset(&c2h_event, 0, sizeof(c2h_event)); - u1b_tmp = rtl_read_byte(rtlpriv, REG_C2HEVT_MSG_NORMAL); - RT_TRACE(COMP_FW, DBG_DMESG, - ("&&&&&&: REG_C2HEVT_MSG_NORMAL is 0x%x\n", u1b_tmp)); - c2h_event.cmd_id = u1b_tmp & 0xF; - c2h_event.cmd_len = (u1b_tmp & 0xF0) >> 4; - c2h_event.cmd_seq = rtl_read_byte(rtlpriv, REG_C2HEVT_MSG_NORMAL + 1); - RT_TRACE(COMP_FW, DBG_DMESG, ("cmd_id: %d, cmd_len: %d, cmd_seq: %d\n", - c2h_event.cmd_id , c2h_event.cmd_len, c2h_event.cmd_seq)); - u1b_tmp = rtl_read_byte(rtlpriv, 0x01AF); - if (u1b_tmp == C2H_EVT_HOST_CLOSE) { - return; - } else if (u1b_tmp != C2H_EVT_FW_CLOSE) { - rtl_write_byte(rtlpriv, 0x1AF, 0x00); - return; - } - ptmp_buf = (u8 *) kmalloc(c2h_event.cmd_len, GFP_KERNEL); - if(ptmp_buf == NULL) { - RT_TRACE(COMP_FW, DBG_TRACE, ("malloc cmd buf failed\n")); - return; - } - - /* Read the content */ - for (index = 0; index < c2h_event.cmd_len; index ++) { - ptmp_buf[index] = rtl_read_byte(rtlpriv, REG_C2HEVT_MSG_NORMAL + 2+ index); - } - - switch(c2h_event.cmd_id) { - case C2H_BT_RSSI: - break; - - case C2H_BT_OP_MODE: - break; - - case BT_INFO: - RT_TRACE(COMP_FW, DBG_TRACE, - ("BT info Byte[0] (ID) is 0x%x\n", c2h_event.cmd_id)); - RT_TRACE(COMP_FW, DBG_TRACE, - ("BT info Byte[1] (Seq) is 0x%x\n", c2h_event.cmd_seq)); - RT_TRACE(COMP_FW, DBG_TRACE, - ("BT info Byte[2] (Data)= 0x%x\n", ptmp_buf[0])); - - if (rtlpriv->cfg->ops->get_btc_status()){ - rtlpriv->btcoexist.btc_ops->btc_btinfo_notify(rtlpriv, ptmp_buf, c2h_event.cmd_len); - } - break; - default: - break; - } - - if(ptmp_buf) - kfree(ptmp_buf); - - rtl_write_byte(rtlpriv, 0x01AF, C2H_EVT_HOST_CLOSE); -} - - - diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.h b/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.h deleted file mode 100644 index a94474f..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.h +++ /dev/null @@ -1,160 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_HAL_BTC_H__ -#define __RTL8821AE_HAL_BTC_H__ - -#include "../wifi.h" -#include "btc.h" -#include "hal_bt_coexist.h" - -#define BT_TXRX_CNT_THRES_1 1200 -#define BT_TXRX_CNT_THRES_2 1400 -#define BT_TXRX_CNT_THRES_3 3000 -#define BT_TXRX_CNT_LEVEL_0 0 // < 1200 -#define BT_TXRX_CNT_LEVEL_1 1 // >= 1200 && < 1400 -#define BT_TXRX_CNT_LEVEL_2 2 // >= 1400 -#define BT_TXRX_CNT_LEVEL_3 3 - - - -#define BT_COEX_DISABLE 0 -#define BT_Q_PKT_OFF 0 -#define BT_Q_PKT_ON 1 - -#define BT_TX_PWR_OFF 0 -#define BT_TX_PWR_ON 1 - -/* TDMA mode definition */ -#define TDMA_2ANT 0 -#define TDMA_1ANT 1 -#define TDMA_NAV_OFF 0 -#define TDMA_NAV_ON 1 -#define TDMA_DAC_SWING_OFF 0 -#define TDMA_DAC_SWING_ON 1 - -/* PTA mode related definition */ -#define BT_PTA_MODE_OFF 0 -#define BT_PTA_MODE_ON 1 - -/* Penalty Tx Rate Adaptive */ -#define BT_TX_RATE_ADAPTIVE_NORMAL 0 -#define BT_TX_RATE_ADAPTIVE_LOW_PENALTY 1 - -/* RF Corner */ -#define BT_RF_RX_LPF_CORNER_RESUME 0 -#define BT_RF_RX_LPF_CORNER_SHRINK 1 - -#define C2H_EVT_HOST_CLOSE 0x00 -#define C2H_EVT_FW_CLOSE 0xFF - -enum bt_traffic_mode { - BT_MOTOR_EXT_BE = 0x00, - BT_MOTOR_EXT_GUL = 0x01, - BT_MOTOR_EXT_GUB = 0x02, - BT_MOTOR_EXT_GULB = 0x03 -}; - -enum bt_traffic_mode_profile { - BT_PROFILE_NONE, - BT_PROFILE_A2DP, - BT_PROFILE_PAN, - BT_PROFILE_HID, - BT_PROFILE_SCO -}; - -enum hci_ext_bt_operation { - HCI_BT_OP_NONE = 0x0, - HCI_BT_OP_INQUIRE_START = 0x1, - HCI_BT_OP_INQUIRE_FINISH = 0x2, - HCI_BT_OP_PAGING_START = 0x3, - HCI_BT_OP_PAGING_SUCCESS = 0x4, - HCI_BT_OP_PAGING_UNSUCCESS = 0x5, - HCI_BT_OP_PAIRING_START = 0x6, - HCI_BT_OP_PAIRING_FINISH = 0x7, - HCI_BT_OP_BT_DEV_ENABLE = 0x8, - HCI_BT_OP_BT_DEV_DISABLE = 0x9, - HCI_BT_OP_MAX, -}; - -enum bt_spec { - BT_SPEC_1_0_b = 0x00, - BT_SPEC_1_1 = 0x01, - BT_SPEC_1_2 = 0x02, - BT_SPEC_2_0_EDR = 0x03, - BT_SPEC_2_1_EDR = 0x04, - BT_SPEC_3_0_HS = 0x05, - BT_SPEC_4_0 = 0x06 -}; - -struct c2h_evt_hdr { - u8 cmd_id; - u8 cmd_len; - u8 cmd_seq; -}; - -enum bt_state{ - BT_INFO_STATE_DISABLED = 0, - BT_INFO_STATE_NO_CONNECTION = 1, - BT_INFO_STATE_CONNECT_IDLE = 2, - BT_INFO_STATE_INQ_OR_PAG = 3, - BT_INFO_STATE_ACL_ONLY_BUSY = 4, - BT_INFO_STATE_SCO_ONLY_BUSY = 5, - BT_INFO_STATE_ACL_SCO_BUSY = 6, - BT_INFO_STATE_HID_BUSY = 7, - BT_INFO_STATE_HID_SCO_BUSY = 8, - BT_INFO_STATE_MAX = 7 -}; - -enum rtl8723be_c2h_evt { - C2H_DBG = 0, - C2H_TSF = 1, - C2H_AP_RPT_RSP = 2, - C2H_CCX_TX_RPT = 3, // The FW notify the report of the specific tx packet. - C2H_BT_RSSI = 4, - C2H_BT_OP_MODE = 5, - C2H_HW_INFO_EXCH = 10, - C2H_C2H_H2C_TEST = 11, - BT_INFO = 9, - MAX_C2HEVENT -}; - - - -void rtl8821ae_dm_bt_fw_coex_all_off_8723a(struct ieee80211_hw *hw); -void rtl8821ae_dm_bt_sw_coex_all_off_8723a(struct ieee80211_hw *hw); -void rtl8821ae_dm_bt_hw_coex_all_off_8723a(struct ieee80211_hw *hw); -void rtl8821ae_dm_bt_coexist(struct ieee80211_hw *hw); -void rtl8821ae_dm_bt_set_bt_dm(struct ieee80211_hw *hw, struct btdm_8821ae *p_btdm); -void rtl_8821ae_c2h_command_handle(struct ieee80211_hw * hw); -void rtl_8821ae_bt_wifi_media_status_notify(struct ieee80211_hw * hw, bool mstatus); -void rtl8821ae_dm_bt_turn_off_bt_coexist_before_enter_lps(struct ieee80211_hw *hw); - - - -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hw.c b/drivers/staging/rtl8821ae/rtl8821ae/hw.c deleted file mode 100644 index 5ed7a11..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/hw.c +++ /dev/null @@ -1,3346 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../efuse.h" -#include "../base.h" -#include "../regd.h" -#include "../cam.h" -#include "../ps.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "fw.h" -#include "led.h" -#include "hw.h" -#include "pwrseqcmd.h" -#include "pwrseq.h" -#include "btc.h" -#include "../btcoexist/rtl_btc.h" - -#define LLT_CONFIG 5 - -static void _rtl8821ae_return_beacon_queue_skb(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[BEACON_QUEUE]; - - while (skb_queue_len(&ring->queue)) { - struct rtl_tx_desc *entry = &ring->desc[ring->idx]; - struct sk_buff *skb = __skb_dequeue(&ring->queue); - - pci_unmap_single(rtlpci->pdev, - le32_to_cpu(rtlpriv->cfg->ops->get_desc( - (u8 *) entry, true, HW_DESC_TXBUFF_ADDR)), - skb->len, PCI_DMA_TODEVICE); - kfree_skb(skb); - ring->idx = (ring->idx + 1) % ring->entries; - } - -} - -static void _rtl8821ae_set_bcn_ctrl_reg(struct ieee80211_hw *hw, - u8 set_bits, u8 clear_bits) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - rtlpci->reg_bcn_ctrl_val |= set_bits; - rtlpci->reg_bcn_ctrl_val &= ~clear_bits; - - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8) rtlpci->reg_bcn_ctrl_val); -} - -void _rtl8821ae_stop_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte & (~BIT(6))); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0x64); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte &= ~(BIT(0)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -void _rtl8821ae_resume_tx_beacon(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp1byte; - - tmp1byte = rtl_read_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, tmp1byte | BIT(6)); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1, 0xff); - tmp1byte = rtl_read_byte(rtlpriv, REG_TBTT_PROHIBIT + 2); - tmp1byte |= BIT(0); - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 2, tmp1byte); -} - -static void _rtl8821ae_enable_bcn_sub_func(struct ieee80211_hw *hw) -{ - _rtl8821ae_set_bcn_ctrl_reg(hw, 0, BIT(1)); -} - -static void _rtl8821ae_disable_bcn_sub_func(struct ieee80211_hw *hw) -{ - _rtl8821ae_set_bcn_ctrl_reg(hw, BIT(1), 0); -} - -static void _rtl8821ae_set_fw_clock_on(struct ieee80211_hw *hw, - u8 rpwm_val, bool b_need_turn_off_ckk) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool b_support_remote_wake_up; - u32 count = 0,isr_regaddr,content; - bool b_schedule_timer = b_need_turn_off_ckk; - rtlpriv->cfg->ops->get_hw_reg(hw, HAL_DEF_WOWLAN, - (u8 *) (&b_support_remote_wake_up)); - - if (!rtlhal->bfw_ready) - return; - if (!rtlpriv->psc.b_fw_current_inpsmode) - return; - - while (1) { - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - if (rtlhal->bfw_clk_change_in_progress) { - while (rtlhal->bfw_clk_change_in_progress) { - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - count++; - udelay(100); - if (count > 1000) - return; - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - } - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - } else { - rtlhal->bfw_clk_change_in_progress = false; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - } - } - - if (IS_IN_LOW_POWER_STATE_8821AE(rtlhal->fw_ps_state)) { - rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *) (&rpwm_val)); - if (FW_PS_IS_ACK(rpwm_val)) { - isr_regaddr = REG_HISR; - content = rtl_read_dword(rtlpriv, isr_regaddr); - while (!(content & IMR_CPWM) && (count < 500)) { - udelay(50); - count++; - content = rtl_read_dword(rtlpriv, isr_regaddr); - } - - if (content & IMR_CPWM) { - rtl_write_word(rtlpriv,isr_regaddr, 0x0100); - rtlhal->fw_ps_state = FW_PS_STATE_RF_ON_8821AE; - RT_TRACE(COMP_POWER, DBG_LOUD, ("Receive CPWM INT!!! Set pHalData->FwPSState = %X\n", rtlhal->fw_ps_state)); - } - } - - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - rtlhal->bfw_clk_change_in_progress = false; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - if (b_schedule_timer) { - mod_timer(&rtlpriv->works.fw_clockoff_timer, - jiffies + MSECS(10)); - } - - } else { - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - rtlhal->bfw_clk_change_in_progress = false; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - } - - -} - -static void _rtl8821ae_set_fw_clock_off(struct ieee80211_hw *hw, - u8 rpwm_val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring; - enum rf_pwrstate rtstate; - bool b_schedule_timer = false; - u8 queue; - - if (!rtlhal->bfw_ready) - return; - if (!rtlpriv->psc.b_fw_current_inpsmode) - return; - if (!rtlhal->ballow_sw_to_change_hwclc) - return; - rtlpriv->cfg->ops->get_hw_reg(hw,HW_VAR_RF_STATE,(u8 *)(&rtstate)); - if (rtstate == ERFOFF ||rtlpriv->psc.inactive_pwrstate ==ERFOFF) - return; - - for (queue = 0; queue < RTL_PCI_MAX_TX_QUEUE_COUNT; queue++) { - ring = &rtlpci->tx_ring[queue]; - if (skb_queue_len(&ring->queue)) { - b_schedule_timer = true; - break; - } - } - - if (b_schedule_timer) { - mod_timer(&rtlpriv->works.fw_clockoff_timer, - jiffies + MSECS(10)); - return; - } - - if (FW_PS_STATE(rtlhal->fw_ps_state) != FW_PS_STATE_RF_OFF_LOW_PWR_8821AE) { - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - if (!rtlhal->bfw_clk_change_in_progress) { - rtlhal->bfw_clk_change_in_progress = true; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - rtlhal->fw_ps_state = FW_PS_STATE(rpwm_val); - rtl_write_word(rtlpriv, REG_HISR, 0x0100); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *) (&rpwm_val)); - spin_lock_bh(&rtlpriv->locks.fw_ps_lock); - rtlhal->bfw_clk_change_in_progress = false; - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - } else { - spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); - mod_timer(&rtlpriv->works.fw_clockoff_timer, - jiffies + MSECS(10)); - } - } - -} - -static void _rtl8821ae_set_fw_ps_rf_on(struct ieee80211_hw *hw) -{ - u8 rpwm_val = 0; - rpwm_val |= (FW_PS_STATE_RF_OFF_8821AE | FW_PS_ACK); - _rtl8821ae_set_fw_clock_on(hw, rpwm_val, true); -} - -static void _rtl8821ae_fwlps_leave(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool b_fw_current_inps = false; - u8 rpwm_val = 0,fw_pwrmode = FW_PS_ACTIVE_MODE; - - if (ppsc->b_low_power_enable){ - rpwm_val = (FW_PS_STATE_ALL_ON_8821AE|FW_PS_ACK);/* RF on */ - _rtl8821ae_set_fw_clock_on(hw, rpwm_val, false); - rtlhal->ballow_sw_to_change_hwclc = false; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_H2C_FW_PWRMODE, - (u8 *) (&fw_pwrmode)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *) (&b_fw_current_inps)); - } else { - rpwm_val = FW_PS_STATE_ALL_ON_8821AE; /* RF on */ - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SET_RPWM, - (u8 *) (&rpwm_val)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_H2C_FW_PWRMODE, - (u8 *) (&fw_pwrmode)); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_FW_PSMODE_STATUS, - (u8 *) (&b_fw_current_inps)); - } - -} - -static void _rtl8821ae_fwlps_enter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - bool b_fw_current_inps = true; - u8 rpwm_val; - - if (ppsc->b_low_power_enable){ - rpwm_val = FW_PS_STATE_RF_OFF_LOW_PWR_8821AE; /* RF off */ - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_PSMODE_STATUS, - (u8 *) (&b_fw_current_inps)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *) (&ppsc->fwctrl_psmode)); - rtlhal->ballow_sw_to_change_hwclc = true; - _rtl8821ae_set_fw_clock_off(hw, rpwm_val); - - - } else { - rpwm_val = FW_PS_STATE_RF_OFF_8821AE; /* RF off */ - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_FW_PSMODE_STATUS, - (u8 *) (&b_fw_current_inps)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_H2C_FW_PWRMODE, - (u8 *) (&ppsc->fwctrl_psmode)); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_SET_RPWM, - (u8 *) (&rpwm_val)); - } - -} - -void rtl8821ae_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - - switch (variable) { - case HW_VAR_ETHER_ADDR: - *((u32 *)(val)) = rtl_read_dword(rtlpriv, REG_MACID); - *((u16 *)(val+4)) = rtl_read_word(rtlpriv, REG_MACID + 4); - break; - case HW_VAR_BSSID: - *((u32 *)(val)) = rtl_read_dword(rtlpriv, REG_BSSID); - *((u16 *)(val+4)) = rtl_read_word(rtlpriv, REG_BSSID+4); - break; - case HW_VAR_MEDIA_STATUS: - val[0] = rtl_read_byte(rtlpriv, REG_CR+2) & 0x3; - break; - case HW_VAR_SLOT_TIME: - *((u8 *)(val)) = mac->slot_time; - break; - case HW_VAR_BEACON_INTERVAL: - *((u16 *)(val)) = rtl_read_word(rtlpriv, REG_BCN_INTERVAL); - break; - case HW_VAR_ATIM_WINDOW: - *((u16 *)(val)) = rtl_read_word(rtlpriv, REG_ATIMWND); - break; - case HW_VAR_RCR: - *((u32 *) (val)) = rtlpci->receive_config; - break; - case HW_VAR_RF_STATE: - *((enum rf_pwrstate *)(val)) = ppsc->rfpwr_state; - break; - case HW_VAR_FWLPS_RF_ON:{ - enum rf_pwrstate rfState; - u32 val_rcr; - - rtlpriv->cfg->ops->get_hw_reg(hw, - HW_VAR_RF_STATE, - (u8 *) (&rfState)); - if (rfState == ERFOFF) { - *((bool *) (val)) = true; - } else { - val_rcr = rtl_read_dword(rtlpriv, REG_RCR); - val_rcr &= 0x00070000; - if (val_rcr) - *((bool *) (val)) = false; - else - *((bool *) (val)) = true; - } - break; - } - case HW_VAR_FW_PSMODE_STATUS: - *((bool *) (val)) = ppsc->b_fw_current_inpsmode; - break; - case HW_VAR_CORRECT_TSF:{ - u64 tsf; - u32 *ptsf_low = (u32 *) & tsf; - u32 *ptsf_high = ((u32 *) & tsf) + 1; - - *ptsf_high = rtl_read_dword(rtlpriv, (REG_TSFTR + 4)); - *ptsf_low = rtl_read_dword(rtlpriv, REG_TSFTR); - - *((u64 *) (val)) = tsf; - - break; - } - default: - RT_TRACE(COMP_ERR, DBG_EMERG, - ("switch case not process %x\n",variable)); - break; - } -} - - -void rtl8821ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 idx; - - switch (variable) { - case HW_VAR_ETHER_ADDR:{ - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_MACID + idx), - val[idx]); - } - break; - } - case HW_VAR_BASIC_RATE:{ - u16 b_rate_cfg = ((u16 *) val)[0]; - u8 rate_index = 0; - b_rate_cfg = b_rate_cfg & 0x15f; - b_rate_cfg |= 0x01; - rtl_write_byte(rtlpriv, REG_RRSR, b_rate_cfg & 0xff); - rtl_write_byte(rtlpriv, REG_RRSR + 1, - (b_rate_cfg >> 8) & 0xff); - while (b_rate_cfg > 0x1) { - b_rate_cfg = (b_rate_cfg >> 1); - rate_index++; - } - rtl_write_byte(rtlpriv, REG_INIRTS_RATE_SEL, - rate_index); - break; - } - case HW_VAR_BSSID:{ - for (idx = 0; idx < ETH_ALEN; idx++) { - rtl_write_byte(rtlpriv, (REG_BSSID + idx), - val[idx]); - } - break; - } - case HW_VAR_SIFS:{ - rtl_write_byte(rtlpriv, REG_SIFS_CTX + 1, val[0]); - rtl_write_byte(rtlpriv, REG_SIFS_TRX + 1, val[1]); - - rtl_write_byte(rtlpriv, REG_SPEC_SIFS + 1, val[0]); - rtl_write_byte(rtlpriv, REG_MAC_SPEC_SIFS + 1, val[0]); - - if (!mac->ht_enable) - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - 0x0e0e); - else - rtl_write_word(rtlpriv, REG_RESP_SIFS_OFDM, - *((u16 *) val)); - break; - } - case HW_VAR_SLOT_TIME:{ - u8 e_aci; - - RT_TRACE(COMP_MLME, DBG_LOUD, - ("HW_VAR_SLOT_TIME %x\n", val[0])); - - rtl_write_byte(rtlpriv, REG_SLOT, val[0]); - - for (e_aci = 0; e_aci < AC_MAX; e_aci++) { - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_AC_PARAM, - (u8 *) (&e_aci)); - } - break; - } - case HW_VAR_ACK_PREAMBLE:{ - u8 reg_tmp; - u8 short_preamble = (bool) (*(u8 *) val); - reg_tmp = rtl_read_byte(rtlpriv, REG_TRXPTCL_CTL+2); - if (short_preamble){ - reg_tmp |= BIT(1); - rtl_write_byte(rtlpriv, REG_TRXPTCL_CTL + 2, reg_tmp); - } else { - reg_tmp &= (~BIT(1)); - rtl_write_byte(rtlpriv, REG_TRXPTCL_CTL + 2, reg_tmp); - } - break; - } - case HW_VAR_WPA_CONFIG: - rtl_write_byte(rtlpriv, REG_SECCFG, *((u8 *) val)); - break; - case HW_VAR_AMPDU_MIN_SPACE:{ - u8 min_spacing_to_set; - u8 sec_min_space; - - min_spacing_to_set = *((u8 *) val); - if (min_spacing_to_set <= 7) { - sec_min_space = 0; - - if (min_spacing_to_set < sec_min_space) - min_spacing_to_set = sec_min_space; - - mac->min_space_cfg = ((mac->min_space_cfg & - 0xf8) | - min_spacing_to_set); - - *val = min_spacing_to_set; - - RT_TRACE(COMP_MLME, DBG_LOUD, - ("Set HW_VAR_AMPDU_MIN_SPACE: %#x\n", - mac->min_space_cfg)); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - } - break; - } - case HW_VAR_SHORTGI_DENSITY:{ - u8 density_to_set; - - density_to_set = *((u8 *) val); - mac->min_space_cfg |= (density_to_set << 3); - - RT_TRACE(COMP_MLME, DBG_LOUD, - ("Set HW_VAR_SHORTGI_DENSITY: %#x\n", - mac->min_space_cfg)); - - rtl_write_byte(rtlpriv, REG_AMPDU_MIN_SPACE, - mac->min_space_cfg); - - break; - } - case HW_VAR_AMPDU_FACTOR:{ - u32 ampdu_len = (*((u8 *)val)); - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { - if(ampdu_len < VHT_AGG_SIZE_128K) - ampdu_len = (0x2000 << (*((u8 *)val))) -1; - else - ampdu_len = 0x1ffff; - } else if(rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { - if(ampdu_len < HT_AGG_SIZE_64K) - ampdu_len = (0x2000 << (*((u8 *)val))) -1; - else - ampdu_len = 0xffff; - } - ampdu_len |= BIT(31); - - rtl_write_dword(rtlpriv, - REG_AMPDU_MAX_LENGTH_8812, ampdu_len); - break; - } - case HW_VAR_AC_PARAM:{ - u8 e_aci = *((u8 *) val); - rtl8821ae_dm_init_edca_turbo(hw); - - if (rtlpci->acm_method != eAcmWay2_SW) - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_ACM_CTRL, - (u8 *) (&e_aci)); - break; - } - case HW_VAR_ACM_CTRL:{ - u8 e_aci = *((u8 *) val); - union aci_aifsn *p_aci_aifsn = - (union aci_aifsn *)(&(mac->ac[0].aifs)); - u8 acm = p_aci_aifsn->f.acm; - u8 acm_ctrl = rtl_read_byte(rtlpriv, REG_ACMHWCTRL); - - acm_ctrl = - acm_ctrl | ((rtlpci->acm_method == 2) ? 0x0 : 0x1); - - if (acm) { - switch (e_aci) { - case AC0_BE: - acm_ctrl |= AcmHw_BeqEn; - break; - case AC2_VI: - acm_ctrl |= AcmHw_ViqEn; - break; - case AC3_VO: - acm_ctrl |= AcmHw_VoqEn; - break; - default: - RT_TRACE(COMP_ERR, DBG_WARNING, - ("HW_VAR_ACM_CTRL acm set " - "failed: eACI is %d\n", acm)); - break; - } - } else { - switch (e_aci) { - case AC0_BE: - acm_ctrl &= (~AcmHw_BeqEn); - break; - case AC2_VI: - acm_ctrl &= (~AcmHw_ViqEn); - break; - case AC3_VO: - acm_ctrl &= (~AcmHw_BeqEn); - break; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, - ("switch case not process \n")); - break; - } - } - - RT_TRACE(COMP_QOS, DBG_TRACE, - ("SetHwReg8190pci(): [HW_VAR_ACM_CTRL] " - "Write 0x%X\n", acm_ctrl)); - rtl_write_byte(rtlpriv, REG_ACMHWCTRL, acm_ctrl); - break; - } - case HW_VAR_RCR:{ - rtl_write_dword(rtlpriv, REG_RCR, ((u32 *) (val))[0]); - rtlpci->receive_config = ((u32 *) (val))[0]; - break; - } - case HW_VAR_RETRY_LIMIT:{ - u8 retry_limit = ((u8 *) (val))[0]; - - rtl_write_word(rtlpriv, REG_RL, - retry_limit << RETRY_LIMIT_SHORT_SHIFT | - retry_limit << RETRY_LIMIT_LONG_SHIFT); - break; - } - case HW_VAR_DUAL_TSF_RST: - rtl_write_byte(rtlpriv, REG_DUAL_TSF_RST, (BIT(0) | BIT(1))); - break; - case HW_VAR_EFUSE_BYTES: - rtlefuse->efuse_usedbytes = *((u16 *) val); - break; - case HW_VAR_EFUSE_USAGE: - rtlefuse->efuse_usedpercentage = *((u8 *) val); - break; - case HW_VAR_IO_CMD: - rtl8821ae_phy_set_io_cmd(hw, (*(enum io_type *)val)); - break; - case HW_VAR_SET_RPWM:{ - u8 rpwm_val; - - rpwm_val = rtl_read_byte(rtlpriv, REG_PCIE_HRPWM); - udelay(1); - - if (rpwm_val & BIT(7)) { - rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, - (*(u8 *) val)); - } else { - rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, - ((*(u8 *) val) | BIT(7))); - } - - break; - } - case HW_VAR_H2C_FW_PWRMODE:{ - rtl8821ae_set_fw_pwrmode_cmd(hw, (*(u8 *) val)); - break; - } - case HW_VAR_FW_PSMODE_STATUS: - ppsc->b_fw_current_inpsmode = *((bool *) val); - break; - - case HW_VAR_RESUME_CLK_ON: - _rtl8821ae_set_fw_ps_rf_on(hw); - break; - - case HW_VAR_FW_LPS_ACTION:{ - bool b_enter_fwlps = *((bool *) val); - - if (b_enter_fwlps) - _rtl8821ae_fwlps_enter(hw); - else - _rtl8821ae_fwlps_leave(hw); - - break; - } - - case HW_VAR_H2C_FW_JOINBSSRPT:{ - u8 mstatus = (*(u8 *) val); - u8 tmp_regcr, tmp_reg422,bcnvalid_reg; - u8 count = 0, dlbcn_count = 0; - bool b_recover = false; - - if (mstatus == RT_MEDIA_CONNECT) { - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_AID, - NULL); - - tmp_regcr = rtl_read_byte(rtlpriv, REG_CR + 1); - rtl_write_byte(rtlpriv, REG_CR + 1, - (tmp_regcr | BIT(0))); - - _rtl8821ae_set_bcn_ctrl_reg(hw, 0, BIT(3)); - _rtl8821ae_set_bcn_ctrl_reg(hw, BIT(4), 0); - - tmp_reg422 = - rtl_read_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2); - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, - tmp_reg422 & (~BIT(6))); - if (tmp_reg422 & BIT(6)) - b_recover = true; - - do { - bcnvalid_reg = rtl_read_byte(rtlpriv, REG_TDECTRL+2); - rtl_write_byte(rtlpriv, REG_TDECTRL+2,(bcnvalid_reg | BIT(0))); - _rtl8821ae_return_beacon_queue_skb(hw); - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtl8812ae_set_fw_rsvdpagepkt(hw, 0); - else - rtl8821ae_set_fw_rsvdpagepkt(hw, 0); - bcnvalid_reg = rtl_read_byte(rtlpriv, REG_TDECTRL+2); - count = 0; - while (!(bcnvalid_reg & BIT(0)) && count <20){ - count++; - udelay(10); - bcnvalid_reg = rtl_read_byte(rtlpriv, REG_TDECTRL+2); - } - dlbcn_count++; - } while (!(bcnvalid_reg & BIT(0)) && dlbcn_count <5); - - if (bcnvalid_reg & BIT(0)) - rtl_write_byte(rtlpriv, REG_TDECTRL+2, BIT(0)); - - _rtl8821ae_set_bcn_ctrl_reg(hw, BIT(3), 0); - _rtl8821ae_set_bcn_ctrl_reg(hw, 0, BIT(4)); - - if (b_recover) { - rtl_write_byte(rtlpriv, - REG_FWHW_TXQ_CTRL + 2, - tmp_reg422); - } - - rtl_write_byte(rtlpriv, REG_CR + 1, - (tmp_regcr & ~(BIT(0)))); - } - rtl8821ae_set_fw_joinbss_report_cmd(hw, (*(u8 *) val)); - - break; - } - case HW_VAR_H2C_FW_P2P_PS_OFFLOAD:{ - rtl8821ae_set_p2p_ps_offload_cmd(hw, (*(u8 *) val)); - break; - } - - case HW_VAR_AID:{ - u16 u2btmp; - u2btmp = rtl_read_word(rtlpriv, REG_BCN_PSR_RPT); - u2btmp &= 0xC000; - rtl_write_word(rtlpriv, REG_BCN_PSR_RPT, (u2btmp | - mac->assoc_id)); - - break; - } - case HW_VAR_CORRECT_TSF:{ - u8 btype_ibss = ((u8 *) (val))[0]; - - if (btype_ibss == true) - _rtl8821ae_stop_tx_beacon(hw); - - _rtl8821ae_set_bcn_ctrl_reg(hw, 0, BIT(3)); - - rtl_write_dword(rtlpriv, REG_TSFTR, - (u32) (mac->tsf & 0xffffffff)); - rtl_write_dword(rtlpriv, REG_TSFTR + 4, - (u32) ((mac->tsf >> 32) & 0xffffffff)); - - _rtl8821ae_set_bcn_ctrl_reg(hw, BIT(3), 0); - - if (btype_ibss == true) - _rtl8821ae_resume_tx_beacon(hw); - - break; - - } - case HW_VAR_NAV_UPPER: { - u32 us_nav_upper = ((u32)*val); - - if(us_nav_upper > HAL_92C_NAV_UPPER_UNIT * 0xFF) - { - RT_TRACE(COMP_INIT , DBG_WARNING, - ("The setting value (0x%08X us) of NAV_UPPER" - " is larger than (%d * 0xFF)!!!\n", - us_nav_upper, HAL_92C_NAV_UPPER_UNIT)); - break; - } - rtl_write_byte(rtlpriv, REG_NAV_UPPER, - ((u8)((us_nav_upper + HAL_92C_NAV_UPPER_UNIT - 1) / HAL_92C_NAV_UPPER_UNIT))); - break; - } - case HW_VAR_KEEP_ALIVE: { - u8 array[2]; - array[0] = 0xff; - array[1] = *((u8 *)val); - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_KEEP_ALIVE_CTRL, 2, array); - } - default: - RT_TRACE(COMP_ERR, DBG_EMERG, ("switch case " - "not process %x\n",variable)); - break; - } -} - -static bool _rtl8821ae_llt_write(struct ieee80211_hw *hw, u32 address, u32 data) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - bool status = true; - long count = 0; - u32 value = _LLT_INIT_ADDR(address) | - _LLT_INIT_DATA(data) | _LLT_OP(_LLT_WRITE_ACCESS); - - rtl_write_dword(rtlpriv, REG_LLT_INIT, value); - - do { - value = rtl_read_dword(rtlpriv, REG_LLT_INIT); - if (_LLT_NO_ACTIVE == _LLT_OP_VALUE(value)) - break; - - if (count > POLLING_LLT_THRESHOLD) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("Failed to polling write LLT done at " - "address %d!\n", address)); - status = false; - break; - } - } while (++count); - - return status; -} - -static bool _rtl8821ae_llt_table_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - unsigned short i; - u8 txpktbuf_bndy; - u8 maxPage; - bool status; - - maxPage = 255; - txpktbuf_bndy = 0xF8; - - - rtl_write_byte(rtlpriv, REG_TRXFF_BNDY, txpktbuf_bndy); - rtl_write_word(rtlpriv, REG_TRXFF_BNDY + 2, MAX_RX_DMA_BUFFER_SIZE - 1); - - rtl_write_byte(rtlpriv, REG_TDECTRL + 1, txpktbuf_bndy); - - rtl_write_byte(rtlpriv, REG_TXPKTBUF_BCNQ_BDNY, txpktbuf_bndy); - rtl_write_byte(rtlpriv, REG_TXPKTBUF_MGQ_BDNY, txpktbuf_bndy); - - rtl_write_byte(rtlpriv, REG_PBP, 0x31); - rtl_write_byte(rtlpriv, REG_RX_DRVINFO_SZ, 0x4); - - for (i = 0; i < (txpktbuf_bndy - 1); i++) { - status = _rtl8821ae_llt_write(hw, i, i + 1); - if (true != status) - return status; - } - - status = _rtl8821ae_llt_write(hw, (txpktbuf_bndy - 1), 0xFF); - if (true != status) - return status; - - for (i = txpktbuf_bndy; i < maxPage; i++) { - status = _rtl8821ae_llt_write(hw, i, (i + 1)); - if (true != status) - return status; - } - - status = _rtl8821ae_llt_write(hw, maxPage, txpktbuf_bndy); - if (true != status) - return status; - - rtl_write_dword(rtlpriv, REG_RQPN, 0x80e70808); - rtl_write_byte(rtlpriv, REG_RQPN_NPQ, 0x00); - - return true; -} - -static void _rtl8821ae_gen_refresh_led_state(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - if (rtlpriv->rtlhal.up_first_time) - return; - - if (ppsc->rfoff_reason == RF_CHANGE_BY_IPS) - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtl8812ae_sw_led_on(hw, pLed0); - else - rtl8821ae_sw_led_on(hw, pLed0); - else if (ppsc->rfoff_reason == RF_CHANGE_BY_INIT) - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtl8812ae_sw_led_on(hw, pLed0); - else - rtl8821ae_sw_led_on(hw, pLed0); - else - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtl8812ae_sw_led_off(hw, pLed0); - else - rtl8821ae_sw_led_off(hw, pLed0); -} - -static bool _rtl8821ae_init_mac(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - u8 bytetmp = 0; - u16 wordtmp = 0; - bool b_mac_func_enable = rtlhal->b_mac_func_enable; - - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00); - - /*Auto Power Down to CHIP-off State*/ - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO + 1) & (~BIT(7)); - rtl_write_byte(rtlpriv, REG_APS_FSMCO + 1, bytetmp); - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { - /* HW Power on sequence*/ - if(!rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, RTL8812_NIC_ENABLE_FLOW)) { - RT_TRACE(COMP_INIT,DBG_LOUD,("init 8812 MAC Fail as power on failure\n")); - return false; - } - } else { - /* HW Power on sequence */ - if (!rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_A_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, RTL8821A_NIC_ENABLE_FLOW)){ - RT_TRACE(COMP_INIT,DBG_LOUD,("init 8821 MAC Fail as power on failure\n")); - return false; - } - } - - bytetmp = rtl_read_byte(rtlpriv, REG_APS_FSMCO) | BIT(4); - rtl_write_byte(rtlpriv, REG_APS_FSMCO, bytetmp); - - bytetmp = rtl_read_byte(rtlpriv, REG_CR); - bytetmp = 0xff; - rtl_write_byte(rtlpriv, REG_CR, bytetmp); - mdelay(2); - - bytetmp |= 0x7f; - rtl_write_byte(rtlpriv, REG_HWSEQ_CTRL, bytetmp); - mdelay(2); - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { - bytetmp = rtl_read_byte(rtlpriv, REG_SYS_CFG + 3); - if (bytetmp & BIT(0)) { - bytetmp = rtl_read_byte(rtlpriv, 0x7c); - bytetmp |= BIT(6); - rtl_write_byte(rtlpriv, 0x7c, bytetmp); - } - } - - bytetmp = rtl_read_byte(rtlpriv, REG_GPIO_MUXCFG + 1); - bytetmp &= ~BIT(4); - rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG + 1, bytetmp); - - rtl_write_word(rtlpriv, REG_CR, 0x2ff); - - if (!b_mac_func_enable) { - if (!_rtl8821ae_llt_table_init(hw)) - return false; - } - - rtl_write_dword(rtlpriv, REG_HISR, 0xffffffff); - rtl_write_dword(rtlpriv, REG_HISRE, 0xffffffff); - - /* Enable FW Beamformer Interrupt */ - bytetmp = rtl_read_byte(rtlpriv, REG_FWIMR + 3); - rtl_write_byte(rtlpriv, REG_FWIMR + 3, bytetmp | BIT(6)); - - wordtmp = rtl_read_word(rtlpriv, REG_TRXDMA_CTRL); - wordtmp &= 0xf; - wordtmp |= 0xF5B1; - rtl_write_word(rtlpriv, REG_TRXDMA_CTRL, wordtmp); - - rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 1, 0x1F); - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - rtl_write_word(rtlpriv, REG_RXFLTMAP2, 0xFFFF); - /*low address*/ - rtl_write_dword(rtlpriv, REG_BCNQ_DESA, - rtlpci->tx_ring[BEACON_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_MGQ_DESA, - rtlpci->tx_ring[MGNT_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_VOQ_DESA, - rtlpci->tx_ring[VO_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_VIQ_DESA, - rtlpci->tx_ring[VI_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_BEQ_DESA, - rtlpci->tx_ring[BE_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_BKQ_DESA, - rtlpci->tx_ring[BK_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_HQ_DESA, - rtlpci->tx_ring[HIGH_QUEUE].dma & DMA_BIT_MASK(32)); - rtl_write_dword(rtlpriv, REG_RX_DESA, - rtlpci->rx_ring[RX_MPDU_QUEUE].dma & DMA_BIT_MASK(32)); - - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 3, 0x77); - - rtl_write_dword(rtlpriv, REG_INT_MIG, 0); - - rtl_write_byte(rtlpriv, REG_SECONDARY_CCA_CTRL, 0x3); - _rtl8821ae_gen_refresh_led_state(hw); - - return true; -} - -static void _rtl8821ae_hw_configure(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u32 reg_rrsr; - - reg_rrsr = RATE_ALL_CCK | RATE_ALL_OFDM_AG; - - rtl_write_dword(rtlpriv, REG_RRSR, reg_rrsr); - /* ARFB table 9 for 11ac 5G 2SS */ - rtl_write_dword(rtlpriv, REG_ARFR0 + 4, 0xfffff000); - /* ARFB table 10 for 11ac 5G 1SS */ - rtl_write_dword(rtlpriv, REG_ARFR1 + 4, 0x003ff000); - /* ARFB table 11 for 11ac 24G 1SS */ - rtl_write_dword(rtlpriv, REG_ARFR2, 0x00000015); - rtl_write_dword(rtlpriv, REG_ARFR2 + 4, 0x003ff000); - /* ARFB table 12 for 11ac 24G 1SS */ - rtl_write_dword(rtlpriv, REG_ARFR3, 0x00000015); - rtl_write_dword(rtlpriv, REG_ARFR3 + 4, 0xffcff000); - /* 0x420[7] = 0 , enable retry AMPDU in new AMPD not singal MPDU. */ - rtl_write_word(rtlpriv, REG_FWHW_TXQ_CTRL, 0x1F00); - rtl_write_byte(rtlpriv, REG_AMPDU_MAX_TIME, 0x70); - - /*Set retry limit*/ - rtl_write_word(rtlpriv, REG_RL, 0x0707); - - - /* Set Data / Response auto rate fallack retry count*/ - rtl_write_dword(rtlpriv, REG_DARFRC, 0x01000000); - rtl_write_dword(rtlpriv, REG_DARFRC + 4, 0x07060504); - rtl_write_dword(rtlpriv, REG_RARFRC, 0x01000000); - rtl_write_dword(rtlpriv, REG_RARFRC + 4, 0x07060504); - - rtlpci->reg_bcn_ctrl_val = 0x1d; - rtl_write_byte(rtlpriv, REG_BCN_CTRL, rtlpci->reg_bcn_ctrl_val); - - /* TBTT prohibit hold time. Suggested by designer TimChen. */ - rtl_write_byte(rtlpriv, REG_TBTT_PROHIBIT + 1,0xff); // 8 ms - - /* AGGR_BK_TIME Reg51A 0x16 */ - rtl_write_word(rtlpriv, REG_NAV_PROT_LEN, 0x0040); - - /*For Rx TP. Suggested by SD1 Richard. Added by tynli. 2010.04.12.*/ - rtl_write_dword(rtlpriv, REG_FAST_EDCA_CTRL, 0x03086666); - - rtl_write_byte(rtlpriv, REG_HT_SINGLE_AMPDU, 0x80); - rtl_write_byte(rtlpriv, REG_RX_PKT_LIMIT, 0x20); - rtl_write_word(rtlpriv, REG_MAX_AGGR_NUM, 0x1F1F); -} - -static u16 _rtl8821ae_mdio_read(struct rtl_priv *rtlpriv, u8 addr) -{ - u16 ret = 0; - u8 tmp = 0, count = 0; - - rtl_write_byte(rtlpriv, REG_MDIO_CTL, addr | BIT(6)); - tmp = rtl_read_byte(rtlpriv, REG_MDIO_CTL) & BIT(6) ; - count = 0; - while (tmp && count < 20) { - udelay(10); - tmp = rtl_read_byte(rtlpriv, REG_MDIO_CTL) & BIT(6); - count++; - } - if (0 == tmp) - ret = rtl_read_word(rtlpriv, REG_MDIO_RDATA); - - return ret; -} - -void _rtl8821ae_mdio_write(struct rtl_priv *rtlpriv, u8 addr, u16 data) -{ - u8 tmp = 0, count = 0; - - rtl_write_word(rtlpriv, REG_MDIO_WDATA, data); - rtl_write_byte(rtlpriv, REG_MDIO_CTL, addr | BIT(5)); - tmp = rtl_read_byte(rtlpriv, REG_MDIO_CTL) & BIT(5) ; - count = 0; - while (tmp && count < 20) { - udelay(10); - tmp = rtl_read_byte(rtlpriv, REG_MDIO_CTL) & BIT(5); - count++; - } -} - -static u8 _rtl8821ae_dbi_read(struct rtl_priv *rtlpriv, u16 addr) -{ - u16 read_addr = addr & 0xfffc; - u8 tmp = 0, count = 0, ret = 0; - - rtl_write_word(rtlpriv, REG_DBI_ADDR, read_addr); - rtl_write_byte(rtlpriv, REG_DBI_FLAG, 0x2); - tmp = rtl_read_byte(rtlpriv, REG_DBI_FLAG); - count = 0; - while (tmp && count < 20) { - udelay(10); - tmp = rtl_read_byte(rtlpriv, REG_DBI_FLAG); - count++; - } - if (0 == tmp) { - read_addr = REG_DBI_RDATA + addr % 4; - ret = rtl_read_word(rtlpriv, read_addr); - } - return ret; -} - -void _rtl8821ae_dbi_write(struct rtl_priv *rtlpriv, u16 addr, u8 data) -{ - u8 tmp = 0, count = 0; - u16 wrtie_addr, remainder = addr % 4; - - wrtie_addr = REG_DBI_WDATA + remainder; - rtl_write_byte(rtlpriv, wrtie_addr, data); - - wrtie_addr = (addr & 0xfffc) | (BIT(0) << (remainder + 12)); - rtl_write_word(rtlpriv, REG_DBI_ADDR, wrtie_addr); - - rtl_write_byte(rtlpriv, REG_DBI_FLAG, 0x1); - - tmp = rtl_read_byte(rtlpriv, REG_DBI_FLAG); - count = 0; - while (tmp && count < 20) { - udelay(10); - tmp = rtl_read_byte(rtlpriv, REG_DBI_FLAG); - count++; - } - -} - -static void _rtl8821ae_enable_aspm_back_door(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp; - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { - if (_rtl8821ae_mdio_read(rtlpriv, 0x04) != 0x8544) - _rtl8821ae_mdio_write(rtlpriv, 0x04, 0x8544); - - if (_rtl8821ae_mdio_read(rtlpriv, 0x0b) != 0x0070) - _rtl8821ae_mdio_write(rtlpriv, 0x0b, 0x0070); - } - - tmp = _rtl8821ae_dbi_read(rtlpriv, 0x70f); - _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7)); - - tmp = _rtl8821ae_dbi_read(rtlpriv, 0x719); - _rtl8821ae_dbi_write(rtlpriv, 0x719, tmp | BIT(3) | BIT(4)); - - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - { - tmp = _rtl8821ae_dbi_read(rtlpriv, 0x718); - _rtl8821ae_dbi_write(rtlpriv, 0x718, tmp|BIT(4)); - } -} - -void rtl8821ae_enable_hw_security_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 sec_reg_value; - u8 tmp; - - RT_TRACE(COMP_INIT, DBG_DMESG, - ("PairwiseEncAlgorithm = %d GroupEncAlgorithm = %d\n", - rtlpriv->sec.pairwise_enc_algorithm, - rtlpriv->sec.group_enc_algorithm)); - - if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) { - RT_TRACE(COMP_SEC, DBG_DMESG, ("not open hw encryption\n")); - return; - } - - sec_reg_value = SCR_TxEncEnable | SCR_RxDecEnable; - - if (rtlpriv->sec.use_defaultkey) { - sec_reg_value |= SCR_TxUseDK; - sec_reg_value |= SCR_RxUseDK; - } - - sec_reg_value |= (SCR_RXBCUSEDK | SCR_TXBCUSEDK); - - tmp = rtl_read_byte(rtlpriv, REG_CR + 1); - rtl_write_byte(rtlpriv, REG_CR + 1, tmp | BIT(1)); - - RT_TRACE(COMP_SEC, DBG_DMESG, - ("The SECR-value %x \n", sec_reg_value)); - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_WPA_CONFIG, &sec_reg_value); - -} - -#if 0 -bool _rtl8821ae_check_pcie_dma_hang(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp; - tmp = rtl_read_byte(rtlpriv, REG_DBI_CTRL+3); - if (!(tmp&BIT(2))) { - rtl_write_byte(rtlpriv, REG_DBI_CTRL+3, tmp|BIT(2)); - mdelay(100); - } - - tmp = rtl_read_byte(rtlpriv, REG_DBI_CTRL+3); - if (tmp&BIT(0) || tmp&BIT(1)) { - RT_TRACE(COMP_INIT, DBG_LOUD, - ("rtl8821ae_check_pcie_dma_hang(): TRUE! Reset PCIE DMA!\n")); - return true; - } else { - return false; - } -} - -void _rtl8821ae_reset_pcie_interface_dma(struct ieee80211_hw *hw, - bool mac_power_on, bool watch_dog) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 tmp; - bool release_mac_rx_pause; - u8 backup_pcie_dma_pause; - - RT_TRACE(COMP_INIT, DBG_LOUD, ("_rtl8821ae_reset_pcie_interface_dma()\n")); - - tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL); - tmp &= ~BIT(1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL, tmp); - tmp = rtl_read_byte(rtlpriv, REG_PMC_DBG_CTRL2); - tmp |= BIT2; - rtl_write_byte(rtlpriv, REG_PMC_DBG_CTRL2, tmp); - - tmp = rtl_read_byte(rtlpriv, REG_RXDMA_CONTROL); - if (tmp & BIT(2)) { - release_mac_rx_pause = false; - } else { - rtl_write_byte(rtlpriv, REG_RXDMA_CONTROL, tmp | BIT(2)); - release_mac_rx_pause = true; - } - backup_pcie_dma_pause = rtl_read_byte(rtlpriv, REG_PCIE_CTRL_REG+1); - if (backup_pcie_dma_pause != 0xFF) - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+1, 0xFF); - - if (mac_power_on) - rtl_write_byte(rtlpriv, REG_CR, 0); - - tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1); - tmp &= ~BIT(0); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, tmp); - - tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1); - tmp |= ~BIT(0); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, tmp); - - if (mac_power_on) - rtl_write_byte(rtlpriv, REG_CR, 0xFF); - - tmp = rtl_read_byte(rtlpriv, REG_MAC_PHY_CTRL_NORMAL+2); - tmp |= BIT1; - rtl_write_byte(rtlpriv, REG_MAC_PHY_CTRL_NORMAL+2, tmp); - - if (watch_dog) { - u32 rqpn = 0; - u32 rqpn_npq = 0; - u8 tx_page_boundary = _RQPN_Init_8812E(Adapter, &rqpn_npq, &rqpn); - - if(LLT_table_init_8812(Adapter, TX_PAGE_BOUNDARY, RQPN, RQPN_NPQ) == RT_STATUS_FAILURE) - return false; - - PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); - PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK); - - // <1> Reset Tx descriptor - Adapter->HalFunc.ResetTxDescHandler(Adapter,Adapter->NumTxDesc); - - // <2> Reset Rx descriptor - Adapter->HalFunc.ResetRxDescHandler(Adapter,Adapter->NumRxDesc); - - // <3> Reset RFDs - FreeRFDs( Adapter, TRUE); - - // <4> Reset TCBs - FreeTCBs( Adapter, TRUE); - - // We should set all Rx desc own bit to 1 to prevent from RDU after enable Rx DMA. 2013.02.18, by tynli. - PrepareAllRxDescBuffer(Adapter); - - PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK); - PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); - - // - // Initialize TRx DMA address. - // - // Because set 0x100 to 0x0 will cause the Rx descriptor address 0x340 be cleared to zero on 88EE, - // we should re-initialize Rx desc. address before enable DMA. 2012.11.07. by tynli. - InitTRxDescHwAddress8812AE(Adapter); - } - - // In MAC power on state, BB and RF maybe in ON state, if we release TRx DMA here - // it will cause packets to be started to Tx/Rx, so we release Tx/Rx DMA later. - if(!bInMACPowerOn || bInWatchDog) - { - // 8. release TRX DMA - //write 0x284 bit[18] = 1'b0 - //write 0x301 = 0x00 - if(bReleaseMACRxPause) - { - u1Tmp = PlatformEFIORead1Byte(Adapter, REG_RXDMA_CONTROL); - PlatformEFIOWrite1Byte(Adapter, REG_RXDMA_CONTROL, (u1Tmp&~BIT2)); - } - PlatformEFIOWrite1Byte(Adapter, REG_PCIE_CTRL_REG+1, BackUpPcieDMAPause); - } - - if(IS_HARDWARE_TYPE_8821E(Adapter)) - { - //9. lock system register - // write 0xCC bit[2] = 1'b0 - u1Tmp = PlatformEFIORead1Byte(Adapter, REG_PMC_DBG_CTRL2_8723B); - u1Tmp &= ~(BIT2); - PlatformEFIOWrite1Byte(Adapter, REG_PMC_DBG_CTRL2_8723B, u1Tmp); - } - - return RT_STATUS_SUCCESS; -} -#endif - -// Static MacID Mapping (cf. Used in MacIdDoStaticMapping) ---------- -#define MAC_ID_STATIC_FOR_DEFAULT_PORT 0 -#define MAC_ID_STATIC_FOR_BROADCAST_MULTICAST 1 -#define MAC_ID_STATIC_FOR_BT_CLIENT_START 2 -#define MAC_ID_STATIC_FOR_BT_CLIENT_END 3 -// ----------------------------------------------------------- - -void rtl8821ae_macid_initialize_mediastatus(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 media_rpt[4] = {RT_MEDIA_CONNECT, 1, \ - MAC_ID_STATIC_FOR_BROADCAST_MULTICAST, \ - MAC_ID_STATIC_FOR_BT_CLIENT_END}; - - rtlpriv->cfg->ops->set_hw_reg(hw, \ - HW_VAR_H2C_FW_MEDIASTATUSRPT, media_rpt); - - RT_TRACE(COMP_INIT,DBG_LOUD, \ - ("Initialize MacId media status: from %d to %d\n", \ - MAC_ID_STATIC_FOR_BROADCAST_MULTICAST, \ - MAC_ID_STATIC_FOR_BT_CLIENT_END)); -} - -int rtl8821ae_hw_init(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - bool rtstatus = true; - int err; - u8 tmp_u1b; - u32 nav_upper = WIFI_NAV_UPPER_US; - - rtlpriv->rtlhal.being_init_adapter = true; - rtlpriv->intf_ops->disable_aspm(hw); - - /*YP wowlan not considered*/ - - tmp_u1b = rtl_read_byte(rtlpriv, REG_CR); - if (tmp_u1b!=0 && tmp_u1b != 0xEA) { - rtlhal->b_mac_func_enable = true; - RT_TRACE(COMP_INIT,DBG_LOUD,(" MAC has already power on.\n")); - } else { - rtlhal->b_mac_func_enable = false; - rtlhal->fw_ps_state = FW_PS_STATE_ALL_ON_8821AE; - } - -/* if (_rtl8821ae_check_pcie_dma_hang(hw)) { - _rtl8821ae_reset_pcie_interface_dma(hw,rtlhal->b_mac_func_enable,false); - rtlhal->b_mac_func_enable = false; - } */ - - rtstatus = _rtl8821ae_init_mac(hw); - if (rtstatus != true) { - RT_TRACE(COMP_ERR, DBG_EMERG, ("Init MAC failed\n")); - err = 1; - return err; - } - - tmp_u1b = rtl_read_byte(rtlpriv, REG_SYS_CFG); - tmp_u1b &= 0x7F; - rtl_write_byte(rtlpriv, REG_SYS_CFG, tmp_u1b); - - err = rtl8821ae_download_fw(hw, false); - if (err) { - RT_TRACE(COMP_ERR, DBG_WARNING, - ("Failed to download FW. Init HW " - "without FW now..\n")); - err = 1; - rtlhal->bfw_ready = false; - return err; - } else { - rtlhal->bfw_ready = true; - } - rtlhal->fw_ps_state = FW_PS_STATE_ALL_ON_8821AE; - rtlhal->bfw_clk_change_in_progress = false; - rtlhal->ballow_sw_to_change_hwclc = false; - rtlhal->last_hmeboxnum = 0; - - /*SIC_Init(Adapter); - if(pHalData->AMPDUBurstMode) - PlatformEFIOWrite1Byte(Adapter,REG_AMPDU_BURST_MODE_8812, 0x7F);*/ - - rtl8821ae_phy_mac_config(hw); - /* because last function modify RCR, so we update - * rcr var here, or TP will unstable for receive_config - * is wrong, RX RCR_ACRC32 will cause TP unstabel & Rx - * RCR_APP_ICV will cause mac80211 unassoc for cisco 1252 - rtlpci->receive_config = rtl_read_dword(rtlpriv, REG_RCR); - rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV); - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config);*/ - rtl8821ae_phy_bb_config(hw); - - rtl8821ae_phy_rf_config(hw); - - _rtl8821ae_hw_configure(hw); - - rtl8821ae_phy_switch_wirelessband(hw, BAND_ON_2_4G); - - /*set wireless mode*/ - - rtlhal->b_mac_func_enable = true; - - rtl_cam_reset_all_entry(hw); - - rtl8821ae_enable_hw_security_config(hw); - - ppsc->rfpwr_state = ERFON; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_ETHER_ADDR, mac->mac_addr); - _rtl8821ae_enable_aspm_back_door(hw); - rtlpriv->intf_ops->enable_aspm(hw); - - //rtl8821ae_bt_hw_init(hw); - rtlpriv->rtlhal.being_init_adapter = false; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_NAV_UPPER, (u8 *)&nav_upper); - - //rtl8821ae_dm_check_txpower_tracking(hw); - //rtl8821ae_phy_lc_calibrate(hw); - - /* Release Rx DMA*/ - tmp_u1b = rtl_read_byte(rtlpriv, REG_RXDMA_CONTROL); - if (tmp_u1b & BIT(2)) { - /* Release Rx DMA if needed*/ - tmp_u1b &= ~BIT(2); - rtl_write_byte(rtlpriv, REG_RXDMA_CONTROL, tmp_u1b); - } - - /* Release Tx/Rx PCIE DMA if*/ - rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG + 1, 0); - - rtl8821ae_dm_init(hw); - rtl8821ae_macid_initialize_mediastatus(hw); - - RT_TRACE(COMP_INIT, DBG_LOUD, ("rtl8821ae_hw_init() <====\n")); - return err; -} - -static enum version_8821ae _rtl8821ae_read_chip_version(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - enum version_8821ae version = VERSION_UNKNOWN; - u32 value32; - - value32 = rtl_read_dword(rtlpriv, REG_SYS_CFG1); - RT_TRACE(COMP_INIT, DBG_LOUD, ("ReadChipVersion8812A 0xF0 = 0x%x \n", value32)); - - - - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtlphy->rf_type = RF_2T2R; - else if(rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) - rtlphy->rf_type = RF_1T1R; - - RT_TRACE(COMP_INIT, DBG_LOUD, ("RF_Type is %x!!\n", rtlphy->rf_type)); - - - if (value32 & TRP_VAUX_EN) - { - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - { - if(rtlphy->rf_type == RF_2T2R) - version = VERSION_TEST_CHIP_2T2R_8812; - else - version = VERSION_TEST_CHIP_1T1R_8812; - } - else - version = VERSION_TEST_CHIP_8821; - } else { - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - { - u32 rtl_id = ((value32 & CHIP_VER_RTL_MASK) >> 12) +1 ; - - if(rtlphy->rf_type == RF_2T2R) - version = (enum version_8821ae)(CHIP_8812 | NORMAL_CHIP | RF_TYPE_2T2R); - else - version = (enum version_8821ae)(CHIP_8812 | NORMAL_CHIP); - - version = (enum version_8821ae)(version| (rtl_id << 12)); - } - else if(rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) - { - u32 rtl_id = value32 & CHIP_VER_RTL_MASK; - - version = (enum version_8821ae)(CHIP_8821 | NORMAL_CHIP | rtl_id); - } - } - - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip RF Type: %s\n", (rtlphy->rf_type == RF_2T2R) ? - "RF_2T2R" : "RF_1T1R")); - - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) - { - /*WL_HWROF_EN.*/ - value32 = rtl_read_dword(rtlpriv, REG_MULTI_FUNC_CTRL); - rtlphy->hw_rof_enable= ((value32 & WL_HWROF_EN) ? 1 : 0); - } - - switch(version) - { - case VERSION_TEST_CHIP_1T1R_8812: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_TEST_CHIP_1T1R_8812.\n")); - break; - case VERSION_TEST_CHIP_2T2R_8812: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_TEST_CHIP_2T2R_8812.\n")); - break; - case VERSION_NORMAL_TSMC_CHIP_1T1R_8812: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_NORMAL_TSMC_CHIP_1T1R_8812.\n")); - break; - case VERSION_NORMAL_TSMC_CHIP_2T2R_8812: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_NORMAL_TSMC_CHIP_2T2R_8812.\n")); - break; - case VERSION_NORMAL_TSMC_CHIP_1T1R_8812_C_CUT: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_NORMAL_TSMC_CHIP_1T1R_8812 C CUT.\n")); - break; - case VERSION_NORMAL_TSMC_CHIP_2T2R_8812_C_CUT: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_NORMAL_TSMC_CHIP_2T2R_8812 C CUT.\n")); - break; - case VERSION_TEST_CHIP_8821: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_TEST_CHIP_8821.\n")); - break; - case VERSION_NORMAL_TSMC_CHIP_8821: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_NORMAL_TSMC_CHIP_8821 A CUT.\n")); - break; - case VERSION_NORMAL_TSMC_CHIP_8821_B_CUT: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: VERSION_NORMAL_TSMC_CHIP_8821 B CUT.\n")); - break; - default: - RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: Unknow (0x%X).\n", version)); - break; - } - - return version; -} - -static int _rtl8821ae_set_media_status(struct ieee80211_hw *hw, - enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 bt_msr = rtl_read_byte(rtlpriv, MSR); - enum led_ctl_mode ledaction = LED_CTL_NO_LINK; - bt_msr &= 0xfc; - - rtl_write_dword(rtlpriv, REG_BCN_CTRL, 0); - RT_TRACE(COMP_BEACON, DBG_LOUD, - ("clear 0x550 when set HW_VAR_MEDIA_STATUS\n")); - - if (type == NL80211_IFTYPE_UNSPECIFIED || - type == NL80211_IFTYPE_STATION) { - _rtl8821ae_stop_tx_beacon(hw); - _rtl8821ae_enable_bcn_sub_func(hw); - } else if (type == NL80211_IFTYPE_ADHOC || - type == NL80211_IFTYPE_AP) { - _rtl8821ae_resume_tx_beacon(hw); - _rtl8821ae_disable_bcn_sub_func(hw); - } else { - RT_TRACE(COMP_ERR, DBG_WARNING,("Set HW_VAR_MEDIA_STATUS: " - "No such media status(%x).\n", type)); - } - - switch (type) { - case NL80211_IFTYPE_UNSPECIFIED: - bt_msr |= MSR_NOLINK; - ledaction = LED_CTL_LINK; - RT_TRACE(COMP_INIT, DBG_TRACE, ("Set Network type to NO LINK!\n")); - break; - case NL80211_IFTYPE_ADHOC: - bt_msr |= MSR_ADHOC; - RT_TRACE(COMP_INIT, DBG_TRACE, ("Set Network type to Ad Hoc!\n")); - break; - case NL80211_IFTYPE_STATION: - bt_msr |= MSR_INFRA; - ledaction = LED_CTL_LINK; - RT_TRACE(COMP_INIT, DBG_TRACE, ("Set Network type to STA!\n")); - break; - case NL80211_IFTYPE_AP: - bt_msr |= MSR_AP; - RT_TRACE(COMP_INIT, DBG_TRACE, ("Set Network type to AP!\n")); - break; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, ("Network type %d not support!\n", type)); - return 1; - break; - - } - - rtl_write_byte(rtlpriv, (MSR), bt_msr); - rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0xfc) == MSR_AP) - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); - else - rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); - - return 0; -} - -void rtl8821ae_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u32 reg_rcr = rtlpci->receive_config; - - if (rtlpriv->psc.rfpwr_state != ERFON) - return; - - if (check_bssid == true) { - reg_rcr |= (RCR_CBSSID_DATA | RCR_CBSSID_BCN); - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_RCR, - (u8 *) (®_rcr)); - _rtl8821ae_set_bcn_ctrl_reg(hw, 0, BIT(4)); - } else if (check_bssid == false) { - reg_rcr &= (~(RCR_CBSSID_DATA | RCR_CBSSID_BCN)); - _rtl8821ae_set_bcn_ctrl_reg(hw, BIT(4), 0); - rtlpriv->cfg->ops->set_hw_reg(hw, - HW_VAR_RCR, (u8 *) (®_rcr)); - } - -} - -int rtl8821ae_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_INIT, DBG_LOUD, ("rtl8821ae_set_network_type!\n")); - - if (_rtl8821ae_set_media_status(hw, type)) - return -EOPNOTSUPP; - - if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { - if (type != NL80211_IFTYPE_AP) - rtl8821ae_set_check_bssid(hw, true); - } else { - rtl8821ae_set_check_bssid(hw, false); - } - - return 0; -} - -/* don't set REG_EDCA_BE_PARAM here because mac80211 will send pkt when scan */ -void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - rtl8821ae_dm_init_edca_turbo(hw); - switch (aci) { - case AC1_BK: - rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0xa44f); - break; - case AC0_BE: - /* rtl_write_dword(rtlpriv, REG_EDCA_BE_PARAM, u4b_ac_param); */ - break; - case AC2_VI: - rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, 0x5e4322); - break; - case AC3_VO: - rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222); - break; - default: - RT_ASSERT(false, ("invalid aci: %d !\n", aci)); - break; - } -} - -void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, REG_HIMR, rtlpci->irq_mask[0] & 0xFFFFFFFF); - rtl_write_dword(rtlpriv, REG_HIMRE, rtlpci->irq_mask[1] & 0xFFFFFFFF); - rtlpci->irq_enabled = true; - /* there are some C2H CMDs have been sent before system interrupt is enabled, e.g., C2H, CPWM. - *So we need to clear all C2H events that FW has notified, otherwise FW won't schedule any commands anymore. - */ - //rtl_write_byte(rtlpriv, REG_C2HEVT_CLEAR, 0); - /*enable system interrupt*/ - rtl_write_dword(rtlpriv, REG_HSIMR, rtlpci->sys_irq_mask & 0xFFFFFFFF); -} - -void rtl8821ae_disable_interrupt(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - rtl_write_dword(rtlpriv, REG_HIMR, IMR_DISABLED); - rtl_write_dword(rtlpriv, REG_HIMRE, IMR_DISABLED); - rtlpci->irq_enabled = false; - synchronize_irq(rtlpci->pdev->irq); -} - -static void _rtl8821ae_poweroff_adapter(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 u1b_tmp; - - rtlhal->b_mac_func_enable = false; - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { - /* Combo (PCIe + USB) Card and PCIe-MF Card */ - /* 1. Run LPS WL RFOFF flow */ - //RT_TRACE(COMP_INIT, DBG_LOUD, ("=====>CardDisableRTL8812E,RTL8821A_NIC_LPS_ENTER_FLOW\n")); - rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, RTL8821A_NIC_LPS_ENTER_FLOW); - } - /* 2. 0x1F[7:0] = 0 */ - /* turn off RF */ - //rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00); - if ((rtl_read_byte(rtlpriv, REG_MCUFWDL) & BIT(7)) && - rtlhal->bfw_ready ) { - rtl8821ae_firmware_selfreset(hw); - } - - /* Reset MCU. Suggested by Filen. */ - u1b_tmp = rtl_read_byte(rtlpriv, REG_SYS_FUNC_EN+1); - rtl_write_byte(rtlpriv, REG_SYS_FUNC_EN+1, (u1b_tmp & (~BIT(2)))); - - /* g. MCUFWDL 0x80[1:0]=0 */ - /* reset MCU ready status */ - rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) { - /* HW card disable configuration. */ - rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, RTL8821A_NIC_DISABLE_FLOW); - } else { - /* HW card disable configuration. */ - rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, - PWR_INTF_PCI_MSK, RTL8812_NIC_DISABLE_FLOW); - } - - /* Reset MCU IO Wrapper */ - u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL + 1, (u1b_tmp & (~BIT(0)))); - u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1); - rtl_write_byte(rtlpriv, REG_RSV_CTRL + 1, u1b_tmp | BIT(0)); - - /* 7. RSV_CTRL 0x1C[7:0] = 0x0E */ - /* lock ISO/CLK/Power control register */ - rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x0e); -} - -void rtl8821ae_card_disable(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - enum nl80211_iftype opmode; - - RT_TRACE(COMP_INIT, DBG_LOUD, - ("rtl8821ae_card_disable.\n")); - - mac->link_state = MAC80211_NOLINK; - opmode = NL80211_IFTYPE_UNSPECIFIED; - _rtl8821ae_set_media_status(hw, opmode); - if (rtlpriv->rtlhal.driver_is_goingto_unload || - ppsc->rfoff_reason > RF_CHANGE_BY_PS) - rtlpriv->cfg->ops->led_control(hw, LED_CTL_POWER_OFF); - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - _rtl8821ae_poweroff_adapter(hw); - - /* after power off we should do iqk again */ - rtlpriv->phy.iqk_initialized = false; -} - -void rtl8821ae_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - *p_inta = rtl_read_dword(rtlpriv, ISR) & rtlpci->irq_mask[0]; - rtl_write_dword(rtlpriv, ISR, *p_inta); - - - *p_intb = rtl_read_dword(rtlpriv, REG_HISRE) & rtlpci->irq_mask[1]; - rtl_write_dword(rtlpriv, REG_HISRE, *p_intb); - -} - - -void rtl8821ae_set_beacon_related_registers(struct ieee80211_hw *hw) -{ - - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u16 bcn_interval, atim_window; - - bcn_interval = mac->beacon_interval; - atim_window = 2; /*FIX MERGE */ - rtl8821ae_disable_interrupt(hw); - rtl_write_word(rtlpriv, REG_ATIMWND, atim_window); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - rtl_write_word(rtlpriv, REG_BCNTCFG, 0x660f); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_CCK, 0x18); - rtl_write_byte(rtlpriv, REG_RXTSF_OFFSET_OFDM, 0x18); - rtl_write_byte(rtlpriv, 0x606, 0x30); - rtlpci->reg_bcn_ctrl_val |= BIT(3); - rtl_write_byte(rtlpriv, REG_BCN_CTRL, (u8) rtlpci->reg_bcn_ctrl_val); - rtl8821ae_enable_interrupt(hw); -} - -void rtl8821ae_set_beacon_interval(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 bcn_interval = mac->beacon_interval; - - RT_TRACE(COMP_BEACON, DBG_DMESG, - ("beacon_interval:%d\n", bcn_interval)); - rtl8821ae_disable_interrupt(hw); - rtl_write_word(rtlpriv, REG_BCN_INTERVAL, bcn_interval); - rtl8821ae_enable_interrupt(hw); -} - -void rtl8821ae_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - RT_TRACE(COMP_INTR, DBG_LOUD, - ("add_msr:%x, rm_msr:%x\n", add_msr, rm_msr)); - - if (add_msr) - rtlpci->irq_mask[0] |= add_msr; - if (rm_msr) - rtlpci->irq_mask[0] &= (~rm_msr); - rtl8821ae_disable_interrupt(hw); - rtl8821ae_enable_interrupt(hw); -} - -static u8 _rtl8821ae_get_chnl_group(u8 chnl) -{ - u8 group = 0; - - if (chnl <= 14) { - if (1 <= chnl && chnl <= 2 ) - group = 0; - else if (3 <= chnl && chnl <= 5 ) - group = 1; - else if (6 <= chnl && chnl <= 8 ) - group = 2; - else if (9 <= chnl && chnl <= 11) - group = 3; - else /*if (12 <= chnl && chnl <= 14)*/ - group = 4; - } else { - if (36 <= chnl && chnl <= 42) - group = 0; - else if (44 <= chnl && chnl <= 48) - group = 1; - else if (50 <= chnl && chnl <= 58) - group = 2; - else if (60 <= chnl && chnl <= 64) - group = 3; - else if (100 <= chnl && chnl <= 106) - group = 4; - else if (108 <= chnl && chnl <= 114) - group = 5; - else if (116 <= chnl && chnl <= 122) - group = 6; - else if (124 <= chnl && chnl <= 130) - group = 7; - else if (132 <= chnl && chnl <= 138) - group = 8; - else if (140 <= chnl && chnl <= 144) - group = 9; - else if (149 <= chnl && chnl <= 155) - group = 10; - else if (157 <= chnl && chnl <= 161) - group = 11; - else if (165 <= chnl && chnl <= 171) - group = 12; - else if (173 <= chnl && chnl <= 177) - group = 13; - else - /*RT_TRACE(COMP_EFUSE,DBG_LOUD, - ("5G, Channel %d in Group not found \n",chnl));*/ - RT_ASSERT(!COMP_EFUSE, - ("5G, Channel %d in Group not found \n",chnl)); - } - return group; -} - -static void _rtl8821ae_read_power_value_fromprom(struct ieee80211_hw *hw, - struct txpower_info_2g *pwrinfo24g, - struct txpower_info_5g *pwrinfo5g, - bool autoload_fail, - u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u32 rfPath, eeAddr=EEPROM_TX_PWR_INX, group,TxCount=0; - - RT_TRACE(COMP_INIT, DBG_LOUD, ("hal_ReadPowerValueFromPROM8821ae(): PROMContent[0x%x]=0x%x\n", (eeAddr+1), hwinfo[eeAddr+1])); - if (0xFF == hwinfo[eeAddr+1]) /*YJ,add,120316*/ - autoload_fail = true; - - if (autoload_fail) - { - RT_TRACE(COMP_INIT, DBG_LOUD, ("auto load fail : Use Default value!\n")); - for (rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) { - /*2.4G default value*/ - for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { - pwrinfo24g->index_cck_base[rfPath][group] = 0x2D; - pwrinfo24g->index_bw40_base[rfPath][group] = 0x2D; - } - for (TxCount = 0;TxCount < MAX_TX_COUNT;TxCount++) { - if (TxCount == 0) { - pwrinfo24g->bw20_diff[rfPath][0] = 0x02; - pwrinfo24g->ofdm_diff[rfPath][0] = 0x04; - } else { - pwrinfo24g->bw20_diff[rfPath][TxCount] = 0xFE; - pwrinfo24g->bw40_diff[rfPath][TxCount] = 0xFE; - pwrinfo24g->cck_diff[rfPath][TxCount] = 0xFE; - pwrinfo24g->ofdm_diff[rfPath][TxCount] = 0xFE; - } - } - /*5G default value*/ - for (group = 0 ; group < MAX_CHNL_GROUP_5G; group++) - pwrinfo5g->index_bw40_base[rfPath][group] = 0x2A; - - for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { - if (TxCount == 0) { - pwrinfo5g->ofdm_diff[rfPath][0] = 0x04; - pwrinfo5g->bw20_diff[rfPath][0] = 0x00; - pwrinfo5g->bw80_diff[rfPath][0] = 0xFE; - pwrinfo5g->bw160_diff[rfPath][0] = 0xFE; - } else { - pwrinfo5g->ofdm_diff[rfPath][0] = 0xFE; - pwrinfo5g->bw20_diff[rfPath][0] = 0xFE; - pwrinfo5g->bw40_diff[rfPath][0] = 0xFE; - pwrinfo5g->bw80_diff[rfPath][0] = 0xFE; - pwrinfo5g->bw160_diff[rfPath][0] = 0xFE; - } - } - } - return; - } - - rtl_priv(hw)->efuse.b_txpwr_fromeprom = true; - - for (rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) { - /*2.4G default value*/ - for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) { - pwrinfo24g->index_cck_base[rfPath][group] = hwinfo[eeAddr++]; - if (pwrinfo24g->index_cck_base[rfPath][group] == 0xFF) - pwrinfo24g->index_cck_base[rfPath][group] = 0x2D; - } - for (group = 0 ; group < MAX_CHNL_GROUP_24G - 1; group++) { - pwrinfo24g->index_bw40_base[rfPath][group] = hwinfo[eeAddr++]; - if (pwrinfo24g->index_bw40_base[rfPath][group] == 0xFF) - pwrinfo24g->index_bw40_base[rfPath][group] = 0x2D; - } - for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount ++) { - if (TxCount == 0) { - pwrinfo24g->bw40_diff[rfPath][TxCount] = 0; - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo24g->bw20_diff[rfPath][TxCount] = 0x02; - } else { - pwrinfo24g->bw20_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0xf0) >> 4; - if (pwrinfo24g->bw20_diff[rfPath][TxCount] & BIT(3)) /*bit sign number to 8 bit sign number*/ - pwrinfo24g->bw20_diff[rfPath][TxCount] |= 0xF0; - } - - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo24g->ofdm_diff[rfPath][TxCount] = 0x04; - } else { - pwrinfo24g->ofdm_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); - if(pwrinfo24g->ofdm_diff[rfPath][TxCount] & BIT(3)) /*bit sign number to 8 bit sign number*/ - pwrinfo24g->ofdm_diff[rfPath][TxCount] |= 0xF0; - } - pwrinfo24g->cck_diff[rfPath][TxCount] = 0; - eeAddr++; - } else { - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo24g->bw40_diff[rfPath][TxCount] = 0xFE; - } else { - pwrinfo24g->bw40_diff[rfPath][TxCount] = (hwinfo[eeAddr]&0xf0) >> 4; - if (pwrinfo24g->bw40_diff[rfPath][TxCount] & BIT(3)) - pwrinfo24g->bw40_diff[rfPath][TxCount] |= 0xF0; - } - - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo24g->bw20_diff[rfPath][TxCount] = 0xFE; - } else { - pwrinfo24g->bw20_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); - if (pwrinfo24g->bw20_diff[rfPath][TxCount] & BIT(3)) - pwrinfo24g->bw20_diff[rfPath][TxCount] |= 0xF0; - } - - eeAddr++; - - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo24g->ofdm_diff[rfPath][TxCount] = 0xFE; - } else { - pwrinfo24g->ofdm_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0xf0) >> 4; - if(pwrinfo24g->ofdm_diff[rfPath][TxCount] & BIT(3)) - pwrinfo24g->ofdm_diff[rfPath][TxCount] |= 0xF0; - } - - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo24g->cck_diff[rfPath][TxCount] = 0xFE; - } else { - pwrinfo24g->cck_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); - if(pwrinfo24g->cck_diff[rfPath][TxCount] & BIT(3)) - pwrinfo24g->cck_diff[rfPath][TxCount] |= 0xF0; - } - eeAddr++; - } - } - - /*5G default value*/ - for (group = 0 ; group < MAX_CHNL_GROUP_5G; group ++) { - pwrinfo5g->index_bw40_base[rfPath][group] = hwinfo[eeAddr++]; - if (pwrinfo5g->index_bw40_base[rfPath][group] == 0xFF) - pwrinfo5g->index_bw40_base[rfPath][group] = 0xFE; - } - - for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { - if (TxCount == 0) { - pwrinfo5g->bw40_diff[rfPath][TxCount] = 0; - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo5g->bw20_diff[rfPath][TxCount] = 0x0; - } else { - pwrinfo5g->bw20_diff[rfPath][0] = (hwinfo[eeAddr] & 0xf0) >> 4; - if(pwrinfo5g->bw20_diff[rfPath][TxCount] & BIT(3)) - pwrinfo5g->bw20_diff[rfPath][TxCount] |= 0xF0; - } - - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo5g->ofdm_diff[rfPath][TxCount] = 0x4; - } else { - pwrinfo5g->ofdm_diff[rfPath][0] = (hwinfo[eeAddr] & 0x0f); - if(pwrinfo5g->ofdm_diff[rfPath][TxCount] & BIT(3)) - pwrinfo5g->ofdm_diff[rfPath][TxCount] |= 0xF0; - } - eeAddr++; - } else { - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo5g->bw40_diff[rfPath][TxCount] = 0xFE; - } else { - pwrinfo5g->bw40_diff[rfPath][TxCount]= (hwinfo[eeAddr] & 0xf0) >> 4; - if(pwrinfo5g->bw40_diff[rfPath][TxCount] & BIT(3)) - pwrinfo5g->bw40_diff[rfPath][TxCount] |= 0xF0; - } - - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo5g->bw20_diff[rfPath][TxCount] = 0xFE; - } else { - pwrinfo5g->bw20_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0x0f); - if(pwrinfo5g->bw20_diff[rfPath][TxCount] & BIT(3)) - pwrinfo5g->bw20_diff[rfPath][TxCount] |= 0xF0; - } - eeAddr++; - } - } - - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo5g->ofdm_diff[rfPath][1] = 0xFE; - pwrinfo5g->ofdm_diff[rfPath][2] = 0xFE; - } else { - pwrinfo5g->ofdm_diff[rfPath][1] = (hwinfo[eeAddr] & 0xf0) >> 4; - pwrinfo5g->ofdm_diff[rfPath][2] = (hwinfo[eeAddr] & 0x0f); - } - eeAddr++; - if (hwinfo[eeAddr] == 0xFF) - pwrinfo5g->ofdm_diff[rfPath][3] = 0xFE; - else - pwrinfo5g->ofdm_diff[rfPath][3] = (hwinfo[eeAddr] & 0x0f); - - eeAddr++; - - for (TxCount = 1; TxCount < MAX_TX_COUNT; TxCount++) { - if (pwrinfo5g->ofdm_diff[rfPath][TxCount] == 0xFF) - pwrinfo5g->ofdm_diff[rfPath][TxCount] = 0xFE; - else if(pwrinfo5g->ofdm_diff[rfPath][TxCount] & BIT(3)) - pwrinfo5g->ofdm_diff[rfPath][TxCount] |= 0xF0; - } - for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo5g->bw80_diff[rfPath][TxCount] = 0xFE; - } else { - pwrinfo5g->bw80_diff[rfPath][TxCount] = (hwinfo[eeAddr] & 0xf0) >> 4; - if(pwrinfo5g->bw80_diff[rfPath][TxCount] & BIT(3)) //4bit sign number to 8 bit sign number - pwrinfo5g->bw80_diff[rfPath][TxCount] |= 0xF0; - } - - if (hwinfo[eeAddr] == 0xFF) { - pwrinfo5g->bw160_diff[rfPath][TxCount] = 0xFE; - } else { - pwrinfo5g->bw160_diff[rfPath][TxCount]= (hwinfo[eeAddr] & 0x0f); - if(pwrinfo5g->bw160_diff[rfPath][TxCount] & BIT(3)) //4bit sign number to 8 bit sign number - pwrinfo5g->bw160_diff[rfPath][TxCount] |= 0xF0; - } - eeAddr++; - } - } -} - -static void _rtl8812ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct txpower_info_2g pwrinfo24g; - struct txpower_info_5g pwrinfo5g; - u8 channel5g[CHANNEL_MAX_NUMBER_5G] = - {36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,100,102,104,106,108,110,112, - 114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,149,151, - 153,155,157,159,161,163,165,167,168,169,171,173,175,177}; - u8 channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = {42, 58, 106, 122, 138, 155, 171}; - u8 rf_path, index; - u8 i; - - _rtl8821ae_read_power_value_fromprom(hw, &pwrinfo24g, &pwrinfo5g, autoload_fail, hwinfo); - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < CHANNEL_MAX_NUMBER_2G; i++) { - index = _rtl8821ae_get_chnl_group(i + 1); - - if (i == CHANNEL_MAX_NUMBER_2G - 1) { - rtlefuse->txpwrlevel_cck[rf_path][i] = - pwrinfo24g.index_cck_base[rf_path][5]; - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = - pwrinfo24g.index_bw40_base[rf_path][index]; - } else { - rtlefuse->txpwrlevel_cck[rf_path][i] = - pwrinfo24g.index_cck_base[rf_path][index]; - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = - pwrinfo24g.index_bw40_base[rf_path][index]; - } - } - - for (i = 0; i < CHANNEL_MAX_NUMBER_5G; i++) { - index = _rtl8821ae_get_chnl_group(channel5g[i]); - rtlefuse->txpwr_5g_bw40base[rf_path][i] = pwrinfo5g.index_bw40_base[rf_path][index]; - } - for (i = 0; i < CHANNEL_MAX_NUMBER_5G_80M; i++) { - u8 upper, lower; - index = _rtl8821ae_get_chnl_group(channel5g_80m[i]); - upper = pwrinfo5g.index_bw40_base[rf_path][index]; - lower = pwrinfo5g.index_bw40_base[rf_path][index + 1]; - - rtlefuse->txpwr_5g_bw80base[rf_path][i] = (upper + lower) / 2; - } - for (i = 0; i < MAX_TX_COUNT; i++) { - rtlefuse->txpwr_cckdiff[rf_path][i] = pwrinfo24g.cck_diff[rf_path][i]; - rtlefuse->txpwr_legacyhtdiff[rf_path][i] = pwrinfo24g.ofdm_diff[rf_path][i]; - rtlefuse->txpwr_ht20diff[rf_path][i] = pwrinfo24g.bw20_diff[rf_path][i]; - rtlefuse->txpwr_ht40diff[rf_path][i] = pwrinfo24g.bw40_diff[rf_path][i]; - - rtlefuse->txpwr_5g_ofdmdiff[rf_path][i] = pwrinfo5g.ofdm_diff[rf_path][i]; - rtlefuse->txpwr_5g_bw20diff[rf_path][i] = pwrinfo5g.bw20_diff[rf_path][i]; - rtlefuse->txpwr_5g_bw40diff[rf_path][i] = pwrinfo5g.bw40_diff[rf_path][i]; - rtlefuse->txpwr_5g_bw80diff[rf_path][i] = pwrinfo5g.bw80_diff[rf_path][i]; - } - } - - if (!autoload_fail){ - rtlefuse->eeprom_regulatory = - hwinfo[EEPROM_RF_BOARD_OPTION] & 0x07;/*bit0~2*/ - if (hwinfo[EEPROM_RF_BOARD_OPTION] == 0xFF) - rtlefuse->eeprom_regulatory = 0; - } else { - rtlefuse->eeprom_regulatory = 0; - } - - RTPRINT(rtlpriv, FINIT, INIT_TxPower, - ("eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory )); -} - -static void _rtl8821ae_read_txpower_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct txpower_info_2g pwrinfo24g; - struct txpower_info_5g pwrinfo5g; - u8 channel5g[CHANNEL_MAX_NUMBER_5G] = - {36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,100,102,104,106,108,110,112, - 114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,149,151, - 153,155,157,159,161,163,165,167,168,169,171,173,175,177}; - u8 channel5g_80m[CHANNEL_MAX_NUMBER_5G_80M] = {42, 58, 106, 122, 138, 155, 171}; - u8 rf_path, index; - u8 i; - - _rtl8821ae_read_power_value_fromprom(hw, &pwrinfo24g, &pwrinfo5g, autoload_fail, hwinfo); - - for (rf_path = 0; rf_path < 2; rf_path++) { - for (i = 0; i < CHANNEL_MAX_NUMBER_2G; i++) { - index = _rtl8821ae_get_chnl_group(i + 1); - - if (i == CHANNEL_MAX_NUMBER_2G - 1) { - rtlefuse->txpwrlevel_cck[rf_path][i] = pwrinfo24g.index_cck_base[rf_path][5]; - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = pwrinfo24g.index_bw40_base[rf_path][index]; - } else { - rtlefuse->txpwrlevel_cck[rf_path][i] = pwrinfo24g.index_cck_base[rf_path][index]; - rtlefuse->txpwrlevel_ht40_1s[rf_path][i] = pwrinfo24g.index_bw40_base[rf_path][index]; - } - } - - for (i = 0; i < CHANNEL_MAX_NUMBER_5G; i++) { - index = _rtl8821ae_get_chnl_group(channel5g[i]); - rtlefuse->txpwr_5g_bw40base[rf_path][i] = pwrinfo5g.index_bw40_base[rf_path][index]; - } - for (i = 0; i < CHANNEL_MAX_NUMBER_5G_80M; i++) { - u8 upper, lower; - index = _rtl8821ae_get_chnl_group(channel5g_80m[i]); - upper = pwrinfo5g.index_bw40_base[rf_path][index]; - lower = pwrinfo5g.index_bw40_base[rf_path][index + 1]; - - rtlefuse->txpwr_5g_bw80base[rf_path][i] = (upper + lower) / 2; - } - for (i = 0; i < MAX_TX_COUNT; i++) { - rtlefuse->txpwr_cckdiff[rf_path][i] = pwrinfo24g.cck_diff[rf_path][i]; - rtlefuse->txpwr_legacyhtdiff[rf_path][i] = pwrinfo24g.ofdm_diff[rf_path][i]; - rtlefuse->txpwr_ht20diff[rf_path][i] = pwrinfo24g.bw20_diff[rf_path][i]; - rtlefuse->txpwr_ht40diff[rf_path][i] = pwrinfo24g.bw40_diff[rf_path][i]; - - rtlefuse->txpwr_5g_ofdmdiff[rf_path][i] = pwrinfo5g.ofdm_diff[rf_path][i]; - rtlefuse->txpwr_5g_bw20diff[rf_path][i] = pwrinfo5g.bw20_diff[rf_path][i]; - rtlefuse->txpwr_5g_bw40diff[rf_path][i] = pwrinfo5g.bw40_diff[rf_path][i]; - rtlefuse->txpwr_5g_bw80diff[rf_path][i] = pwrinfo5g.bw80_diff[rf_path][i]; - } - } - - if (!autoload_fail){ - rtlefuse->eeprom_regulatory = hwinfo[EEPROM_RF_BOARD_OPTION] & 0x07;/*bit0~2*/ - if (hwinfo[EEPROM_RF_BOARD_OPTION] == 0xFF) - rtlefuse->eeprom_regulatory = 0; - } else { - rtlefuse->eeprom_regulatory = 0; - } - - RTPRINT(rtlpriv, FINIT, INIT_TxPower, - ("eeprom_regulatory = 0x%x\n", rtlefuse->eeprom_regulatory )); -} - -static void _rtl8812ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_test ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - - if (b_pseudo_test) { - /* need add */ - } - - if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - rtl_efuse_shadow_map_update(hw); - memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - HWSET_MAX_SIZE); - } else if (rtlefuse->epromtype == EEPROM_93C46) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("RTL819X Not boot from eeprom, check it !!")); - } - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP \n"), - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *) & hwinfo[0]); - if (eeprom_id != RTL_EEPROM_ID) { - RT_TRACE(COMP_ERR, DBG_WARNING, - ("EEPROM ID(%#x) is invalid!!\n", eeprom_id)); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(COMP_INIT, DBG_LOUD, ("Autoload OK\n")); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag == true) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("RTL8812AE autoload_failflag, check it !!")); - return; - } - - rtlefuse->eeprom_version = *(u8 *) & hwinfo[EEPROM_VERSION]; - if (rtlefuse->eeprom_version == 0xff) - rtlefuse->eeprom_version = 0; - - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM version: 0x%2x\n", rtlefuse->eeprom_version)); - - rtlefuse->eeprom_vid = *(u16 *) &hwinfo[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *) &hwinfo[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *) &hwinfo[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *) &hwinfo[EEPROM_SMID]; - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROMId = 0x%4x\n", eeprom_id)); - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid)); - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did)); - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid)); - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid)); - - /*customer ID*/ - rtlefuse->eeprom_oemid = *(u8 *) & hwinfo[EEPROM_CUSTOMER_ID]; - if (rtlefuse->eeprom_oemid == 0xFF) - rtlefuse->eeprom_oemid = 0; - - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid)); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *) & hwinfo[EEPROM_MAC_ADDR + i]; - *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; - } - - RT_TRACE(COMP_INIT, DBG_DMESG, - ("dev_addr: %pM\n", rtlefuse->dev_addr)); - - _rtl8812ae_read_txpower_info_from_hwpg(hw, - rtlefuse->autoload_failflag, hwinfo); - - /*board type*/ - rtlefuse->board_type = (((*(u8 *) & hwinfo[EEPROM_RF_BOARD_OPTION]) & 0xE0 ) >> 5); - if ((*(u8 *) & hwinfo[EEPROM_RF_BOARD_OPTION]) == 0xff ) - rtlefuse->board_type = 0; - rtlhal->boad_type = rtlefuse->board_type; - - rtl8812ae_read_bt_coexist_info_from_hwpg(hw, - rtlefuse->autoload_failflag, hwinfo); - - rtlefuse->eeprom_channelplan = *(u8 *) & hwinfo[EEPROM_CHANNELPLAN]; - if (rtlefuse->eeprom_channelplan == 0xff) - rtlefuse->eeprom_channelplan = 0x7F; - - /* set channel paln to world wide 13 */ - //rtlefuse->channel_plan = (u8) rtlefuse->eeprom_channelplan; - - /*parse xtal*/ - rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_8821AE]; - if ( rtlefuse->crystalcap == 0xFF ) - rtlefuse->crystalcap = 0x20; - - rtlefuse->eeprom_thermalmeter = *(u8 *) & hwinfo[EEPROM_THERMAL_METER]; - if ((rtlefuse->eeprom_thermalmeter == 0xff) ||rtlefuse->autoload_failflag ) - { - rtlefuse->b_apk_thermalmeterignore = true; - rtlefuse->eeprom_thermalmeter = 0xff; - } - - rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; - RT_TRACE(COMP_INIT, DBG_LOUD, - ("thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter)); - - if (rtlefuse->autoload_failflag == false) { - rtlefuse->antenna_div_cfg = *(u8 *) & hwinfo[EEPROM_RF_BOARD_OPTION] & 0x18 >> 3; - if (*(u8 *) & hwinfo[EEPROM_RF_BOARD_OPTION] == 0xff) - rtlefuse->antenna_div_cfg = 0x00; - /*if (BT_1ant()) - rtlefuse->antenna_div_cfg = 0;*/ - rtlefuse->antenna_div_type = *(u8 *) & hwinfo[EEPROM_RF_ANTENNA_OPT_88E]; - if (rtlefuse->antenna_div_type == 0xFF) - { - rtlefuse->antenna_div_type = FIXED_HW_ANTDIV; - } - } else { - rtlefuse->antenna_div_cfg = 0; - rtlefuse->antenna_div_type = 0; - } - - RT_TRACE(COMP_INIT, DBG_LOUD, - ("SWAS: bHwAntDiv = %x, TRxAntDivType = %x\n", - rtlefuse->antenna_div_cfg, rtlefuse->antenna_div_type)); - - /*Hal_ReadPAType_8821A()*/ - /*Hal_EfuseParseRateIndicationOption8821A()*/ - /*Hal_ReadEfusePCIeCap8821AE()*/ - - pcipriv->ledctl.bled_opendrain = true; - - if (rtlhal->oem_id == RT_CID_DEFAULT) { - switch (rtlefuse->eeprom_oemid) { - case RT_CID_DEFAULT: - break; - case EEPROM_CID_TOSHIBA: - rtlhal->oem_id = RT_CID_TOSHIBA; - break; - case EEPROM_CID_CCX: - rtlhal->oem_id = RT_CID_CCX; - break; - case EEPROM_CID_QMI: - rtlhal->oem_id = RT_CID_819x_QMI; - break; - case EEPROM_CID_WHQL: - break; - default: - break; - - } - } -} - -static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_test ) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u16 i, usvalue; - u8 hwinfo[HWSET_MAX_SIZE]; - u16 eeprom_id; - - if (b_pseudo_test) { - /* need add */ - } - - if (rtlefuse->epromtype == EEPROM_BOOT_EFUSE) { - rtl_efuse_shadow_map_update(hw); - memcpy(hwinfo, &rtlefuse->efuse_map[EFUSE_INIT_MAP][0], - HWSET_MAX_SIZE); - } else if (rtlefuse->epromtype == EEPROM_93C46) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("RTL819X Not boot from eeprom, check it !!")); - } - - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("MAP \n"), - hwinfo, HWSET_MAX_SIZE); - - eeprom_id = *((u16 *) & hwinfo[0]); - if (eeprom_id != RTL_EEPROM_ID) { - RT_TRACE(COMP_ERR, DBG_WARNING, - ("EEPROM ID(%#x) is invalid!!\n", eeprom_id)); - rtlefuse->autoload_failflag = true; - } else { - RT_TRACE(COMP_INIT, DBG_LOUD, ("Autoload OK\n")); - rtlefuse->autoload_failflag = false; - } - - if (rtlefuse->autoload_failflag == true) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("RTL8812AE autoload_failflag, check it !!")); - return; - } - - rtlefuse->eeprom_version = *(u8 *) & hwinfo[EEPROM_VERSION]; - if (rtlefuse->eeprom_version == 0xff) - rtlefuse->eeprom_version = 0; - - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM version: 0x%2x\n", rtlefuse->eeprom_version)); - - rtlefuse->eeprom_vid = *(u16 *) &hwinfo[EEPROM_VID]; - rtlefuse->eeprom_did = *(u16 *) &hwinfo[EEPROM_DID]; - rtlefuse->eeprom_svid = *(u16 *) &hwinfo[EEPROM_SVID]; - rtlefuse->eeprom_smid = *(u16 *) &hwinfo[EEPROM_SMID]; - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROMId = 0x%4x\n", eeprom_id)); - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM VID = 0x%4x\n", rtlefuse->eeprom_vid)); - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM DID = 0x%4x\n", rtlefuse->eeprom_did)); - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM SVID = 0x%4x\n", rtlefuse->eeprom_svid)); - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM SMID = 0x%4x\n", rtlefuse->eeprom_smid)); - - /*customer ID*/ - rtlefuse->eeprom_oemid = *(u8 *) & hwinfo[EEPROM_CUSTOMER_ID]; - if (rtlefuse->eeprom_oemid == 0xFF) - rtlefuse->eeprom_oemid = 0; - - RT_TRACE(COMP_INIT, DBG_LOUD, - ("EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid)); - - for (i = 0; i < 6; i += 2) { - usvalue = *(u16 *) & hwinfo[EEPROM_MAC_ADDR + i]; - *((u16 *) (&rtlefuse->dev_addr[i])) = usvalue; - } - - RT_TRACE(COMP_INIT, DBG_DMESG, - ("dev_addr: %pM\n", rtlefuse->dev_addr)); - - _rtl8821ae_read_txpower_info_from_hwpg(hw, - rtlefuse->autoload_failflag, hwinfo); - - /*board type*/ - rtlefuse->board_type = (((*(u8 *) & hwinfo[EEPROM_RF_BOARD_OPTION]) & 0xE0 ) >> 5); - if ((*(u8 *) & hwinfo[EEPROM_RF_BOARD_OPTION]) == 0xff ) - rtlefuse->board_type = 0; - rtlhal->boad_type = rtlefuse->board_type; - - rtl8821ae_read_bt_coexist_info_from_hwpg(hw, - rtlefuse->autoload_failflag, hwinfo); - - rtlefuse->eeprom_channelplan = *(u8 *) & hwinfo[EEPROM_CHANNELPLAN]; - if (rtlefuse->eeprom_channelplan == 0xff) - rtlefuse->eeprom_channelplan = 0x7F; - - /* set channel paln to world wide 13 */ - //rtlefuse->channel_plan = (u8) rtlefuse->eeprom_channelplan; - - /*parse xtal*/ - rtlefuse->crystalcap = hwinfo[EEPROM_XTAL_8821AE]; - if ( rtlefuse->crystalcap == 0xFF ) - rtlefuse->crystalcap = 0x20; - - rtlefuse->eeprom_thermalmeter = *(u8 *) & hwinfo[EEPROM_THERMAL_METER]; - if ((rtlefuse->eeprom_thermalmeter == 0xff) ||rtlefuse->autoload_failflag ) - { - rtlefuse->b_apk_thermalmeterignore = true; - rtlefuse->eeprom_thermalmeter = 0x18; - } - - rtlefuse->thermalmeter[0] = rtlefuse->eeprom_thermalmeter; - RT_TRACE(COMP_INIT, DBG_LOUD, - ("thermalmeter = 0x%x\n", rtlefuse->eeprom_thermalmeter)); - - if (rtlefuse->autoload_failflag == false) { - rtlefuse->antenna_div_cfg = (*(u8 *) & hwinfo[EEPROM_RF_BOARD_OPTION] & BIT(3))?true:false; - /*if (BT_1ant()) - rtlefuse->antenna_div_cfg = 0;*/ - - rtlefuse->antenna_div_type = CG_TRX_HW_ANTDIV; - } else { - rtlefuse->antenna_div_cfg = 0; - rtlefuse->antenna_div_type = 0; - } - - RT_TRACE(COMP_INIT, DBG_LOUD, - ("SWAS: bHwAntDiv = %x, TRxAntDivType = %x\n", - rtlefuse->antenna_div_cfg, rtlefuse->antenna_div_type)); - - pcipriv->ledctl.bled_opendrain = true; - - if (rtlhal->oem_id == RT_CID_DEFAULT) { - switch (rtlefuse->eeprom_oemid) { - case RT_CID_DEFAULT: - break; - case EEPROM_CID_TOSHIBA: - rtlhal->oem_id = RT_CID_TOSHIBA; - break; - case EEPROM_CID_CCX: - rtlhal->oem_id = RT_CID_CCX; - break; - case EEPROM_CID_QMI: - rtlhal->oem_id = RT_CID_819x_QMI; - break; - case EEPROM_CID_WHQL: - break; - default: - break; - } - } -} - - -/*static void _rtl8821ae_hal_customized_behavior(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - - pcipriv->ledctl.bled_opendrain = true; - switch (rtlhal->oem_id) { - case RT_CID_819x_HP: - pcipriv->ledctl.bled_opendrain = true; - break; - case RT_CID_819x_Lenovo: - case RT_CID_DEFAULT: - case RT_CID_TOSHIBA: - case RT_CID_CCX: - case RT_CID_819x_Acer: - case RT_CID_WHQL: - default: - break; - } - RT_TRACE(COMP_INIT, DBG_DMESG, - ("RT Customized ID: 0x%02X\n", rtlhal->oem_id)); -}*/ - -void rtl8821ae_read_eeprom_info(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u8 tmp_u1b; - - rtlhal->version = _rtl8821ae_read_chip_version(hw); - - if (get_rf_type(rtlphy) == RF_1T1R) - rtlpriv->dm.brfpath_rxenable[0] = true; - else - rtlpriv->dm.brfpath_rxenable[0] = - rtlpriv->dm.brfpath_rxenable[1] = true; - RT_TRACE(COMP_INIT, DBG_LOUD, ("VersionID = 0x%4x\n", - rtlhal->version)); - - tmp_u1b = rtl_read_byte(rtlpriv, REG_9346CR); - if (tmp_u1b & BIT(4)) { - RT_TRACE(COMP_INIT, DBG_DMESG, ("Boot from EEPROM\n")); - rtlefuse->epromtype = EEPROM_93C46; - } else { - RT_TRACE(COMP_INIT, DBG_DMESG, ("Boot from EFUSE\n")); - rtlefuse->epromtype = EEPROM_BOOT_EFUSE; - } - - if (tmp_u1b & BIT(5)) { - RT_TRACE(COMP_INIT, DBG_LOUD, ("Autoload OK\n")); - rtlefuse->autoload_failflag = false; - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - _rtl8812ae_read_adapter_info(hw, false); - else if (rtlhal->hw_type == HARDWARE_TYPE_RTL8821AE) - _rtl8821ae_read_adapter_info(hw, false); - } else { - RT_TRACE(COMP_ERR, DBG_EMERG, ("Autoload ERR!!\n")); - } - /*hal_ReadRFType_8812A()*/ - //_rtl8821ae_hal_customized_behavior(hw); -} - -static void rtl8821ae_update_hal_rate_table(struct ieee80211_hw *hw, - struct ieee80211_sta *sta) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - u32 ratr_value; - u8 ratr_index = 0; - u8 b_nmode = mac->ht_enable; - u8 mimo_ps = IEEE80211_SMPS_OFF; - u16 shortgi_rate; - u32 tmp_ratr_value; - u8 b_curtxbw_40mhz = mac->bw_40; - u8 b_curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 b_curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = mac->mode; - - if (rtlhal->current_bandtype == BAND_ON_5G) - ratr_value = sta->supp_rates[1] << 4; - else - ratr_value = sta->supp_rates[0]; - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_value = 0xfff; - ratr_value |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); - switch (wirelessmode) { - case WIRELESS_MODE_B: - if (ratr_value & 0x0000000c) - ratr_value &= 0x0000000d; - else - ratr_value &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_value &= 0x00000FF5; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - b_nmode = 1; - if (mimo_ps == IEEE80211_SMPS_STATIC) { - ratr_value &= 0x0007F005; - } else { - u32 ratr_mask; - - if (get_rf_type(rtlphy) == RF_1T2R || - get_rf_type(rtlphy) == RF_1T1R) - ratr_mask = 0x000ff005; - else - ratr_mask = 0x0f0ff005; - - ratr_value &= ratr_mask; - } - break; - default: - if (rtlphy->rf_type == RF_1T2R) - ratr_value &= 0x000ff0ff; - else - ratr_value &= 0x0f0ff0ff; - - break; - } - - if ( (rtlpcipriv->btcoexist.bt_coexistence) && - (rtlpcipriv->btcoexist.bt_coexist_type == BT_CSR_BC4) && - (rtlpcipriv->btcoexist.bt_cur_state) && - (rtlpcipriv->btcoexist.bt_ant_isolation) && - ((rtlpcipriv->btcoexist.bt_service == BT_SCO)|| - (rtlpcipriv->btcoexist.bt_service == BT_BUSY)) ) - ratr_value &= 0x0fffcfc0; - else - ratr_value &= 0x0FFFFFFF; - - if (b_nmode && ((b_curtxbw_40mhz && - b_curshortgi_40mhz) || (!b_curtxbw_40mhz && - b_curshortgi_20mhz))) { - - ratr_value |= 0x10000000; - tmp_ratr_value = (ratr_value >> 12); - - for (shortgi_rate = 15; shortgi_rate > 0; shortgi_rate--) { - if ((1 << shortgi_rate) & tmp_ratr_value) - break; - } - - shortgi_rate = (shortgi_rate << 12) | (shortgi_rate << 8) | - (shortgi_rate << 4) | (shortgi_rate); - } - - rtl_write_dword(rtlpriv, REG_ARFR0 + ratr_index * 4, ratr_value); - - RT_TRACE(COMP_RATR, DBG_DMESG, - ("%x\n", rtl_read_dword(rtlpriv, REG_ARFR0))); -} - - -static u8 _rtl8821ae_mrate_idx_to_arfr_id( - struct ieee80211_hw *hw, u8 rate_index, - enum wireless_mode wirelessmode) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u8 ret = 0; - switch(rate_index){ - case RATR_INX_WIRELESS_NGB: - if(rtlphy->rf_type == RF_1T1R) - ret = 1; - else - ret = 0; - ;break; - case RATR_INX_WIRELESS_N: - case RATR_INX_WIRELESS_NG: - if(rtlphy->rf_type == RF_1T1R) - ret = 5; - else - ret = 4; - ;break; - case RATR_INX_WIRELESS_NB: - if(rtlphy->rf_type == RF_1T1R) - ret = 3; - else - ret = 2; - ;break; - case RATR_INX_WIRELESS_GB: - ret = 6; - break; - case RATR_INX_WIRELESS_G: - ret = 7; - break; - case RATR_INX_WIRELESS_B: - ret = 8; - break; - case RATR_INX_WIRELESS_MC: - if ((wirelessmode == WIRELESS_MODE_B) - || (wirelessmode == WIRELESS_MODE_G) - || (wirelessmode == WIRELESS_MODE_N_24G) - || (wirelessmode == WIRELESS_MODE_AC_24G)) - ret = 6; - else - ret = 7; - case RATR_INX_WIRELESS_AC_5N: - if(rtlphy->rf_type == RF_1T1R) - ret = 10; - else - ret = 9; - break; - case RATR_INX_WIRELESS_AC_24N: - if(rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_80) - { - if(rtlphy->rf_type == RF_1T1R) - ret = 10; - else - ret = 9; - } else { - if(rtlphy->rf_type == RF_1T1R) - ret = 11; - else - ret = 12; - } - break; - default: - ret = 0;break; - } - return ret; -} - -static void rtl8821ae_update_hal_rate_mask(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_sta_info * sta_entry = NULL; - u32 ratr_bitmap; - u8 ratr_index; - u8 b_curtxbw_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) - ? 1 : 0; - u8 b_curshortgi_40mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? - 1 : 0; - u8 b_curshortgi_20mhz = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_20) ? - 1 : 0; - enum wireless_mode wirelessmode = 0; - bool b_shortgi = false; - u8 rate_mask[7]; - u8 macid = 0; - u8 mimo_ps = IEEE80211_SMPS_OFF; - - sta_entry = (struct rtl_sta_info *) sta->drv_priv; - wirelessmode = sta_entry->wireless_mode; - if (mac->opmode == NL80211_IFTYPE_STATION || - mac->opmode == NL80211_IFTYPE_MESH_POINT) - b_curtxbw_40mhz = mac->bw_40; - else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) - macid = sta->aid + 1; - - ratr_bitmap = sta->supp_rates[0]; - - if (mac->opmode == NL80211_IFTYPE_ADHOC) - ratr_bitmap = 0xfff; - - ratr_bitmap |= (sta->ht_cap.mcs.rx_mask[1] << 20 | - sta->ht_cap.mcs.rx_mask[0] << 12); -/*mac id owner*/ - switch (wirelessmode) { - case WIRELESS_MODE_B: - ratr_index = RATR_INX_WIRELESS_B; - if (ratr_bitmap & 0x0000000c) - ratr_bitmap &= 0x0000000d; - else - ratr_bitmap &= 0x0000000f; - break; - case WIRELESS_MODE_G: - ratr_index = RATR_INX_WIRELESS_GB; - - if (rssi_level == 1) - ratr_bitmap &= 0x00000f00; - else if (rssi_level == 2) - ratr_bitmap &= 0x00000ff0; - else - ratr_bitmap &= 0x00000ff5; - break; - case WIRELESS_MODE_A: - ratr_index = RATR_INX_WIRELESS_G; - ratr_bitmap &= 0x00000ff0; - break; - case WIRELESS_MODE_N_24G: - case WIRELESS_MODE_N_5G: - if (wirelessmode == WIRELESS_MODE_N_24G) - ratr_index = RATR_INX_WIRELESS_NGB; - else - ratr_index = RATR_INX_WIRELESS_NG; - - if (mimo_ps == IEEE80211_SMPS_STATIC || mimo_ps == IEEE80211_SMPS_DYNAMIC) { - if (rssi_level == 1) - ratr_bitmap &= 0x00070000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0007f000; - else - ratr_bitmap &= 0x0007f005; - } else { - if ( rtlphy->rf_type == RF_1T1R) { - if (b_curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x000f0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x000ff000; - else - ratr_bitmap &= 0x000ff005; - } - } else { - if (b_curtxbw_40mhz) { - if (rssi_level == 1) - ratr_bitmap &= 0x0fff0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0ffff000; - else - ratr_bitmap &= 0x0ffff015; - } else { - if (rssi_level == 1) - ratr_bitmap &= 0x0fff0000; - else if (rssi_level == 2) - ratr_bitmap &= 0x0ffff000; - else - ratr_bitmap &= 0x0ffff005; - } - } - } - if ((b_curtxbw_40mhz && b_curshortgi_40mhz) || - (!b_curtxbw_40mhz && b_curshortgi_20mhz)) { - - if (macid == 0) - b_shortgi = true; - else if (macid == 1) - b_shortgi = false; - } - break; - - case WIRELESS_MODE_AC_24G: - ratr_index = RATR_INX_WIRELESS_AC_24N; - if(rssi_level == 1) - ratr_bitmap &= 0xfc3f0000; - else if(rssi_level == 2) - ratr_bitmap &= 0xfffff000; - else - ratr_bitmap &= 0xffffffff; - break; - - case WIRELESS_MODE_AC_5G: - ratr_index = RATR_INX_WIRELESS_AC_5N; - - if (rtlphy->rf_type == RF_1T1R) - { - if(rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - { - if(rssi_level == 1) /*add by Gary for ac-series*/ - ratr_bitmap &= 0x003f8000; - else if (rssi_level == 2) - ratr_bitmap &= 0x003ff000; - else - ratr_bitmap &= 0x003ff010; - } - else - ratr_bitmap &= 0x000ff010; - } - else - { - if(rssi_level == 1) /* add by Gary for ac-series*/ - ratr_bitmap &= 0xfe3f8000; /*VHT 2SS MCS3~9*/ - else if (rssi_level == 2) - ratr_bitmap &= 0xfffff000; /*VHT 2SS MCS0~9*/ - else - ratr_bitmap &= 0xfffff010; /*All*/ - } - break; - - default: - ratr_index = RATR_INX_WIRELESS_NGB; - - if (rtlphy->rf_type == RF_1T2R) - ratr_bitmap &= 0x000ff0ff; - else - ratr_bitmap &= 0x0f0ff0ff; - break; - - } - - sta_entry->ratr_index = ratr_index; - - RT_TRACE(COMP_RATR, DBG_DMESG, - ("ratr_bitmap :%x\n", ratr_bitmap)); - *(u32 *) & rate_mask = EF4BYTE((ratr_bitmap & 0x0fffffff) | - (ratr_index << 28)); - rate_mask[0] = macid; - rate_mask[1] = _rtl8821ae_mrate_idx_to_arfr_id(hw, ratr_index, wirelessmode) | (b_shortgi ? 0x80 : 0x00); - rate_mask[2] = b_curtxbw_40mhz; - /* if (prox_priv->proxim_modeinfo->power_output > 0) - rate_mask[2] |= BIT(6); */ - - rate_mask[3] = (u8)(ratr_bitmap & 0x000000ff); - rate_mask[4] = (u8)((ratr_bitmap & 0x0000ff00) >>8); - rate_mask[5] = (u8)((ratr_bitmap & 0x00ff0000) >> 16); - rate_mask[6] = (u8)((ratr_bitmap & 0xff000000) >> 24); - - RT_TRACE(COMP_RATR, DBG_DMESG, ("Rate_index:%x, " - "ratr_val:%x, %x:%x:%x:%x:%x:%x:%x\n", - ratr_index, ratr_bitmap, - rate_mask[0], rate_mask[1], - rate_mask[2], rate_mask[3], - rate_mask[4], rate_mask[5], - rate_mask[6])); - rtl8821ae_fill_h2c_cmd(hw, H2C_8821AE_RA_MASK, 7, rate_mask); - _rtl8821ae_set_bcn_ctrl_reg(hw, BIT(3), 0); -} - -void rtl8821ae_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, u8 rssi_level) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - if (rtlpriv->dm.b_useramask) - rtl8821ae_update_hal_rate_mask(hw, sta, rssi_level); - else - /*RT_TRACE(COMP_RATR,DBG_LOUD,("rtl8821ae_update_hal_rate_tbl(): Error! 8821ae FW RA Only"));*/ - rtl8821ae_update_hal_rate_table(hw, sta); -} - -void rtl8821ae_update_channel_access_setting(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - u16 sifs_timer; - - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, - (u8 *) & mac->slot_time); - if (!mac->ht_enable) - sifs_timer = 0x0a0a; - else - sifs_timer = 0x0e0e; - rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SIFS, (u8 *) & sifs_timer); -} - -bool rtl8821ae_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - enum rf_pwrstate e_rfpowerstate_toset, cur_rfstate; - u8 u1tmp = 0; - bool b_actuallyset = false; - - if (rtlpriv->rtlhal.being_init_adapter) - return false; - - if (ppsc->b_swrf_processing) - return false; - - spin_lock(&rtlpriv->locks.rf_ps_lock); - if (ppsc->rfchange_inprogress) { - spin_unlock(&rtlpriv->locks.rf_ps_lock); - return false; - } else { - ppsc->rfchange_inprogress = true; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } - - cur_rfstate = ppsc->rfpwr_state; - - rtl_write_byte(rtlpriv, REG_GPIO_IO_SEL_2, - rtl_read_byte(rtlpriv, REG_GPIO_IO_SEL_2) & ~(BIT(1))); - - u1tmp = rtl_read_byte(rtlpriv, REG_GPIO_PIN_CTRL_2); - - if (rtlphy->polarity_ctl) { - e_rfpowerstate_toset = (u1tmp & BIT(1)) ? ERFOFF : ERFON; - } else { - e_rfpowerstate_toset = (u1tmp & BIT(1)) ? ERFON : ERFOFF; - } - - if ((ppsc->b_hwradiooff == true) && (e_rfpowerstate_toset == ERFON)) { - RT_TRACE(COMP_RF, DBG_DMESG, - ("GPIOChangeRF - HW Radio ON, RF ON\n")); - - e_rfpowerstate_toset = ERFON; - ppsc->b_hwradiooff = false; - b_actuallyset = true; - } else if ((ppsc->b_hwradiooff == false) - && (e_rfpowerstate_toset == ERFOFF)) { - RT_TRACE(COMP_RF, DBG_DMESG, - ("GPIOChangeRF - HW Radio OFF, RF OFF\n")); - - e_rfpowerstate_toset = ERFOFF; - ppsc->b_hwradiooff = true; - b_actuallyset = true; - } - - if (b_actuallyset) { - spin_lock(&rtlpriv->locks.rf_ps_lock); - ppsc->rfchange_inprogress = false; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } else { - if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_HALT_NIC) - RT_SET_PS_LEVEL(ppsc, RT_RF_OFF_LEVL_HALT_NIC); - - spin_lock(&rtlpriv->locks.rf_ps_lock); - ppsc->rfchange_inprogress = false; - spin_unlock(&rtlpriv->locks.rf_ps_lock); - } - - *valid = 1; - return !ppsc->b_hwradiooff; - -} - -void rtl8821ae_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 *macaddr = p_macaddr; - u32 entry_id = 0; - bool is_pairwise = false; - - static u8 cam_const_addr[4][6] = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} - }; - static u8 cam_const_broad[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - }; - - if (clear_all) { - u8 idx = 0; - u8 cam_offset = 0; - u8 clear_number = 5; - - RT_TRACE(COMP_SEC, DBG_DMESG, ("clear_all\n")); - - for (idx = 0; idx < clear_number; idx++) { - rtl_cam_mark_invalid(hw, cam_offset + idx); - rtl_cam_empty_entry(hw, cam_offset + idx); - - if (idx < 5) { - memset(rtlpriv->sec.key_buf[idx], 0, - MAX_KEY_LEN); - rtlpriv->sec.key_len[idx] = 0; - } - } - - } else { - switch (enc_algo) { - case WEP40_ENCRYPTION: - enc_algo = CAM_WEP40; - break; - case WEP104_ENCRYPTION: - enc_algo = CAM_WEP104; - break; - case TKIP_ENCRYPTION: - enc_algo = CAM_TKIP; - break; - case AESCCMP_ENCRYPTION: - enc_algo = CAM_AES; - break; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, ("switch case " - "not process \n")); - enc_algo = CAM_TKIP; - break; - } - - if (is_wepkey || rtlpriv->sec.use_defaultkey) { - macaddr = cam_const_addr[key_index]; - entry_id = key_index; - } else { - if (is_group) { - macaddr = cam_const_broad; - entry_id = key_index; - } else { - if (mac->opmode == NL80211_IFTYPE_AP) { - entry_id = rtl_cam_get_free_entry(hw, p_macaddr); - if (entry_id >= TOTAL_CAM_ENTRY) { - RT_TRACE(COMP_SEC, DBG_EMERG, - ("Can not find free hw security cam entry\n")); - return; - } - } else { - entry_id = CAM_PAIRWISE_KEY_POSITION; - } - - key_index = PAIRWISE_KEYIDX; - is_pairwise = true; - } - } - - if (rtlpriv->sec.key_len[key_index] == 0) { - RT_TRACE(COMP_SEC, DBG_DMESG, - ("delete one entry, entry_id is %d\n",entry_id)); - if (mac->opmode == NL80211_IFTYPE_AP) - rtl_cam_del_entry(hw, p_macaddr); - rtl_cam_delete_one_entry(hw, p_macaddr, entry_id); - } else { - RT_TRACE(COMP_SEC, DBG_DMESG, ("add one entry\n")); - if (is_pairwise) { - RT_TRACE(COMP_SEC, DBG_DMESG, ("set Pairwiase key\n")); - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[key_index]); - } else { - RT_TRACE(COMP_SEC, DBG_DMESG, ("set group key\n")); - - if (mac->opmode == NL80211_IFTYPE_ADHOC) { - rtl_cam_add_one_entry(hw, - rtlefuse->dev_addr, - PAIRWISE_KEYIDX, - CAM_PAIRWISE_KEY_POSITION, - enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf - [entry_id]); - } - - rtl_cam_add_one_entry(hw, macaddr, key_index, - entry_id, enc_algo, - CAM_CONFIG_NO_USEDK, - rtlpriv->sec.key_buf[entry_id]); - } - - } - } -} - - -void rtl8812ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool auto_load_fail, u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value; - - if (!auto_load_fail) { - value = *(u8 *) & hwinfo[EEPROM_RF_BOARD_OPTION]; - if (((value & 0xe0) >> 5) == 0x1) - rtlpriv->btcoexist.btc_info.btcoexist = 1; - else - rtlpriv->btcoexist.btc_info.btcoexist = 0; - rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8812A; - - value = hwinfo[EEPROM_RF_BT_SETTING]; - rtlpriv->btcoexist.btc_info.ant_num = (value & 0x1); - } else { - rtlpriv->btcoexist.btc_info.btcoexist = 0; - rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8812A; - rtlpriv->btcoexist.btc_info.ant_num = ANT_X2; - } - /*move BT_InitHalVars() to init_sw_vars*/ -} - -void rtl8821ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool auto_load_fail, u8 *hwinfo) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u8 value; - u32 tmpu_32; - - if (!auto_load_fail) { - tmpu_32 = rtl_read_dword(rtlpriv, REG_MULTI_FUNC_CTRL); - if(tmpu_32 & BIT(18)) - rtlpriv->btcoexist.btc_info.btcoexist = 1; - else - rtlpriv->btcoexist.btc_info.btcoexist = 0; - rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8821A; - - value = hwinfo[EEPROM_RF_BT_SETTING]; - rtlpriv->btcoexist.btc_info.ant_num = (value & 0x1); - } else { - rtlpriv->btcoexist.btc_info.btcoexist = 0; - rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8821A; - rtlpriv->btcoexist.btc_info.ant_num = ANT_X2; - } - /*move BT_InitHalVars() to init_sw_vars*/ -} - -void rtl8821ae_bt_reg_init(struct ieee80211_hw* hw) -{ - struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); - - /* 0:Low, 1:High, 2:From Efuse. */ - rtlpcipriv->btcoexist.b_reg_bt_iso = 2; - /* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter. */ - rtlpcipriv->btcoexist.b_reg_bt_sco= 3; - /* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */ - rtlpcipriv->btcoexist.b_reg_bt_sco= 0; -} - - -void rtl8821ae_bt_hw_init(struct ieee80211_hw* hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->cfg->ops->get_btc_status()){ - rtlpriv->btcoexist.btc_ops->btc_init_hw_config(rtlpriv); - } -} - -void rtl8821ae_suspend(struct ieee80211_hw *hw) -{ -} - -void rtl8821ae_resume(struct ieee80211_hw *hw) -{ -} - -/* Turn on AAP (RCR:bit 0) for promicuous mode. */ -void rtl8821ae_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - if (allow_all_da) /* Set BIT0 */ - rtlpci->receive_config |= RCR_AAP; - else /* Clear BIT0 */ - rtlpci->receive_config &= ~RCR_AAP; - - if(write_into_reg) - rtl_write_dword(rtlpriv, REG_RCR, rtlpci->receive_config); - - - RT_TRACE(COMP_TURBO | COMP_INIT, DBG_LOUD, - ("receive_config=0x%08X, write_into_reg=%d\n", - rtlpci->receive_config, write_into_reg )); -} - diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hw.h b/drivers/staging/rtl8821ae/rtl8821ae/hw.h deleted file mode 100644 index 4fb6bf0..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/hw.h +++ /dev/null @@ -1,75 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_HW_H__ -#define __RTL8821AE_HW_H__ - -void rtl8821ae_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl8821ae_read_eeprom_info(struct ieee80211_hw *hw); - -void rtl8821ae_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb); -int rtl8821ae_hw_init(struct ieee80211_hw *hw); -void rtl8821ae_card_disable(struct ieee80211_hw *hw); -void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw); -void rtl8821ae_disable_interrupt(struct ieee80211_hw *hw); -int rtl8821ae_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type); -void rtl8821ae_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); -void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci); -void rtl8821ae_set_beacon_related_registers(struct ieee80211_hw *hw); -void rtl8821ae_set_beacon_interval(struct ieee80211_hw *hw); -void rtl8821ae_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); -void rtl8821ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); -void rtl8821ae_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u8 rssi_level); -void rtl8821ae_update_channel_access_setting(struct ieee80211_hw *hw); -bool rtl8821ae_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid); -void rtl8821ae_enable_hw_security_config(struct ieee80211_hw *hw); -void rtl8821ae_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); - -void rtl8821ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8* hwinfo); -void rtl8812ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8* hwinfo); -void rtl8821ae_bt_reg_init(struct ieee80211_hw* hw); -void rtl8821ae_bt_hw_init(struct ieee80211_hw* hw); -void rtl8821ae_suspend(struct ieee80211_hw *hw); -void rtl8821ae_resume(struct ieee80211_hw *hw); -void rtl8821ae_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, - bool write_into_reg); -void _rtl8821ae_stop_tx_beacon(struct ieee80211_hw *hw); -void _rtl8821ae_resume_tx_beacon(struct ieee80211_hw *hw); -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/led.c b/drivers/staging/rtl8821ae/rtl8821ae/led.c deleted file mode 100644 index 130a4f4..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/led.c +++ /dev/null @@ -1,239 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "reg.h" - -static void _rtl8821ae_init_led(struct ieee80211_hw *hw, - struct rtl_led *pled, - enum rtl_led_pin ledpin) -{ - pled->hw = hw; - pled->ledpin = ledpin; - pled->b_ledon = false; -} - -void rtl8821ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - u8 ledcfg; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_LED, DBG_LOUD, - ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - ledcfg &= ~BIT(6); - rtl_write_byte(rtlpriv, - REG_LEDCFG2, (ledcfg & 0xf0) | BIT(5)); - break; - case LED_PIN_LED1: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG1); - rtl_write_byte(rtlpriv, REG_LEDCFG1, ledcfg & 0x10); - break; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, - ("switch case not process \n")); - break; - } - pled->b_ledon = true; -} - -void rtl8812ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - u16 ledreg = REG_LEDCFG1; - u8 ledcfg = 0; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - switch (pled->ledpin) { - case LED_PIN_LED0: - ledreg = REG_LEDCFG1; - break; - - case LED_PIN_LED1: - ledreg = REG_LEDCFG2; - break; - - case LED_PIN_GPIO0: - default: - break; - } - - RT_TRACE(COMP_LED, DBG_LOUD, ("In SwLedOn, LedAddr:%X LEDPIN=%d \n", ledreg, pled->ledpin)); - - ledcfg = rtl_read_byte(rtlpriv, ledreg); - ledcfg |= BIT(5); /*Set 0x4c[21]*/ - ledcfg &= ~(BIT(7) | BIT(6) | BIT(3) |BIT(2) | BIT(1) |BIT(0)); - /*Clear 0x4c[23:22] and 0x4c[19:16]*/ - rtl_write_byte(rtlpriv, ledreg, ledcfg); /*SW control led0 on.*/ - pled->b_ledon = true; -} - -void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u8 ledcfg; - - RT_TRACE(COMP_LED, DBG_LOUD, - ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin)); - - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2); - - switch (pled->ledpin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - ledcfg &= 0xf0; - if (pcipriv->ledctl.bled_opendrain == true) { - ledcfg &= 0x90; /* Set to software control. */ - rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg|BIT(3))); - ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG); - ledcfg &= 0xFE; - rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, ledcfg); - } - else { - ledcfg &= ~BIT(6); - rtl_write_byte(rtlpriv, REG_LEDCFG2, - (ledcfg | BIT(3) | BIT(5))); - } - break; - case LED_PIN_LED1: - ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG1); - ledcfg &= 0x10; /* Set to software control. */ - rtl_write_byte(rtlpriv, REG_LEDCFG1, ledcfg|BIT(3)); - - break; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, - ("switch case not process \n")); - break; - } - pled->b_ledon = false; -} - -void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled){ - u16 ledreg = REG_LEDCFG1; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - - switch(pled->ledpin) - { - case LED_PIN_LED0: - ledreg = REG_LEDCFG1; - break; - - case LED_PIN_LED1: - ledreg = REG_LEDCFG2; - break; - - case LED_PIN_GPIO0: - default: - break; - } - - RT_TRACE(COMP_LED,DBG_LOUD,("In SwLedOff,LedAddr:%X LEDPIN=%d\n", ledreg, pled->ledpin)); - - if(pcipriv->ledctl.bled_opendrain == true) /*Open-drain arrangement for controlling the LED*/ - { - u8 ledcfg = rtl_read_byte(rtlpriv, ledreg); - - ledreg &= 0xd0; /* Set to software control.*/ - rtl_write_byte(rtlpriv, ledreg, (ledcfg | BIT(3))); - - /*Open-drain arrangement*/ - ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG); - ledcfg &= 0xFE;/*Set GPIO[8] to input mode*/ - rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG, ledcfg); - } - else - { - rtl_write_byte(rtlpriv, ledreg, 0x28); - } - - pled->b_ledon = false; -} - -void rtl8821ae_init_sw_leds(struct ieee80211_hw *hw) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - _rtl8821ae_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0); - _rtl8821ae_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1); -} - -static void _rtl8821ae_sw_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - switch (ledaction) { - case LED_CTL_POWER_ON: - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtl8812ae_sw_led_on(hw, pLed0); - else - rtl8821ae_sw_led_on(hw, pLed0); - break; - case LED_CTL_POWER_OFF: - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE)\ - rtl8812ae_sw_led_off(hw, pLed0); - else - rtl8821ae_sw_led_off(hw, pLed0); - break; - default: - break; - } -} - -void rtl8821ae_led_control(struct ieee80211_hw *hw, - enum led_ctl_mode ledaction) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - - if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) && - (ledaction == LED_CTL_TX || - ledaction == LED_CTL_RX || - ledaction == LED_CTL_SITE_SURVEY || - ledaction == LED_CTL_LINK || - ledaction == LED_CTL_NO_LINK || - ledaction == LED_CTL_START_TO_LINK || - ledaction == LED_CTL_POWER_ON)) { - return; - } - RT_TRACE(COMP_LED, DBG_LOUD, ("ledaction %d, \n", - ledaction)); - _rtl8821ae_sw_led_control(hw, ledaction); -} diff --git a/drivers/staging/rtl8821ae/rtl8821ae/led.h b/drivers/staging/rtl8821ae/rtl8821ae/led.h deleted file mode 100644 index 44be401..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/led.h +++ /dev/null @@ -1,40 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_LED_H__ -#define __RTL8821AE_LED_H__ - -void rtl8821ae_init_sw_leds(struct ieee80211_hw *hw); -void rtl8821ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl8812ae_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl8821ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl8812ae_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled); -void rtl8821ae_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction); - -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/phy.h b/drivers/staging/rtl8821ae/rtl8821ae/phy.h deleted file mode 100644 index a932d8c..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/phy.h +++ /dev/null @@ -1,258 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_PHY_H__ -#define __RTL8821AE_PHY_H__ - -/*It must always set to 4, otherwise read efuse table secquence will be wrong.*/ -#define MAX_TX_COUNT 4 -#define TX_1S 0 -#define TX_2S 1 -#define TX_3S 2 -#define TX_4S 3 - -#define MAX_POWER_INDEX 0x3F - -#define MAX_PRECMD_CNT 16 -#define MAX_RFDEPENDCMD_CNT 16 -#define MAX_POSTCMD_CNT 16 - -#define MAX_DOZE_WAITING_TIMES_9x 64 - -#define RT_CANNOT_IO(hw) false -#define HIGHPOWER_RADIOA_ARRAYLEN 22 - -#define IQK_ADDA_REG_NUM 16 -#define IQK_BB_REG_NUM 9 -#define MAX_TOLERANCE 5 -#define IQK_DELAY_TIME 10 -#define index_mapping_NUM 15 - -#define APK_BB_REG_NUM 5 -#define APK_AFE_REG_NUM 16 -#define APK_CURVE_REG_NUM 4 -#define PATH_NUM 2 - -#define LOOP_LIMIT 5 -#define MAX_STALL_TIME 50 -#define AntennaDiversityValue 0x80 -#define MAX_TXPWR_IDX_NMODE_92S 63 -#define Reset_Cnt_Limit 3 - -#define IQK_ADDA_REG_NUM 16 -#define IQK_MAC_REG_NUM 4 - -#define RF6052_MAX_PATH 2 - -#define CT_OFFSET_MAC_ADDR 0X16 - -#define CT_OFFSET_CCK_TX_PWR_IDX 0x5A -#define CT_OFFSET_HT401S_TX_PWR_IDX 0x60 -#define CT_OFFSET_HT402S_TX_PWR_IDX_DIFF 0x66 -#define CT_OFFSET_HT20_TX_PWR_IDX_DIFF 0x69 -#define CT_OFFSET_OFDM_TX_PWR_IDX_DIFF 0x6C - -#define CT_OFFSET_HT40_MAX_PWR_OFFSET 0x6F -#define CT_OFFSET_HT20_MAX_PWR_OFFSET 0x72 - -#define CT_OFFSET_CHANNEL_PLAH 0x75 -#define CT_OFFSET_THERMAL_METER 0x78 -#define CT_OFFSET_RF_OPTION 0x79 -#define CT_OFFSET_VERSION 0x7E -#define CT_OFFSET_CUSTOMER_ID 0x7F - -#define RTL8821AE_MAX_PATH_NUM 2 - -#define TARGET_CHNL_NUM_2G_5G_8812 59 - -enum swchnlcmd_id { - CMDID_END, - CMDID_SET_TXPOWEROWER_LEVEL, - CMDID_BBREGWRITE10, - CMDID_WRITEPORT_ULONG, - CMDID_WRITEPORT_USHORT, - CMDID_WRITEPORT_UCHAR, - CMDID_RF_WRITEREG, -}; - -struct swchnlcmd { - enum swchnlcmd_id cmdid; - u32 para1; - u32 para2; - u32 msdelay; -}; - -enum hw90_block_e { - HW90_BLOCK_MAC = 0, - HW90_BLOCK_PHY0 = 1, - HW90_BLOCK_PHY1 = 2, - HW90_BLOCK_RF = 3, - HW90_BLOCK_MAXIMUM = 4, -}; - -enum baseband_config_type { - BASEBAND_CONFIG_PHY_REG = 0, - BASEBAND_CONFIG_AGC_TAB = 1, -}; - -enum ra_offset_area { - RA_OFFSET_LEGACY_OFDM1, - RA_OFFSET_LEGACY_OFDM2, - RA_OFFSET_HT_OFDM1, - RA_OFFSET_HT_OFDM2, - RA_OFFSET_HT_OFDM3, - RA_OFFSET_HT_OFDM4, - RA_OFFSET_HT_CCK, -}; - -enum antenna_path { - ANTENNA_NONE, - ANTENNA_D, - ANTENNA_C, - ANTENNA_CD, - ANTENNA_B, - ANTENNA_BD, - ANTENNA_BC, - ANTENNA_BCD, - ANTENNA_A, - ANTENNA_AD, - ANTENNA_AC, - ANTENNA_ACD, - ANTENNA_AB, - ANTENNA_ABD, - ANTENNA_ABC, - ANTENNA_ABCD -}; - -struct r_antenna_select_ofdm { - u32 r_tx_antenna:4; - u32 r_ant_l:4; - u32 r_ant_non_ht:4; - u32 r_ant_ht1:4; - u32 r_ant_ht2:4; - u32 r_ant_ht_s1:4; - u32 r_ant_non_ht_s1:4; - u32 ofdm_txsc:2; - u32 reserved:2; -}; - -struct r_antenna_select_cck { - u8 r_cckrx_enable_2:2; - u8 r_cckrx_enable:2; - u8 r_ccktx_enable:4; -}; - - -struct efuse_contents { - u8 mac_addr[ETH_ALEN]; - u8 cck_tx_power_idx[6]; - u8 ht40_1s_tx_power_idx[6]; - u8 ht40_2s_tx_power_idx_diff[3]; - u8 ht20_tx_power_idx_diff[3]; - u8 ofdm_tx_power_idx_diff[3]; - u8 ht40_max_power_offset[3]; - u8 ht20_max_power_offset[3]; - u8 channel_plan; - u8 thermal_meter; - u8 rf_option[5]; - u8 version; - u8 oem_id; - u8 regulatory; -}; - -struct tx_power_struct { - u8 cck[RTL8821AE_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_1s[RTL8821AE_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht40_2s[RTL8821AE_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 ht20_diff[RTL8821AE_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_diff[RTL8821AE_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 legacy_ht_txpowerdiff; - u8 groupht20[RTL8821AE_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 groupht40[RTL8821AE_MAX_PATH_NUM][CHANNEL_MAX_NUMBER]; - u8 pwrgroup_cnt; - u32 mcs_original_offset[4][16]; -}; -enum _ANT_DIV_TYPE -{ - NO_ANTDIV = 0xFF, - CG_TRX_HW_ANTDIV = 0x01, - CGCS_RX_HW_ANTDIV = 0x02, - FIXED_HW_ANTDIV = 0x03, - CG_TRX_SMART_ANTDIV = 0x04, - CGCS_RX_SW_ANTDIV = 0x05, - -}; - -extern u32 rtl8821ae_phy_query_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask); -extern void rtl8821ae_phy_set_bb_reg(struct ieee80211_hw *hw, - u32 regaddr, u32 bitmask, u32 data); -extern u32 rtl8821ae_phy_query_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask); -extern void rtl8821ae_phy_set_rf_reg(struct ieee80211_hw *hw, - enum radio_path rfpath, u32 regaddr, - u32 bitmask, u32 data); -extern bool rtl8821ae_phy_mac_config(struct ieee80211_hw *hw); -extern bool rtl8821ae_phy_bb_config(struct ieee80211_hw *hw); -extern bool rtl8821ae_phy_rf_config(struct ieee80211_hw *hw); -extern void rtl8821ae_phy_switch_wirelessband(struct ieee80211_hw *hw, u8 band); -extern void rtl8821ae_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); -extern void rtl8821ae_phy_get_txpower_level(struct ieee80211_hw *hw, - long *powerlevel); -extern void rtl8821ae_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); -extern void rtl8821ae_phy_scan_operation_backup(struct ieee80211_hw *hw, - u8 operation); -extern void rtl8821ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw); -extern void rtl8821ae_phy_set_bw_mode(struct ieee80211_hw *hw, - enum nl80211_channel_type ch_type); -extern void rtl8821ae_phy_sw_chnl_callback(struct ieee80211_hw *hw); -extern u8 rtl8821ae_phy_sw_chnl(struct ieee80211_hw *hw); -extern void rtl8821ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); -extern void rtl8812ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); -void rtl8821ae_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); -void rtl8821ae_phy_lc_calibrate(struct ieee80211_hw *hw); -void rtl8821ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); -bool rtl8812ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -bool rtl8821ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, - enum radio_path rfpath); -bool rtl8821ae_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); -extern bool rtl8821ae_phy_set_rf_power_state(struct ieee80211_hw *hw, - enum rf_pwrstate rfpwr_state); -u8 _rtl8812ae_get_right_chnl_place_for_iqk(u8 chnl); -void rtl8821ae_phy_set_txpower_level_by_path(struct ieee80211_hw *hw, u8 channel, u8 path); -void rtl8812ae_do_iqk(struct ieee80211_hw *hw,u8 delta_thermal_index, - u8 thermal_value, u8 threshold); -void rtl8821ae_do_iqk(struct ieee80211_hw *hw,u8 delta_thermal_index, - u8 thermal_value, u8 threshold); -void rtl8821ae_reset_iqk_result(struct ieee80211_hw *hw); - - -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/pwrseq.c b/drivers/staging/rtl8821ae/rtl8821ae/pwrseq.c deleted file mode 100644 index a2e4a01..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/pwrseq.c +++ /dev/null @@ -1,199 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "pwrseqcmd.h" -#include "pwrseq.h" - -/* - drivers should parse below arrays and do the corresponding actions -*/ -//3 Power on Array -struct wlan_pwr_cfg rtl8812_power_on_flow[RTL8812_TRANS_CARDEMU_TO_ACT_STEPS+RTL8812_TRANS_END_STEPS]= -{ - RTL8812_TRANS_CARDEMU_TO_ACT - RTL8812_TRANS_END -}; - -//3Radio off GPIO Array -struct wlan_pwr_cfg rtl8812_radio_off_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_END_STEPS]= -{ - RTL8812_TRANS_ACT_TO_CARDEMU - RTL8812_TRANS_END -}; - -//3Card Disable Array -struct wlan_pwr_cfg rtl8812_card_disable_flow[ RTL8812_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8812_TRANS_CARDEMU_TO_PDN_STEPS - + RTL8812_TRANS_END_STEPS ] = -{ - RTL8812_TRANS_ACT_TO_CARDEMU - RTL8812_TRANS_CARDEMU_TO_CARDDIS - RTL8812_TRANS_END -}; - -//3 Card Enable Array -struct wlan_pwr_cfg rtl8812_card_enable_flow[ RTL8812_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8812_TRANS_CARDEMU_TO_PDN_STEPS - + RTL8812_TRANS_END_STEPS ] = -{ - RTL8812_TRANS_CARDDIS_TO_CARDEMU - RTL8812_TRANS_CARDEMU_TO_ACT - RTL8812_TRANS_END -}; - -//3Suspend Array -struct wlan_pwr_cfg rtl8812_suspend_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_SUS_STEPS+RTL8812_TRANS_END_STEPS]= -{ - RTL8812_TRANS_ACT_TO_CARDEMU - RTL8812_TRANS_CARDEMU_TO_SUS - RTL8812_TRANS_END -}; - -//3 Resume Array -struct wlan_pwr_cfg rtl8812_resume_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_SUS_STEPS+RTL8812_TRANS_END_STEPS]= -{ - RTL8812_TRANS_SUS_TO_CARDEMU - RTL8812_TRANS_CARDEMU_TO_ACT - RTL8812_TRANS_END -}; - - - -//3HWPDN Array -struct wlan_pwr_cfg rtl8812_hwpdn_flow[RTL8812_TRANS_ACT_TO_CARDEMU_STEPS+RTL8812_TRANS_CARDEMU_TO_PDN_STEPS+RTL8812_TRANS_END_STEPS]= -{ - RTL8812_TRANS_ACT_TO_CARDEMU - RTL8812_TRANS_CARDEMU_TO_PDN - RTL8812_TRANS_END -}; - -//3 Enter LPS -struct wlan_pwr_cfg rtl8812_enter_lps_flow[RTL8812_TRANS_ACT_TO_LPS_STEPS+RTL8812_TRANS_END_STEPS]= -{ - //FW behavior - RTL8812_TRANS_ACT_TO_LPS - RTL8812_TRANS_END -}; - -//3 Leave LPS -struct wlan_pwr_cfg rtl8812_leave_lps_flow[RTL8812_TRANS_LPS_TO_ACT_STEPS+RTL8812_TRANS_END_STEPS]= -{ - //FW behavior - RTL8812_TRANS_LPS_TO_ACT - RTL8812_TRANS_END -}; - - -/* - drivers should parse below arrays and do the corresponding actions -*/ -/*3 Power on Array*/ -struct wlan_pwr_cfg rtl8821A_power_on_flow[RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS - + RTL8821A_TRANS_END_STEPS] = -{ - RTL8821A_TRANS_CARDEMU_TO_ACT - RTL8821A_TRANS_END -}; - -/*3Radio off GPIO Array */ -struct wlan_pwr_cfg rtl8821A_radio_off_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8821A_TRANS_END_STEPS] = -{ - RTL8821A_TRANS_ACT_TO_CARDEMU - RTL8821A_TRANS_END -}; - -/*3Card Disable Array*/ -struct wlan_pwr_cfg rtl8821A_card_disable_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS - + RTL8821A_TRANS_END_STEPS] = -{ - RTL8821A_TRANS_ACT_TO_CARDEMU - RTL8821A_TRANS_CARDEMU_TO_CARDDIS - RTL8821A_TRANS_END -}; - -/*3 Card Enable Array*/ -struct wlan_pwr_cfg rtl8821A_card_enable_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8821A_TRANS_CARDEMU_TO_ACT_STEPS /*RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS*/ - + RTL8821A_TRANS_END_STEPS] = -{ - RTL8821A_TRANS_CARDDIS_TO_CARDEMU - RTL8821A_TRANS_CARDEMU_TO_ACT - RTL8821A_TRANS_END -}; - -/*3Suspend Array*/ -struct wlan_pwr_cfg rtl8821A_suspend_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS - + RTL8821A_TRANS_END_STEPS] = -{ - RTL8821A_TRANS_ACT_TO_CARDEMU - RTL8821A_TRANS_CARDEMU_TO_SUS - RTL8821A_TRANS_END -}; - -/*3 Resume Array*/ -struct wlan_pwr_cfg rtl8821A_resume_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8821A_TRANS_CARDEMU_TO_SUS_STEPS - + RTL8821A_TRANS_END_STEPS] = -{ - RTL8821A_TRANS_SUS_TO_CARDEMU - RTL8821A_TRANS_CARDEMU_TO_ACT - RTL8821A_TRANS_END -}; - -/*3HWPDN Array*/ -struct wlan_pwr_cfg rtl8821A_hwpdn_flow[RTL8821A_TRANS_ACT_TO_CARDEMU_STEPS - + RTL8821A_TRANS_CARDEMU_TO_PDN_STEPS - + RTL8821A_TRANS_END_STEPS] = -{ - RTL8821A_TRANS_ACT_TO_CARDEMU - RTL8821A_TRANS_CARDEMU_TO_PDN - RTL8821A_TRANS_END -}; - -/*3 Enter LPS */ -struct wlan_pwr_cfg rtl8821A_enter_lps_flow[RTL8821A_TRANS_ACT_TO_LPS_STEPS - + RTL8821A_TRANS_END_STEPS] = -{ - /*FW behavior*/ - RTL8821A_TRANS_ACT_TO_LPS - RTL8821A_TRANS_END -}; - -/*3 Leave LPS */ -struct wlan_pwr_cfg rtl8821A_leave_lps_flow[RTL8821A_TRANS_LPS_TO_ACT_STEPS - + RTL8821A_TRANS_END_STEPS] = -{ - /*FW behavior*/ - RTL8821A_TRANS_LPS_TO_ACT - RTL8821A_TRANS_END -}; - diff --git a/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c b/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c deleted file mode 100644 index 710bc01..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c +++ /dev/null @@ -1,140 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "pwrseq.h" - - -/* -* Description: -* This routine deal with the Power Configuration CMDs -* parsing for RTL8723/RTL8188E Series IC. -* Assumption: -* We should follow specific format which was released from HW SD. -* -* 2011.07.07, added by Roger. -*/ -bool rtl_hal_pwrseqcmdparsing (struct rtl_priv* rtlpriv, u8 cut_version, - u8 fab_version, u8 interface_type, - struct wlan_pwr_cfg pwrcfgcmd[]) - -{ - struct wlan_pwr_cfg pwr_cfg_cmd = {0}; - bool polling_bit = false; - u32 ary_idx=0; - u8 value = 0; - u32 offset = 0; - u32 polling_count = 0; - u32 max_polling_cnt = 5000; - - do { - pwr_cfg_cmd = pwrcfgcmd[ary_idx]; - RT_TRACE(COMP_INIT, DBG_TRACE, - ("rtl_hal_pwrseqcmdparsing(): offset(%#x),cut_msk(%#x), fab_msk(%#x)," - "interface_msk(%#x), base(%#x), cmd(%#x), msk(%#x), value(%#x)\n", - GET_PWR_CFG_OFFSET(pwr_cfg_cmd), GET_PWR_CFG_CUT_MASK(pwr_cfg_cmd), - GET_PWR_CFG_FAB_MASK(pwr_cfg_cmd), GET_PWR_CFG_INTF_MASK(pwr_cfg_cmd), - GET_PWR_CFG_BASE(pwr_cfg_cmd), GET_PWR_CFG_CMD(pwr_cfg_cmd), - GET_PWR_CFG_MASK(pwr_cfg_cmd), GET_PWR_CFG_VALUE(pwr_cfg_cmd))); - - if ((GET_PWR_CFG_FAB_MASK(pwr_cfg_cmd)&fab_version) && - (GET_PWR_CFG_CUT_MASK(pwr_cfg_cmd)&cut_version) && - (GET_PWR_CFG_INTF_MASK(pwr_cfg_cmd)&interface_type)) { - switch (GET_PWR_CFG_CMD(pwr_cfg_cmd)) { - case PWR_CMD_READ: - RT_TRACE(COMP_INIT, DBG_TRACE, - ("rtl_hal_pwrseqcmdparsing(): PWR_CMD_READ\n")); - break; - - case PWR_CMD_WRITE: { - RT_TRACE(COMP_INIT, DBG_TRACE, - ("rtl_hal_pwrseqcmdparsing(): PWR_CMD_WRITE\n")); - offset = GET_PWR_CFG_OFFSET(pwr_cfg_cmd); - - /*Read the value from system register*/ - value = rtl_read_byte(rtlpriv, offset); - value = value & (~(GET_PWR_CFG_MASK(pwr_cfg_cmd))); - value = value | (GET_PWR_CFG_VALUE(pwr_cfg_cmd) - & GET_PWR_CFG_MASK(pwr_cfg_cmd)); - - /*Write the value back to sytem register*/ - rtl_write_byte(rtlpriv, offset, value); - } - break; - - case PWR_CMD_POLLING: - RT_TRACE(COMP_INIT, DBG_TRACE, - ("rtl_hal_pwrseqcmdparsing(): PWR_CMD_POLLING\n")); - polling_bit = false; - offset = GET_PWR_CFG_OFFSET(pwr_cfg_cmd); - - do { - value = rtl_read_byte(rtlpriv, offset); - - value = value & GET_PWR_CFG_MASK(pwr_cfg_cmd); - if (value == (GET_PWR_CFG_VALUE(pwr_cfg_cmd) - & GET_PWR_CFG_MASK(pwr_cfg_cmd))) - polling_bit=true; - else - udelay(10); - - if (polling_count++ > max_polling_cnt) { - return false; - } - } while (!polling_bit); - - break; - - case PWR_CMD_DELAY: - RT_TRACE(COMP_INIT, DBG_TRACE, - ("rtl_hal_pwrseqcmdparsing(): PWR_CMD_DELAY\n")); - if (GET_PWR_CFG_VALUE(pwr_cfg_cmd) == PWRSEQ_DELAY_US) - udelay(GET_PWR_CFG_OFFSET(pwr_cfg_cmd)); - else - mdelay(GET_PWR_CFG_OFFSET(pwr_cfg_cmd)); - break; - - case PWR_CMD_END: - RT_TRACE(COMP_INIT, DBG_TRACE, - ("rtl_hal_pwrseqcmdparsing(): PWR_CMD_END\n")); - return true; - break; - - default: - RT_ASSERT(false, - ("rtl_hal_pwrseqcmdparsing(): Unknown CMD!!\n")); - break; - } - - } - - ary_idx++; - } while (1); - - return true; -} diff --git a/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.h b/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.h deleted file mode 100644 index 571e7e5..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef __RTL8821AE_PWRSEQCMD_H__ -#define __RTL8821AE_PWRSEQCMD_H__ - -#include "../wifi.h" -/*---------------------------------------------*/ -/*The value of cmd: 4 bits */ -/*---------------------------------------------*/ -#define PWR_CMD_READ 0x00 -#define PWR_CMD_WRITE 0x01 -#define PWR_CMD_POLLING 0x02 -#define PWR_CMD_DELAY 0x03 -#define PWR_CMD_END 0x04 - -/* define the base address of each block */ -#define PWR_BASEADDR_MAC 0x00 -#define PWR_BASEADDR_USB 0x01 -#define PWR_BASEADDR_PCIE 0x02 -#define PWR_BASEADDR_SDIO 0x03 - -#define PWR_INTF_SDIO_MSK BIT(0) -#define PWR_INTF_USB_MSK BIT(1) -#define PWR_INTF_PCI_MSK BIT(2) -#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) - -#define PWR_FAB_TSMC_MSK BIT(0) -#define PWR_FAB_UMC_MSK BIT(1) -#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3)) - -#define PWR_CUT_TESTCHIP_MSK BIT(0) -#define PWR_CUT_A_MSK BIT(1) -#define PWR_CUT_B_MSK BIT(2) -#define PWR_CUT_C_MSK BIT(3) -#define PWR_CUT_D_MSK BIT(4) -#define PWR_CUT_E_MSK BIT(5) -#define PWR_CUT_F_MSK BIT(6) -#define PWR_CUT_G_MSK BIT(7) -#define PWR_CUT_ALL_MSK 0xFF - - -enum pwrseq_delay_unit { - PWRSEQ_DELAY_US, - PWRSEQ_DELAY_MS, -}; - -struct wlan_pwr_cfg { - u16 offset; - u8 cut_msk; - u8 fab_msk:4; - u8 interface_msk:4; - u8 base:4; - u8 cmd:4; - u8 msk; - u8 value; - -}; - -#define GET_PWR_CFG_OFFSET(__PWR_CMD) __PWR_CMD.offset -#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) __PWR_CMD.cut_msk -#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) __PWR_CMD.fab_msk -#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) __PWR_CMD.interface_msk -#define GET_PWR_CFG_BASE(__PWR_CMD) __PWR_CMD.base -#define GET_PWR_CFG_CMD(__PWR_CMD) __PWR_CMD.cmd -#define GET_PWR_CFG_MASK(__PWR_CMD) __PWR_CMD.msk -#define GET_PWR_CFG_VALUE(__PWR_CMD) __PWR_CMD.value - -bool rtl_hal_pwrseqcmdparsing(struct rtl_priv * rtlpriv, u8 cut_version, - u8 fab_version, u8 interface_type, - struct wlan_pwr_cfg pwrcfgcmd[]); - -#endif - diff --git a/drivers/staging/rtl8821ae/rtl8821ae/reg.h b/drivers/staging/rtl8821ae/rtl8821ae/reg.h deleted file mode 100644 index 09c5f00..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/reg.h +++ /dev/null @@ -1,2427 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_REG_H__ -#define __RTL8821AE_REG_H__ - -#define TXPKT_BUF_SELECT 0x69 -#define RXPKT_BUF_SELECT 0xA5 -#define DISABLE_TRXPKT_BUF_ACCESS 0x0 - -#define REG_SYS_ISO_CTRL 0x0000 -#define REG_SYS_FUNC_EN 0x0002 -#define REG_APS_FSMCO 0x0004 -#define REG_SYS_CLKR 0x0008 -#define REG_9346CR 0x000A -#define REG_EE_VPD 0x000C -#define REG_AFE_MISC 0x0010 -#define REG_SPS0_CTRL 0x0011 -#define REG_SPS_OCP_CFG 0x0018 -#define REG_RSV_CTRL 0x001C -#define REG_RF_CTRL 0x001F -#define REG_LDOA15_CTRL 0x0020 -#define REG_LDOV12D_CTRL 0x0021 -#define REG_LDOHCI12_CTRL 0x0022 -#define REG_LPLDO_CTRL 0x0023 -#define REG_AFE_XTAL_CTRL 0x0024 -#define REG_AFE_LDO_CTRL 0x0027 /* 1.5v for 8188EE test chip, 1.4v for MP chip */ -#define REG_AFE_PLL_CTRL 0x0028 -#define REG_MAC_PHY_CTRL 0x002c -#define REG_EFUSE_CTRL 0x0030 -#define REG_EFUSE_TEST 0x0034 -#define REG_PWR_DATA 0x0038 -#define REG_CAL_TIMER 0x003C -#define REG_ACLK_MON 0x003E -#define REG_GPIO_MUXCFG 0x0040 -#define REG_GPIO_IO_SEL 0x0042 -#define REG_MAC_PINMUX_CFG 0x0043 -#define REG_GPIO_PIN_CTRL 0x0044 -#define REG_GPIO_INTM 0x0048 -#define REG_LEDCFG0 0x004C -#define REG_LEDCFG1 0x004D -#define REG_LEDCFG2 0x004E -#define REG_LEDCFG3 0x004F -#define REG_FSIMR 0x0050 -#define REG_FSISR 0x0054 -#define REG_HSIMR 0x0058 -#define REG_HSISR 0x005c -#define REG_GPIO_PIN_CTRL_2 0x0060 -#define REG_GPIO_IO_SEL_2 0x0062 -#define REG_MULTI_FUNC_CTRL 0x0068 -#define REG_GPIO_OUTPUT 0x006c -#define REG_OPT_CTRL 0x0074 -#define REG_AFE_XTAL_CTRL_EXT 0x0078 -#define REG_XCK_OUT_CTRL 0x007c -#define REG_MCUFWDL 0x0080 -#define REG_WOL_EVENT 0x0081 -#define REG_MCUTSTCFG 0x0084 - - -#define REG_HIMR 0x00B0 -#define REG_HISR 0x00B4 -#define REG_HIMRE 0x00B8 -#define REG_HISRE 0x00BC - -#define REG_PMC_DBG_CTRL2 0x00CC - -#define REG_EFUSE_ACCESS 0x00CF - -#define REG_BIST_SCAN 0x00D0 -#define REG_BIST_RPT 0x00D4 -#define REG_BIST_ROM_RPT 0x00D8 -#define REG_USB_SIE_INTF 0x00E0 -#define REG_PCIE_MIO_INTF 0x00E4 -#define REG_PCIE_MIO_INTD 0x00E8 -#define REG_HPON_FSM 0x00EC -#define REG_SYS_CFG 0x00F0 -#define REG_GPIO_OUTSTS 0x00F4 -#define REG_SYS_CFG1 0x00FC -#define REG_ROM_VERSION 0x00FD - -#define REG_CR 0x0100 -#define REG_PBP 0x0104 -#define REG_PKT_BUFF_ACCESS_CTRL 0x0106 -#define REG_TRXDMA_CTRL 0x010C -#define REG_TRXFF_BNDY 0x0114 -#define REG_TRXFF_STATUS 0x0118 -#define REG_RXFF_PTR 0x011C - -#define REG_CPWM 0x012F -#define REG_FWIMR 0x0130 -#define REG_FWISR 0x0134 -#define REG_PKTBUF_DBG_CTRL 0x0140 -#define REG_PKTBUF_DBG_DATA_L 0x0144 -#define REG_PKTBUF_DBG_DATA_H 0x0148 -#define REG_RXPKTBUF_CTRL (REG_PKTBUF_DBG_CTRL+2) - -#define REG_TC0_CTRL 0x0150 -#define REG_TC1_CTRL 0x0154 -#define REG_TC2_CTRL 0x0158 -#define REG_TC3_CTRL 0x015C -#define REG_TC4_CTRL 0x0160 -#define REG_TCUNIT_BASE 0x0164 -#define REG_MBIST_START 0x0174 -#define REG_MBIST_DONE 0x0178 -#define REG_MBIST_FAIL 0x017C -#define REG_32K_CTRL 0x0194 -#define REG_C2HEVT_MSG_NORMAL 0x01A0 -#define REG_C2HEVT_CLEAR 0x01AF -#define REG_C2HEVT_MSG_TEST 0x01B8 -#define REG_MCUTST_1 0x01c0 -#define REG_FMETHR 0x01C8 -#define REG_HMETFR 0x01CC -#define REG_HMEBOX_0 0x01D0 -#define REG_HMEBOX_1 0x01D4 -#define REG_HMEBOX_2 0x01D8 -#define REG_HMEBOX_3 0x01DC - -#define REG_LLT_INIT 0x01E0 -#define REG_BB_ACCEESS_CTRL 0x01E8 -#define REG_BB_ACCESS_DATA 0x01EC - -#define REG_HMEBOX_EXT_0 0x01F0 -#define REG_HMEBOX_EXT_1 0x01F4 -#define REG_HMEBOX_EXT_2 0x01F8 -#define REG_HMEBOX_EXT_3 0x01FC - -#define REG_RQPN 0x0200 -#define REG_FIFOPAGE 0x0204 -#define REG_TDECTRL 0x0208 -#define REG_TXDMA_OFFSET_CHK 0x020C -#define REG_TXDMA_STATUS 0x0210 -#define REG_RQPN_NPQ 0x0214 - -#define REG_RXDMA_AGG_PG_TH 0x0280 -#define REG_FW_UPD_RDPTR 0x0284 /* FW shall update this register before FW write RXPKT_RELEASE_POLL to 1 */ -#define REG_RXDMA_CONTROL 0x0286 /* Control the RX DMA.*/ -#define REG_RXPKT_NUM 0x0287 /* The number of packets in RXPKTBUF. */ - -#define REG_PCIE_CTRL_REG 0x0300 -#define REG_INT_MIG 0x0304 -#define REG_BCNQ_DESA 0x0308 -#define REG_HQ_DESA 0x0310 -#define REG_MGQ_DESA 0x0318 -#define REG_VOQ_DESA 0x0320 -#define REG_VIQ_DESA 0x0328 -#define REG_BEQ_DESA 0x0330 -#define REG_BKQ_DESA 0x0338 -#define REG_RX_DESA 0x0340 - -#define REG_DBI_WDATA 0x0348 -#define REG_DBI_RDATA 0x034C -#define REG_DBI_ADDR 0x0350 -#define REG_DBI_FLAG 0x0352 -#define REG_MDIO_WDATA 0x0354 -#define REG_MDIO_RDATA 0x0356 -#define REG_MDIO_CTL 0x0358 -#define REG_DBG_SEL 0x0360 -#define REG_PCIE_HRPWM 0x0361 -#define REG_PCIE_HCPWM 0x0363 -#define REG_UART_CTRL 0x0364 -#define REG_WATCH_DOG 0x0368 -#define REG_UART_TX_DESA 0x0370 -#define REG_UART_RX_DESA 0x0378 - - -#define REG_HDAQ_DESA_NODEF 0x0000 -#define REG_CMDQ_DESA_NODEF 0x0000 - -#define REG_VOQ_INFORMATION 0x0400 -#define REG_VIQ_INFORMATION 0x0404 -#define REG_BEQ_INFORMATION 0x0408 -#define REG_BKQ_INFORMATION 0x040C -#define REG_MGQ_INFORMATION 0x0410 -#define REG_HGQ_INFORMATION 0x0414 -#define REG_BCNQ_INFORMATION 0x0418 -#define REG_TXPKT_EMPTY 0x041A - - -#define REG_CPU_MGQ_INFORMATION 0x041C -#define REG_FWHW_TXQ_CTRL 0x0420 -#define REG_HWSEQ_CTRL 0x0423 -#define REG_TXPKTBUF_BCNQ_BDNY 0x0424 -#define REG_TXPKTBUF_MGQ_BDNY 0x0425 -#define REG_MULTI_BCNQ_EN 0x0426 -#define REG_MULTI_BCNQ_OFFSET 0x0427 -#define REG_SPEC_SIFS 0x0428 -#define REG_RL 0x042A -#define REG_DARFRC 0x0430 -#define REG_RARFRC 0x0438 -#define REG_RRSR 0x0440 -#define REG_ARFR0 0x0444 -#define REG_ARFR1 0x044C -#define REG_CCK_CHECK 0x0454 -#define REG_AMPDU_MAX_TIME 0x0456 -#define REG_AGGLEN_LMT 0x0458 -#define REG_AMPDU_MIN_SPACE 0x045C -#define REG_TXPKTBUF_WMAC_LBK_BF_HD 0x045D -#define REG_FAST_EDCA_CTRL 0x0460 -#define REG_RD_RESP_PKT_TH 0x0463 -#define REG_INIRTS_RATE_SEL 0x0480 -#define REG_INIDATA_RATE_SEL 0x0484 -#define REG_ARFR2 0x048C -#define REG_ARFR3 0x0494 -#define REG_POWER_STATUS 0x04A4 -#define REG_POWER_STAGE1 0x04B4 -#define REG_POWER_STAGE2 0x04B8 -#define REG_PKT_LIFE_TIME 0x04C0 -#define REG_STBC_SETTING 0x04C4 -#define REG_HT_SINGLE_AMPDU 0x04C7 -#define REG_PROT_MODE_CTRL 0x04C8 -#define REG_MAX_AGGR_NUM 0x04CA -#define REG_BAR_MODE_CTRL 0x04CC -#define REG_RA_TRY_RATE_AGG_LMT 0x04CF -#define REG_EARLY_MODE_CONTROL 0x04D0 -#define REG_NQOS_SEQ 0x04DC -#define REG_QOS_SEQ 0x04DE -#define REG_NEED_CPU_HANDLE 0x04E0 -#define REG_PKT_LOSE_RPT 0x04E1 -#define REG_PTCL_ERR_STATUS 0x04E2 -#define REG_TX_RPT_CTRL 0x04EC -#define REG_TX_RPT_TIME 0x04F0 -#define REG_DUMMY 0x04FC - -#define REG_EDCA_VO_PARAM 0x0500 -#define REG_EDCA_VI_PARAM 0x0504 -#define REG_EDCA_BE_PARAM 0x0508 -#define REG_EDCA_BK_PARAM 0x050C -#define REG_BCNTCFG 0x0510 -#define REG_PIFS 0x0512 -#define REG_RDG_PIFS 0x0513 -#define REG_SIFS_CTX 0x0514 -#define REG_SIFS_TRX 0x0516 -#define REG_AGGR_BREAK_TIME 0x051A -#define REG_SLOT 0x051B -#define REG_TX_PTCL_CTRL 0x0520 -#define REG_TXPAUSE 0x0522 -#define REG_DIS_TXREQ_CLR 0x0523 -#define REG_RD_CTRL 0x0524 -#define REG_TBTT_PROHIBIT 0x0540 -#define REG_RD_NAV_NXT 0x0544 -#define REG_NAV_PROT_LEN 0x0546 -#define REG_BCN_CTRL 0x0550 -#define REG_USTIME_TSF 0x0551 -#define REG_MBID_NUM 0x0552 -#define REG_DUAL_TSF_RST 0x0553 -#define REG_BCN_INTERVAL 0x0554 -#define REG_MBSSID_BCN_SPACE 0x0554 -#define REG_DRVERLYINT 0x0558 -#define REG_BCNDMATIM 0x0559 -#define REG_ATIMWND 0x055A -#define REG_BCN_MAX_ERR 0x055D -#define REG_RXTSF_OFFSET_CCK 0x055E -#define REG_RXTSF_OFFSET_OFDM 0x055F -#define REG_TSFTR 0x0560 -#define REG_INIT_TSFTR 0x0564 -#define REG_SECONDARY_CCA_CTRL 0x0577 -#define REG_PSTIMER 0x0580 -#define REG_TIMER0 0x0584 -#define REG_TIMER1 0x0588 -#define REG_ACMHWCTRL 0x05C0 -#define REG_ACMRSTCTRL 0x05C1 -#define REG_ACMAVG 0x05C2 -#define REG_VO_ADMTIME 0x05C4 -#define REG_VI_ADMTIME 0x05C6 -#define REG_BE_ADMTIME 0x05C8 -#define REG_EDCA_RANDOM_GEN 0x05CC -#define REG_NOA_DESC_SEL 0x05CF -#define REG_NOA_DESC_DURATION 0x05E0 -#define REG_NOA_DESC_INTERVAL 0x05E4 -#define REG_NOA_DESC_START 0x05E8 -#define REG_NOA_DESC_COUNT 0x05EC -#define REG_SCH_TX_CMD 0x05F8 - -#define REG_APSD_CTRL 0x0600 -#define REG_BWOPMODE 0x0603 -#define REG_TCR 0x0604 -#define REG_RCR 0x0608 -#define REG_RX_PKT_LIMIT 0x060C -#define REG_RX_DLK_TIME 0x060D -#define REG_RX_DRVINFO_SZ 0x060F - -#define REG_MACID 0x0610 -#define REG_BSSID 0x0618 -#define REG_MAR 0x0620 -#define REG_MBIDCAMCFG 0x0628 - -#define REG_USTIME_EDCA 0x0638 -#define REG_MAC_SPEC_SIFS 0x063A -#define REG_RESP_SIFS_CCK 0x063C -#define REG_RESP_SIFS_OFDM 0x063E -#define REG_ACKTO 0x0640 -#define REG_CTS2TO 0x0641 -#define REG_EIFS 0x0642 - -#define REG_NAV_CTRL 0x0650 -#define REG_NAV_UPPER 0x0652 -#define REG_BACAMCMD 0x0654 -#define REG_BACAMCONTENT 0x0658 -#define REG_LBDLY 0x0660 -#define REG_FWDLY 0x0661 -#define REG_RXERR_RPT 0x0664 -#define REG_TRXPTCL_CTL 0x0668 - -#define REG_CAMCMD 0x0670 -#define REG_CAMWRITE 0x0674 -#define REG_CAMREAD 0x0678 -#define REG_CAMDBG 0x067C -#define REG_SECCFG 0x0680 - -#define REG_WOW_CTRL 0x0690 -#define REG_PSSTATUS 0x0691 -#define REG_PS_RX_INFO 0x0692 -#define REG_UAPSD_TID 0x0693 -#define REG_LPNAV_CTRL 0x0694 -#define REG_WKFMCAM_NUM 0x0698 -#define REG_WKFMCAM_RWD 0x069C -#define REG_RXFLTMAP0 0x06A0 -#define REG_RXFLTMAP1 0x06A2 -#define REG_RXFLTMAP2 0x06A4 -#define REG_BCN_PSR_RPT 0x06A8 -#define REG_CALB32K_CTRL 0x06AC -#define REG_PKT_MON_CTRL 0x06B4 -#define REG_BT_COEX_TABLE 0x06C0 -#define REG_WMAC_RESP_TXINFO 0x06D8 - -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_TEST_USB_TXQS 0xFE48 -#define REG_TEST_SIE_VID 0xFE60 -#define REG_TEST_SIE_PID 0xFE62 -#define REG_TEST_SIE_OPTIONAL 0xFE64 -#define REG_TEST_SIE_CHIRP_K 0xFE65 -#define REG_TEST_SIE_PHY 0xFE66 -#define REG_TEST_SIE_MAC_ADDR 0xFE70 -#define REG_TEST_SIE_STRING 0xFE80 - -#define REG_NORMAL_SIE_VID 0xFE60 -#define REG_NORMAL_SIE_PID 0xFE62 -#define REG_NORMAL_SIE_OPTIONAL 0xFE64 -#define REG_NORMAL_SIE_EP 0xFE65 -#define REG_NORMAL_SIE_PHY 0xFE68 -#define REG_NORMAL_SIE_MAC_ADDR 0xFE70 -#define REG_NORMAL_SIE_STRING 0xFE80 - -#define CR9346 REG_9346CR -#define MSR (REG_CR + 2) -#define ISR REG_HISR -#define TSFR REG_TSFTR - -#define MACIDR0 REG_MACID -#define MACIDR4 (REG_MACID + 4) - -#define PBP REG_PBP - -#define IDR0 MACIDR0 -#define IDR4 MACIDR4 - -#define UNUSED_REGISTER 0x1BF -#define DCAM UNUSED_REGISTER -#define PSR UNUSED_REGISTER -#define BBADDR UNUSED_REGISTER -#define PHYDATAR UNUSED_REGISTER - -#define INVALID_BBRF_VALUE 0x12345678 - -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define CMDEEPROM_EN BIT(5) -#define CMDEEPROM_SEL BIT(4) -#define CMD9346CR_9356SEL BIT(4) -#define AUTOLOAD_EEPROM (CMDEEPROM_EN|CMDEEPROM_SEL) -#define AUTOLOAD_EFUSE CMDEEPROM_EN - -#define GPIOSEL_GPIO 0 -#define GPIOSEL_ENBT BIT(5) - -#define GPIO_IN REG_GPIO_PIN_CTRL -#define GPIO_OUT (REG_GPIO_PIN_CTRL+1) -#define GPIO_IO_SEL (REG_GPIO_PIN_CTRL+2) -#define GPIO_MOD (REG_GPIO_PIN_CTRL+3) - -/* 8723/8188E Host System Interrupt Mask Register (offset 0x58, 32 byte) */ -#define HSIMR_GPIO12_0_INT_EN BIT(0) -#define HSIMR_SPS_OCP_INT_EN BIT(5) -#define HSIMR_RON_INT_EN BIT(6) -#define HSIMR_PDN_INT_EN BIT(7) -#define HSIMR_GPIO9_INT_EN BIT(25) - - -/* -* 8723/8188E Host System Interrupt Status Register (offset 0x5C, 32 byte) -*/ -#define HSISR_GPIO12_0_INT BIT(0) -#define HSISR_SPS_OCP_INT BIT(5) -#define HSISR_RON_INT_EN BIT(6) -#define HSISR_PDNINT BIT(7) -#define HSISR_GPIO9_INT BIT(25) - -#define MSR_NOLINK 0x00 -#define MSR_ADHOC 0x01 -#define MSR_INFRA 0x02 -#define MSR_AP 0x03 - -#define RRSR_RSC_OFFSET 21 -#define RRSR_SHORT_OFFSET 23 -#define RRSR_RSC_BW_40M 0x600000 -#define RRSR_RSC_UPSUBCHNL 0x400000 -#define RRSR_RSC_LOWSUBCHNL 0x200000 -#define RRSR_SHORT 0x800000 -#define RRSR_1M BIT(0) -#define RRSR_2M BIT(1) -#define RRSR_5_5M BIT(2) -#define RRSR_11M BIT(3) -#define RRSR_6M BIT(4) -#define RRSR_9M BIT(5) -#define RRSR_12M BIT(6) -#define RRSR_18M BIT(7) -#define RRSR_24M BIT(8) -#define RRSR_36M BIT(9) -#define RRSR_48M BIT(10) -#define RRSR_54M BIT(11) -#define RRSR_MCS0 BIT(12) -#define RRSR_MCS1 BIT(13) -#define RRSR_MCS2 BIT(14) -#define RRSR_MCS3 BIT(15) -#define RRSR_MCS4 BIT(16) -#define RRSR_MCS5 BIT(17) -#define RRSR_MCS6 BIT(18) -#define RRSR_MCS7 BIT(19) -#define BRSR_ACKSHORTPMB BIT(23) - -#define RATR_1M 0x00000001 -#define RATR_2M 0x00000002 -#define RATR_55M 0x00000004 -#define RATR_11M 0x00000008 -#define RATR_6M 0x00000010 -#define RATR_9M 0x00000020 -#define RATR_12M 0x00000040 -#define RATR_18M 0x00000080 -#define RATR_24M 0x00000100 -#define RATR_36M 0x00000200 -#define RATR_48M 0x00000400 -#define RATR_54M 0x00000800 -#define RATR_MCS0 0x00001000 -#define RATR_MCS1 0x00002000 -#define RATR_MCS2 0x00004000 -#define RATR_MCS3 0x00008000 -#define RATR_MCS4 0x00010000 -#define RATR_MCS5 0x00020000 -#define RATR_MCS6 0x00040000 -#define RATR_MCS7 0x00080000 -#define RATR_MCS8 0x00100000 -#define RATR_MCS9 0x00200000 -#define RATR_MCS10 0x00400000 -#define RATR_MCS11 0x00800000 -#define RATR_MCS12 0x01000000 -#define RATR_MCS13 0x02000000 -#define RATR_MCS14 0x04000000 -#define RATR_MCS15 0x08000000 - -#define RATE_1M BIT(0) -#define RATE_2M BIT(1) -#define RATE_5_5M BIT(2) -#define RATE_11M BIT(3) -#define RATE_6M BIT(4) -#define RATE_9M BIT(5) -#define RATE_12M BIT(6) -#define RATE_18M BIT(7) -#define RATE_24M BIT(8) -#define RATE_36M BIT(9) -#define RATE_48M BIT(10) -#define RATE_54M BIT(11) -#define RATE_MCS0 BIT(12) -#define RATE_MCS1 BIT(13) -#define RATE_MCS2 BIT(14) -#define RATE_MCS3 BIT(15) -#define RATE_MCS4 BIT(16) -#define RATE_MCS5 BIT(17) -#define RATE_MCS6 BIT(18) -#define RATE_MCS7 BIT(19) -#define RATE_MCS8 BIT(20) -#define RATE_MCS9 BIT(21) -#define RATE_MCS10 BIT(22) -#define RATE_MCS11 BIT(23) -#define RATE_MCS12 BIT(24) -#define RATE_MCS13 BIT(25) -#define RATE_MCS14 BIT(26) -#define RATE_MCS15 BIT(27) - -#define RATE_ALL_CCK (RATR_1M | RATR_2M | RATR_55M | RATR_11M) -#define RATE_ALL_OFDM_AG (RATR_6M | RATR_9M | RATR_12M | RATR_18M |\ - RATR_24M| RATR_36M | RATR_48M | RATR_54M) -#define RATE_ALL_OFDM_1SS (RATR_MCS0 | RATR_MCS1 | RATR_MCS2 |\ - RATR_MCS3 | RATR_MCS4 | RATR_MCS5 |\ - RATR_MCS6 | RATR_MCS7) -#define RATE_ALL_OFDM_2SS (RATR_MCS8 | RATR_MCS9 | RATR_MCS10 |\ - RATR_MCS11| RATR_MCS12 | RATR_MCS13 |\ - RATR_MCS14 | RATR_MCS15) - -#define BW_OPMODE_20MHZ BIT(2) -#define BW_OPMODE_5G BIT(1) -#define BW_OPMODE_11J BIT(0) - -#define CAM_VALID BIT(15) -#define CAM_NOTVALID 0x0000 -#define CAM_USEDK BIT(5) - -#define CAM_NONE 0x0 -#define CAM_WEP40 0x01 -#define CAM_TKIP 0x02 -#define CAM_AES 0x04 -#define CAM_WEP104 0x05 - -#define TOTAL_CAM_ENTRY 32 -#define HALF_CAM_ENTRY 16 - -#define CAM_WRITE BIT(16) -#define CAM_READ 0x00000000 -#define CAM_POLLINIG BIT(31) - -#define SCR_USEDK 0x01 -#define SCR_TXSEC_ENABLE 0x02 -#define SCR_RXSEC_ENABLE 0x04 - -#define WOW_PMEN BIT(0) -#define WOW_WOMEN BIT(1) -#define WOW_MAGIC BIT(2) -#define WOW_UWF BIT(3) - -/********************************************* -* 8188 IMR/ISR bits -**********************************************/ -#define IMR_DISABLED 0x0 -/* IMR DW0(0x0060-0063) Bit 0-31 */ -#define IMR_TXCCK BIT(30) /* TXRPT interrupt when CCX bit of the packet is set */ -#define IMR_PSTIMEOUT BIT(29) /* Power Save Time Out Interrupt */ -#define IMR_GTINT4 BIT(28) /* When GTIMER4 expires, this bit is set to 1 */ -#define IMR_GTINT3 BIT(27) /* When GTIMER3 expires, this bit is set to 1 */ -#define IMR_TBDER BIT(26) /* Transmit Beacon0 Error */ -#define IMR_TBDOK BIT(25) /* Transmit Beacon0 OK */ -#define IMR_TSF_BIT32_TOGGLE BIT(24) /* TSF Timer BIT32 toggle indication interrupt */ -#define IMR_BCNDMAINT0 BIT(20) /* Beacon DMA Interrupt 0 */ -#define IMR_BCNDOK0 BIT(16) /* Beacon Queue DMA OK0 */ -#define IMR_HSISR_IND_ON_INT BIT(15) /* HSISR Indicator (HSIMR & HSISR is true, this bit is set to 1) */ -#define IMR_BCNDMAINT_E BIT(14) /* Beacon DMA Interrupt Extension for Win7 */ -#define IMR_ATIMEND BIT(12) /* CTWidnow End or ATIM Window End */ -#define IMR_HISR1_IND_INT BIT(11) /* HISR1 Indicator (HISR1 & HIMR1 is true, this bit is set to 1)*/ -#define IMR_C2HCMD BIT(10) /* CPU to Host Command INT Status, Write 1 clear */ -#define IMR_CPWM2 BIT(9) /* CPU power Mode exchange INT Status, Write 1 clear */ -#define IMR_CPWM BIT(8) /* CPU power Mode exchange INT Status, Write 1 clear */ -#define IMR_HIGHDOK BIT(7) /* High Queue DMA OK */ -#define IMR_MGNTDOK BIT(6) /* Management Queue DMA OK */ -#define IMR_BKDOK BIT(5) /* AC_BK DMA OK */ -#define IMR_BEDOK BIT(4) /* AC_BE DMA OK */ -#define IMR_VIDOK BIT(3) /* AC_VI DMA OK */ -#define IMR_VODOK BIT(2) /* AC_VO DMA OK */ -#define IMR_RDU BIT(1) /* Rx Descriptor Unavailable */ -#define IMR_ROK BIT(0) /* Receive DMA OK */ - -/* IMR DW1(0x00B4-00B7) Bit 0-31 */ -#define IMR_BCNDMAINT7 BIT(27) /* Beacon DMA Interrupt 7 */ -#define IMR_BCNDMAINT6 BIT(26) /* Beacon DMA Interrupt 6 */ -#define IMR_BCNDMAINT5 BIT(25) /* Beacon DMA Interrupt 5 */ -#define IMR_BCNDMAINT4 BIT(24) /* Beacon DMA Interrupt 4 */ -#define IMR_BCNDMAINT3 BIT(23) /* Beacon DMA Interrupt 3 */ -#define IMR_BCNDMAINT2 BIT(22) /* Beacon DMA Interrupt 2 */ -#define IMR_BCNDMAINT1 BIT(21) /* Beacon DMA Interrupt 1 */ -#define IMR_BCNDOK7 BIT(20) /* Beacon Queue DMA OK Interrup 7 */ -#define IMR_BCNDOK6 BIT(19) /* Beacon Queue DMA OK Interrup 6 */ -#define IMR_BCNDOK5 BIT(18) /* Beacon Queue DMA OK Interrup 5 */ -#define IMR_BCNDOK4 BIT(17) /* Beacon Queue DMA OK Interrup 4 */ -#define IMR_BCNDOK3 BIT(16) /* Beacon Queue DMA OK Interrup 3 */ -#define IMR_BCNDOK2 BIT(15) /* Beacon Queue DMA OK Interrup 2 */ -#define IMR_BCNDOK1 BIT(14) /* Beacon Queue DMA OK Interrup 1 */ -#define IMR_ATIMEND_E BIT(13) /* ATIM Window End Extension for Win7 */ -#define IMR_TXERR BIT(11) /* Tx Error Flag Interrupt Status, write 1 clear. */ -#define IMR_RXERR BIT(10) /* Rx Error Flag INT Status, Write 1 clear */ -#define IMR_TXFOVW BIT(9) /* Transmit FIFO Overflow */ -#define IMR_RXFOVW BIT(8) /* Receive FIFO Overflow */ - - -#define HWSET_MAX_SIZE 512 -#define EFUSE_MAX_SECTION 64 -#define EFUSE_REAL_CONTENT_LEN 256 -#define EFUSE_OOB_PROTECT_BYTES 18 /* PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte.*/ - - -#define EEPROM_DEFAULT_TSSI 0x0 -#define EEPROM_DEFAULT_TXPOWERDIFF 0x0 -#define EEPROM_DEFAULT_CRYSTALCAP 0x5 -#define EEPROM_DEFAULT_BOARDTYPE 0x02 -#define EEPROM_DEFAULT_TXPOWER 0x1010 -#define EEPROM_DEFAULT_HT2T_TXPWR 0x10 - -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 -#define EEPROM_DEFAULT_THERMALMETER 0x18 -#define EEPROM_DEFAULT_ANTTXPOWERDIFF 0x0 -#define EEPROM_DEFAULT_TXPWDIFF_CRYSTALCAP 0x5 -#define EEPROM_DEFAULT_TXPOWERLEVEL 0x22 -#define EEPROM_DEFAULT_HT40_2SDIFF 0x0 -#define EEPROM_DEFAULT_HT20_DIFF 2 -#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3 -#define EEPROM_DEFAULT_HT40_PWRMAXOFFSET 0 -#define EEPROM_DEFAULT_HT20_PWRMAXOFFSET 0 - -#define RF_OPTION1 0x79 -#define RF_OPTION2 0x7A -#define RF_OPTION3 0x7B -#define RF_OPTION4 0xC3 - -#define EEPROM_DEFAULT_PID 0x1234 -#define EEPROM_DEFAULT_VID 0x5678 -#define EEPROM_DEFAULT_CUSTOMERID 0xAB -#define EEPROM_DEFAULT_SUBCUSTOMERID 0xCD -#define EEPROM_DEFAULT_VERSION 0 - -#define EEPROM_CHANNEL_PLAN_FCC 0x0 -#define EEPROM_CHANNEL_PLAN_IC 0x1 -#define EEPROM_CHANNEL_PLAN_ETSI 0x2 -#define EEPROM_CHANNEL_PLAN_SPAIN 0x3 -#define EEPROM_CHANNEL_PLAN_FRANCE 0x4 -#define EEPROM_CHANNEL_PLAN_MKK 0x5 -#define EEPROM_CHANNEL_PLAN_MKK1 0x6 -#define EEPROM_CHANNEL_PLAN_ISRAEL 0x7 -#define EEPROM_CHANNEL_PLAN_TELEC 0x8 -#define EEPROM_CHANNEL_PLAN_GLOBAL_DOMAIN 0x9 -#define EEPROM_CHANNEL_PLAN_WORLD_WIDE_13 0xA -#define EEPROM_CHANNEL_PLAN_NCC 0xB -#define EEPROM_CHANNEL_PLAN_BY_HW_MASK 0x80 - -#define EEPROM_CID_DEFAULT 0x0 -#define EEPROM_CID_TOSHIBA 0x4 -#define EEPROM_CID_CCX 0x10 -#define EEPROM_CID_QMI 0x0D -#define EEPROM_CID_WHQL 0xFE - -#define RTL_EEPROM_ID 0x8129 - -#define EEPROM_HPON 0x02 -#define EEPROM_CLK 0x06 -#define EEPROM_TESTR 0x08 - - -#define EEPROM_TXPOWERCCK 0x10 -#define EEPROM_TXPOWERHT40_1S 0x16 -#define EEPROM_TXPOWERHT20DIFF 0x1B -#define EEPROM_TXPOWER_OFDMDIFF 0x1B - - - -#define EEPROM_TX_PWR_INX 0x10 - -#define EEPROM_CHANNELPLAN 0xB8 -#define EEPROM_XTAL_8821AE 0xB9 -#define EEPROM_THERMAL_METER 0xBA -#define EEPROM_IQK_LCK_88E 0xBB - -#define EEPROM_RF_BOARD_OPTION 0xC1 -#define EEPROM_RF_FEATURE_OPTION_88E 0xC2 -#define EEPROM_RF_BT_SETTING 0xC3 -#define EEPROM_VERSION 0xC4 -#define EEPROM_CUSTOMER_ID 0xC5 -#define EEPROM_RF_ANTENNA_OPT_88E 0xC9 - -#define EEPROM_MAC_ADDR 0xD0 -#define EEPROM_VID 0xD6 -#define EEPROM_DID 0xD8 -#define EEPROM_SVID 0xDA -#define EEPROM_SMID 0xDC - -#define STOPBECON BIT(6) -#define STOPHIGHT BIT(5) -#define STOPMGT BIT(4) -#define STOPVO BIT(3) -#define STOPVI BIT(2) -#define STOPBE BIT(1) -#define STOPBK BIT(0) - -#define RCR_APPFCS BIT(31) -#define RCR_APP_MIC BIT(30) -#define RCR_APP_ICV BIT(29) -#define RCR_APP_PHYST_RXFF BIT(28) -#define RCR_APP_BA_SSN BIT(27) -#define RCR_NONQOS_VHT BIT(26) -#define RCR_ENMBID BIT(24) -#define RCR_LSIGEN BIT(23) -#define RCR_MFBEN BIT(22) -#define RCR_HTC_LOC_CTRL BIT(14) -#define RCR_AMF BIT(13) -#define RCR_ACF BIT(12) -#define RCR_ADF BIT(11) -#define RCR_AICV BIT(9) -#define RCR_ACRC32 BIT(8) -#define RCR_CBSSID_BCN BIT(7) -#define RCR_CBSSID_DATA BIT(6) -#define RCR_CBSSID RCR_CBSSID_DATA -#define RCR_APWRMGT BIT(5) -#define RCR_ADD3 BIT(4) -#define RCR_AB BIT(3) -#define RCR_AM BIT(2) -#define RCR_APM BIT(1) -#define RCR_AAP BIT(0) -#define RCR_MXDMA_OFFSET 8 -#define RCR_FIFO_OFFSET 13 - -#define RSV_CTRL 0x001C -#define RD_CTRL 0x0524 - -#define REG_USB_INFO 0xFE17 -#define REG_USB_SPECIAL_OPTION 0xFE55 -#define REG_USB_DMA_AGG_TO 0xFE5B -#define REG_USB_AGG_TO 0xFE5C -#define REG_USB_AGG_TH 0xFE5D - -#define REG_USB_VID 0xFE60 -#define REG_USB_PID 0xFE62 -#define REG_USB_OPTIONAL 0xFE64 -#define REG_USB_CHIRP_K 0xFE65 -#define REG_USB_PHY 0xFE66 -#define REG_USB_MAC_ADDR 0xFE70 -#define REG_USB_HRPWM 0xFE58 -#define REG_USB_HCPWM 0xFE57 - -#define SW18_FPWM BIT(3) - -#define ISO_MD2PP BIT(0) -#define ISO_UA2USB BIT(1) -#define ISO_UD2CORE BIT(2) -#define ISO_PA2PCIE BIT(3) -#define ISO_PD2CORE BIT(4) -#define ISO_IP2MAC BIT(5) -#define ISO_DIOP BIT(6) -#define ISO_DIOE BIT(7) -#define ISO_EB2CORE BIT(8) -#define ISO_DIOR BIT(9) - -#define PWC_EV25V BIT(14) -#define PWC_EV12V BIT(15) - -#define FEN_BBRSTB BIT(0) -#define FEN_BB_GLB_RSTN BIT(1) -#define FEN_USBA BIT(2) -#define FEN_UPLL BIT(3) -#define FEN_USBD BIT(4) -#define FEN_DIO_PCIE BIT(5) -#define FEN_PCIEA BIT(6) -#define FEN_PPLL BIT(7) -#define FEN_PCIED BIT(8) -#define FEN_DIOE BIT(9) -#define FEN_CPUEN BIT(10) -#define FEN_DCORE BIT(11) -#define FEN_ELDR BIT(12) -#define FEN_DIO_RF BIT(13) -#define FEN_HWPDN BIT(14) -#define FEN_MREGEN BIT(15) - -#define PFM_LDALL BIT(0) -#define PFM_ALDN BIT(1) -#define PFM_LDKP BIT(2) -#define PFM_WOWL BIT(3) -#define EnPDN BIT(4) -#define PDN_PL BIT(5) -#define APFM_ONMAC BIT(8) -#define APFM_OFF BIT(9) -#define APFM_RSM BIT(10) -#define AFSM_HSUS BIT(11) -#define AFSM_PCIE BIT(12) -#define APDM_MAC BIT(13) -#define APDM_HOST BIT(14) -#define APDM_HPDN BIT(15) -#define RDY_MACON BIT(16) -#define SUS_HOST BIT(17) -#define ROP_ALD BIT(20) -#define ROP_PWR BIT(21) -#define ROP_SPS BIT(22) -#define SOP_MRST BIT(25) -#define SOP_FUSE BIT(26) -#define SOP_ABG BIT(27) -#define SOP_AMB BIT(28) -#define SOP_RCK BIT(29) -#define SOP_A8M BIT(30) -#define XOP_BTCK BIT(31) - -#define ANAD16V_EN BIT(0) -#define ANA8M BIT(1) -#define MACSLP BIT(4) -#define LOADER_CLK_EN BIT(5) -#define _80M_SSC_DIS BIT(7) -#define _80M_SSC_EN_HO BIT(8) -#define PHY_SSC_RSTB BIT(9) -#define SEC_CLK_EN BIT(10) -#define MAC_CLK_EN BIT(11) -#define SYS_CLK_EN BIT(12) -#define RING_CLK_EN BIT(13) - -#define BOOT_FROM_EEPROM BIT(4) -#define EEPROM_EN BIT(5) - -#define AFE_BGEN BIT(0) -#define AFE_MBEN BIT(1) -#define MAC_ID_EN BIT(7) - -#define WLOCK_ALL BIT(0) -#define WLOCK_00 BIT(1) -#define WLOCK_04 BIT(2) -#define WLOCK_08 BIT(3) -#define WLOCK_40 BIT(4) -#define R_DIS_PRST_0 BIT(5) -#define R_DIS_PRST_1 BIT(6) -#define LOCK_ALL_EN BIT(7) - -#define RF_EN BIT(0) -#define RF_RSTB BIT(1) -#define RF_SDMRSTB BIT(2) - -#define LDA15_EN BIT(0) -#define LDA15_STBY BIT(1) -#define LDA15_OBUF BIT(2) -#define LDA15_REG_VOS BIT(3) -#define _LDA15_VOADJ(x) (((x) & 0x7) << 4) - -#define LDV12_EN BIT(0) -#define LDV12_SDBY BIT(1) -#define LPLDO_HSM BIT(2) -#define LPLDO_LSM_DIS BIT(3) -#define _LDV12_VADJ(x) (((x) & 0xF) << 4) - -#define XTAL_EN BIT(0) -#define XTAL_BSEL BIT(1) -#define _XTAL_BOSC(x) (((x) & 0x3) << 2) -#define _XTAL_CADJ(x) (((x) & 0xF) << 4) -#define XTAL_GATE_USB BIT(8) -#define _XTAL_USB_DRV(x) (((x) & 0x3) << 9) -#define XTAL_GATE_AFE BIT(11) -#define _XTAL_AFE_DRV(x) (((x) & 0x3) << 12) -#define XTAL_RF_GATE BIT(14) -#define _XTAL_RF_DRV(x) (((x) & 0x3) << 15) -#define XTAL_GATE_DIG BIT(17) -#define _XTAL_DIG_DRV(x) (((x) & 0x3) << 18) -#define XTAL_BT_GATE BIT(20) -#define _XTAL_BT_DRV(x) (((x) & 0x3) << 21) -#define _XTAL_GPIO(x) (((x) & 0x7) << 23) - -#define CKDLY_AFE BIT(26) -#define CKDLY_USB BIT(27) -#define CKDLY_DIG BIT(28) -#define CKDLY_BT BIT(29) - -#define APLL_EN BIT(0) -#define APLL_320_EN BIT(1) -#define APLL_FREF_SEL BIT(2) -#define APLL_EDGE_SEL BIT(3) -#define APLL_WDOGB BIT(4) -#define APLL_LPFEN BIT(5) - -#define APLL_REF_CLK_13MHZ 0x1 -#define APLL_REF_CLK_19_2MHZ 0x2 -#define APLL_REF_CLK_20MHZ 0x3 -#define APLL_REF_CLK_25MHZ 0x4 -#define APLL_REF_CLK_26MHZ 0x5 -#define APLL_REF_CLK_38_4MHZ 0x6 -#define APLL_REF_CLK_40MHZ 0x7 - -#define APLL_320EN BIT(14) -#define APLL_80EN BIT(15) -#define APLL_1MEN BIT(24) - -#define ALD_EN BIT(18) -#define EF_PD BIT(19) -#define EF_FLAG BIT(31) - -#define EF_TRPT BIT(7) -#define LDOE25_EN BIT(31) - -#define RSM_EN BIT(0) -#define Timer_EN BIT(4) - -#define TRSW0EN BIT(2) -#define TRSW1EN BIT(3) -#define EROM_EN BIT(4) -#define EnBT BIT(5) -#define EnUart BIT(8) -#define Uart_910 BIT(9) -#define EnPMAC BIT(10) -#define SIC_SWRST BIT(11) -#define EnSIC BIT(12) -#define SIC_23 BIT(13) -#define EnHDP BIT(14) -#define SIC_LBK BIT(15) - -#define LED0PL BIT(4) -#define LED1PL BIT(12) -#define LED0DIS BIT(7) - -#define MCUFWDL_EN BIT(0) -#define MCUFWDL_RDY BIT(1) -#define FWDL_CHKSUM_RPT BIT(2) -#define MACINI_RDY BIT(3) -#define BBINI_RDY BIT(4) -#define RFINI_RDY BIT(5) -#define WINTINI_RDY BIT(6) -#define CPRST BIT(23) - -#define XCLK_VLD BIT(0) -#define ACLK_VLD BIT(1) -#define UCLK_VLD BIT(2) -#define PCLK_VLD BIT(3) -#define PCIRSTB BIT(4) -#define V15_VLD BIT(5) -#define TRP_B15V_EN BIT(7) -#define SIC_IDLE BIT(8) -#define BD_MAC2 BIT(9) -#define BD_MAC1 BIT(10) -#define IC_MACPHY_MODE BIT(11) -#define VENDOR_ID BIT(19) -#define PAD_HWPD_IDN BIT(22) -#define TRP_VAUX_EN BIT(23) -#define TRP_BT_EN BIT(24) -#define BD_PKG_SEL BIT(25) -#define BD_HCI_SEL BIT(26) -#define TYPE_ID BIT(27) - -#define CHIP_VER_RTL_MASK 0xF000 -#define CHIP_VER_RTL_SHIFT 12 - -#define REG_LBMODE (REG_CR + 3) - -#define HCI_TXDMA_EN BIT(0) -#define HCI_RXDMA_EN BIT(1) -#define TXDMA_EN BIT(2) -#define RXDMA_EN BIT(3) -#define PROTOCOL_EN BIT(4) -#define SCHEDULE_EN BIT(5) -#define MACTXEN BIT(6) -#define MACRXEN BIT(7) -#define ENSWBCN BIT(8) -#define ENSEC BIT(9) - -#define _NETTYPE(x) (((x) & 0x3) << 16) -#define MASK_NETTYPE 0x30000 -#define NT_NO_LINK 0x0 -#define NT_LINK_AD_HOC 0x1 -#define NT_LINK_AP 0x2 -#define NT_AS_AP 0x3 - -#define _LBMODE(x) (((x) & 0xF) << 24) -#define MASK_LBMODE 0xF000000 -#define LOOPBACK_NORMAL 0x0 -#define LOOPBACK_IMMEDIATELY 0xB -#define LOOPBACK_MAC_DELAY 0x3 -#define LOOPBACK_PHY 0x1 -#define LOOPBACK_DMA 0x7 - -#define GET_RX_PAGE_SIZE(value) ((value) & 0xF) -#define GET_TX_PAGE_SIZE(value) (((value) & 0xF0) >> 4) -#define _PSRX_MASK 0xF -#define _PSTX_MASK 0xF0 -#define _PSRX(x) (x) -#define _PSTX(x) ((x) << 4) - -#define PBP_64 0x0 -#define PBP_128 0x1 -#define PBP_256 0x2 -#define PBP_512 0x3 -#define PBP_1024 0x4 - -#define RXDMA_ARBBW_EN BIT(0) -#define RXSHFT_EN BIT(1) -#define RXDMA_AGG_EN BIT(2) -#define QS_VO_QUEUE BIT(8) -#define QS_VI_QUEUE BIT(9) -#define QS_BE_QUEUE BIT(10) -#define QS_BK_QUEUE BIT(11) -#define QS_MANAGER_QUEUE BIT(12) -#define QS_HIGH_QUEUE BIT(13) - -#define HQSEL_VOQ BIT(0) -#define HQSEL_VIQ BIT(1) -#define HQSEL_BEQ BIT(2) -#define HQSEL_BKQ BIT(3) -#define HQSEL_MGTQ BIT(4) -#define HQSEL_HIQ BIT(5) - -#define _TXDMA_HIQ_MAP(x) (((x)&0x3) << 14) -#define _TXDMA_MGQ_MAP(x) (((x)&0x3) << 12) -#define _TXDMA_BKQ_MAP(x) (((x)&0x3) << 10) -#define _TXDMA_BEQ_MAP(x) (((x)&0x3) << 8 ) -#define _TXDMA_VIQ_MAP(x) (((x)&0x3) << 6 ) -#define _TXDMA_VOQ_MAP(x) (((x)&0x3) << 4 ) - -#define QUEUE_LOW 1 -#define QUEUE_NORMAL 2 -#define QUEUE_HIGH 3 - -#define _LLT_NO_ACTIVE 0x0 -#define _LLT_WRITE_ACCESS 0x1 -#define _LLT_READ_ACCESS 0x2 - -#define _LLT_INIT_DATA(x) ((x) & 0xFF) -#define _LLT_INIT_ADDR(x) (((x) & 0xFF) << 8) -#define _LLT_OP(x) (((x) & 0x3) << 30) -#define _LLT_OP_VALUE(x) (((x) >> 30) & 0x3) - -#define BB_WRITE_READ_MASK (BIT(31) | BIT(30)) -#define BB_WRITE_EN BIT(30) -#define BB_READ_EN BIT(31) - -#define _HPQ(x) ((x) & 0xFF) -#define _LPQ(x) (((x) & 0xFF) << 8) -#define _PUBQ(x) (((x) & 0xFF) << 16) -#define _NPQ(x) ((x) & 0xFF) - -#define HPQ_PUBLIC_DIS BIT(24) -#define LPQ_PUBLIC_DIS BIT(25) -#define LD_RQPN BIT(31) - -#define BCN_VALID BIT(16) -#define BCN_HEAD(x) (((x) & 0xFF) << 8) -#define BCN_HEAD_MASK 0xFF00 - -#define BLK_DESC_NUM_SHIFT 4 -#define BLK_DESC_NUM_MASK 0xF - -#define DROP_DATA_EN BIT(9) - -#define EN_AMPDU_RTY_NEW BIT(7) - -#define _INIRTSMCS_SEL(x) ((x) & 0x3F) - -#define _SPEC_SIFS_CCK(x) ((x) & 0xFF) -#define _SPEC_SIFS_OFDM(x) (((x) & 0xFF) << 8) - -#define RATE_REG_BITMAP_ALL 0xFFFFF - -#define _RRSC_BITMAP(x) ((x) & 0xFFFFF) - -#define _RRSR_RSC(x) (((x) & 0x3) << 21) -#define RRSR_RSC_RESERVED 0x0 -#define RRSR_RSC_UPPER_SUBCHANNEL 0x1 -#define RRSR_RSC_LOWER_SUBCHANNEL 0x2 -#define RRSR_RSC_DUPLICATE_MODE 0x3 - -#define USE_SHORT_G1 BIT(20) - -#define _AGGLMT_MCS0(x) ((x) & 0xF) -#define _AGGLMT_MCS1(x) (((x) & 0xF) << 4) -#define _AGGLMT_MCS2(x) (((x) & 0xF) << 8) -#define _AGGLMT_MCS3(x) (((x) & 0xF) << 12) -#define _AGGLMT_MCS4(x) (((x) & 0xF) << 16) -#define _AGGLMT_MCS5(x) (((x) & 0xF) << 20) -#define _AGGLMT_MCS6(x) (((x) & 0xF) << 24) -#define _AGGLMT_MCS7(x) (((x) & 0xF) << 28) - -#define RETRY_LIMIT_SHORT_SHIFT 8 -#define RETRY_LIMIT_LONG_SHIFT 0 - -#define _DARF_RC1(x) ((x) & 0x1F) -#define _DARF_RC2(x) (((x) & 0x1F) << 8) -#define _DARF_RC3(x) (((x) & 0x1F) << 16) -#define _DARF_RC4(x) (((x) & 0x1F) << 24) -#define _DARF_RC5(x) ((x) & 0x1F) -#define _DARF_RC6(x) (((x) & 0x1F) << 8) -#define _DARF_RC7(x) (((x) & 0x1F) << 16) -#define _DARF_RC8(x) (((x) & 0x1F) << 24) - -#define _RARF_RC1(x) ((x) & 0x1F) -#define _RARF_RC2(x) (((x) & 0x1F) << 8) -#define _RARF_RC3(x) (((x) & 0x1F) << 16) -#define _RARF_RC4(x) (((x) & 0x1F) << 24) -#define _RARF_RC5(x) ((x) & 0x1F) -#define _RARF_RC6(x) (((x) & 0x1F) << 8) -#define _RARF_RC7(x) (((x) & 0x1F) << 16) -#define _RARF_RC8(x) (((x) & 0x1F) << 24) - -#define AC_PARAM_TXOP_LIMIT_OFFSET 16 -#define AC_PARAM_ECW_MAX_OFFSET 12 -#define AC_PARAM_ECW_MIN_OFFSET 8 -#define AC_PARAM_AIFS_OFFSET 0 - -#define _AIFS(x) (x) -#define _ECW_MAX_MIN(x) ((x) << 8) -#define _TXOP_LIMIT(x) ((x) << 16) - -#define _BCNIFS(x) ((x) & 0xFF) -#define _BCNECW(x) ((((x) & 0xF))<< 8) - -#define _LRL(x) ((x) & 0x3F) -#define _SRL(x) (((x) & 0x3F) << 8) - -#define _SIFS_CCK_CTX(x) ((x) & 0xFF) -#define _SIFS_CCK_TRX(x) (((x) & 0xFF) << 8); - -#define _SIFS_OFDM_CTX(x) ((x) & 0xFF) -#define _SIFS_OFDM_TRX(x) (((x) & 0xFF) << 8); - -#define _TBTT_PROHIBIT_HOLD(x) (((x) & 0xFF) << 8) - -#define DIS_EDCA_CNT_DWN BIT(11) - -#define EN_MBSSID BIT(1) -#define EN_TXBCN_RPT BIT(2) -#define EN_BCN_FUNCTION BIT(3) - -#define TSFTR_RST BIT(0) -#define TSFTR1_RST BIT(1) - -#define STOP_BCNQ BIT(6) - -#define DIS_TSF_UDT0_NORMAL_CHIP BIT(4) -#define DIS_TSF_UDT0_TEST_CHIP BIT(5) - -#define AcmHw_HwEn BIT(0) -#define AcmHw_BeqEn BIT(1) -#define AcmHw_ViqEn BIT(2) -#define AcmHw_VoqEn BIT(3) -#define AcmHw_BeqStatus BIT(4) -#define AcmHw_ViqStatus BIT(5) -#define AcmHw_VoqStatus BIT(6) - -#define APSDOFF BIT(6) -#define APSDOFF_STATUS BIT(7) - -#define BW_20MHZ BIT(2) - -#define RATE_BITMAP_ALL 0xFFFFF - -#define RATE_RRSR_CCK_ONLY_1M 0xFFFF1 - -#define TSFRST BIT(0) -#define DIS_GCLK BIT(1) -#define PAD_SEL BIT(2) -#define PWR_ST BIT(6) -#define PWRBIT_OW_EN BIT(7) -#define ACRC BIT(8) -#define CFENDFORM BIT(9) -#define ICV BIT(10) - -#define AAP BIT(0) -#define APM BIT(1) -#define AM BIT(2) -#define AB BIT(3) -#define ADD3 BIT(4) -#define APWRMGT BIT(5) -#define CBSSID BIT(6) -#define CBSSID_DATA BIT(6) -#define CBSSID_BCN BIT(7) -#define ACRC32 BIT(8) -#define AICV BIT(9) -#define ADF BIT(11) -#define ACF BIT(12) -#define AMF BIT(13) -#define HTC_LOC_CTRL BIT(14) -#define UC_DATA_EN BIT(16) -#define BM_DATA_EN BIT(17) -#define MFBEN BIT(22) -#define LSIGEN BIT(23) -#define EnMBID BIT(24) -#define APP_BASSN BIT(27) -#define APP_PHYSTS BIT(28) -#define APP_ICV BIT(29) -#define APP_MIC BIT(30) -#define APP_FCS BIT(31) - -#define _MIN_SPACE(x) ((x) & 0x7) -#define _SHORT_GI_PADDING(x) (((x) & 0x1F) << 3) - -#define RXERR_TYPE_OFDM_PPDU 0 -#define RXERR_TYPE_OFDM_FALSE_ALARM 1 -#define RXERR_TYPE_OFDM_MPDU_OK 2 -#define RXERR_TYPE_OFDM_MPDU_FAIL 3 -#define RXERR_TYPE_CCK_PPDU 4 -#define RXERR_TYPE_CCK_FALSE_ALARM 5 -#define RXERR_TYPE_CCK_MPDU_OK 6 -#define RXERR_TYPE_CCK_MPDU_FAIL 7 -#define RXERR_TYPE_HT_PPDU 8 -#define RXERR_TYPE_HT_FALSE_ALARM 9 -#define RXERR_TYPE_HT_MPDU_TOTAL 10 -#define RXERR_TYPE_HT_MPDU_OK 11 -#define RXERR_TYPE_HT_MPDU_FAIL 12 -#define RXERR_TYPE_RX_FULL_DROP 15 - -#define RXERR_COUNTER_MASK 0xFFFFF -#define RXERR_RPT_RST BIT(27) -#define _RXERR_RPT_SEL(type) ((type) << 28) - -#define SCR_TxUseDK BIT(0) -#define SCR_RxUseDK BIT(1) -#define SCR_TxEncEnable BIT(2) -#define SCR_RxDecEnable BIT(3) -#define SCR_SKByA2 BIT(4) -#define SCR_NoSKMC BIT(5) -#define SCR_TXBCUSEDK BIT(6) -#define SCR_RXBCUSEDK BIT(7) - -#define XCLK_VLD BIT(0) -#define ACLK_VLD BIT(1) -#define UCLK_VLD BIT(2) -#define PCLK_VLD BIT(3) -#define PCIRSTB BIT(4) -#define V15_VLD BIT(5) -#define TRP_B15V_EN BIT(7) -#define SIC_IDLE BIT(8) -#define BD_MAC2 BIT(9) -#define BD_MAC1 BIT(10) -#define IC_MACPHY_MODE BIT(11) -#define BT_FUNC BIT(16) -#define VENDOR_ID BIT(19) -#define PAD_HWPD_IDN BIT(22) -#define TRP_VAUX_EN BIT(23) -#define TRP_BT_EN BIT(24) -#define BD_PKG_SEL BIT(25) -#define BD_HCI_SEL BIT(26) -#define TYPE_ID BIT(27) - -#define USB_IS_HIGH_SPEED 0 -#define USB_IS_FULL_SPEED 1 -#define USB_SPEED_MASK BIT(5) - -#define USB_NORMAL_SIE_EP_MASK 0xF -#define USB_NORMAL_SIE_EP_SHIFT 4 - -#define USB_TEST_EP_MASK 0x30 -#define USB_TEST_EP_SHIFT 4 - -#define USB_AGG_EN BIT(3) - -#define MAC_ADDR_LEN 6 -#define LAST_ENTRY_OF_TX_PKT_BUFFER 175/*255 88e*/ - -#define POLLING_LLT_THRESHOLD 20 -#define POLLING_READY_TIMEOUT_COUNT 3000 - -#define MAX_MSS_DENSITY_2T 0x13 -#define MAX_MSS_DENSITY_1T 0x0A - -#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) -#define EPROM_CMD_CONFIG 0x3 -#define EPROM_CMD_LOAD 1 - -#define HWSET_MAX_SIZE_92S HWSET_MAX_SIZE - -#define HAL_8192C_HW_GPIO_WPS_BIT BIT(2) - -#define RA_LSSIWRITE_8821A 0xc90 -#define RB_LSSIWRITE_8821A 0xe90 - -#define RA_PIREAD_8821A 0xd04 -#define RB_PIREAD_8821A 0xd44 -#define RA_SIREAD_8821A 0xd08 -#define RB_SIREAD_8821A 0xd48 - -#define RPMAC_RESET 0x100 -#define RPMAC_TXSTART 0x104 -#define RPMAC_TXLEGACYSIG 0x108 -#define RPMAC_TXHTSIG1 0x10c -#define RPMAC_TXHTSIG2 0x110 -#define RPMAC_PHYDEBUG 0x114 -#define RPMAC_TXPACKETNUM 0x118 -#define RPMAC_TXIDLE 0x11c -#define RPMAC_TXMACHEADER0 0x120 -#define RPMAC_TXMACHEADER1 0x124 -#define RPMAC_TXMACHEADER2 0x128 -#define RPMAC_TXMACHEADER3 0x12c -#define RPMAC_TXMACHEADER4 0x130 -#define RPMAC_TXMACHEADER5 0x134 -#define RPMAC_TXDADATYPE 0x138 -#define RPMAC_TXRANDOMSEED 0x13c -#define RPMAC_CCKPLCPPREAMBLE 0x140 -#define RPMAC_CCKPLCPHEADER 0x144 -#define RPMAC_CCKCRC16 0x148 -#define RPMAC_OFDMRXCRC32OK 0x170 -#define RPMAC_OFDMRXCRC32Er 0x174 -#define RPMAC_OFDMRXPARITYER 0x178 -#define RPMAC_OFDMRXCRC8ER 0x17c -#define RPMAC_CCKCRXRC16ER 0x180 -#define RPMAC_CCKCRXRC32ER 0x184 -#define RPMAC_CCKCRXRC32OK 0x188 -#define RPMAC_TXSTATUS 0x18c - -#define RFPGA0_RFMOD 0x800 - -#define RFPGA0_TXINFO 0x804 -#define RFPGA0_PSDFUNCTION 0x808 - -#define RFPGA0_TXGAINSTAGE 0x80c - -#define RFPGA0_RFTIMING1 0x810 -#define RFPGA0_RFTIMING2 0x814 - -#define RFPGA0_XA_HSSIPARAMETER1 0x820 -#define RFPGA0_XA_HSSIPARAMETER2 0x824 -#define RFPGA0_XB_HSSIPARAMETER1 0x828 -#define RFPGA0_XB_HSSIPARAMETER2 0x82c -#define RCCAONSEC 0x838 - -#define RFPGA0_XA_LSSIPARAMETER 0x840 -#define RFPGA0_XB_LSSIPARAMETER 0x844 -#define RL1PEAKTH 0x848 - -#define RFPGA0_RFWAKEUPPARAMETER 0x850 -#define RFPGA0_RFSLEEPUPPARAMETER 0x854 - -#define RFPGA0_XAB_SWITCHCONTROL 0x858 -#define RFPGA0_XCD_SWITCHCONTROL 0x85c - -#define RFPGA0_XA_RFINTERFACEOE 0x860 -#define RFC_AREA 0x860 -#define RFPGA0_XB_RFINTERFACEOE 0x864 - -#define RFPGA0_XAB_RFINTERFACESW 0x870 -#define RFPGA0_XCD_RFINTERFACESW 0x874 - -#define rFPGA0_XAB_RFPARAMETER 0x878 -#define rFPGA0_XCD_RFPARAMETER 0x87c - -#define RFPGA0_ANALOGPARAMETER1 0x880 -#define RFPGA0_ANALOGPARAMETER2 0x884 -#define RFPGA0_ANALOGPARAMETER3 0x888 -#define RFPGA0_ANALOGPARAMETER4 0x88c - -#define RFPGA0_XA_LSSIREADBACK 0x8a0 -#define RFPGA0_XB_LSSIREADBACK 0x8a4 -#define RFPGA0_XC_LSSIREADBACK 0x8a8 -//#define RFPGA0_XD_LSSIREADBACK 0x8ac -#define RRFMOD 0x8ac -#define RHSSIREAD_8821AE 0x8b0 - -#define RFPGA0_PSDREPORT 0x8b4 -#define TRANSCEIVEA_HSPI_READBACK 0x8b8 -#define TRANSCEIVEB_HSPI_READBACK 0x8bc -//#define REG_SC_CNT 0x8c4 -#define RADC_BUF_CLK 0x8c4 -#define RFPGA0_XAB_RFINTERFACERB 0x8e0 -#define RFPGA0_XCD_RFINTERFACERB 0x8e4 - -#define RFPGA1_RFMOD 0x900 - -#define RFPGA1_TXBLOCK 0x904 -#define RFPGA1_DEBUGSELECT 0x908 -#define RFPGA1_TXINFO 0x90c - -#define RCCK_SYSTEM 0xa00 -#define BCCK_SYSTEM 0x10 - - -#define RCCK0_AFESETTING 0xa04 -#define RCCK0_CCA 0xa08 - -#define RCCK0_RXAGC1 0xa0c -#define RCCK0_RXAGC2 0xa10 - -#define RCCK0_RXHP 0xa14 - -#define RCCK0_DSPPARAMETER1 0xa18 -#define RCCK0_DSPPARAMETER2 0xa1c - -#define RCCK0_TXFILTER1 0xa20 -#define RCCK0_TXFILTER2 0xa24 -#define RCCK0_DEBUGPORT 0xa28 -#define RCCK0_FALSEALARMREPORT 0xa2c -#define RCCK0_TRSSIREPORT 0xa50 -#define RCCK0_RXREPORT 0xa54 -#define RCCK0_FACOUNTERLOWER 0xa5c -#define RCCK0_FACOUNTERUPPER 0xa58 -#define RCCK0_CCA_CNT 0xa60 - - -/* PageB(0xB00) */ -#define rPdp_AntA 0xb00 -#define rPdp_AntA_4 0xb04 -#define rPdp_AntA_8 0xb08 -#define rPdp_AntA_C 0xb0c -#define rPdp_AntA_10 0xb10 -#define rPdp_AntA_14 0xb14 -#define rPdp_AntA_18 0xb18 -#define rPdp_AntA_1C 0xb1c -#define rPdp_AntA_20 0xb20 -#define rPdp_AntA_24 0xb24 - -#define rConfig_Pmpd_AntA 0xb28 -#define rConfig_ram64x16 0xb2c - -#define rBndA 0xb30 -#define rHssiPar 0xb34 - -#define rConfig_AntA 0xb68 -#define rConfig_AntB 0xb6c - -#define rPdp_AntB 0xb70 -#define rPdp_AntB_4 0xb74 -#define rPdp_AntB_8 0xb78 -#define rPdp_AntB_C 0xb7c -#define rPdp_AntB_10 0xb80 -#define rPdp_AntB_14 0xb84 -#define rPdp_AntB_18 0xb88 -#define rPdp_AntB_1C 0xb8c -#define rPdp_AntB_20 0xb90 -#define rPdp_AntB_24 0xb94 - -#define rConfig_Pmpd_AntB 0xb98 - -#define rBndB 0xba0 - -#define rAPK 0xbd8 -#define rPm_Rx0_AntA 0xbdc -#define rPm_Rx1_AntA 0xbe0 -#define rPm_Rx2_AntA 0xbe4 -#define rPm_Rx3_AntA 0xbe8 -#define rPm_Rx0_AntB 0xbec -#define rPm_Rx1_AntB 0xbf0 -#define rPm_Rx2_AntB 0xbf4 -#define rPm_Rx3_AntB 0xbf8 - -/*RSSI Dump*/ -#define RA_RSSI_DUMP 0xBF0 -#define RB_RSSI_DUMP 0xBF1 -#define RS1_RX_EVM_DUMP 0xBF4 -#define RS2_RX_EVM_DUMP 0xBF5 -#define RA_RX_SNR_DUMP 0xBF6 -#define RB_RX_SNR_DUMP 0xBF7 -#define RA_CFO_SHORT_DUMP 0xBF8 -#define RB_CFO_SHORT_DUMP 0xBFA -#define RA_CFO_LONG_DUMP 0xBEC -#define RB_CFO_LONG_DUMP 0xBEE - -/*Page C*/ -#define ROFDM0_LSTF 0xc00 - -#define ROFDM0_TRXPATHENABLE 0xc04 -#define ROFDM0_TRMUXPAR 0xc08 -#define ROFDM0_TRSWISOLATION 0xc0c - -#define ROFDM0_XARXAFE 0xc10 -#define ROFDM0_XARXIQIMBALANCE 0xc14 -#define ROFDM0_XBRXAFE 0xc18 -#define ROFDM0_XBRXIQIMBALANCE 0xc1c -#define ROFDM0_XCRXAFE 0xc20 -#define ROFDM0_XCRXIQIMBANLANCE 0xc24 -#define ROFDM0_XDRXAFE 0xc28 -#define ROFDM0_XDRXIQIMBALANCE 0xc2c - -#define ROFDM0_RXDETECTOR1 0xc30 -#define ROFDM0_RXDETECTOR2 0xc34 -#define ROFDM0_RXDETECTOR3 0xc38 -#define ROFDM0_RXDETECTOR4 0xc3c - -#define ROFDM0_RXDSP 0xc40 -#define ROFDM0_CFOANDDAGC 0xc44 -#define ROFDM0_CCADROPTHRESHOLD 0xc48 -#define ROFDM0_ECCATHRESHOLD 0xc4c - -#define ROFDM0_XAAGCCORE1 0xc50 -#define ROFDM0_XAAGCCORE2 0xc54 -#define ROFDM0_XBAGCCORE1 0xc58 -#define ROFDM0_XBAGCCORE2 0xc5c -#define ROFDM0_XCAGCCORE1 0xc60 -#define ROFDM0_XCAGCCORE2 0xc64 -#define ROFDM0_XDAGCCORE1 0xc68 -#define ROFDM0_XDAGCCORE2 0xc6c - -#define ROFDM0_AGCPARAMETER1 0xc70 -#define ROFDM0_AGCPARAMETER2 0xc74 -#define ROFDM0_AGCRSSITABLE 0xc78 -#define ROFDM0_HTSTFAGC 0xc7c - -#define ROFDM0_XATXIQIMBALANCE 0xc80 -#define ROFDM0_XATXAFE 0xc84 -#define ROFDM0_XBTXIQIMBALANCE 0xc88 -#define ROFDM0_XBTXAFE 0xc8c -#define ROFDM0_XCTXIQIMBALANCE 0xc90 -#define ROFDM0_XCTXAFE 0xc94 -#define ROFDM0_XDTXIQIMBALANCE 0xc98 -#define ROFDM0_XDTXAFE 0xc9c - -#define ROFDM0_RXIQEXTANTA 0xca0 -#define ROFDM0_TXCOEFF1 0xca4 -#define ROFDM0_TXCOEFF2 0xca8 -#define ROFDM0_TXCOEFF3 0xcac -#define ROFDM0_TXCOEFF4 0xcb0 -#define ROFDM0_TXCOEFF5 0xcb4 -#define ROFDM0_TXCOEFF6 0xcb8 - -/*Path_A RFE cotrol */ -#define RA_RFE_CTRL_8812 0xcb8 -/*Path_B RFE control*/ -#define RB_RFE_CTRL_8812 0xeb8 - -#define ROFDM0_RXHPPARAMETER 0xce0 -#define ROFDM0_TXPSEUDONOISEWGT 0xce4 -#define ROFDM0_FRAMESYNC 0xcf0 -#define ROFDM0_DFSREPORT 0xcf4 - - -#define ROFDM1_LSTF 0xd00 -#define ROFDM1_TRXPATHENABLE 0xd04 - -#define ROFDM1_CF0 0xd08 -#define ROFDM1_CSI1 0xd10 -#define ROFDM1_SBD 0xd14 -#define ROFDM1_CSI2 0xd18 -#define ROFDM1_CFOTRACKING 0xd2c -#define ROFDM1_TRXMESAURE1 0xd34 -#define ROFDM1_INTFDET 0xd3c -#define ROFDM1_PSEUDONOISESTATEAB 0xd50 -#define ROFDM1_PSEUDONOISESTATECD 0xd54 -#define ROFDM1_RXPSEUDONOISEWGT 0xd58 - -#define ROFDM_PHYCOUNTER1 0xda0 -#define ROFDM_PHYCOUNTER2 0xda4 -#define ROFDM_PHYCOUNTER3 0xda8 - -#define ROFDM_SHORTCFOAB 0xdac -#define ROFDM_SHORTCFOCD 0xdb0 -#define ROFDM_LONGCFOAB 0xdb4 -#define ROFDM_LONGCFOCD 0xdb8 -#define ROFDM_TAILCF0AB 0xdbc -#define ROFDM_TAILCF0CD 0xdc0 -#define ROFDM_PWMEASURE1 0xdc4 -#define ROFDM_PWMEASURE2 0xdc8 -#define ROFDM_BWREPORT 0xdcc -#define ROFDM_AGCREPORT 0xdd0 -#define ROFDM_RXSNR 0xdd4 -#define ROFDM_RXEVMCSI 0xdd8 -#define ROFDM_SIGREPORT 0xddc - -#define RTXAGC_A_CCK11_CCK1 0xc20 -#define RTXAGC_A_OFDM18_OFDM6 0xc24 -#define RTXAGC_A_OFDM54_OFDM24 0xc28 -#define RTXAGC_A_MCS03_MCS00 0xc2c -#define RTXAGC_A_MCS07_MCS04 0xc30 -#define RTXAGC_A_MCS11_MCS08 0xc34 -#define RTXAGC_A_MCS15_MCS12 0xc38 -#define RTXAGC_A_NSS1INDEX3_NSS1INDEX0 0xc3c -#define RTXAGC_A_NSS1INDEX7_NSS1INDEX4 0xc40 -#define RTXAGC_A_NSS2INDEX1_NSS1INDEX8 0xc44 -#define RTXAGC_A_NSS2INDEX5_NSS2INDEX2 0xc48 -#define RTXAGC_A_NSS2INDEX9_NSS2INDEX6 0xc4c -#define RTXAGC_B_CCK11_CCK1 0xe20 -#define RTXAGC_B_OFDM18_OFDM6 0xe24 -#define RTXAGC_B_OFDM54_OFDM24 0xe28 -#define RTXAGC_B_MCS03_MCS00 0xe2c -#define RTXAGC_B_MCS07_MCS04 0xe30 -#define RTXAGC_B_MCS11_MCS08 0xe34 -#define RTXAGC_B_MCS15_MCS12 0xe38 -#define RTXAGC_B_NSS1INDEX3_NSS1INDEX0 0xe3c -#define RTXAGC_B_NSS1INDEX7_NSS1INDEX4 0xe40 -#define RTXAGC_B_NSS2INDEX1_NSS1INDEX8 0xe44 -#define RTXAGC_B_NSS2INDEX5_NSS2INDEX2 0xe48 -#define RTXAGC_B_NSS2INDEX9_NSS2INDEX6 0xe4c - -#define RA_TXPWRTRAING 0xc54 -#define RB_TXPWRTRAING 0xe54 - - -#define RFPGA0_IQK 0xe28 -#define RTx_IQK_Tone_A 0xe30 -#define RRx_IQK_Tone_A 0xe34 -#define RTx_IQK_PI_A 0xe38 -#define RRx_IQK_PI_A 0xe3c - -#define RTx_IQK 0xe40 -#define RRx_IQK 0xe44 -#define RIQK_AGC_Pts 0xe48 -#define RIQK_AGC_Rsp 0xe4c -#define RTx_IQK_Tone_B 0xe50 -#define RRx_IQK_Tone_B 0xe54 -#define RTx_IQK_PI_B 0xe58 -#define RRx_IQK_PI_B 0xe5c -#define RIQK_AGC_Cont 0xe60 - -#define RBlue_Tooth 0xe6c -#define RRx_Wait_CCA 0xe70 -#define RTx_CCK_RFON 0xe74 -#define RTx_CCK_BBON 0xe78 -#define RTx_OFDM_RFON 0xe7c -#define RTx_OFDM_BBON 0xe80 -#define RTx_To_Rx 0xe84 -#define RTx_To_Tx 0xe88 -#define RRx_CCK 0xe8c - -#define RTx_Power_Before_IQK_A 0xe94 -#define RTx_Power_After_IQK_A 0xe9c - -#define RRx_Power_Before_IQK_A 0xea0 -#define RRx_Power_Before_IQK_A_2 0xea4 -#define RRx_Power_After_IQK_A 0xea8 -#define RRx_Power_After_IQK_A_2 0xeac - -#define RTx_Power_Before_IQK_B 0xeb4 -#define RTx_Power_After_IQK_B 0xebc - -#define RRx_Power_Before_IQK_B 0xec0 -#define RRx_Power_Before_IQK_B_2 0xec4 -#define RRx_Power_After_IQK_B 0xec8 -#define RRx_Power_After_IQK_B_2 0xecc - -#define RRx_OFDM 0xed0 -#define RRx_Wait_RIFS 0xed4 -#define RRx_TO_Rx 0xed8 -#define RStandby 0xedc -#define RSleep 0xee0 -#define RPMPD_ANAEN 0xeec - -#define RZEBRA1_HSSIENABLE 0x0 -#define RZEBRA1_TRXENABLE1 0x1 -#define RZEBRA1_TRXENABLE2 0x2 -#define RZEBRA1_AGC 0x4 -#define RZEBRA1_CHARGEPUMP 0x5 -#define RZEBRA1_CHANNEL 0x7 - -#define RZEBRA1_TXGAIN 0x8 -#define RZEBRA1_TXLPF 0x9 -#define RZEBRA1_RXLPF 0xb -#define RZEBRA1_RXHPFCORNER 0xc - -#define RGLOBALCTRL 0 -#define RRTL8256_TXLPF 19 -#define RRTL8256_RXLPF 11 -#define RRTL8258_TXLPF 0x11 -#define RRTL8258_RXLPF 0x13 -#define RRTL8258_RSSILPF 0xa - -#define RF_AC 0x00 - -#define RF_IQADJ_G1 0x01 -#define RF_IQADJ_G2 0x02 -#define RF_POW_TRSW 0x05 - -#define RF_GAIN_RX 0x06 -#define RF_GAIN_TX 0x07 - -#define RF_TXM_IDAC 0x08 -#define RF_BS_IQGEN 0x0F - -#define RF_MODE1 0x10 -#define RF_MODE2 0x11 - -#define RF_RX_AGC_HP 0x12 -#define RF_TX_AGC 0x13 -#define RF_BIAS 0x14 -#define RF_IPA 0x15 -#define RF_POW_ABILITY 0x17 -#define RF_MODE_AG 0x18 -#define RRFCHANNEL 0x18 -#define RF_CHNLBW 0x18 -#define RF_TOP 0x19 - -#define RF_RX_G1 0x1A -#define RF_RX_G2 0x1B - -#define RF_RX_BB2 0x1C -#define RF_RX_BB1 0x1D - -#define RF_RCK1 0x1E -#define RF_RCK2 0x1F - -#define RF_TX_G1 0x20 -#define RF_TX_G2 0x21 -#define RF_TX_G3 0x22 - -#define RF_TX_BB1 0x23 -#define RF_T_METER 0x24 -#define RF_T_METER_88E 0x42 -#define RF_T_METER_8812A 0x42 - -#define RF_SYN_G1 0x25 -#define RF_SYN_G2 0x26 -#define RF_SYN_G3 0x27 -#define RF_SYN_G4 0x28 -#define RF_SYN_G5 0x29 -#define RF_SYN_G6 0x2A -#define RF_SYN_G7 0x2B -#define RF_SYN_G8 0x2C - -#define RF_RCK_OS 0x30 -#define RF_TXPA_G1 0x31 -#define RF_TXPA_G2 0x32 -#define RF_TXPA_G3 0x33 - -#define RF_TX_BIAS_A 0x35 -#define RF_TX_BIAS_D 0x36 -#define RF_LOBF_9 0x38 -#define RF_RXRF_A3 0x3C -#define RF_TRSW 0x3F - -#define RF_TXRF_A2 0x41 -#define RF_TXPA_G4 0x46 -#define RF_TXPA_A4 0x4B - -#define RF_APK 0x63 - -#define RF_WE_LUT 0xEF - -#define BBBRESETB 0x100 -#define BGLOBALRESETB 0x200 -#define BOFDMTXSTART 0x4 -#define BCCKTXSTART 0x8 -#define BCRC32DEBUG 0x100 -#define BPMACLOOPBACK 0x10 -#define BTXLSIG 0xffffff -#define BOFDMTXRATE 0xf -#define BOFDMTXRESERVED 0x10 -#define BOFDMTXLENGTH 0x1ffe0 -#define BOFDMTXPARITY 0x20000 -#define BTXHTSIG1 0xffffff -#define BTXHTMCSRATE 0x7f -#define BTXHTBW 0x80 -#define BTXHTLENGTH 0xffff00 -#define BTXHTSIG2 0xffffff -#define BTXHTSMOOTHING 0x1 -#define BTXHTSOUNDING 0x2 -#define BTXHTRESERVED 0x4 -#define BTXHTAGGREATION 0x8 -#define BTXHTSTBC 0x30 -#define BTXHTADVANCECODING 0x40 -#define BTXHTSHORTGI 0x80 -#define BTXHTNUMBERHT_LTF 0x300 -#define BTXHTCRC8 0x3fc00 -#define BCOUNTERRESET 0x10000 -#define BNUMOFOFDMTX 0xffff -#define BNUMOFCCKTX 0xffff0000 -#define BTXIDLEINTERVAL 0xffff -#define BOFDMSERVICE 0xffff0000 -#define BTXMACHEADER 0xffffffff -#define BTXDATAINIT 0xff -#define BTXHTMODE 0x100 -#define BTXDATATYPE 0x30000 -#define BTXRANDOMSEED 0xffffffff -#define BCCKTXPREAMBLE 0x1 -#define BCCKTXSFD 0xffff0000 -#define BCCKTXSIG 0xff -#define BCCKTXSERVICE 0xff00 -#define BCCKLENGTHEXT 0x8000 -#define BCCKTXLENGHT 0xffff0000 -#define BCCKTXCRC16 0xffff -#define BCCKTXSTATUS 0x1 -#define BOFDMTXSTATUS 0x2 -#define IS_BB_REG_OFFSET_92S(_Offset) \ - ((_Offset >= 0x800) && (_Offset <= 0xfff)) - -#define BRFMOD 0x1 -#define BJAPANMODE 0x2 -#define BCCKTXSC 0x30 -/* Block & Path enable*/ -#define ROFDMCCKEN 0x808 -#define BCCKEN 0x10000000 -#define BOFDMEN 0x20000000 -#define RRXPATH 0x808 /* Rx antenna*/ -#define BRXPATH 0xff -#define RTXPATH 0x80c /* Tx antenna*/ -#define BTXPATH 0x0fffffff -#define RCCK_RX 0xa04 /* for cck rx path selection*/ -#define BCCK_RX 0x0c000000 -#define RVHTLEN_USE_LSIG 0x8c3 /* Use LSIG for VHT length*/ - - -#define BOFDMRXADCPHASE 0x10000 -#define BOFDMTXDACPHASE 0x40000 -#define BXATXAGC 0x3f - -#define BXBTXAGC 0xf00 -#define BXCTXAGC 0xf000 -#define BXDTXAGC 0xf0000 - -#define BPASTART 0xf0000000 -#define BTRSTART 0x00f00000 -#define BRFSTART 0x0000f000 -#define BBBSTART 0x000000f0 -#define BBBCCKSTART 0x0000000f -#define BPAEND 0xf -#define BTREND 0x0f000000 -#define BRFEND 0x000f0000 -#define BCCAMASK 0x000000f0 -#define BR2RCCAMASK 0x00000f00 -#define BHSSI_R2TDELAY 0xf8000000 -#define BHSSI_T2RDELAY 0xf80000 -#define BCONTXHSSI 0x400 -#define BIGFROMCCK 0x200 -#define BAGCADDRESS 0x3f -#define BRXHPTX 0x7000 -#define BRXHP2RX 0x38000 -#define BRXHPCCKINI 0xc0000 -#define BAGCTXCODE 0xc00000 -#define BAGCRXCODE 0x300000 - -#define B3WIREDATALENGTH 0x800 -#define B3WIREADDREAALENGTH 0x400 - -#define B3WIRERFPOWERDOWN 0x1 -#define B5GPAPEPOLARITY 0x40000000 -#define B2GPAPEPOLARITY 0x80000000 -#define BRFSW_TXDEFAULTANT 0x3 -#define BRFSW_TXOPTIONANT 0x30 -#define BRFSW_RXDEFAULTANT 0x300 -#define BRFSW_RXOPTIONANT 0x3000 -#define BRFSI_3WIREDATA 0x1 -#define BRFSI_3WIRECLOCK 0x2 -#define BRFSI_3WIRELOAD 0x4 -#define BRFSI_3WIRERW 0x8 -#define BRFSI_3WIRE 0xf - -#define BRFSI_RFENV 0x10 - -#define BRFSI_TRSW 0x20 -#define BRFSI_TRSWB 0x40 -#define BRFSI_ANTSW 0x100 -#define BRFSI_ANTSWB 0x200 -#define BRFSI_PAPE 0x400 -#define BRFSI_PAPE5G 0x800 -#define BBANDSELECT 0x1 -#define BHTSIG2_GI 0x80 -#define BHTSIG2_SMOOTHING 0x01 -#define BHTSIG2_SOUNDING 0x02 -#define BHTSIG2_AGGREATON 0x08 -#define BHTSIG2_STBC 0x30 -#define BHTSIG2_ADVCODING 0x40 -#define BHTSIG2_NUMOFHTLTF 0x300 -#define BHTSIG2_CRC8 0x3fc -#define BHTSIG1_MCS 0x7f -#define BHTSIG1_BANDWIDTH 0x80 -#define BHTSIG1_HTLENGTH 0xffff -#define BLSIG_RATE 0xf -#define BLSIG_RESERVED 0x10 -#define BLSIG_LENGTH 0x1fffe -#define BLSIG_PARITY 0x20 -#define BCCKRXPHASE 0x4 - -#define BLSSIREADADDRESS 0x7f800000 -#define BLSSIREADEDGE 0x80000000 - -#define BLSSIREADBACKDATA 0xfffff - -#define BLSSIREADOKFLAG 0x1000 -#define BCCKSAMPLERATE 0x8 -#define BREGULATOR0STANDBY 0x1 -#define BREGULATORPLLSTANDBY 0x2 -#define BREGULATOR1STANDBY 0x4 -#define BPLLPOWERUP 0x8 -#define BDPLLPOWERUP 0x10 -#define BDA10POWERUP 0x20 -#define BAD7POWERUP 0x200 -#define BDA6POWERUP 0x2000 -#define BXTALPOWERUP 0x4000 -#define B40MDCLKPOWERUP 0x8000 -#define BDA6DEBUGMODE 0x20000 -#define BDA6SWING 0x380000 - -#define BADCLKPHASE 0x4000000 -#define B80MCLKDELAY 0x18000000 -#define BAFEWATCHDOGENABLE 0x20000000 - -#define BXTALCAP01 0xc0000000 -#define BXTALCAP23 0x3 -#define BXTALCAP92X 0x0f000000 -#define BXTALCAP 0x0f000000 - -#define BINTDIFCLKENABLE 0x400 -#define BEXTSIGCLKENABLE 0x800 -#define BBANDGAP_MBIAS_POWERUP 0x10000 -#define BAD11SH_GAIN 0xc0000 -#define BAD11NPUT_RANGE 0x700000 -#define BAD110P_CURRENT 0x3800000 -#define BLPATH_LOOPBACK 0x4000000 -#define BQPATH_LOOPBACK 0x8000000 -#define BAFE_LOOPBACK 0x10000000 -#define BDA10_SWING 0x7e0 -#define BDA10_REVERSE 0x800 -#define BDA_CLK_SOURCE 0x1000 -#define BDA7INPUT_RANGE 0x6000 -#define BDA7_GAIN 0x38000 -#define BDA7OUTPUT_CM_MODE 0x40000 -#define BDA7INPUT_CM_MODE 0x380000 -#define BDA7CURRENT 0xc00000 -#define BREGULATOR_ADJUST 0x7000000 -#define BAD11POWERUP_ATTX 0x1 -#define BDA10PS_ATTX 0x10 -#define BAD11POWERUP_ATRX 0x100 -#define BDA10PS_ATRX 0x1000 -#define BCCKRX_AGC_FORMAT 0x200 -#define BPSDFFT_SAMPLE_POINT 0xc000 -#define BPSD_AVERAGE_NUM 0x3000 -#define BIQPATH_CONTROL 0xc00 -#define BPSD_FREQ 0x3ff -#define BPSD_ANTENNA_PATH 0x30 -#define BPSD_IQ_SWITCH 0x40 -#define BPSD_RX_TRIGGER 0x400000 -#define BPSD_TX_TRIGGER 0x80000000 -#define BPSD_SINE_TONE_SCALE 0x7f000000 -#define BPSD_REPORT 0xffff - -#define BOFDM_TXSC 0x30000000 -#define BCCK_TXON 0x1 -#define BOFDM_TXON 0x2 -#define BDEBUG_PAGE 0xfff -#define BDEBUG_ITEM 0xff -#define BANTL 0x10 -#define BANT_NONHT 0x100 -#define BANT_HT1 0x1000 -#define BANT_HT2 0x10000 -#define BANT_HT1S1 0x100000 -#define BANT_NONHTS1 0x1000000 - -#define BCCK_BBMODE 0x3 -#define BCCK_TXPOWERSAVING 0x80 -#define BCCK_RXPOWERSAVING 0x40 - -#define BCCK_SIDEBAND 0x10 - -#define BCCK_SCRAMBLE 0x8 -#define BCCK_ANTDIVERSITY 0x8000 -#define BCCK_CARRIER_RECOVERY 0x4000 -#define BCCK_TXRATE 0x3000 -#define BCCK_DCCANCEL 0x0800 -#define BCCK_ISICANCEL 0x0400 -#define BCCK_MATCH_FILTER 0x0200 -#define BCCK_EQUALIZER 0x0100 -#define BCCK_PREAMBLE_DETECT 0x800000 -#define BCCK_FAST_FALSECCA 0x400000 -#define BCCK_CH_ESTSTART 0x300000 -#define BCCK_CCA_COUNT 0x080000 -#define BCCK_CS_LIM 0x070000 -#define BCCK_BIST_MODE 0x80000000 -#define BCCK_CCAMASK 0x40000000 -#define BCCK_TX_DAC_PHASE 0x4 -#define BCCK_RX_ADC_PHASE 0x20000000 -#define BCCKR_CP_MODE 0x0100 -#define BCCK_TXDC_OFFSET 0xf0 -#define BCCK_RXDC_OFFSET 0xf -#define BCCK_CCA_MODE 0xc000 -#define BCCK_FALSECS_LIM 0x3f00 -#define BCCK_CS_RATIO 0xc00000 -#define BCCK_CORGBIT_SEL 0x300000 -#define BCCK_PD_LIM 0x0f0000 -#define BCCK_NEWCCA 0x80000000 -#define BCCK_RXHP_OF_IG 0x8000 -#define BCCK_RXIG 0x7f00 -#define BCCK_LNA_POLARITY 0x800000 -#define BCCK_RX1ST_BAIN 0x7f0000 -#define BCCK_RF_EXTEND 0x20000000 -#define BCCK_RXAGC_SATLEVEL 0x1f000000 -#define BCCK_RXAGC_SATCOUNT 0xe0 -#define bCCKRxRFSettle 0x1f -#define BCCK_FIXED_RXAGC 0x8000 -#define BCCK_ANTENNA_POLARITY 0x2000 -#define BCCK_TXFILTER_TYPE 0x0c00 -#define BCCK_RXAGC_REPORTTYPE 0x0300 -#define BCCK_RXDAGC_EN 0x80000000 -#define BCCK_RXDAGC_PERIOD 0x20000000 -#define BCCK_RXDAGC_SATLEVEL 0x1f000000 -#define BCCK_TIMING_RECOVERY 0x800000 -#define BCCK_TXC0 0x3f0000 -#define BCCK_TXC1 0x3f000000 -#define BCCK_TXC2 0x3f -#define BCCK_TXC3 0x3f00 -#define BCCK_TXC4 0x3f0000 -#define BCCK_TXC5 0x3f000000 -#define BCCK_TXC6 0x3f -#define BCCK_TXC7 0x3f00 -#define BCCK_DEBUGPORT 0xff0000 -#define BCCK_DAC_DEBUG 0x0f000000 -#define BCCK_FALSEALARM_ENABLE 0x8000 -#define BCCK_FALSEALARM_READ 0x4000 -#define BCCK_TRSSI 0x7f -#define BCCK_RXAGC_REPORT 0xfe -#define BCCK_RXREPORT_ANTSEL 0x80000000 -#define BCCK_RXREPORT_MFOFF 0x40000000 -#define BCCK_RXREPORT_SQLOSS 0x20000000 -#define BCCK_RXREPORT_PKTLOSS 0x10000000 -#define BCCK_RXREPORT_LOCKEDBIT 0x08000000 -#define BCCK_RXREPORT_RATEERROR 0x04000000 -#define BCCK_RXREPORT_RXRATE 0x03000000 -#define BCCK_RXFA_COUNTER_LOWER 0xff -#define BCCK_RXFA_COUNTER_UPPER 0xff000000 -#define BCCK_RXHPAGC_START 0xe000 -#define BCCK_RXHPAGC_FINAL 0x1c00 -#define BCCK_RXFALSEALARM_ENABLE 0x8000 -#define BCCK_FACOUNTER_FREEZE 0x4000 -#define BCCK_TXPATH_SEL 0x10000000 -#define BCCK_DEFAULT_RXPATH 0xc000000 -#define BCCK_OPTION_RXPATH 0x3000000 - -#define BNUM_OFSTF 0x3 -#define BSHIFT_L 0xc0 -#define BGI_TH 0xc -#define BRXPATH_A 0x1 -#define BRXPATH_B 0x2 -#define BRXPATH_C 0x4 -#define BRXPATH_D 0x8 -#define BTXPATH_A 0x1 -#define BTXPATH_B 0x2 -#define BTXPATH_C 0x4 -#define BTXPATH_D 0x8 -#define BTRSSI_FREQ 0x200 -#define BADC_BACKOFF 0x3000 -#define BDFIR_BACKOFF 0xc000 -#define BTRSSI_LATCH_PHASE 0x10000 -#define BRX_LDC_OFFSET 0xff -#define BRX_QDC_OFFSET 0xff00 -#define BRX_DFIR_MODE 0x1800000 -#define BRX_DCNF_TYPE 0xe000000 -#define BRXIQIMB_A 0x3ff -#define BRXIQIMB_B 0xfc00 -#define BRXIQIMB_C 0x3f0000 -#define BRXIQIMB_D 0xffc00000 -#define BDC_DC_NOTCH 0x60000 -#define BRXNB_NOTCH 0x1f000000 -#define BPD_TH 0xf -#define BPD_TH_OPT2 0xc000 -#define BPWED_TH 0x700 -#define BIFMF_WIN_L 0x800 -#define BPD_OPTION 0x1000 -#define BMF_WIN_L 0xe000 -#define BBW_SEARCH_L 0x30000 -#define BWIN_ENH_L 0xc0000 -#define BBW_TH 0x700000 -#define BED_TH2 0x3800000 -#define BBW_OPTION 0x4000000 -#define BRADIO_TH 0x18000000 -#define BWINDOW_L 0xe0000000 -#define BSBD_OPTION 0x1 -#define BFRAME_TH 0x1c -#define BFS_OPTION 0x60 -#define BDC_SLOPE_CHECK 0x80 -#define BFGUARD_COUNTER_DC_L 0xe00 -#define BFRAME_WEIGHT_SHORT 0x7000 -#define BSUB_TUNE 0xe00000 -#define BFRAME_DC_LENGTH 0xe000000 -#define BSBD_START_OFFSET 0x30000000 -#define BFRAME_TH_2 0x7 -#define BFRAME_GI2_TH 0x38 -#define BGI2_SYNC_EN 0x40 -#define BSARCH_SHORT_EARLY 0x300 -#define BSARCH_SHORT_LATE 0xc00 -#define BSARCH_GI2_LATE 0x70000 -#define BCFOANTSUM 0x1 -#define BCFOACC 0x2 -#define BCFOSTARTOFFSET 0xc -#define BCFOLOOPBACK 0x70 -#define BCFOSUMWEIGHT 0x80 -#define BDAGCENABLE 0x10000 -#define BTXIQIMB_A 0x3ff -#define BTXIQIMB_b 0xfc00 -#define BTXIQIMB_C 0x3f0000 -#define BTXIQIMB_D 0xffc00000 -#define BTXIDCOFFSET 0xff -#define BTXIQDCOFFSET 0xff00 -#define BTXDFIRMODE 0x10000 -#define BTXPESUDO_NOISEON 0x4000000 -#define BTXPESUDO_NOISE_A 0xff -#define BTXPESUDO_NOISE_B 0xff00 -#define BTXPESUDO_NOISE_C 0xff0000 -#define BTXPESUDO_NOISE_D 0xff000000 -#define BCCA_DROPOPTION 0x20000 -#define BCCA_DROPTHRES 0xfff00000 -#define BEDCCA_H 0xf -#define BEDCCA_L 0xf0 -#define BLAMBDA_ED 0x300 -#define BRX_INITIALGAIN 0x7f -#define BRX_ANTDIV_EN 0x80 -#define BRX_AGC_ADDRESS_FOR_LNA 0x7f00 -#define BRX_HIGHPOWER_FLOW 0x8000 -#define BRX_AGC_FREEZE_THRES 0xc0000 -#define BRX_FREEZESTEP_AGC1 0x300000 -#define BRX_FREEZESTEP_AGC2 0xc00000 -#define BRX_FREEZESTEP_AGC3 0x3000000 -#define BRX_FREEZESTEP_AGC0 0xc000000 -#define BRXRSSI_CMP_EN 0x10000000 -#define BRXQUICK_AGCEN 0x20000000 -#define BRXAGC_FREEZE_THRES_MODE 0x40000000 -#define BRX_OVERFLOW_CHECKTYPE 0x80000000 -#define BRX_AGCSHIFT 0x7f -#define BTRSW_TRI_ONLY 0x80 -#define BPOWER_THRES 0x300 -#define BRXAGC_EN 0x1 -#define BRXAGC_TOGETHER_EN 0x2 -#define BRXAGC_MIN 0x4 -#define BRXHP_INI 0x7 -#define BRXHP_TRLNA 0x70 -#define BRXHP_RSSI 0x700 -#define BRXHP_BBP1 0x7000 -#define BRXHP_BBP2 0x70000 -#define BRXHP_BBP3 0x700000 -#define BRSSI_H 0x7f0000 -#define BRSSI_GEN 0x7f000000 -#define BRXSETTLE_TRSW 0x7 -#define BRXSETTLE_LNA 0x38 -#define BRXSETTLE_RSSI 0x1c0 -#define BRXSETTLE_BBP 0xe00 -#define BRXSETTLE_RXHP 0x7000 -#define BRXSETTLE_ANTSW_RSSI 0x38000 -#define BRXSETTLE_ANTSW 0xc0000 -#define BRXPROCESS_TIME_DAGC 0x300000 -#define BRXSETTLE_HSSI 0x400000 -#define BRXPROCESS_TIME_BBPPW 0x800000 -#define BRXANTENNA_POWER_SHIFT 0x3000000 -#define BRSSI_TABLE_SELECT 0xc000000 -#define BRXHP_FINAL 0x7000000 -#define BRXHPSETTLE_BBP 0x7 -#define BRXHTSETTLE_HSSI 0x8 -#define BRXHTSETTLE_RXHP 0x70 -#define BRXHTSETTLE_BBPPW 0x80 -#define BRXHTSETTLE_IDLE 0x300 -#define BRXHTSETTLE_RESERVED 0x1c00 -#define BRXHT_RXHP_EN 0x8000 -#define BRXAGC_FREEZE_THRES 0x30000 -#define BRXAGC_TOGETHEREN 0x40000 -#define BRXHTAGC_MIN 0x80000 -#define BRXHTAGC_EN 0x100000 -#define BRXHTDAGC_EN 0x200000 -#define BRXHT_RXHP_BBP 0x1c00000 -#define BRXHT_RXHP_FINAL 0xe0000000 -#define BRXPW_RADIO_TH 0x3 -#define BRXPW_RADIO_EN 0x4 -#define BRXMF_HOLD 0x3800 -#define BRXPD_DELAY_TH1 0x38 -#define BRXPD_DELAY_TH2 0x1c0 -#define BRXPD_DC_COUNT_MAX 0x600 -#define BRXPD_DELAY_TH 0x8000 -#define BRXPROCESS_DELAY 0xf0000 -#define BRXSEARCHRANGE_GI2_EARLY 0x700000 -#define BRXFRAME_FUARD_COUNTER_L 0x3800000 -#define BRXSGI_GUARD_L 0xc000000 -#define BRXSGI_SEARCH_L 0x30000000 -#define BRXSGI_TH 0xc0000000 -#define BDFSCNT0 0xff -#define BDFSCNT1 0xff00 -#define BDFSFLAG 0xf0000 -#define BMF_WEIGHT_SUM 0x300000 -#define BMINIDX_TH 0x7f000000 -#define BDAFORMAT 0x40000 -#define BTXCH_EMU_ENABLE 0x01000000 -#define BTRSW_ISOLATION_A 0x7f -#define BTRSW_ISOLATION_B 0x7f00 -#define BTRSW_ISOLATION_C 0x7f0000 -#define BTRSW_ISOLATION_D 0x7f000000 -#define BEXT_LNA_GAIN 0x7c00 - -#define BSTBC_EN 0x4 -#define BANTENNA_MAPPING 0x10 -#define BNSS 0x20 -#define BCFO_ANTSUM_ID 0x200 -#define BPHY_COUNTER_RESET 0x8000000 -#define BCFO_REPORT_GET 0x4000000 -#define BOFDM_CONTINUE_TX 0x10000000 -#define BOFDM_SINGLE_CARRIER 0x20000000 -#define BOFDM_SINGLE_TONE 0x40000000 -#define BHT_DETECT 0x100 -#define BCFOEN 0x10000 -#define BCFOVALUE 0xfff00000 -#define BSIGTONE_RE 0x3f -#define BSIGTONE_IM 0x7f00 -#define BCOUNTER_CCA 0xffff -#define BCOUNTER_PARITYFAIL 0xffff0000 -#define BCOUNTER_RATEILLEGAL 0xffff -#define BCOUNTER_CRC8FAIL 0xffff0000 -#define BCOUNTER_MCSNOSUPPORT 0xffff -#define BCOUNTER_FASTSYNC 0xffff -#define BSHORTCFO 0xfff -#define BSHORTCFOT_LENGTH 12 -#define BSHORTCFOF_LENGTH 11 -#define BLONGCFO 0x7ff -#define BLONGCFOT_LENGTH 11 -#define BLONGCFOF_LENGTH 11 -#define BTAILCFO 0x1fff -#define BTAILCFOT_LENGTH 13 -#define BTAILCFOF_LENGTH 12 -#define BNOISE_EN_PWDB 0xffff -#define BCC_POWER_DB 0xffff0000 -#define BMOISE_PWDB 0xffff -#define BPOWERMEAST_LENGTH 10 -#define BPOWERMEASF_LENGTH 3 -#define BRX_HT_BW 0x1 -#define BRXSC 0x6 -#define BRX_HT 0x8 -#define BNB_INTF_DET_ON 0x1 -#define BINTF_WIN_LEN_CFG 0x30 -#define BNB_INTF_TH_CFG 0x1c0 -#define BRFGAIN 0x3f -#define BTABLESEL 0x40 -#define BTRSW 0x80 -#define BRXSNR_A 0xff -#define BRXSNR_B 0xff00 -#define BRXSNR_C 0xff0000 -#define BRXSNR_D 0xff000000 -#define BSNR_EVMT_LENGTH 8 -#define BSNR_EVMF_LENGTH 1 -#define BCSI1ST 0xff -#define BCSI2ND 0xff00 -#define BRXEVM1ST 0xff0000 -#define BRXEVM2ND 0xff000000 -#define BSIGEVM 0xff -#define BPWDB 0xff00 -#define BSGIEN 0x10000 - -#define BSFACTOR_QMA1 0xf -#define BSFACTOR_QMA2 0xf0 -#define BSFACTOR_QMA3 0xf00 -#define BSFACTOR_QMA4 0xf000 -#define BSFACTOR_QMA5 0xf0000 -#define BSFACTOR_QMA6 0xf0000 -#define BSFACTOR_QMA7 0xf00000 -#define BSFACTOR_QMA8 0xf000000 -#define BSFACTOR_QMA9 0xf0000000 -#define BCSI_SCHEME 0x100000 - -#define BNOISE_LVL_TOP_SET 0x3 -#define BCHSMOOTH 0x4 -#define BCHSMOOTH_CFG1 0x38 -#define BCHSMOOTH_CFG2 0x1c0 -#define BCHSMOOTH_CFG3 0xe00 -#define BCHSMOOTH_CFG4 0x7000 -#define BMRCMODE 0x800000 -#define BTHEVMCFG 0x7000000 - -#define BLOOP_FIT_TYPE 0x1 -#define BUPD_CFO 0x40 -#define BUPD_CFO_OFFDATA 0x80 -#define BADV_UPD_CFO 0x100 -#define BADV_TIME_CTRL 0x800 -#define BUPD_CLKO 0x1000 -#define BFC 0x6000 -#define BTRACKING_MODE 0x8000 -#define BPHCMP_ENABLE 0x10000 -#define BUPD_CLKO_LTF 0x20000 -#define BCOM_CH_CFO 0x40000 -#define BCSI_ESTI_MODE 0x80000 -#define BADV_UPD_EQZ 0x100000 -#define BUCHCFG 0x7000000 -#define BUPDEQZ 0x8000000 - -#define BRX_PESUDO_NOISE_ON 0x20000000 -#define BRX_PESUDO_NOISE_A 0xff -#define BRX_PESUDO_NOISE_B 0xff00 -#define BRX_PESUDO_NOISE_C 0xff0000 -#define BRX_PESUDO_NOISE_D 0xff000000 -#define BRX_PESUDO_NOISESTATE_A 0xffff -#define BRX_PESUDO_NOISESTATE_B 0xffff0000 -#define BRX_PESUDO_NOISESTATE_C 0xffff -#define BRX_PESUDO_NOISESTATE_D 0xffff0000 - -#define BZEBRA1_HSSIENABLE 0x8 -#define BZEBRA1_TRXCONTROL 0xc00 -#define BZEBRA1_TRXGAINSETTING 0x07f -#define BZEBRA1_RXCOUNTER 0xc00 -#define BZEBRA1_TXCHANGEPUMP 0x38 -#define BZEBRA1_RXCHANGEPUMP 0x7 -#define BZEBRA1_CHANNEL_NUM 0xf80 -#define BZEBRA1_TXLPFBW 0x400 -#define BZEBRA1_RXLPFBW 0x600 - -#define BRTL8256REG_MODE_CTRL1 0x100 -#define BRTL8256REG_MODE_CTRL0 0x40 -#define BRTL8256REG_TXLPFBW 0x18 -#define BRTL8256REG_RXLPFBW 0x600 - -#define BRTL8258_TXLPFBW 0xc -#define BRTL8258_RXLPFBW 0xc00 -#define BRTL8258_RSSILPFBW 0xc0 - -#define BBYTE0 0x1 -#define BBYTE1 0x2 -#define BBYTE2 0x4 -#define BBYTE3 0x8 -#define BWORD0 0x3 -#define BWORD1 0xc -#define BWORD 0xf - -#define MASKBYTE0 0xff -#define MASKBYTE1 0xff00 -#define MASKBYTE2 0xff0000 -#define MASKBYTE3 0xff000000 -#define MASKHWORD 0xffff0000 -#define MASKLWORD 0x0000ffff -#define MASKDWORD 0xffffffff -#define MASK12BITS 0xfff -#define MASKH4BITS 0xf0000000 -#define MASKOFDM_D 0xffc00000 -#define MASKCCK 0x3f3f3f3f - -#define MASK4BITS 0x0f -#define MASK20BITS 0xfffff -#define RFREG_OFFSET_MASK 0xfffff - -#define BENABLE 0x1 -#define BDISABLE 0x0 - -#define LEFT_ANTENNA 0x0 -#define RIGHT_ANTENNA 0x1 - -#define TCHECK_TXSTATUS 500 -#define TUPDATE_RXCOUNTER 100 - -#define REG_UN_used_register 0x01bf - -/* WOL bit information */ -#define HAL92C_WOL_PTK_UPDATE_EVENT BIT(0) -#define HAL92C_WOL_GTK_UPDATE_EVENT BIT(1) -#define HAL92C_WOL_DISASSOC_EVENT BIT(2) -#define HAL92C_WOL_DEAUTH_EVENT BIT(3) -#define HAL92C_WOL_FW_DISCONNECT_EVENT BIT(4) - -#define WOL_REASON_PTK_UPDATE BIT(0) -#define WOL_REASON_GTK_UPDATE BIT(1) -#define WOL_REASON_DISASSOC BIT(2) -#define WOL_REASON_DEAUTH BIT(3) -#define WOL_REASON_FW_DISCONNECT BIT(4) - -#define RA_RFE_PINMUX 0xcb0 /* Path_A RFE cotrol pinmux*/ -#define RB_RFE_PINMUX 0xeb0 /* Path_B RFE control pinmux*/ - -#define RA_RFE_INV 0xcb4 -#define RB_RFE_INV 0xeb4 - -/* RXIQC */ -#define RA_RXIQC_AB 0xc10 /*RxIQ imblance matrix coeff. A & B*/ -#define RA_RXIQC_CD 0xc14 /*RxIQ imblance matrix coeff. C & D*/ -#define RA_TXSCALE 0xc1c /* Pah_A TX scaling factor*/ -#define RB_TXSCALE 0xe1c /* Path_B TX scaling factor*/ -#define RB_RXIQC_AB 0xe10 /*RxIQ imblance matrix coeff. A & B*/ -#define RB_RXIQC_CD 0xe14 /*RxIQ imblance matrix coeff. C & D*/ -#define RXIQC_AC 0x02ff /*bit mask for IQC matrix element A & C*/ -#define RXIQC_BD 0x02ff0000 /*bit mask for IQC matrix element A & C*/ - -/* 2 EFUSE_TEST (For RTL8723 partially) */ -#define EFUSE_SEL(x) (((x) & 0x3) << 8) -#define EFUSE_SEL_MASK 0x300 -#define EFUSE_WIFI_SEL_0 0x0 - -/*REG_MULTI_FUNC_CTRL(For RTL8723 Only)*/ -#define WL_HWPDN_EN BIT(0) /* Enable GPIO[9] as WiFi HW PDn source*/ -#define WL_HWPDN_SL BIT(1) /* WiFi HW PDn polarity control*/ -#define WL_FUNC_EN BIT(2) // WiFi function enable -#define WL_HWROF_EN BIT(3) // Enable GPIO[9] as WiFi RF HW PDn source -#define BT_HWPDN_EN BIT(16) // Enable GPIO[11] as BT HW PDn source -#define BT_HWPDN_SL BIT(17) // BT HW PDn polarity control -#define BT_FUNC_EN BIT(18) // BT function enable -#define BT_HWROF_EN BIT(19) // Enable GPIO[11] as BT/GPS RF HW PDn source -#define GPS_HWPDN_EN BIT(20) // Enable GPIO[10] as GPS HW PDn source -#define GPS_HWPDN_SL BIT(21) // GPS HW PDn polarity control -#define GPS_FUNC_EN BIT(22) // GPS function enable - - -#define BMASKBYTE0 0xff -#define BMASKBYTE1 0xff00 -#define BMASKBYTE2 0xff0000 -#define BMASKBYTE3 0xff000000 -#define BMASKHWORD 0xffff0000 -#define BMASKLWORD 0x0000ffff -#define BMASKDWORD 0xffffffff -#define BMASK12BITS 0xfff -#define BMASKH4BITS 0xf0000000 -#define BMASKOFDM_D 0xffc00000 -#define BMASKCCK 0x3f3f3f3f - -#define BRFREGOFFSETMASK 0xfffff - -#define ODM_REG_CCK_RPT_FORMAT_11AC 0x804 -#define ODM_REG_BB_RX_PATH_11AC 0x808 -/*PAGE 9*/ -#define ODM_REG_OFDM_FA_RST_11AC 0x9A4 -/*PAGE A*/ -#define ODM_REG_CCK_CCA_11AC 0xA0A -#define ODM_REG_CCK_FA_RST_11AC 0xA2C -#define ODM_REG_CCK_FA_11AC 0xA5C -/*PAGE C*/ -#define ODM_REG_IGI_A_11AC 0xC50 -/*PAGE E*/ -#define ODM_REG_IGI_B_11AC 0xE50 -/*PAGE F*/ -#define ODM_REG_OFDM_FA_11AC 0xF48 - - -//2 MAC REG LIST - - - - -//DIG Related -#define ODM_BIT_IGI_11AC 0xFFFFFFFF -#define ODM_BIT_CCK_RPT_FORMAT_11AC BIT16 -#define ODM_BIT_BB_RX_PATH_11AC 0xF - -typedef enum AGGRE_SIZE{ - HT_AGG_SIZE_8K = 0, - HT_AGG_SIZE_16K = 1, - HT_AGG_SIZE_32K = 2, - HT_AGG_SIZE_64K = 3, - VHT_AGG_SIZE_128K = 4, - VHT_AGG_SIZE_256K = 5, - VHT_AGG_SIZE_512K = 6, - VHT_AGG_SIZE_1024K = 7, -}AGGRE_SIZE_E, *PAGGRE_SIZE_E; - -#define REG_AMPDU_MAX_LENGTH_8812 0x0458 - -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/rf.c b/drivers/staging/rtl8821ae/rtl8821ae/rf.c deleted file mode 100644 index 87c1c97..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/rf.c +++ /dev/null @@ -1,464 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "../wifi.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "rf.h" -#include "dm.h" - -static bool _rtl8821ae_phy_rf6052_config_parafile(struct ieee80211_hw *hw); - -void rtl8821ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - switch (bandwidth) { - case HT_CHANNEL_WIDTH_20: - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, BIT(11)|BIT(10), 3); - rtl_set_rfreg(hw, RF90_PATH_B, RF_CHNLBW, BIT(11)|BIT(10), 3); - break; - case HT_CHANNEL_WIDTH_20_40: - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, BIT(11)|BIT(10), 1); - rtl_set_rfreg(hw, RF90_PATH_B, RF_CHNLBW, BIT(11)|BIT(10), 1); - break; - case HT_CHANNEL_WIDTH_80: - rtl_set_rfreg(hw, RF90_PATH_A, RF_CHNLBW, BIT(11)|BIT(10), 0); - rtl_set_rfreg(hw, RF90_PATH_B, RF_CHNLBW, BIT(11)|BIT(10), 0); - break; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, - ("unknown bandwidth: %#X\n", bandwidth)); - break; - } -} - -void rtl8821ae_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u32 tx_agc[2] = {0, 0}, tmpval; - bool turbo_scanoff = false; - u8 idx1, idx2; - u8 *ptr; - u8 direction; - u32 pwrtrac_value; - - if (rtlefuse->eeprom_regulatory != 0) - turbo_scanoff = true; - - if (mac->act_scanning == true) { - tx_agc[RF90_PATH_A] = 0x3f3f3f3f; - tx_agc[RF90_PATH_B] = 0x3f3f3f3f; - - if (turbo_scanoff) { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - } - } else { - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] << 8) | - (ppowerlevel[idx1] << 16) | - (ppowerlevel[idx1] << 24); - } - - if (rtlefuse->eeprom_regulatory == 0) { - tmpval = - (rtlphy->mcs_txpwrlevel_origoffset[0][6]) + - (rtlphy->mcs_txpwrlevel_origoffset[0][7] << - 8); - tx_agc[RF90_PATH_A] += tmpval; - - tmpval = (rtlphy->mcs_txpwrlevel_origoffset[0][14]) + - (rtlphy->mcs_txpwrlevel_origoffset[0][15] << - 24); - tx_agc[RF90_PATH_B] += tmpval; - } - } - - for (idx1 = RF90_PATH_A; idx1 <= RF90_PATH_B; idx1++) { - ptr = (u8 *) (&(tx_agc[idx1])); - for (idx2 = 0; idx2 < 4; idx2++) { - if (*ptr > RF6052_MAX_TX_PWR) - *ptr = RF6052_MAX_TX_PWR; - ptr++; - } - } - rtl8821ae_dm_txpower_track_adjust(hw,1,&direction,&pwrtrac_value); - if (direction ==1){ - tx_agc[0] += pwrtrac_value; - tx_agc[1] += pwrtrac_value; - } else if (direction == 2){ - tx_agc[0] -= pwrtrac_value; - tx_agc[1] -= pwrtrac_value; - } - tmpval = tx_agc[RF90_PATH_A] ; - rtl_set_bbreg(hw, RTXAGC_A_CCK11_CCK1, MASKDWORD, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("CCK PWR 1~11M (rf-A) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_A_CCK11_CCK1)); - - tmpval = tx_agc[RF90_PATH_B] ; - rtl_set_bbreg(hw, RTXAGC_B_CCK11_CCK1, MASKDWORD, tmpval); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("CCK PWR 11M (rf-B) = 0x%x (reg 0x%x)\n", tmpval, - RTXAGC_B_CCK11_CCK1)); -} - -static void rtl8821ae_phy_get_power_base(struct ieee80211_hw *hw, - u8 *ppowerlevel_ofdm, u8 *ppowerlevel_bw20, u8 *ppowerlevel_bw40, u8 channel, - u32 *ofdmbase, u32 *mcsbase) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - u32 powerBase0, powerBase1; - u8 i, powerlevel[2]; - - for (i = 0; i < 2; i++) { - powerBase0 = ppowerlevel_ofdm[i]; - - powerBase0 = (powerBase0 << 24) | (powerBase0 << 16) | - (powerBase0 << 8) | powerBase0; - *(ofdmbase + i) = powerBase0; - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - (" [OFDM power base index rf(%c) = 0x%x]\n", - ((i == 0) ? 'A' : 'B'), *(ofdmbase + i))); - } - - for (i = 0; i < 2; i++) { - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) { - powerlevel[i] = ppowerlevel_bw20[i]; - }else{ - powerlevel[i] = ppowerlevel_bw40[i]; - } - powerBase1 = powerlevel[i]; - powerBase1 = (powerBase1 << 24) | - (powerBase1 << 16) | (powerBase1 << 8) | powerBase1; - - *(mcsbase + i) = powerBase1; - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - (" [MCS power base index rf(%c) = 0x%x]\n", - ((i == 0) ? 'A' : 'B'), *(mcsbase + i))); - } -} - -static void _rtl8821ae_get_txpower_writeval_by_regulatory(struct ieee80211_hw *hw, - u8 channel, u8 index, - u32 *powerBase0, - u32 *powerBase1, - u32 *p_outwriteval) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - u8 i, chnlgroup = 0, pwr_diff_limit[4],pwr_diff = 0,customer_pwr_diff; - u32 writeVal, customer_limit, rf; - - for (rf = 0; rf < 2; rf++) { - switch (rtlefuse->eeprom_regulatory) { - case 0: - chnlgroup = 0; - - writeVal = - rtlphy->mcs_txpwrlevel_origoffset[chnlgroup][index + - (rf ? 8 : 0)] - + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("RTK better performance, " - "writeVal(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal)); - break; - case 1: - if (rtlphy->pwrgroup_cnt == 1) - chnlgroup = 0; - else { - if(channel<3) - chnlgroup = 0; - else if (channel <6) - chnlgroup = 1; - else if (channel <9) - chnlgroup = 2; - else if (channel <12) - chnlgroup = 3; - else if (channel < 14) - chnlgroup = 4; - else if (channel == 14) - chnlgroup = 5; - } - - writeVal = - rtlphy->mcs_txpwrlevel_origoffset[chnlgroup] - [index + (rf ? 8 : 0)] + ((index < 2) ? - powerBase0[rf] : - powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("Realtek regulatory, 20MHz, " - "writeVal(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal)); - - break; - case 2: - writeVal = - ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("Better regulatory, " - "writeVal(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal)); - break; - case 3: - chnlgroup = 0; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("customer's limit, 40MHz " - "rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), - rtlefuse->pwrgroup_ht40[rf][channel - - 1])); - } else { - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("customer's limit, 20MHz " - "rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), - rtlefuse->pwrgroup_ht20[rf][channel - - 1])); - } - - if (index < 2) - pwr_diff = rtlefuse->txpwr_legacyhtdiff[rf][channel-1]; - else if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20) - pwr_diff = rtlefuse->txpwr_ht20diff[rf][channel-1]; - - if (rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40) - customer_pwr_diff = rtlefuse->pwrgroup_ht40[rf][channel-1]; - else - customer_pwr_diff = rtlefuse->pwrgroup_ht20[rf][channel-1]; - - if (pwr_diff > customer_pwr_diff) - pwr_diff = 0; - else - pwr_diff = customer_pwr_diff - pwr_diff; - - for (i = 0; i < 4; i++) { - pwr_diff_limit[i] = - (u8) ((rtlphy->mcs_txpwrlevel_origoffset - [chnlgroup][index + (rf ? 8 : 0)] & (0x7f << - (i * 8))) >> (i * 8)); - - if(pwr_diff_limit[i] > pwr_diff) - pwr_diff_limit[i] = pwr_diff; - } - - customer_limit = (pwr_diff_limit[3] << 24) | - (pwr_diff_limit[2] << 16) | - (pwr_diff_limit[1] << 8) | (pwr_diff_limit[0]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("Customer's limit rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), customer_limit)); - - writeVal = customer_limit + - ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("Customer, writeVal rf(%c)= 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal)); - break; - default: - chnlgroup = 0; - writeVal = - rtlphy->mcs_txpwrlevel_origoffset[chnlgroup] - [index + (rf ? 8 : 0)] - + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("RTK better performance, writeVal " - "rf(%c) = 0x%x\n", - ((rf == 0) ? 'A' : 'B'), writeVal)); - break; - } - - if (rtlpriv->dm.dynamic_txhighpower_lvl == TXHIGHPWRLEVEL_BT1) - writeVal = writeVal - 0x06060606; - else if (rtlpriv->dm.dynamic_txhighpower_lvl == - TXHIGHPWRLEVEL_BT2) - writeVal = writeVal - 0x0c0c0c0c; - *(p_outwriteval + rf) = writeVal; - } -} - -static void _rtl8821ae_write_ofdm_power_reg(struct ieee80211_hw *hw, - u8 index, u32 *pValue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - u16 regoffset_a[6] = { - RTXAGC_A_OFDM18_OFDM6, RTXAGC_A_OFDM54_OFDM24, - RTXAGC_A_MCS03_MCS00, RTXAGC_A_MCS07_MCS04, - RTXAGC_A_MCS11_MCS08, RTXAGC_A_MCS15_MCS12 - }; - u16 regoffset_b[6] = { - RTXAGC_B_OFDM18_OFDM6, RTXAGC_B_OFDM54_OFDM24, - RTXAGC_B_MCS03_MCS00, RTXAGC_B_MCS07_MCS04, - RTXAGC_B_MCS11_MCS08, RTXAGC_B_MCS15_MCS12 - }; - u8 i, rf, pwr_val[4]; - u32 writeVal; - u16 regoffset; - - for (rf = 0; rf < 2; rf++) { - writeVal = pValue[rf]; - for (i = 0; i < 4; i++) { - pwr_val[i] = (u8) ((writeVal & (0x7f << - (i * 8))) >> (i * 8)); - - if (pwr_val[i] > RF6052_MAX_TX_PWR) - pwr_val[i] = RF6052_MAX_TX_PWR; - } - writeVal = (pwr_val[3] << 24) | (pwr_val[2] << 16) | - (pwr_val[1] << 8) | pwr_val[0]; - - if (rf == 0) - regoffset = regoffset_a[index]; - else - regoffset = regoffset_b[index]; - rtl_set_bbreg(hw, regoffset, MASKDWORD, writeVal); - - RTPRINT(rtlpriv, FPHY, PHY_TXPWR, - ("Set 0x%x = %08x\n", regoffset, writeVal)); - } -} - -void rtl8821ae_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel_ofdm, u8 *ppowerlevel_bw20, u8 *ppowerlevel_bw40, u8 channel) -{ - u32 writeVal[2], powerBase0[2], powerBase1[2]; - u8 index; - u8 direction; - u32 pwrtrac_value; - - rtl8821ae_phy_get_power_base(hw, ppowerlevel_ofdm, ppowerlevel_bw20, ppowerlevel_bw40, - channel, &powerBase0[0], &powerBase1[0]); - - rtl8821ae_dm_txpower_track_adjust(hw,1,&direction,&pwrtrac_value); - - for (index = 0; index < 6; index++) { - _rtl8821ae_get_txpower_writeval_by_regulatory(hw, - channel, index, - &powerBase0[0], - &powerBase1[0], - &writeVal[0]); - if (direction ==1){ - writeVal[0] += pwrtrac_value; - writeVal[1] += pwrtrac_value; - } else if (direction == 2){ - writeVal[0] -= pwrtrac_value; - writeVal[1] -= pwrtrac_value; - } - _rtl8821ae_write_ofdm_power_reg(hw, index, &writeVal[0]); - } -} - -bool rtl8821ae_phy_rf6052_config(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - - if (rtlphy->rf_type == RF_1T1R) - rtlphy->num_total_rfpath = 1; - else - rtlphy->num_total_rfpath = 2; - - return _rtl8821ae_phy_rf6052_config_parafile(hw); - -} - -static bool _rtl8821ae_phy_rf6052_config_parafile(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_phy *rtlphy = &(rtlpriv->phy); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - //u32 u4_regvalue = 0; - u8 rfpath; - bool rtstatus = true; - //struct bb_reg_def *pphyreg; - - for (rfpath = 0; rfpath < rtlphy->num_total_rfpath; rfpath++) { - switch (rfpath) { - case RF90_PATH_A: { - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtstatus = rtl8812ae_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - else - rtstatus = rtl8821ae_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - break; - } - case RF90_PATH_B: { - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) - rtstatus = rtl8812ae_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - else - rtstatus = rtl8821ae_phy_config_rf_with_headerfile(hw, - (enum radio_path)rfpath); - break; - } - case RF90_PATH_C: - break; - case RF90_PATH_D: - break; - } - - if (rtstatus != true) { - RT_TRACE(COMP_INIT, DBG_TRACE, - ("Radio[%d] Fail!!", rfpath)); - return false; - } - - } - - /*put arrays in dm.c*/ - /*_rtl8821ae_config_rf_txpwr_track_headerfile(hw);*/ - RT_TRACE(COMP_INIT, DBG_TRACE, ("\n")); - return rtstatus; -} diff --git a/drivers/staging/rtl8821ae/rtl8821ae/rf.h b/drivers/staging/rtl8821ae/rtl8821ae/rf.h deleted file mode 100644 index b665c0f..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/rf.h +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_RF_H__ -#define __RTL8821AE_RF_H__ - -#define RF6052_MAX_TX_PWR 0x3F -#define RF6052_MAX_REG 0x3F - -extern void rtl8821ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, - u8 bandwidth); -extern void rtl8821ae_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel); -extern void rtl8821ae_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, - u8 *ppowerlevel_ofdm, - u8 *ppowerlevel_bw20, - u8 *ppowerlevel_bw40, - u8 channel); -extern bool rtl8821ae_phy_rf6052_config(struct ieee80211_hw *hw); -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/sw.c b/drivers/staging/rtl8821ae/rtl8821ae/sw.c deleted file mode 100644 index 85a3474..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/sw.c +++ /dev/null @@ -1,499 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include <linux/vmalloc.h> -#include <linux/module.h> - -#include "../wifi.h" -#include "../core.h" -#include "../pci.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "dm.h" -#include "hw.h" -#include "sw.h" -#include "trx.h" -#include "led.h" -#include "table.h" -#include "hal_btc.h" -#include "../btcoexist/rtl_btc.h" - -void rtl8821ae_init_aspm_vars(struct ieee80211_hw *hw) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - - /*close ASPM for AMD defaultly */ - rtlpci->const_amdpci_aspm = 0; - - /* - * ASPM PS mode. - * 0 - Disable ASPM, - * 1 - Enable ASPM without Clock Req, - * 2 - Enable ASPM with Clock Req, - * 3 - Alwyas Enable ASPM with Clock Req, - * 4 - Always Enable ASPM without Clock Req. - * set defult to RTL8192CE:3 RTL8192E:2 - * */ - rtlpci->const_pci_aspm = 3; - - /*Setting for PCI-E device */ - rtlpci->const_devicepci_aspm_setting = 0x03; - - /*Setting for PCI-E bridge */ - rtlpci->const_hostpci_aspm_setting = 0x02; - - /* - * In Hw/Sw Radio Off situation. - * 0 - Default, - * 1 - From ASPM setting without low Mac Pwr, - * 2 - From ASPM setting with low Mac Pwr, - * 3 - Bus D3 - * set default to RTL8192CE:0 RTL8192SE:2 - */ - rtlpci->const_hwsw_rfoff_d3 = 0; - - /* - * This setting works for those device with - * backdoor ASPM setting such as EPHY setting. - * 0 - Not support ASPM, - * 1 - Support ASPM, - * 2 - According to chipset. - */ - rtlpci->const_support_pciaspm = 1; -} - -/*InitializeVariables8812E*/ -int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) -{ - int err = 0; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - const struct firmware *firmware; - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - char *fw_name = NULL; - - rtl8821ae_bt_reg_init(hw); - rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); - - rtlpriv->dm.b_dm_initialgain_enable = 1; - rtlpriv->dm.dm_flag = 0; - rtlpriv->dm.b_disable_framebursting = 0;; - rtlpriv->dm.thermalvalue = 0; - rtlpci->transmit_config = CFENDFORM | BIT(15) | BIT(24) | BIT(25); - - mac->ht_enable = true; - - rtlpriv->rtlhal.current_bandtype = BAND_ON_2_4G; - /*following 2 is for register 5G band, refer to _rtl_init_mac80211()*/ - rtlpriv->rtlhal.bandset = BAND_ON_BOTH; - rtlpriv->rtlhal.macphymode = SINGLEMAC_SINGLEPHY; - - rtlpci->receive_config = (RCR_APPFCS | - RCR_APP_MIC | - RCR_APP_ICV | - RCR_APP_PHYST_RXFF | - RCR_NONQOS_VHT | - RCR_HTC_LOC_CTRL | - RCR_AMF | - RCR_ACF | - RCR_ADF | /*This bit controls the PS-Poll packet filter.*/ - RCR_AICV | - RCR_ACRC32 | - RCR_AB | - RCR_AM | - RCR_APM | - 0); - - - rtlpci->irq_mask[0] = - (u32) (IMR_PSTIMEOUT | - IMR_GTINT3 | - /*IMR_TBDER | - IMR_TBDOK | - IMR_BCNDMAINT0 |*/ - IMR_HSISR_IND_ON_INT | - IMR_C2HCMD | - IMR_HIGHDOK | - IMR_MGNTDOK | - IMR_BKDOK | - IMR_BEDOK | - IMR_VIDOK | - IMR_VODOK | - IMR_RDU | - IMR_ROK | - 0); - - rtlpci->irq_mask[1] = - (u32)( IMR_RXFOVW | - IMR_TXFOVW | - 0); - - /* for LPS & IPS */ - rtlpriv->psc.b_inactiveps = rtlpriv->cfg->mod_params->b_inactiveps; - rtlpriv->psc.b_swctrl_lps = rtlpriv->cfg->mod_params->b_swctrl_lps; - rtlpriv->psc.b_fwctrl_lps = rtlpriv->cfg->mod_params->b_fwctrl_lps; - rtlpriv->psc.b_reg_fwctrl_lps = 3; - rtlpriv->psc.reg_max_lps_awakeintvl = 5; - /* for ASPM, you can close aspm through - * set const_support_pciaspm = 0 */ - rtl8821ae_init_aspm_vars(hw); - - if (rtlpriv->psc.b_reg_fwctrl_lps == 1) - rtlpriv->psc.fwctrl_psmode = FW_PS_MIN_MODE; - else if (rtlpriv->psc.b_reg_fwctrl_lps == 2) - rtlpriv->psc.fwctrl_psmode = FW_PS_MAX_MODE; - else if (rtlpriv->psc.b_reg_fwctrl_lps == 3) - rtlpriv->psc.fwctrl_psmode = FW_PS_DTIM_MODE; - - /* for firmware buf */ - rtlpriv->rtlhal.pfirmware = (u8 *) vmalloc(0x8000); - if (!rtlpriv->rtlhal.pfirmware) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("Can't alloc buffer for fw.\n")); - return 1; - } - - fw_name = "rtlwifi/rtl8821aefw.bin"; - err = request_firmware(&firmware, fw_name, rtlpriv->io.dev); - if (err) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("Failed to request firmware!\n")); - return 1; - } - - if (firmware->size > 0x8000) { - RT_TRACE(COMP_ERR, DBG_EMERG, - ("Firmware is too big!\n")); - release_firmware(firmware); - return 1; - } - - memcpy(rtlpriv->rtlhal.pfirmware, firmware->data, firmware->size); - rtlpriv->rtlhal.fwsize = firmware->size; - release_firmware(firmware); - - if (rtlpriv->cfg->ops->get_btc_status()){ - rtlpriv->btcoexist.btc_ops->btc_init_variables(rtlpriv); - rtlpriv->btcoexist.btc_ops->btc_init_hal_vars(rtlpriv); - } - - RT_TRACE(COMP_INIT, DBG_LOUD, (" FirmwareDownload OK\n")); - return err; -} - -void rtl8821ae_deinit_sw_vars(struct ieee80211_hw *hw) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - //printk("=========>rtl8821ae_deinit_sw_vars().\n"); - if (rtlpriv->cfg->ops->get_btc_status()){ - //printk("=========>rtl8821ae_deinit_sw_vars().get_btc_status\n"); - rtlpriv->btcoexist.btc_ops->btc_halt_notify(); - } - if (rtlpriv->rtlhal.pfirmware) { - //printk("=========>rtl8821ae_deinit_sw_vars().rtlpriv->rtlhal.pfirmware\n"); - vfree(rtlpriv->rtlhal.pfirmware); - rtlpriv->rtlhal.pfirmware = NULL; - } - //printk("<=========rtl8821ae_deinit_sw_vars().\n"); -} - -u32 rtl8812ae_rx_command_packet_handler( - struct ieee80211_hw *hw, - struct rtl_stats status, - struct sk_buff *skb - ) -{ - u32 result = 0; - struct rtl_priv *rtlpriv = rtl_priv(hw); - - switch (status.packet_report_type) { - case NORMAL_RX: - result = 0; - break; - case C2H_PACKET: - rtl8812ae_c2h_packet_handler(hw, skb->data, (u8) skb->len); - result = 1; - RT_TRACE(COMP_RECV, DBG_LOUD, - ("===>rtl8821ae_rx_command_packet_handler(): (u8) skb->len=%d\n\n", skb->len)); - break; - default: - RT_TRACE(COMP_RECV, DBG_LOUD, - ("===>rtl8821ae_rx_command_packet_handler(): No this packet type!!\n")); - break; - } - - return result; -} - - -/* get bt coexist status */ -bool rtl8821ae_get_btc_status(void) -{ - return true; -} - -struct rtl_hal_ops rtl8821ae_hal_ops = { - .init_sw_vars = rtl8821ae_init_sw_vars, - .deinit_sw_vars = rtl8821ae_deinit_sw_vars, - .read_eeprom_info = rtl8821ae_read_eeprom_info, - .interrupt_recognized = rtl8821ae_interrupt_recognized, - .hw_init = rtl8821ae_hw_init, - .hw_disable = rtl8821ae_card_disable, - .hw_suspend = rtl8821ae_suspend, - .hw_resume = rtl8821ae_resume, - .enable_interrupt = rtl8821ae_enable_interrupt, - .disable_interrupt = rtl8821ae_disable_interrupt, - .set_network_type = rtl8821ae_set_network_type, - .set_chk_bssid = rtl8821ae_set_check_bssid, - .set_qos = rtl8821ae_set_qos, - .set_bcn_reg = rtl8821ae_set_beacon_related_registers, - .set_bcn_intv = rtl8821ae_set_beacon_interval, - .update_interrupt_mask = rtl8821ae_update_interrupt_mask, - .get_hw_reg = rtl8821ae_get_hw_reg, - .set_hw_reg = rtl8821ae_set_hw_reg, - .update_rate_tbl = rtl8821ae_update_hal_rate_tbl, - .fill_tx_desc = rtl8821ae_tx_fill_desc, - .fill_tx_cmddesc = rtl8821ae_tx_fill_cmddesc, - .query_rx_desc = rtl8821ae_rx_query_desc, - .set_channel_access = rtl8821ae_update_channel_access_setting, - .radio_onoff_checking = rtl8821ae_gpio_radio_on_off_checking, - .set_bw_mode = rtl8821ae_phy_set_bw_mode, - .switch_channel = rtl8821ae_phy_sw_chnl, - .dm_watchdog = rtl8821ae_dm_watchdog, - .scan_operation_backup = rtl8821ae_phy_scan_operation_backup, - .set_rf_power_state = rtl8821ae_phy_set_rf_power_state, - .led_control = rtl8821ae_led_control, - .set_desc = rtl8821ae_set_desc, - .get_desc = rtl8821ae_get_desc, - .is_tx_desc_closed = rtl8821ae_is_tx_desc_closed, - .tx_polling = rtl8821ae_tx_polling, - .enable_hw_sec = rtl8821ae_enable_hw_security_config, - .set_key = rtl8821ae_set_key, - .init_sw_leds = rtl8821ae_init_sw_leds, - .allow_all_destaddr = rtl8821ae_allow_all_destaddr, - .get_bbreg = rtl8821ae_phy_query_bb_reg, - .set_bbreg = rtl8821ae_phy_set_bb_reg, - .get_rfreg = rtl8821ae_phy_query_rf_reg, - .set_rfreg = rtl8821ae_phy_set_rf_reg, - .c2h_command_handle = rtl_8821ae_c2h_command_handle, - .bt_wifi_media_status_notify = rtl_8821ae_bt_wifi_media_status_notify, - .bt_turn_off_bt_coexist_before_enter_lps = rtl8821ae_dm_bt_turn_off_bt_coexist_before_enter_lps, - .fill_h2c_cmd = rtl8821ae_fill_h2c_cmd, - .get_btc_status = rtl8821ae_get_btc_status, - .rx_command_packet_handler = rtl8812ae_rx_command_packet_handler, -}; - -struct rtl_mod_params rtl8821ae_mod_params = { - .sw_crypto = false, - .b_inactiveps = false,//true, - .b_swctrl_lps = false, - .b_fwctrl_lps = false, //true, -}; - -struct rtl_hal_cfg rtl8821ae_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl8821ae_pci", - .fw_name = "rtlwifi/rtl8821aefw.bin", - .ops = &rtl8821ae_hal_ops, - .mod_params = &rtl8821ae_mod_params, - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, - .maps[SYS_FUNC_EN] = REG_SYS_FUNC_EN, - .maps[SYS_CLK] = REG_SYS_CLKR, - .maps[MAC_RCR_AM] = AM, - .maps[MAC_RCR_AB] = AB, - .maps[MAC_RCR_ACRC32] = ACRC32, - .maps[MAC_RCR_ACF] = ACF, - .maps[MAC_RCR_AAP] = AAP, - .maps[MAC_HIMR] = REG_HIMR, - .maps[MAC_HIMRE] = REG_HIMRE, - - - .maps[EFUSE_ACCESS] = REG_EFUSE_ACCESS, - - .maps[EFUSE_TEST] = REG_EFUSE_TEST, - .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_CLK] = 0, - .maps[EFUSE_CLK_CTRL] = REG_EFUSE_CTRL, - .maps[EFUSE_PWC_EV12V] = PWC_EV12V, - .maps[EFUSE_FEN_ELDR] = FEN_ELDR, - .maps[EFUSE_LOADER_CLK_EN] = LOADER_CLK_EN, - .maps[EFUSE_ANA8M] = ANA8M, - .maps[EFUSE_HWSET_MAX_SIZE] = HWSET_MAX_SIZE, - .maps[EFUSE_MAX_SECTION_MAP] = EFUSE_MAX_SECTION, - .maps[EFUSE_REAL_CONTENT_SIZE] = EFUSE_REAL_CONTENT_LEN, - .maps[EFUSE_OOB_PROTECT_BYTES_LEN] = EFUSE_OOB_PROTECT_BYTES, - - .maps[RWCAM] = REG_CAMCMD, - .maps[WCAMI] = REG_CAMWRITE, - .maps[RCAMO] = REG_CAMREAD, - .maps[CAMDBG] = REG_CAMDBG, - .maps[SECR] = REG_SECCFG, - .maps[SEC_CAM_NONE] = CAM_NONE, - .maps[SEC_CAM_WEP40] = CAM_WEP40, - .maps[SEC_CAM_TKIP] = CAM_TKIP, - .maps[SEC_CAM_AES] = CAM_AES, - .maps[SEC_CAM_WEP104] = CAM_WEP104, - - .maps[RTL_IMR_BCNDMAINT6] = IMR_BCNDMAINT6, - .maps[RTL_IMR_BCNDMAINT5] = IMR_BCNDMAINT5, - .maps[RTL_IMR_BCNDMAINT4] = IMR_BCNDMAINT4, - .maps[RTL_IMR_BCNDMAINT3] = IMR_BCNDMAINT3, - .maps[RTL_IMR_BCNDMAINT2] = IMR_BCNDMAINT2, - .maps[RTL_IMR_BCNDMAINT1] = IMR_BCNDMAINT1, -/* .maps[RTL_IMR_BCNDOK8] = IMR_BCNDOK8, */ /*need check*/ - .maps[RTL_IMR_BCNDOK7] = IMR_BCNDOK7, - .maps[RTL_IMR_BCNDOK6] = IMR_BCNDOK6, - .maps[RTL_IMR_BCNDOK5] = IMR_BCNDOK5, - .maps[RTL_IMR_BCNDOK4] = IMR_BCNDOK4, - .maps[RTL_IMR_BCNDOK3] = IMR_BCNDOK3, - .maps[RTL_IMR_BCNDOK2] = IMR_BCNDOK2, - .maps[RTL_IMR_BCNDOK1] = IMR_BCNDOK1, -/* .maps[RTL_IMR_TIMEOUT2] = IMR_TIMEOUT2,*/ -/* .maps[RTL_IMR_TIMEOUT1] = IMR_TIMEOUT1,*/ - - .maps[RTL_IMR_TXFOVW] = IMR_TXFOVW, - .maps[RTL_IMR_PSTIMEOUT] = IMR_PSTIMEOUT, - .maps[RTL_IMR_BcnInt] = IMR_BCNDMAINT0, - .maps[RTL_IMR_RXFOVW] = IMR_RXFOVW, - .maps[RTL_IMR_RDU] = IMR_RDU, - .maps[RTL_IMR_ATIMEND] = IMR_ATIMEND, - .maps[RTL_IMR_BDOK] = IMR_BCNDOK0, - .maps[RTL_IMR_MGNTDOK] = IMR_MGNTDOK, - .maps[RTL_IMR_TBDER] = IMR_TBDER, - .maps[RTL_IMR_HIGHDOK] = IMR_HIGHDOK, - .maps[RTL_IMR_TBDOK] = IMR_TBDOK, - .maps[RTL_IMR_BKDOK] = IMR_BKDOK, - .maps[RTL_IMR_BEDOK] = IMR_BEDOK, - .maps[RTL_IMR_VIDOK] = IMR_VIDOK, - .maps[RTL_IMR_VODOK] = IMR_VODOK, - .maps[RTL_IMR_ROK] = IMR_ROK, - .maps[RTL_IBSS_INT_MASKS] = (IMR_BCNDMAINT0 | IMR_TBDOK | IMR_TBDER), - - .maps[RTL_RC_CCK_RATE1M] = DESC_RATE1M, - .maps[RTL_RC_CCK_RATE2M] = DESC_RATE2M, - .maps[RTL_RC_CCK_RATE5_5M] = DESC_RATE5_5M, - .maps[RTL_RC_CCK_RATE11M] = DESC_RATE11M, - .maps[RTL_RC_OFDM_RATE6M] = DESC_RATE6M, - .maps[RTL_RC_OFDM_RATE9M] = DESC_RATE9M, - .maps[RTL_RC_OFDM_RATE12M] = DESC_RATE12M, - .maps[RTL_RC_OFDM_RATE18M] = DESC_RATE18M, - .maps[RTL_RC_OFDM_RATE24M] = DESC_RATE24M, - .maps[RTL_RC_OFDM_RATE36M] = DESC_RATE36M, - .maps[RTL_RC_OFDM_RATE48M] = DESC_RATE48M, - .maps[RTL_RC_OFDM_RATE54M] = DESC_RATE54M, - - .maps[RTL_RC_HT_RATEMCS7] = DESC_RATEMCS7, - .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15, -}; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) -static struct pci_device_id rtl8821ae_pci_ids[] = { - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8812, rtl8821ae_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8821, rtl8821ae_hal_cfg)}, - {}, -}; -#else -static struct pci_device_id rtl8821ae_pci_ids[] __devinitdata = { - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8812, rtl8821ae_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8821, rtl8821ae_hal_cfg)}, - {}, -}; -#endif - -MODULE_DEVICE_TABLE(pci, rtl8821ae_pci_ids); - -MODULE_AUTHOR("Ping Yan<ping_yan@xxxxxxxxxxxxxx>"); -MODULE_AUTHOR("Realtek WlanFAE <wlanfae@xxxxxxxxxxx>"); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("Realtek 8821ae 802.11ac PCI wireless"); -MODULE_FIRMWARE("rtlwifi/rtl8821aefw.bin"); - -module_param_named(swenc, rtl8821ae_mod_params.sw_crypto, bool, 0444); -module_param_named(ips, rtl8821ae_mod_params.b_inactiveps, bool, 0444); -module_param_named(swlps, rtl8821ae_mod_params.b_swctrl_lps, bool, 0444); -module_param_named(fwlps, rtl8821ae_mod_params.b_fwctrl_lps, bool, 0444); -MODULE_PARM_DESC(swenc, "using hardware crypto (default 0 [hardware])\n"); -MODULE_PARM_DESC(ips, "using no link power save (default 1 is open)\n"); -MODULE_PARM_DESC(fwlps, "using linked fw control power save (default 1 is open)\n"); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) -static const SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -compat_pci_suspend(rtl_pci_suspend) -compat_pci_resume(rtl_pci_resume) -#endif - -static struct pci_driver rtl8821ae_driver = { - .name = KBUILD_MODNAME, - .id_table = rtl8821ae_pci_ids, - .probe = rtl_pci_probe, - .remove = rtl_pci_disconnect, - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - .driver.pm = &rtlwifi_pm_ops, -#elif defined(CONFIG_PM) - .suspend = rtl_pci_suspend_compat, - .resume = rtl_pci_resume_compat, -#endif - -}; - - -extern int rtl_core_module_init(void); -extern void rtl_core_module_exit(void); - -static int __init rtl8821ae_module_init(void) -{ - int ret; - - ret = rtl_core_module_init(); - if (ret) - return ret; - - //printk("==========>rtl8821ae_module_init().\n"); - ret = pci_register_driver(&rtl8821ae_driver); - if (ret) - RT_ASSERT(false, (": No device found\n")); - - return ret; -} - -static void __exit rtl8821ae_module_exit(void) -{ - pci_unregister_driver(&rtl8821ae_driver); - rtl_core_module_exit(); -} - -module_init(rtl8821ae_module_init); -module_exit(rtl8821ae_module_exit); diff --git a/drivers/staging/rtl8821ae/rtl8821ae/sw.h b/drivers/staging/rtl8821ae/rtl8821ae/sw.h deleted file mode 100644 index 3d49b2f..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/sw.h +++ /dev/null @@ -1,39 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_SW_H__ -#define __RTL8821AE_SW_H__ - -int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw); -void rtl8821ae_deinit_sw_vars(struct ieee80211_hw *hw); -void rtl8821ae_init_var_map(struct ieee80211_hw *hw); -bool rtl8821ae_get_btc_status(void); - - -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/table.c b/drivers/staging/rtl8821ae/rtl8821ae/table.c deleted file mode 100644 index a6c4ca4..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/table.c +++ /dev/null @@ -1,4002 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Created on 2010/ 5/18, 1:41 - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "table.h" -u32 RTL8812AE_PHY_REG_ARRAY[] = { - 0x800, 0x8020D010, - 0x804, 0x080112E0, - 0x808, 0x0E028233, - 0x80C, 0x12131113, - 0x810, 0x20101263, - 0x814, 0x020C3D10, - 0x818, 0x03A00385, - 0x820, 0x00000000, - 0x824, 0x00030FE0, - 0x828, 0x00000000, - 0x82C, 0x002083DD, - 0x830, 0x2AAA6C86, - 0x834, 0x0037A706, - 0x838, 0x06C89B44, - 0x83C, 0x0000095B, - 0x840, 0xC0000001, - 0x844, 0x40003CDE, - 0x848, 0x6210FF8B, - 0x84C, 0x6CFDFFB8, - 0x850, 0x28874706, - 0x854, 0x0001520C, - 0x858, 0x8060E000, - 0x85C, 0x74210168, - 0x860, 0x6929C321, - 0x864, 0x79727432, - 0x868, 0x8CA7A314, - 0x86C, 0x338C2878, - 0x870, 0x03333333, - 0x874, 0x31602C2E, - 0x878, 0x00003152, - 0x87C, 0x000FC000, - 0x8A0, 0x00000013, - 0x8A4, 0x7F7F7F7F, - 0x8A8, 0xA202033E, - 0x8AC, 0x0FF0FA0A, - 0x8B0, 0x00000600, - 0x8B4, 0x000FC080, - 0x8B8, 0x6C0057FF, - 0x8BC, 0x4CA520A3, - 0x8C0, 0x27F00020, - 0x8C4, 0x00000000, - 0x8C8, 0x00013169, - 0x8CC, 0x08248492, - 0x8D0, 0x0000B800, - 0x8DC, 0x00000000, - 0x8D4, 0x940008A0, - 0x8D8, 0x290B5612, - 0x8F8, 0x400002C0, - 0x8FC, 0x00000000, - 0xFF0F07D8, 0xABCD, - 0x900, 0x00000700, - 0xFF0F07D0, 0xCDEF, - 0x900, 0x00000700, - 0xCDCDCDCD, 0xCDCD, - 0x900, 0x00000700, - 0xFF0F07D8, 0xDEAD, - 0x90C, 0x00000000, - 0x910, 0x0000FC00, - 0x914, 0x00000404, - 0x918, 0x1C1028C0, - 0x91C, 0x64B11A1C, - 0x920, 0xE0767233, - 0x924, 0x055AA500, - 0x928, 0x00000004, - 0x92C, 0xFFFE0000, - 0x930, 0xFFFFFFFE, - 0x934, 0x001FFFFF, - 0x960, 0x00000000, - 0x964, 0x00000000, - 0x968, 0x00000000, - 0x96C, 0x00000000, - 0x970, 0x801FFFFF, - 0x978, 0x00000000, - 0x97C, 0x00000000, - 0x980, 0x00000000, - 0x984, 0x00000000, - 0x988, 0x00000000, - 0x990, 0x27100000, - 0x994, 0xFFFF0100, - 0x998, 0xFFFFFF5C, - 0x99C, 0xFFFFFFFF, - 0x9A0, 0x000000FF, - 0x9A4, 0x00080080, - 0x9A8, 0x00000000, - 0x9AC, 0x00000000, - 0x9B0, 0x81081008, - 0x9B4, 0x00000000, - 0x9B8, 0x01081008, - 0x9BC, 0x01081008, - 0x9D0, 0x00000000, - 0x9D4, 0x00000000, - 0x9D8, 0x00000000, - 0x9DC, 0x00000000, - 0x9E4, 0x00000002, - 0x9E8, 0x000002D5, - 0xA00, 0x00D047C8, - 0xA04, 0x01FF000C, - 0xA08, 0x8C838300, - 0xA0C, 0x2E7F000F, - 0xA10, 0x9500BB78, - 0xA14, 0x11144028, - 0xA18, 0x00881117, - 0xA1C, 0x89140F00, - 0xA20, 0x1A1B0000, - 0xA24, 0x090E1317, - 0xA28, 0x00000204, - 0xA2C, 0x00900000, - 0xA70, 0x101FFF00, - 0xA74, 0x00000008, - 0xA78, 0x00000900, - 0xA7C, 0x225B0606, - 0xA80, 0x218075B2, - 0xA84, 0x001F8C80, - 0xB00, 0x03100000, - 0xB04, 0x0000B000, - 0xB08, 0xAE0201EB, - 0xB0C, 0x01003207, - 0xB10, 0x00009807, - 0xB14, 0x01000000, - 0xB18, 0x00000002, - 0xB1C, 0x00000002, - 0xB20, 0x0000001F, - 0xB24, 0x03020100, - 0xB28, 0x07060504, - 0xB2C, 0x0B0A0908, - 0xB30, 0x0F0E0D0C, - 0xB34, 0x13121110, - 0xB38, 0x17161514, - 0xB3C, 0x0000003A, - 0xB40, 0x00000000, - 0xB44, 0x00000000, - 0xB48, 0x13000032, - 0xB4C, 0x48080000, - 0xB50, 0x00000000, - 0xB54, 0x00000000, - 0xB58, 0x00000000, - 0xB5C, 0x00000000, - 0xC00, 0x00000007, - 0xC04, 0x00042020, - 0xC08, 0x80410231, - 0xC0C, 0x00000000, - 0xC10, 0x00000100, - 0xC14, 0x01000000, - 0xC1C, 0x40000003, - 0xC20, 0x12121212, - 0xC24, 0x12121212, - 0xC28, 0x12121212, - 0xC2C, 0x12121212, - 0xC30, 0x12121212, - 0xC34, 0x12121212, - 0xC38, 0x12121212, - 0xC3C, 0x12121212, - 0xC40, 0x12121212, - 0xC44, 0x12121212, - 0xC48, 0x12121212, - 0xC4C, 0x12121212, - 0xC50, 0x00000020, - 0xC54, 0x0008121C, - 0xC58, 0x30000C1C, - 0xC5C, 0x00000058, - 0xC60, 0x34344443, - 0xC64, 0x07003333, - 0xC68, 0x59791979, - 0xC6C, 0x59795979, - 0xC70, 0x19795979, - 0xC74, 0x19795979, - 0xC78, 0x19791979, - 0xC7C, 0x19791979, - 0xC80, 0x19791979, - 0xC84, 0x19791979, - 0xC94, 0x0100005C, - 0xC98, 0x00000000, - 0xC9C, 0x00000000, - 0xCA0, 0x00000029, - 0xCA4, 0x08040201, - 0xCA8, 0x80402010, - 0xFF0F0740, 0xABCD, - 0xCB0, 0x77547717, - 0xFF0F01C0, 0xCDEF, - 0xCB0, 0x77547717, - 0xFF0F02C0, 0xCDEF, - 0xCB0, 0x77547717, - 0xFF0F07D8, 0xCDEF, - 0xCB0, 0x54547710, - 0xFF0F07D0, 0xCDEF, - 0xCB0, 0x54547710, - 0xCDCDCDCD, 0xCDCD, - 0xCB0, 0x77547777, - 0xFF0F0740, 0xDEAD, - 0xCB4, 0x00000077, - 0xCB8, 0x00508242, - 0xE00, 0x00000007, - 0xE04, 0x00042020, - 0xE08, 0x80410231, - 0xE0C, 0x00000000, - 0xE10, 0x00000100, - 0xE14, 0x01000000, - 0xE1C, 0x40000003, - 0xE20, 0x12121212, - 0xE24, 0x12121212, - 0xE28, 0x12121212, - 0xE2C, 0x12121212, - 0xE30, 0x12121212, - 0xE34, 0x12121212, - 0xE38, 0x12121212, - 0xE3C, 0x12121212, - 0xE40, 0x12121212, - 0xE44, 0x12121212, - 0xE48, 0x12121212, - 0xE4C, 0x12121212, - 0xE50, 0x00000020, - 0xE54, 0x0008121C, - 0xE58, 0x30000C1C, - 0xE5C, 0x00000058, - 0xE60, 0x34344443, - 0xE64, 0x07003333, - 0xE68, 0x59791979, - 0xE6C, 0x59795979, - 0xE70, 0x19795979, - 0xE74, 0x19795979, - 0xE78, 0x19791979, - 0xE7C, 0x19791979, - 0xE80, 0x19791979, - 0xE84, 0x19791979, - 0xE94, 0x0100005C, - 0xE98, 0x00000000, - 0xE9C, 0x00000000, - 0xEA0, 0x00000029, - 0xEA4, 0x08040201, - 0xEA8, 0x80402010, - 0xFF0F0740, 0xABCD, - 0xEB0, 0x77547717, - 0xFF0F01C0, 0xCDEF, - 0xEB0, 0x77547717, - 0xFF0F02C0, 0xCDEF, - 0xEB0, 0x77547717, - 0xFF0F07D8, 0xCDEF, - 0xEB0, 0x54547710, - 0xFF0F07D0, 0xCDEF, - 0xEB0, 0x54547710, - 0xCDCDCDCD, 0xCDCD, - 0xEB0, 0x77547777, - 0xFF0F0740, 0xDEAD, - 0xEB4, 0x00000077, - 0xEB8, 0x00508242, -}; - -u32 RTL8821AE_PHY_REG_ARRAY[] = { - 0x800, 0x0020D090, - 0x804, 0x080112E0, - 0x808, 0x0E028211, - 0x80C, 0x92131111, - 0x810, 0x20101261, - 0x814, 0x020C3D10, - 0x818, 0x03A00385, - 0x820, 0x00000000, - 0x824, 0x00030FE0, - 0x828, 0x00000000, - 0x82C, 0x002081DD, - 0x830, 0x2AAA8E24, - 0x834, 0x0037A706, - 0x838, 0x06489B44, - 0x83C, 0x0000095B, - 0x840, 0xC0000001, - 0x844, 0x40003CDE, - 0x848, 0x62103F8B, - 0x84C, 0x6CFDFFB8, - 0x850, 0x28874706, - 0x854, 0x0001520C, - 0x858, 0x8060E000, - 0x85C, 0x74210168, - 0x860, 0x6929C321, - 0x864, 0x79727432, - 0x868, 0x8CA7A314, - 0x86C, 0x888C2878, - 0x870, 0x08888888, - 0x874, 0x31612C2E, - 0x878, 0x00000152, - 0x87C, 0x000FD000, - 0x8A0, 0x00000013, - 0x8A4, 0x7F7F7F7F, - 0x8A8, 0xA2000338, - 0x8AC, 0x0FF0FA0A, - 0x8B4, 0x000FC080, - 0x8B8, 0x6C10D7FF, - 0x8BC, 0x0CA52090, - 0x8C0, 0x1BF00020, - 0x8C4, 0x00000000, - 0x8C8, 0x00013169, - 0x8CC, 0x08248492, - 0x8D4, 0x940008A0, - 0x8D8, 0x290B5612, - 0x8F8, 0x400002C0, - 0x8FC, 0x00000000, - 0x900, 0x00000700, - 0x90C, 0x00000000, - 0x910, 0x0000FC00, - 0x914, 0x00000404, - 0x918, 0x1C1028C0, - 0x91C, 0x64B11A1C, - 0x920, 0xE0767233, - 0x924, 0x055AA500, - 0x928, 0x00000004, - 0x92C, 0xFFFE0000, - 0x930, 0xFFFFFFFE, - 0x934, 0x001FFFFF, - 0x960, 0x00000000, - 0x964, 0x00000000, - 0x968, 0x00000000, - 0x96C, 0x00000000, - 0x970, 0x801FFFFF, - 0x974, 0x000003FF, - 0x978, 0x00000000, - 0x97C, 0x00000000, - 0x980, 0x00000000, - 0x984, 0x00000000, - 0x988, 0x00000000, - 0x990, 0x27100000, - 0x994, 0xFFFF0100, - 0x998, 0xFFFFFF5C, - 0x99C, 0xFFFFFFFF, - 0x9A0, 0x000000FF, - 0x9A4, 0x00480080, - 0x9A8, 0x00000000, - 0x9AC, 0x00000000, - 0x9B0, 0x81081008, - 0x9B4, 0x01081008, - 0x9B8, 0x01081008, - 0x9BC, 0x01081008, - 0x9D0, 0x00000000, - 0x9D4, 0x00000000, - 0x9D8, 0x00000000, - 0x9DC, 0x00000000, - 0x9E0, 0x00005D00, - 0x9E4, 0x00000002, - 0x9E8, 0x00000001, - 0xA00, 0x00D047C8, - 0xA04, 0x01FF000C, - 0xA08, 0x8C8A8300, - 0xA0C, 0x2E68000F, - 0xA10, 0x9500BB78, - 0xA14, 0x11144028, - 0xA18, 0x00881117, - 0xA1C, 0x89140F00, - 0xA20, 0x1A1B0000, - 0xA24, 0x090E1317, - 0xA28, 0x00000204, - 0xA2C, 0x00900000, - 0xA70, 0x101FFF00, - 0xA74, 0x00000008, - 0xA78, 0x00000900, - 0xA7C, 0x225B0606, - 0xA80, 0x21805490, - 0xA84, 0x001F0000, - 0xB00, 0x03100040, - 0xB04, 0x0000B000, - 0xB08, 0xAE0201EB, - 0xB0C, 0x01003207, - 0xB10, 0x00009807, - 0xB14, 0x01000000, - 0xB18, 0x00000002, - 0xB1C, 0x00000002, - 0xB20, 0x0000001F, - 0xB24, 0x03020100, - 0xB28, 0x07060504, - 0xB2C, 0x0B0A0908, - 0xB30, 0x0F0E0D0C, - 0xB34, 0x13121110, - 0xB38, 0x17161514, - 0xB3C, 0x0000003A, - 0xB40, 0x00000000, - 0xB44, 0x00000000, - 0xB48, 0x13000032, - 0xB4C, 0x48080000, - 0xB50, 0x00000000, - 0xB54, 0x00000000, - 0xB58, 0x00000000, - 0xB5C, 0x00000000, - 0xC00, 0x00000007, - 0xC04, 0x00042020, - 0xC08, 0x80410231, - 0xC0C, 0x00000000, - 0xC10, 0x00000100, - 0xC14, 0x01000000, - 0xC1C, 0x40000003, - 0xC20, 0x2C2C2C2C, - 0xC24, 0x30303030, - 0xC28, 0x30303030, - 0xC2C, 0x2C2C2C2C, - 0xC30, 0x2C2C2C2C, - 0xC34, 0x2C2C2C2C, - 0xC38, 0x2C2C2C2C, - 0xC3C, 0x2A2A2A2A, - 0xC40, 0x2A2A2A2A, - 0xC44, 0x2A2A2A2A, - 0xC48, 0x2A2A2A2A, - 0xC4C, 0x2A2A2A2A, - 0xC50, 0x00000020, - 0xC54, 0x001C1208, - 0xC58, 0x30000C1C, - 0xC5C, 0x00000058, - 0xC60, 0x34344443, - 0xC64, 0x07003333, - 0xC68, 0x19791979, - 0xC6C, 0x19791979, - 0xC70, 0x19791979, - 0xC74, 0x19791979, - 0xC78, 0x19791979, - 0xC7C, 0x19791979, - 0xC80, 0x19791979, - 0xC84, 0x19791979, - 0xC94, 0x0100005C, - 0xC98, 0x00000000, - 0xC9C, 0x00000000, - 0xCA0, 0x00000029, - 0xCA4, 0x08040201, - 0xCA8, 0x80402010, - 0xCB0, 0x77775747, - 0xCB4, 0x10000077, - 0xCB8, 0x00508240, -}; - -u32 RTL8812AE_PHY_REG_ARRAY_PG[] = { - 0, 0, 0, 0x00000c20, 0xffffffff, 0x34363840, - 0, 0, 0, 0x00000c24, 0xffffffff, 0x42424444, - 0, 0, 0, 0x00000c28, 0xffffffff, 0x30323638, - 0, 0, 0, 0x00000c2c, 0xffffffff, 0x40424444, - 0, 0, 0, 0x00000c30, 0xffffffff, 0x28303236, - 0, 0, 1, 0x00000c34, 0xffffffff, 0x38404242, - 0, 0, 1, 0x00000c38, 0xffffffff, 0x26283034, - 0, 0, 0, 0x00000c3c, 0xffffffff, 0x40424444, - 0, 0, 0, 0x00000c40, 0xffffffff, 0x28303236, - 0, 0, 0, 0x00000c44, 0xffffffff, 0x42422426, - 0, 0, 1, 0x00000c48, 0xffffffff, 0x30343840, - 0, 0, 1, 0x00000c4c, 0xffffffff, 0x22242628, - 0, 1, 0, 0x00000e20, 0xffffffff, 0x34363840, - 0, 1, 0, 0x00000e24, 0xffffffff, 0x42424444, - 0, 1, 0, 0x00000e28, 0xffffffff, 0x30323638, - 0, 1, 0, 0x00000e2c, 0xffffffff, 0x40424444, - 0, 1, 0, 0x00000e30, 0xffffffff, 0x28303236, - 0, 1, 1, 0x00000e34, 0xffffffff, 0x38404242, - 0, 1, 1, 0x00000e38, 0xffffffff, 0x26283034, - 0, 1, 0, 0x00000e3c, 0xffffffff, 0x40424444, - 0, 1, 0, 0x00000e40, 0xffffffff, 0x28303236, - 0, 1, 0, 0x00000e44, 0xffffffff, 0x42422426, - 0, 1, 1, 0x00000e48, 0xffffffff, 0x30343840, - 0, 1, 1, 0x00000e4c, 0xffffffff, 0x22242628, - 1, 0, 0, 0x00000c24, 0xffffffff, 0x42424444, - 1, 0, 0, 0x00000c28, 0xffffffff, 0x30323640, - 1, 0, 0, 0x00000c2c, 0xffffffff, 0x40424444, - 1, 0, 0, 0x00000c30, 0xffffffff, 0x28303236, - 1, 0, 1, 0x00000c34, 0xffffffff, 0x38404242, - 1, 0, 1, 0x00000c38, 0xffffffff, 0x26283034, - 1, 0, 0, 0x00000c3c, 0xffffffff, 0x40424444, - 1, 0, 0, 0x00000c40, 0xffffffff, 0x28303236, - 1, 0, 0, 0x00000c44, 0xffffffff, 0x42422426, - 1, 0, 1, 0x00000c48, 0xffffffff, 0x30343840, - 1, 0, 1, 0x00000c4c, 0xffffffff, 0x22242628, - 1, 1, 0, 0x00000e24, 0xffffffff, 0x42424444, - 1, 1, 0, 0x00000e28, 0xffffffff, 0x30323640, - 1, 1, 0, 0x00000e2c, 0xffffffff, 0x40424444, - 1, 1, 0, 0x00000e30, 0xffffffff, 0x28303236, - 1, 1, 1, 0x00000e34, 0xffffffff, 0x38404242, - 1, 1, 1, 0x00000e38, 0xffffffff, 0x26283034, - 1, 1, 0, 0x00000e3c, 0xffffffff, 0x40424444, - 1, 1, 0, 0x00000e40, 0xffffffff, 0x28303236, - 1, 1, 0, 0x00000e44, 0xffffffff, 0x42422426, - 1, 1, 1, 0x00000e48, 0xffffffff, 0x30343840, - 1, 1, 1, 0x00000e4c, 0xffffffff, 0x22242628 -}; - -u32 RTL8821AE_PHY_REG_ARRAY_PG[] = { - 0, 0, 0, 0x00000c20, 0xffffffff, 0x32343638, - 0, 0, 0, 0x00000c24, 0xffffffff, 0x36363838, - 0, 0, 0, 0x00000c28, 0xffffffff, 0x28303234, - 0, 0, 0, 0x00000c2c, 0xffffffff, 0x34363838, - 0, 0, 0, 0x00000c30, 0xffffffff, 0x26283032, - 0, 0, 0, 0x00000c3c, 0xffffffff, 0x32343636, - 0, 0, 0, 0x00000c40, 0xffffffff, 0x24262830, - 0, 0, 0, 0x00000c44, 0x0000ffff, 0x00002022, - 1, 0, 0, 0x00000c24, 0xffffffff, 0x34343636, - 1, 0, 0, 0x00000c28, 0xffffffff, 0x26283032, - 1, 0, 0, 0x00000c2c, 0xffffffff, 0x32343636, - 1, 0, 0, 0x00000c30, 0xffffffff, 0x24262830, - 1, 0, 0, 0x00000c3c, 0xffffffff, 0x32343636, - 1, 0, 0, 0x00000c40, 0xffffffff, 0x24262830, - 1, 0, 0, 0x00000c44, 0x0000ffff, 0x00002022 -}; - -/* it seems not used -u8 *RTL8821AE_TXPWR_LMT_ARRAY[] = { - "FCC", "2.4G", "20M", "CCK", "1T", "01", "32", - "ETSI", "2.4G", "20M", "CCK", "1T", "01", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "01", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "02", "32", - "ETSI", "2.4G", "20M", "CCK", "1T", "02", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "02", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "03", "32", - "ETSI", "2.4G", "20M", "CCK", "1T", "03", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "03", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "04", "34", - "ETSI", "2.4G", "20M", "CCK", "1T", "04", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "04", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "05", "34", - "ETSI", "2.4G", "20M", "CCK", "1T", "05", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "05", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "06", "34", - "ETSI", "2.4G", "20M", "CCK", "1T", "06", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "06", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "07", "34", - "ETSI", "2.4G", "20M", "CCK", "1T", "07", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "07", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "08", "34", - "ETSI", "2.4G", "20M", "CCK", "1T", "08", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "08", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "09", "34", - "ETSI", "2.4G", "20M", "CCK", "1T", "09", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "09", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "10", "32", - "ETSI", "2.4G", "20M", "CCK", "1T", "10", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "10", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "11", "32", - "ETSI", "2.4G", "20M", "CCK", "1T", "11", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "11", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "12", "63", - "ETSI", "2.4G", "20M", "CCK", "1T", "12", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "12", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "13", "63", - "ETSI", "2.4G", "20M", "CCK", "1T", "13", "32", - "MKK", "2.4G", "20M", "CCK", "1T", "13", "32", - "FCC", "2.4G", "20M", "CCK", "1T", "14", "63", - "ETSI", "2.4G", "20M", "CCK", "1T", "14", "63", - "MKK", "2.4G", "20M", "CCK", "1T", "14", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "01", "30", - "ETSI", "2.4G", "20M", "OFDM", "1T", "01", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "01", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "02", "30", - "ETSI", "2.4G", "20M", "OFDM", "1T", "02", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "02", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "03", "30", - "ETSI", "2.4G", "20M", "OFDM", "1T", "03", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "03", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "04", "32", - "ETSI", "2.4G", "20M", "OFDM", "1T", "04", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "04", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "05", "32", - "ETSI", "2.4G", "20M", "OFDM", "1T", "05", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "05", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "06", "32", - "ETSI", "2.4G", "20M", "OFDM", "1T", "06", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "06", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "07", "32", - "ETSI", "2.4G", "20M", "OFDM", "1T", "07", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "07", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "08", "32", - "ETSI", "2.4G", "20M", "OFDM", "1T", "08", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "08", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "09", "32", - "ETSI", "2.4G", "20M", "OFDM", "1T", "09", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "09", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "10", "30", - "ETSI", "2.4G", "20M", "OFDM", "1T", "10", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "10", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "11", "30", - "ETSI", "2.4G", "20M", "OFDM", "1T", "11", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "11", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "12", "63", - "ETSI", "2.4G", "20M", "OFDM", "1T", "12", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "12", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "13", "63", - "ETSI", "2.4G", "20M", "OFDM", "1T", "13", "32", - "MKK", "2.4G", "20M", "OFDM", "1T", "13", "32", - "FCC", "2.4G", "20M", "OFDM", "1T", "14", "63", - "ETSI", "2.4G", "20M", "OFDM", "1T", "14", "63", - "MKK", "2.4G", "20M", "OFDM", "1T", "14", "63", - "FCC", "2.4G", "20M", "HT", "1T", "01", "26", - "ETSI", "2.4G", "20M", "HT", "1T", "01", "32", - "MKK", "2.4G", "20M", "HT", "1T", "01", "32", - "FCC", "2.4G", "20M", "HT", "1T", "02", "26", - "ETSI", "2.4G", "20M", "HT", "1T", "02", "32", - "MKK", "2.4G", "20M", "HT", "1T", "02", "32", - "FCC", "2.4G", "20M", "HT", "1T", "03", "26", - "ETSI", "2.4G", "20M", "HT", "1T", "03", "32", - "MKK", "2.4G", "20M", "HT", "1T", "03", "32", - "FCC", "2.4G", "20M", "HT", "1T", "04", "32", - "ETSI", "2.4G", "20M", "HT", "1T", "04", "32", - "MKK", "2.4G", "20M", "HT", "1T", "04", "32", - "FCC", "2.4G", "20M", "HT", "1T", "05", "32", - "ETSI", "2.4G", "20M", "HT", "1T", "05", "32", - "MKK", "2.4G", "20M", "HT", "1T", "05", "32", - "FCC", "2.4G", "20M", "HT", "1T", "06", "32", - "ETSI", "2.4G", "20M", "HT", "1T", "06", "32", - "MKK", "2.4G", "20M", "HT", "1T", "06", "32", - "FCC", "2.4G", "20M", "HT", "1T", "07", "32", - "ETSI", "2.4G", "20M", "HT", "1T", "07", "32", - "MKK", "2.4G", "20M", "HT", "1T", "07", "32", - "FCC", "2.4G", "20M", "HT", "1T", "08", "32", - "ETSI", "2.4G", "20M", "HT", "1T", "08", "32", - "MKK", "2.4G", "20M", "HT", "1T", "08", "32", - "FCC", "2.4G", "20M", "HT", "1T", "09", "32", - "ETSI", "2.4G", "20M", "HT", "1T", "09", "32", - "MKK", "2.4G", "20M", "HT", "1T", "09", "32", - "FCC", "2.4G", "20M", "HT", "1T", "10", "26", - "ETSI", "2.4G", "20M", "HT", "1T", "10", "32", - "MKK", "2.4G", "20M", "HT", "1T", "10", "32", - "FCC", "2.4G", "20M", "HT", "1T", "11", "26", - "ETSI", "2.4G", "20M", "HT", "1T", "11", "32", - "MKK", "2.4G", "20M", "HT", "1T", "11", "32", - "FCC", "2.4G", "20M", "HT", "1T", "12", "63", - "ETSI", "2.4G", "20M", "HT", "1T", "12", "32", - "MKK", "2.4G", "20M", "HT", "1T", "12", "32", - "FCC", "2.4G", "20M", "HT", "1T", "13", "63", - "ETSI", "2.4G", "20M", "HT", "1T", "13", "32", - "MKK", "2.4G", "20M", "HT", "1T", "13", "32", - "FCC", "2.4G", "20M", "HT", "1T", "14", "63", - "ETSI", "2.4G", "20M", "HT", "1T", "14", "63", - "MKK", "2.4G", "20M", "HT", "1T", "14", "63", - "FCC", "2.4G", "20M", "HT", "2T", "01", "30", - "ETSI", "2.4G", "20M", "HT", "2T", "01", "32", - "MKK", "2.4G", "20M", "HT", "2T", "01", "32", - "FCC", "2.4G", "20M", "HT", "2T", "02", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "02", "32", - "MKK", "2.4G", "20M", "HT", "2T", "02", "32", - "FCC", "2.4G", "20M", "HT", "2T", "03", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "03", "32", - "MKK", "2.4G", "20M", "HT", "2T", "03", "32", - "FCC", "2.4G", "20M", "HT", "2T", "04", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "04", "32", - "MKK", "2.4G", "20M", "HT", "2T", "04", "32", - "FCC", "2.4G", "20M", "HT", "2T", "05", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "05", "32", - "MKK", "2.4G", "20M", "HT", "2T", "05", "32", - "FCC", "2.4G", "20M", "HT", "2T", "06", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "06", "32", - "MKK", "2.4G", "20M", "HT", "2T", "06", "32", - "FCC", "2.4G", "20M", "HT", "2T", "07", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "07", "32", - "MKK", "2.4G", "20M", "HT", "2T", "07", "32", - "FCC", "2.4G", "20M", "HT", "2T", "08", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "08", "32", - "MKK", "2.4G", "20M", "HT", "2T", "08", "32", - "FCC", "2.4G", "20M", "HT", "2T", "09", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "09", "32", - "MKK", "2.4G", "20M", "HT", "2T", "09", "32", - "FCC", "2.4G", "20M", "HT", "2T", "10", "32", - "ETSI", "2.4G", "20M", "HT", "2T", "10", "32", - "MKK", "2.4G", "20M", "HT", "2T", "10", "32", - "FCC", "2.4G", "20M", "HT", "2T", "11", "30", - "ETSI", "2.4G", "20M", "HT", "2T", "11", "32", - "MKK", "2.4G", "20M", "HT", "2T", "11", "32", - "FCC", "2.4G", "20M", "HT", "2T", "12", "63", - "ETSI", "2.4G", "20M", "HT", "2T", "12", "32", - "MKK", "2.4G", "20M", "HT", "2T", "12", "32", - "FCC", "2.4G", "20M", "HT", "2T", "13", "63", - "ETSI", "2.4G", "20M", "HT", "2T", "13", "32", - "MKK", "2.4G", "20M", "HT", "2T", "13", "32", - "FCC", "2.4G", "20M", "HT", "2T", "14", "63", - "ETSI", "2.4G", "20M", "HT", "2T", "14", "63", - "MKK", "2.4G", "20M", "HT", "2T", "14", "63", - "FCC", "2.4G", "40M", "HT", "1T", "01", "63", - "ETSI", "2.4G", "40M", "HT", "1T", "01", "63", - "MKK", "2.4G", "40M", "HT", "1T", "01", "63", - "FCC", "2.4G", "40M", "HT", "1T", "02", "63", - "ETSI", "2.4G", "40M", "HT", "1T", "02", "63", - "MKK", "2.4G", "40M", "HT", "1T", "02", "63", - "FCC", "2.4G", "40M", "HT", "1T", "03", "26", - "ETSI", "2.4G", "40M", "HT", "1T", "03", "32", - "MKK", "2.4G", "40M", "HT", "1T", "03", "32", - "FCC", "2.4G", "40M", "HT", "1T", "04", "26", - "ETSI", "2.4G", "40M", "HT", "1T", "04", "32", - "MKK", "2.4G", "40M", "HT", "1T", "04", "32", - "FCC", "2.4G", "40M", "HT", "1T", "05", "32", - "ETSI", "2.4G", "40M", "HT", "1T", "05", "32", - "MKK", "2.4G", "40M", "HT", "1T", "05", "32", - "FCC", "2.4G", "40M", "HT", "1T", "06", "32", - "ETSI", "2.4G", "40M", "HT", "1T", "06", "32", - "MKK", "2.4G", "40M", "HT", "1T", "06", "32", - "FCC", "2.4G", "40M", "HT", "1T", "07", "32", - "ETSI", "2.4G", "40M", "HT", "1T", "07", "32", - "MKK", "2.4G", "40M", "HT", "1T", "07", "32", - "FCC", "2.4G", "40M", "HT", "1T", "08", "26", - "ETSI", "2.4G", "40M", "HT", "1T", "08", "32", - "MKK", "2.4G", "40M", "HT", "1T", "08", "32", - "FCC", "2.4G", "40M", "HT", "1T", "09", "26", - "ETSI", "2.4G", "40M", "HT", "1T", "09", "32", - "MKK", "2.4G", "40M", "HT", "1T", "09", "32", - "FCC", "2.4G", "40M", "HT", "1T", "10", "26", - "ETSI", "2.4G", "40M", "HT", "1T", "10", "32", - "MKK", "2.4G", "40M", "HT", "1T", "10", "32", - "FCC", "2.4G", "40M", "HT", "1T", "11", "26", - "ETSI", "2.4G", "40M", "HT", "1T", "11", "32", - "MKK", "2.4G", "40M", "HT", "1T", "11", "32", - "FCC", "2.4G", "40M", "HT", "1T", "12", "63", - "ETSI", "2.4G", "40M", "HT", "1T", "12", "32", - "MKK", "2.4G", "40M", "HT", "1T", "12", "32", - "FCC", "2.4G", "40M", "HT", "1T", "13", "63", - "ETSI", "2.4G", "40M", "HT", "1T", "13", "32", - "MKK", "2.4G", "40M", "HT", "1T", "13", "32", - "FCC", "2.4G", "40M", "HT", "1T", "14", "63", - "ETSI", "2.4G", "40M", "HT", "1T", "14", "63", - "MKK", "2.4G", "40M", "HT", "1T", "14", "63", - "FCC", "2.4G", "40M", "HT", "2T", "01", "63", - "ETSI", "2.4G", "40M", "HT", "2T", "01", "63", - "MKK", "2.4G", "40M", "HT", "2T", "01", "63", - "FCC", "2.4G", "40M", "HT", "2T", "02", "63", - "ETSI", "2.4G", "40M", "HT", "2T", "02", "63", - "MKK", "2.4G", "40M", "HT", "2T", "02", "63", - "FCC", "2.4G", "40M", "HT", "2T", "03", "30", - "ETSI", "2.4G", "40M", "HT", "2T", "03", "30", - "MKK", "2.4G", "40M", "HT", "2T", "03", "30", - "FCC", "2.4G", "40M", "HT", "2T", "04", "32", - "ETSI", "2.4G", "40M", "HT", "2T", "04", "30", - "MKK", "2.4G", "40M", "HT", "2T", "04", "30", - "FCC", "2.4G", "40M", "HT", "2T", "05", "32", - "ETSI", "2.4G", "40M", "HT", "2T", "05", "30", - "MKK", "2.4G", "40M", "HT", "2T", "05", "30", - "FCC", "2.4G", "40M", "HT", "2T", "06", "32", - "ETSI", "2.4G", "40M", "HT", "2T", "06", "30", - "MKK", "2.4G", "40M", "HT", "2T", "06", "30", - "FCC", "2.4G", "40M", "HT", "2T", "07", "32", - "ETSI", "2.4G", "40M", "HT", "2T", "07", "30", - "MKK", "2.4G", "40M", "HT", "2T", "07", "30", - "FCC", "2.4G", "40M", "HT", "2T", "08", "32", - "ETSI", "2.4G", "40M", "HT", "2T", "08", "30", - "MKK", "2.4G", "40M", "HT", "2T", "08", "30", - "FCC", "2.4G", "40M", "HT", "2T", "09", "32", - "ETSI", "2.4G", "40M", "HT", "2T", "09", "30", - "MKK", "2.4G", "40M", "HT", "2T", "09", "30", - "FCC", "2.4G", "40M", "HT", "2T", "10", "32", - "ETSI", "2.4G", "40M", "HT", "2T", "10", "30", - "MKK", "2.4G", "40M", "HT", "2T", "10", "30", - "FCC", "2.4G", "40M", "HT", "2T", "11", "30", - "ETSI", "2.4G", "40M", "HT", "2T", "11", "30", - "MKK", "2.4G", "40M", "HT", "2T", "11", "30", - "FCC", "2.4G", "40M", "HT", "2T", "12", "63", - "ETSI", "2.4G", "40M", "HT", "2T", "12", "32", - "MKK", "2.4G", "40M", "HT", "2T", "12", "32", - "FCC", "2.4G", "40M", "HT", "2T", "13", "63", - "ETSI", "2.4G", "40M", "HT", "2T", "13", "32", - "MKK", "2.4G", "40M", "HT", "2T", "13", "32", - "FCC", "2.4G", "40M", "HT", "2T", "14", "63", - "ETSI", "2.4G", "40M", "HT", "2T", "14", "63", - "MKK", "2.4G", "40M", "HT", "2T", "14", "63", - "FCC", "5G", "20M", "OFDM", "1T", "36", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "36", "30", - "MKK", "5G", "20M", "OFDM", "1T", "36", "30", - "FCC", "5G", "20M", "OFDM", "1T", "40", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "40", "30", - "MKK", "5G", "20M", "OFDM", "1T", "40", "30", - "FCC", "5G", "20M", "OFDM", "1T", "44", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "44", "30", - "MKK", "5G", "20M", "OFDM", "1T", "44", "30", - "FCC", "5G", "20M", "OFDM", "1T", "48", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "48", "30", - "MKK", "5G", "20M", "OFDM", "1T", "48", "30", - "FCC", "5G", "20M", "OFDM", "1T", "52", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "52", "30", - "MKK", "5G", "20M", "OFDM", "1T", "52", "30", - "FCC", "5G", "20M", "OFDM", "1T", "56", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "56", "30", - "MKK", "5G", "20M", "OFDM", "1T", "56", "30", - "FCC", "5G", "20M", "OFDM", "1T", "60", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "60", "30", - "MKK", "5G", "20M", "OFDM", "1T", "60", "30", - "FCC", "5G", "20M", "OFDM", "1T", "64", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "64", "30", - "MKK", "5G", "20M", "OFDM", "1T", "64", "30", - "FCC", "5G", "20M", "OFDM", "1T", "100", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "100", "30", - "MKK", "5G", "20M", "OFDM", "1T", "100", "30", - "FCC", "5G", "20M", "OFDM", "1T", "114", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "114", "30", - "MKK", "5G", "20M", "OFDM", "1T", "114", "30", - "FCC", "5G", "20M", "OFDM", "1T", "108", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "108", "30", - "MKK", "5G", "20M", "OFDM", "1T", "108", "30", - "FCC", "5G", "20M", "OFDM", "1T", "112", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "112", "30", - "MKK", "5G", "20M", "OFDM", "1T", "112", "30", - "FCC", "5G", "20M", "OFDM", "1T", "116", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "116", "30", - "MKK", "5G", "20M", "OFDM", "1T", "116", "30", - "FCC", "5G", "20M", "OFDM", "1T", "120", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "120", "30", - "MKK", "5G", "20M", "OFDM", "1T", "120", "30", - "FCC", "5G", "20M", "OFDM", "1T", "124", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "124", "30", - "MKK", "5G", "20M", "OFDM", "1T", "124", "30", - "FCC", "5G", "20M", "OFDM", "1T", "128", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "128", "30", - "MKK", "5G", "20M", "OFDM", "1T", "128", "30", - "FCC", "5G", "20M", "OFDM", "1T", "132", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "132", "30", - "MKK", "5G", "20M", "OFDM", "1T", "132", "30", - "FCC", "5G", "20M", "OFDM", "1T", "136", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "136", "30", - "MKK", "5G", "20M", "OFDM", "1T", "136", "30", - "FCC", "5G", "20M", "OFDM", "1T", "140", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "140", "30", - "MKK", "5G", "20M", "OFDM", "1T", "140", "30", - "FCC", "5G", "20M", "OFDM", "1T", "149", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "149", "30", - "MKK", "5G", "20M", "OFDM", "1T", "149", "63", - "FCC", "5G", "20M", "OFDM", "1T", "153", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "153", "30", - "MKK", "5G", "20M", "OFDM", "1T", "153", "63", - "FCC", "5G", "20M", "OFDM", "1T", "157", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "157", "30", - "MKK", "5G", "20M", "OFDM", "1T", "157", "63", - "FCC", "5G", "20M", "OFDM", "1T", "161", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "161", "30", - "MKK", "5G", "20M", "OFDM", "1T", "161", "63", - "FCC", "5G", "20M", "OFDM", "1T", "165", "30", - "ETSI", "5G", "20M", "OFDM", "1T", "165", "30", - "MKK", "5G", "20M", "OFDM", "1T", "165", "63", - "FCC", "5G", "20M", "HT", "1T", "36", "30", - "ETSI", "5G", "20M", "HT", "1T", "36", "30", - "MKK", "5G", "20M", "HT", "1T", "36", "30", - "FCC", "5G", "20M", "HT", "1T", "40", "30", - "ETSI", "5G", "20M", "HT", "1T", "40", "30", - "MKK", "5G", "20M", "HT", "1T", "40", "30", - "FCC", "5G", "20M", "HT", "1T", "44", "30", - "ETSI", "5G", "20M", "HT", "1T", "44", "30", - "MKK", "5G", "20M", "HT", "1T", "44", "30", - "FCC", "5G", "20M", "HT", "1T", "48", "30", - "ETSI", "5G", "20M", "HT", "1T", "48", "30", - "MKK", "5G", "20M", "HT", "1T", "48", "30", - "FCC", "5G", "20M", "HT", "1T", "52", "30", - "ETSI", "5G", "20M", "HT", "1T", "52", "30", - "MKK", "5G", "20M", "HT", "1T", "52", "30", - "FCC", "5G", "20M", "HT", "1T", "56", "30", - "ETSI", "5G", "20M", "HT", "1T", "56", "30", - "MKK", "5G", "20M", "HT", "1T", "56", "30", - "FCC", "5G", "20M", "HT", "1T", "60", "30", - "ETSI", "5G", "20M", "HT", "1T", "60", "30", - "MKK", "5G", "20M", "HT", "1T", "60", "30", - "FCC", "5G", "20M", "HT", "1T", "64", "30", - "ETSI", "5G", "20M", "HT", "1T", "64", "30", - "MKK", "5G", "20M", "HT", "1T", "64", "30", - "FCC", "5G", "20M", "HT", "1T", "100", "30", - "ETSI", "5G", "20M", "HT", "1T", "100", "30", - "MKK", "5G", "20M", "HT", "1T", "100", "30", - "FCC", "5G", "20M", "HT", "1T", "114", "30", - "ETSI", "5G", "20M", "HT", "1T", "114", "30", - "MKK", "5G", "20M", "HT", "1T", "114", "30", - "FCC", "5G", "20M", "HT", "1T", "108", "30", - "ETSI", "5G", "20M", "HT", "1T", "108", "30", - "MKK", "5G", "20M", "HT", "1T", "108", "30", - "FCC", "5G", "20M", "HT", "1T", "112", "30", - "ETSI", "5G", "20M", "HT", "1T", "112", "30", - "MKK", "5G", "20M", "HT", "1T", "112", "30", - "FCC", "5G", "20M", "HT", "1T", "116", "30", - "ETSI", "5G", "20M", "HT", "1T", "116", "30", - "MKK", "5G", "20M", "HT", "1T", "116", "30", - "FCC", "5G", "20M", "HT", "1T", "120", "30", - "ETSI", "5G", "20M", "HT", "1T", "120", "30", - "MKK", "5G", "20M", "HT", "1T", "120", "30", - "FCC", "5G", "20M", "HT", "1T", "124", "30", - "ETSI", "5G", "20M", "HT", "1T", "124", "30", - "MKK", "5G", "20M", "HT", "1T", "124", "30", - "FCC", "5G", "20M", "HT", "1T", "128", "30", - "ETSI", "5G", "20M", "HT", "1T", "128", "30", - "MKK", "5G", "20M", "HT", "1T", "128", "30", - "FCC", "5G", "20M", "HT", "1T", "132", "30", - "ETSI", "5G", "20M", "HT", "1T", "132", "30", - "MKK", "5G", "20M", "HT", "1T", "132", "30", - "FCC", "5G", "20M", "HT", "1T", "136", "30", - "ETSI", "5G", "20M", "HT", "1T", "136", "30", - "MKK", "5G", "20M", "HT", "1T", "136", "30", - "FCC", "5G", "20M", "HT", "1T", "140", "30", - "ETSI", "5G", "20M", "HT", "1T", "140", "30", - "MKK", "5G", "20M", "HT", "1T", "140", "30", - "FCC", "5G", "20M", "HT", "1T", "149", "30", - "ETSI", "5G", "20M", "HT", "1T", "149", "30", - "MKK", "5G", "20M", "HT", "1T", "149", "63", - "FCC", "5G", "20M", "HT", "1T", "153", "30", - "ETSI", "5G", "20M", "HT", "1T", "153", "30", - "MKK", "5G", "20M", "HT", "1T", "153", "63", - "FCC", "5G", "20M", "HT", "1T", "157", "30", - "ETSI", "5G", "20M", "HT", "1T", "157", "30", - "MKK", "5G", "20M", "HT", "1T", "157", "63", - "FCC", "5G", "20M", "HT", "1T", "161", "30", - "ETSI", "5G", "20M", "HT", "1T", "161", "30", - "MKK", "5G", "20M", "HT", "1T", "161", "63", - "FCC", "5G", "20M", "HT", "1T", "165", "30", - "ETSI", "5G", "20M", "HT", "1T", "165", "30", - "MKK", "5G", "20M", "HT", "1T", "165", "63", - "FCC", "5G", "20M", "HT", "2T", "36", "28", - "ETSI", "5G", "20M", "HT", "2T", "36", "30", - "MKK", "5G", "20M", "HT", "2T", "36", "30", - "FCC", "5G", "20M", "HT", "2T", "40", "28", - "ETSI", "5G", "20M", "HT", "2T", "40", "30", - "MKK", "5G", "20M", "HT", "2T", "40", "30", - "FCC", "5G", "20M", "HT", "2T", "44", "28", - "ETSI", "5G", "20M", "HT", "2T", "44", "30", - "MKK", "5G", "20M", "HT", "2T", "44", "30", - "FCC", "5G", "20M", "HT", "2T", "48", "28", - "ETSI", "5G", "20M", "HT", "2T", "48", "30", - "MKK", "5G", "20M", "HT", "2T", "48", "30", - "FCC", "5G", "20M", "HT", "2T", "52", "34", - "ETSI", "5G", "20M", "HT", "2T", "52", "30", - "MKK", "5G", "20M", "HT", "2T", "52", "30", - "FCC", "5G", "20M", "HT", "2T", "56", "32", - "ETSI", "5G", "20M", "HT", "2T", "56", "30", - "MKK", "5G", "20M", "HT", "2T", "56", "30", - "FCC", "5G", "20M", "HT", "2T", "60", "30", - "ETSI", "5G", "20M", "HT", "2T", "60", "30", - "MKK", "5G", "20M", "HT", "2T", "60", "30", - "FCC", "5G", "20M", "HT", "2T", "64", "26", - "ETSI", "5G", "20M", "HT", "2T", "64", "30", - "MKK", "5G", "20M", "HT", "2T", "64", "30", - "FCC", "5G", "20M", "HT", "2T", "100", "28", - "ETSI", "5G", "20M", "HT", "2T", "100", "30", - "MKK", "5G", "20M", "HT", "2T", "100", "30", - "FCC", "5G", "20M", "HT", "2T", "114", "28", - "ETSI", "5G", "20M", "HT", "2T", "114", "30", - "MKK", "5G", "20M", "HT", "2T", "114", "30", - "FCC", "5G", "20M", "HT", "2T", "108", "30", - "ETSI", "5G", "20M", "HT", "2T", "108", "30", - "MKK", "5G", "20M", "HT", "2T", "108", "30", - "FCC", "5G", "20M", "HT", "2T", "112", "32", - "ETSI", "5G", "20M", "HT", "2T", "112", "30", - "MKK", "5G", "20M", "HT", "2T", "112", "30", - "FCC", "5G", "20M", "HT", "2T", "116", "32", - "ETSI", "5G", "20M", "HT", "2T", "116", "30", - "MKK", "5G", "20M", "HT", "2T", "116", "30", - "FCC", "5G", "20M", "HT", "2T", "120", "34", - "ETSI", "5G", "20M", "HT", "2T", "120", "30", - "MKK", "5G", "20M", "HT", "2T", "120", "30", - "FCC", "5G", "20M", "HT", "2T", "124", "32", - "ETSI", "5G", "20M", "HT", "2T", "124", "30", - "MKK", "5G", "20M", "HT", "2T", "124", "30", - "FCC", "5G", "20M", "HT", "2T", "128", "30", - "ETSI", "5G", "20M", "HT", "2T", "128", "30", - "MKK", "5G", "20M", "HT", "2T", "128", "30", - "FCC", "5G", "20M", "HT", "2T", "132", "28", - "ETSI", "5G", "20M", "HT", "2T", "132", "30", - "MKK", "5G", "20M", "HT", "2T", "132", "30", - "FCC", "5G", "20M", "HT", "2T", "136", "28", - "ETSI", "5G", "20M", "HT", "2T", "136", "30", - "MKK", "5G", "20M", "HT", "2T", "136", "30", - "FCC", "5G", "20M", "HT", "2T", "140", "26", - "ETSI", "5G", "20M", "HT", "2T", "140", "30", - "MKK", "5G", "20M", "HT", "2T", "140", "30", - "FCC", "5G", "20M", "HT", "2T", "149", "34", - "ETSI", "5G", "20M", "HT", "2T", "149", "30", - "MKK", "5G", "20M", "HT", "2T", "149", "63", - "FCC", "5G", "20M", "HT", "2T", "153", "34", - "ETSI", "5G", "20M", "HT", "2T", "153", "30", - "MKK", "5G", "20M", "HT", "2T", "153", "63", - "FCC", "5G", "20M", "HT", "2T", "157", "34", - "ETSI", "5G", "20M", "HT", "2T", "157", "30", - "MKK", "5G", "20M", "HT", "2T", "157", "63", - "FCC", "5G", "20M", "HT", "2T", "161", "34", - "ETSI", "5G", "20M", "HT", "2T", "161", "30", - "MKK", "5G", "20M", "HT", "2T", "161", "63", - "FCC", "5G", "20M", "HT", "2T", "165", "34", - "ETSI", "5G", "20M", "HT", "2T", "165", "30", - "MKK", "5G", "20M", "HT", "2T", "165", "63", - "FCC", "5G", "40M", "HT", "1T", "38", "26", - "ETSI", "5G", "40M", "HT", "1T", "38", "30", - "MKK", "5G", "40M", "HT", "1T", "38", "30", - "FCC", "5G", "40M", "HT", "1T", "46", "30", - "ETSI", "5G", "40M", "HT", "1T", "46", "30", - "MKK", "5G", "40M", "HT", "1T", "46", "30", - "FCC", "5G", "40M", "HT", "1T", "54", "30", - "ETSI", "5G", "40M", "HT", "1T", "54", "30", - "MKK", "5G", "40M", "HT", "1T", "54", "30", - "FCC", "5G", "40M", "HT", "1T", "62", "26", - "ETSI", "5G", "40M", "HT", "1T", "62", "30", - "MKK", "5G", "40M", "HT", "1T", "62", "30", - "FCC", "5G", "40M", "HT", "1T", "102", "24", - "ETSI", "5G", "40M", "HT", "1T", "102", "30", - "MKK", "5G", "40M", "HT", "1T", "102", "30", - "FCC", "5G", "40M", "HT", "1T", "110", "30", - "ETSI", "5G", "40M", "HT", "1T", "110", "30", - "MKK", "5G", "40M", "HT", "1T", "110", "30", - "FCC", "5G", "40M", "HT", "1T", "118", "30", - "ETSI", "5G", "40M", "HT", "1T", "118", "30", - "MKK", "5G", "40M", "HT", "1T", "118", "30", - "FCC", "5G", "40M", "HT", "1T", "126", "30", - "ETSI", "5G", "40M", "HT", "1T", "126", "30", - "MKK", "5G", "40M", "HT", "1T", "126", "30", - "FCC", "5G", "40M", "HT", "1T", "134", "30", - "ETSI", "5G", "40M", "HT", "1T", "134", "30", - "MKK", "5G", "40M", "HT", "1T", "134", "30", - "FCC", "5G", "40M", "HT", "1T", "151", "30", - "ETSI", "5G", "40M", "HT", "1T", "151", "30", - "MKK", "5G", "40M", "HT", "1T", "151", "63", - "FCC", "5G", "40M", "HT", "1T", "159", "30", - "ETSI", "5G", "40M", "HT", "1T", "159", "30", - "MKK", "5G", "40M", "HT", "1T", "159", "63", - "FCC", "5G", "40M", "HT", "2T", "38", "28", - "ETSI", "5G", "40M", "HT", "2T", "38", "30", - "MKK", "5G", "40M", "HT", "2T", "38", "30", - "FCC", "5G", "40M", "HT", "2T", "46", "28", - "ETSI", "5G", "40M", "HT", "2T", "46", "30", - "MKK", "5G", "40M", "HT", "2T", "46", "30", - "FCC", "5G", "40M", "HT", "2T", "54", "30", - "ETSI", "5G", "40M", "HT", "2T", "54", "30", - "MKK", "5G", "40M", "HT", "2T", "54", "30", - "FCC", "5G", "40M", "HT", "2T", "62", "30", - "ETSI", "5G", "40M", "HT", "2T", "62", "30", - "MKK", "5G", "40M", "HT", "2T", "62", "30", - "FCC", "5G", "40M", "HT", "2T", "102", "26", - "ETSI", "5G", "40M", "HT", "2T", "102", "30", - "MKK", "5G", "40M", "HT", "2T", "102", "30", - "FCC", "5G", "40M", "HT", "2T", "110", "30", - "ETSI", "5G", "40M", "HT", "2T", "110", "30", - "MKK", "5G", "40M", "HT", "2T", "110", "30", - "FCC", "5G", "40M", "HT", "2T", "118", "34", - "ETSI", "5G", "40M", "HT", "2T", "118", "30", - "MKK", "5G", "40M", "HT", "2T", "118", "30", - "FCC", "5G", "40M", "HT", "2T", "126", "32", - "ETSI", "5G", "40M", "HT", "2T", "126", "30", - "MKK", "5G", "40M", "HT", "2T", "126", "30", - "FCC", "5G", "40M", "HT", "2T", "134", "30", - "ETSI", "5G", "40M", "HT", "2T", "134", "30", - "MKK", "5G", "40M", "HT", "2T", "134", "30", - "FCC", "5G", "40M", "HT", "2T", "151", "34", - "ETSI", "5G", "40M", "HT", "2T", "151", "30", - "MKK", "5G", "40M", "HT", "2T", "151", "63", - "FCC", "5G", "40M", "HT", "2T", "159", "34", - "ETSI", "5G", "40M", "HT", "2T", "159", "30", - "MKK", "5G", "40M", "HT", "2T", "159", "63", - "FCC", "5G", "80M", "VHT", "1T", "42", "22", - "ETSI", "5G", "80M", "VHT", "1T", "42", "30", - "MKK", "5G", "80M", "VHT", "1T", "42", "30", - "FCC", "5G", "80M", "VHT", "1T", "58", "20", - "ETSI", "5G", "80M", "VHT", "1T", "58", "30", - "MKK", "5G", "80M", "VHT", "1T", "58", "30", - "FCC", "5G", "80M", "VHT", "1T", "106", "20", - "ETSI", "5G", "80M", "VHT", "1T", "106", "30", - "MKK", "5G", "80M", "VHT", "1T", "106", "30", - "FCC", "5G", "80M", "VHT", "1T", "122", "28", - "ETSI", "5G", "80M", "VHT", "1T", "122", "30", - "MKK", "5G", "80M", "VHT", "1T", "122", "30", - "FCC", "5G", "80M", "VHT", "1T", "155", "30", - "ETSI", "5G", "80M", "VHT", "1T", "155", "30", - "MKK", "5G", "80M", "VHT", "1T", "155", "63", - "FCC", "5G", "80M", "VHT", "2T", "42", "28", - "ETSI", "5G", "80M", "VHT", "2T", "42", "30", - "MKK", "5G", "80M", "VHT", "2T", "42", "30", - "FCC", "5G", "80M", "VHT", "2T", "58", "26", - "ETSI", "5G", "80M", "VHT", "2T", "58", "30", - "MKK", "5G", "80M", "VHT", "2T", "58", "30", - "FCC", "5G", "80M", "VHT", "2T", "106", "28", - "ETSI", "5G", "80M", "VHT", "2T", "106", "30", - "MKK", "5G", "80M", "VHT", "2T", "106", "30", - "FCC", "5G", "80M", "VHT", "2T", "122", "32", - "ETSI", "5G", "80M", "VHT", "2T", "122", "30", - "MKK", "5G", "80M", "VHT", "2T", "122", "30", - "FCC", "5G", "80M", "VHT", "2T", "155", "34", - "ETSI", "5G", "80M", "VHT", "2T", "155", "30", - "MKK", "5G", "80M", "VHT", "2T", "155", "63" -};*/ - -u32 RTL8812AE_RADIOA_ARRAY[] = { - 0x000, 0x00010000, - 0x018, 0x0001712A, - 0x056, 0x00051CF2, - 0x066, 0x00040000, - 0x01E, 0x00080000, - 0x089, 0x00000080, - 0xFF0F0740, 0xABCD, - 0x086, 0x00014B38, - 0xFF0F02C0, 0xCDEF, - 0x086, 0x00014B38, - 0xFF0F01C0, 0xCDEF, - 0x086, 0x00014B38, - 0xFF0F07D8, 0xCDEF, - 0x086, 0x00014B3A, - 0xFF0F07D0, 0xCDEF, - 0x086, 0x00014B3A, - 0xCDCDCDCD, 0xCDCD, - 0x086, 0x00014B38, - 0xFF0F0740, 0xDEAD, - 0x0B1, 0x0001FC1A, - 0x0B3, 0x000F0810, - 0x0B4, 0x0001A78D, - 0x0BA, 0x00086180, - 0x018, 0x00000006, - 0x0EF, 0x00002000, - 0xFF0F07D8, 0xABCD, - 0x03B, 0x0003F218, - 0x03B, 0x00030A58, - 0x03B, 0x0002FA58, - 0x03B, 0x00022590, - 0x03B, 0x0001FA50, - 0x03B, 0x00010248, - 0x03B, 0x00008240, - 0xFF0F07D0, 0xCDEF, - 0x03B, 0x0003F218, - 0x03B, 0x00030A58, - 0x03B, 0x0002FA58, - 0x03B, 0x00022590, - 0x03B, 0x0001FA50, - 0x03B, 0x00010248, - 0x03B, 0x00008240, - 0xCDCDCDCD, 0xCDCD, - 0x03B, 0x00038A58, - 0x03B, 0x00037A58, - 0x03B, 0x0002A590, - 0x03B, 0x00027A50, - 0x03B, 0x00018248, - 0x03B, 0x00010240, - 0x03B, 0x00008240, - 0xFF0F07D8, 0xDEAD, - 0x0EF, 0x00000100, - 0xFF0F07D8, 0xABCD, - 0x034, 0x0000A4EE, - 0x034, 0x00009076, - 0x034, 0x00008073, - 0x034, 0x00007070, - 0x034, 0x0000606D, - 0x034, 0x0000506A, - 0x034, 0x00004049, - 0x034, 0x00003046, - 0x034, 0x00002028, - 0x034, 0x00001025, - 0x034, 0x00000022, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0000ADF4, - 0x034, 0x00009DF1, - 0x034, 0x00008DEE, - 0x034, 0x00007DEB, - 0x034, 0x00006DE8, - 0x034, 0x00005CEC, - 0x034, 0x00004CE9, - 0x034, 0x000034EA, - 0x034, 0x000024E7, - 0x034, 0x0000146B, - 0x034, 0x0000006D, - 0xFF0F07D8, 0xDEAD, - 0x0EF, 0x00000000, - 0x0EF, 0x000020A2, - 0x0DF, 0x00000080, - 0x035, 0x00000192, - 0x035, 0x00008192, - 0x035, 0x00010192, - 0x036, 0x00000024, - 0x036, 0x00008024, - 0x036, 0x00010024, - 0x036, 0x00018024, - 0x0EF, 0x00000000, - 0x051, 0x00000C21, - 0x052, 0x000006D9, - 0x053, 0x000FC649, - 0x054, 0x0000017E, - 0x0EF, 0x00000002, - 0x008, 0x00008400, - 0x018, 0x0001712A, - 0x0EF, 0x00001000, - 0x03A, 0x00000080, - 0x03B, 0x0003A02C, - 0x03C, 0x00004000, - 0x03A, 0x00000400, - 0x03B, 0x0003202C, - 0x03C, 0x00010000, - 0x03A, 0x000000A0, - 0x03B, 0x0002B064, - 0x03C, 0x00004000, - 0x03A, 0x000000D8, - 0x03B, 0x00023070, - 0x03C, 0x00004000, - 0x03A, 0x00000468, - 0x03B, 0x0001B870, - 0x03C, 0x00010000, - 0x03A, 0x00000098, - 0x03B, 0x00012085, - 0x03C, 0x000E4000, - 0x03A, 0x00000418, - 0x03B, 0x0000A080, - 0x03C, 0x000F0000, - 0x03A, 0x00000418, - 0x03B, 0x00002080, - 0x03C, 0x00010000, - 0x03A, 0x00000080, - 0x03B, 0x0007A02C, - 0x03C, 0x00004000, - 0x03A, 0x00000400, - 0x03B, 0x0007202C, - 0x03C, 0x00010000, - 0x03A, 0x000000A0, - 0x03B, 0x0006B064, - 0x03C, 0x00004000, - 0x03A, 0x000000D8, - 0x03B, 0x00023070, - 0x03C, 0x00004000, - 0x03A, 0x00000468, - 0x03B, 0x0005B870, - 0x03C, 0x00010000, - 0x03A, 0x00000098, - 0x03B, 0x00052085, - 0x03C, 0x000E4000, - 0x03A, 0x00000418, - 0x03B, 0x0004A080, - 0x03C, 0x000F0000, - 0x03A, 0x00000418, - 0x03B, 0x00042080, - 0x03C, 0x00010000, - 0x03A, 0x00000080, - 0x03B, 0x000BA02C, - 0x03C, 0x00004000, - 0x03A, 0x00000400, - 0x03B, 0x000B202C, - 0x03C, 0x00010000, - 0x03A, 0x000000A0, - 0x03B, 0x000AB064, - 0x03C, 0x00004000, - 0x03A, 0x000000D8, - 0x03B, 0x000A3070, - 0x03C, 0x00004000, - 0x03A, 0x00000468, - 0x03B, 0x0009B870, - 0x03C, 0x00010000, - 0x03A, 0x00000098, - 0x03B, 0x00092085, - 0x03C, 0x000E4000, - 0x03A, 0x00000418, - 0x03B, 0x0008A080, - 0x03C, 0x000F0000, - 0x03A, 0x00000418, - 0x03B, 0x00082080, - 0x03C, 0x00010000, - 0x0EF, 0x00001100, - 0xFF0F0740, 0xABCD, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xFF0F01C0, 0xCDEF, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xFF0F07D8, 0xCDEF, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xFF0F07D0, 0xCDEF, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0004ADF5, - 0x034, 0x00049DF2, - 0x034, 0x00048DEF, - 0x034, 0x00047DEC, - 0x034, 0x00046DE9, - 0x034, 0x00045DC9, - 0x034, 0x00044CE8, - 0x034, 0x000438CA, - 0x034, 0x00042889, - 0x034, 0x0004184A, - 0x034, 0x0004044A, - 0xFF0F0740, 0xDEAD, - 0xFF0F0740, 0xABCD, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xFF0F01C0, 0xCDEF, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xFF0F07D8, 0xCDEF, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xFF0F07D0, 0xCDEF, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0002ADF5, - 0x034, 0x00029DF2, - 0x034, 0x00028DEF, - 0x034, 0x00027DEC, - 0x034, 0x00026DE9, - 0x034, 0x00025DC9, - 0x034, 0x00024CE8, - 0x034, 0x000238CA, - 0x034, 0x00022889, - 0x034, 0x0002184A, - 0x034, 0x0002044A, - 0xFF0F0740, 0xDEAD, - 0xFF0F0740, 0xABCD, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xFF0F01C0, 0xCDEF, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xFF0F07D8, 0xCDEF, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xFF0F07D0, 0xCDEF, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0000AFF7, - 0x034, 0x00009DF7, - 0x034, 0x00008DF4, - 0x034, 0x00007DF1, - 0x034, 0x00006DEE, - 0x034, 0x00005DCD, - 0x034, 0x00004CEB, - 0x034, 0x000038CC, - 0x034, 0x0000288B, - 0x034, 0x0000184C, - 0x034, 0x0000044C, - 0xFF0F0740, 0xDEAD, - 0x0EF, 0x00000000, - 0xFF0F0740, 0xABCD, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001D4, - 0x035, 0x000081D4, - 0x035, 0x000101D4, - 0x035, 0x000201B4, - 0x035, 0x000281B4, - 0x035, 0x000301B4, - 0x035, 0x000401B4, - 0x035, 0x000481B4, - 0x035, 0x000501B4, - 0xFF0F02C0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001D4, - 0x035, 0x000081D4, - 0x035, 0x000101D4, - 0x035, 0x000201B4, - 0x035, 0x000281B4, - 0x035, 0x000301B4, - 0x035, 0x000401B4, - 0x035, 0x000481B4, - 0x035, 0x000501B4, - 0xFF0F01C0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001D4, - 0x035, 0x000081D4, - 0x035, 0x000101D4, - 0x035, 0x000201B4, - 0x035, 0x000281B4, - 0x035, 0x000301B4, - 0x035, 0x000401B4, - 0x035, 0x000481B4, - 0x035, 0x000501B4, - 0xFF0F07D8, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001D4, - 0x035, 0x000081D4, - 0x035, 0x000101D4, - 0x035, 0x000201B4, - 0x035, 0x000281B4, - 0x035, 0x000301B4, - 0x035, 0x000401B4, - 0x035, 0x000481B4, - 0x035, 0x000501B4, - 0xFF0F07D0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001D4, - 0x035, 0x000081D4, - 0x035, 0x000101D4, - 0x035, 0x000201B4, - 0x035, 0x000281B4, - 0x035, 0x000301B4, - 0x035, 0x000401B4, - 0x035, 0x000481B4, - 0x035, 0x000501B4, - 0xCDCDCDCD, 0xCDCD, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x00000188, - 0x035, 0x00008147, - 0x035, 0x00010147, - 0x035, 0x000201D7, - 0x035, 0x000281D7, - 0x035, 0x000301D7, - 0x035, 0x000401D8, - 0x035, 0x000481D8, - 0x035, 0x000501D8, - 0xFF0F0740, 0xDEAD, - 0x0EF, 0x00000000, - 0xFF0F0740, 0xABCD, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00004BFB, - 0x036, 0x0000CBFB, - 0x036, 0x00014BFB, - 0x036, 0x0001CBFB, - 0x036, 0x00024F4B, - 0x036, 0x0002CF4B, - 0x036, 0x00034F4B, - 0x036, 0x0003CF4B, - 0x036, 0x00044F4B, - 0x036, 0x0004CF4B, - 0x036, 0x00054F4B, - 0x036, 0x0005CF4B, - 0xFF0F02C0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00004BFB, - 0x036, 0x0000CBFB, - 0x036, 0x00014BFB, - 0x036, 0x0001CBFB, - 0x036, 0x00024F4B, - 0x036, 0x0002CF4B, - 0x036, 0x00034F4B, - 0x036, 0x0003CF4B, - 0x036, 0x00044F4B, - 0x036, 0x0004CF4B, - 0x036, 0x00054F4B, - 0x036, 0x0005CF4B, - 0xFF0F01C0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00004BFB, - 0x036, 0x0000CBFB, - 0x036, 0x00014BFB, - 0x036, 0x0001CBFB, - 0x036, 0x00024F4B, - 0x036, 0x0002CF4B, - 0x036, 0x00034F4B, - 0x036, 0x0003CF4B, - 0x036, 0x00044F4B, - 0x036, 0x0004CF4B, - 0x036, 0x00054F4B, - 0x036, 0x0005CF4B, - 0xFF0F07D8, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00004BFB, - 0x036, 0x0000CBFB, - 0x036, 0x00014BFB, - 0x036, 0x0001CBFB, - 0x036, 0x00024F4B, - 0x036, 0x0002CF4B, - 0x036, 0x00034F4B, - 0x036, 0x0003CF4B, - 0x036, 0x00044F4B, - 0x036, 0x0004CF4B, - 0x036, 0x00054F4B, - 0x036, 0x0005CF4B, - 0xFF0F07D0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00004BFB, - 0x036, 0x0000CBFB, - 0x036, 0x00014BFB, - 0x036, 0x0001CBFB, - 0x036, 0x00024F4B, - 0x036, 0x0002CF4B, - 0x036, 0x00034F4B, - 0x036, 0x0003CF4B, - 0x036, 0x00044F4B, - 0x036, 0x0004CF4B, - 0x036, 0x00054F4B, - 0x036, 0x0005CF4B, - 0xCDCDCDCD, 0xCDCD, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00084EB4, - 0x036, 0x0008CC35, - 0x036, 0x00094C35, - 0x036, 0x0009CC35, - 0x036, 0x000A4935, - 0x036, 0x000ACC35, - 0x036, 0x000B4C35, - 0x036, 0x000BCC35, - 0x036, 0x000C4EB4, - 0x036, 0x000CCEB5, - 0x036, 0x000D4EB5, - 0x036, 0x000DCEB5, - 0xFF0F0740, 0xDEAD, - 0x0EF, 0x00000000, - 0x0EF, 0x00000008, - 0xFF0F0740, 0xABCD, - 0x03C, 0x000002CC, - 0x03C, 0x00000522, - 0x03C, 0x00000902, - 0xFF0F02C0, 0xCDEF, - 0x03C, 0x000002CC, - 0x03C, 0x00000522, - 0x03C, 0x00000902, - 0xFF0F01C0, 0xCDEF, - 0x03C, 0x000002CC, - 0x03C, 0x00000522, - 0x03C, 0x00000902, - 0xFF0F07D8, 0xCDEF, - 0x03C, 0x000002CC, - 0x03C, 0x00000522, - 0x03C, 0x00000902, - 0xFF0F07D0, 0xCDEF, - 0x03C, 0x000002CC, - 0x03C, 0x00000522, - 0x03C, 0x00000902, - 0xCDCDCDCD, 0xCDCD, - 0x03C, 0x000002A8, - 0x03C, 0x000005A2, - 0x03C, 0x00000880, - 0xFF0F0740, 0xDEAD, - 0x0EF, 0x00000000, - 0x018, 0x0001712A, - 0x0EF, 0x00000002, - 0x0DF, 0x00000080, - 0x01F, 0x00040064, - 0xFF0F0740, 0xABCD, - 0x061, 0x000FDD43, - 0x062, 0x00038F4B, - 0x063, 0x00032117, - 0x064, 0x000194AC, - 0x065, 0x000931D1, - 0xFF0F02C0, 0xCDEF, - 0x061, 0x000FDD43, - 0x062, 0x00038F4B, - 0x063, 0x00032117, - 0x064, 0x000194AC, - 0x065, 0x000931D1, - 0xFF0F01C0, 0xCDEF, - 0x061, 0x000FDD43, - 0x062, 0x00038F4B, - 0x063, 0x00032117, - 0x064, 0x000194AC, - 0x065, 0x000931D1, - 0xFF0F07D8, 0xCDEF, - 0x061, 0x000FDD43, - 0x062, 0x00038F4B, - 0x063, 0x00032117, - 0x064, 0x000194AC, - 0x065, 0x000931D1, - 0xFF0F07D0, 0xCDEF, - 0x061, 0x000FDD43, - 0x062, 0x00038F4B, - 0x063, 0x00032117, - 0x064, 0x000194AC, - 0x065, 0x000931D1, - 0xCDCDCDCD, 0xCDCD, - 0x061, 0x000E5D53, - 0x062, 0x00038FCD, - 0x063, 0x000314EB, - 0x064, 0x000196AC, - 0x065, 0x000911D7, - 0xFF0F0740, 0xDEAD, - 0x008, 0x00008400, - 0x01C, 0x000739D2, - 0x0B4, 0x0001E78D, - 0x018, 0x0001F12A, - 0x0FE, 0x00000000, - 0x0FE, 0x00000000, - 0x0FE, 0x00000000, - 0x0FE, 0x00000000, - 0x0B4, 0x0001A78D, - 0x018, 0x0001712A, -}; - -u32 RTL8812AE_RADIOB_ARRAY[] = { - 0x056, 0x00051CF2, - 0x066, 0x00040000, - 0x089, 0x00000080, - 0xFF0F0740, 0xABCD, - 0x086, 0x00014B38, - 0xFF0F01C0, 0xCDEF, - 0x086, 0x00014B38, - 0xFF0F02C0, 0xCDEF, - 0x086, 0x00014B38, - 0xFF0F07D8, 0xCDEF, - 0x086, 0x00014B3A, - 0xFF0F07D0, 0xCDEF, - 0x086, 0x00014B3A, - 0xCDCDCDCD, 0xCDCD, - 0x086, 0x00014B38, - 0xFF0F0740, 0xDEAD, - 0x018, 0x00000006, - 0x0EF, 0x00002000, - 0xFF0F07D8, 0xABCD, - 0x03B, 0x0003F218, - 0x03B, 0x00030A58, - 0x03B, 0x0002FA58, - 0x03B, 0x00022590, - 0x03B, 0x0001FA50, - 0x03B, 0x00010248, - 0x03B, 0x00008240, - 0xFF0F07D0, 0xCDEF, - 0x03B, 0x0003F218, - 0x03B, 0x00030A58, - 0x03B, 0x0002FA58, - 0x03B, 0x00022590, - 0x03B, 0x0001FA50, - 0x03B, 0x00010248, - 0x03B, 0x00008240, - 0xCDCDCDCD, 0xCDCD, - 0x03B, 0x00038A58, - 0x03B, 0x00037A58, - 0x03B, 0x0002A590, - 0x03B, 0x00027A50, - 0x03B, 0x00018248, - 0x03B, 0x00010240, - 0x03B, 0x00008240, - 0xFF0F07D8, 0xDEAD, - 0x0EF, 0x00000100, - 0xFF0F07D8, 0xABCD, - 0x034, 0x0000A4EE, - 0x034, 0x00009076, - 0x034, 0x00008073, - 0x034, 0x00007070, - 0x034, 0x0000606D, - 0x034, 0x0000506A, - 0x034, 0x00004049, - 0x034, 0x00003046, - 0x034, 0x00002028, - 0x034, 0x00001025, - 0x034, 0x00000022, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0000ADF4, - 0x034, 0x00009DF1, - 0x034, 0x00008DEE, - 0x034, 0x00007DEB, - 0x034, 0x00006DE8, - 0x034, 0x00005CEC, - 0x034, 0x00004CE9, - 0x034, 0x000034EA, - 0x034, 0x000024E7, - 0x034, 0x0000146B, - 0x034, 0x0000006D, - 0xFF0F07D8, 0xDEAD, - 0x0EF, 0x00000000, - 0x0EF, 0x000020A2, - 0x0DF, 0x00000080, - 0x035, 0x00000192, - 0x035, 0x00008192, - 0x035, 0x00010192, - 0x036, 0x00000024, - 0x036, 0x00008024, - 0x036, 0x00010024, - 0x036, 0x00018024, - 0x0EF, 0x00000000, - 0x051, 0x00000C21, - 0x052, 0x000006D9, - 0x053, 0x000FC649, - 0x054, 0x0000017E, - 0x0EF, 0x00000002, - 0x008, 0x00008400, - 0x018, 0x0001712A, - 0x0EF, 0x00001000, - 0x03A, 0x00000080, - 0x03B, 0x0003A02C, - 0x03C, 0x00004000, - 0x03A, 0x00000400, - 0x03B, 0x0003202C, - 0x03C, 0x00010000, - 0x03A, 0x000000A0, - 0x03B, 0x0002B064, - 0x03C, 0x00004000, - 0x03A, 0x000000D8, - 0x03B, 0x00023070, - 0x03C, 0x00004000, - 0x03A, 0x00000468, - 0x03B, 0x0001B870, - 0x03C, 0x00010000, - 0x03A, 0x00000098, - 0x03B, 0x00012085, - 0x03C, 0x000E4000, - 0x03A, 0x00000418, - 0x03B, 0x0000A080, - 0x03C, 0x000F0000, - 0x03A, 0x00000418, - 0x03B, 0x00002080, - 0x03C, 0x00010000, - 0x03A, 0x00000080, - 0x03B, 0x0007A02C, - 0x03C, 0x00004000, - 0x03A, 0x00000400, - 0x03B, 0x0007202C, - 0x03C, 0x00010000, - 0x03A, 0x000000A0, - 0x03B, 0x0006B064, - 0x03C, 0x00004000, - 0x03A, 0x000000D8, - 0x03B, 0x00063070, - 0x03C, 0x00004000, - 0x03A, 0x00000468, - 0x03B, 0x0005B870, - 0x03C, 0x00010000, - 0x03A, 0x00000098, - 0x03B, 0x00052085, - 0x03C, 0x000E4000, - 0x03A, 0x00000418, - 0x03B, 0x0004A080, - 0x03C, 0x000F0000, - 0x03A, 0x00000418, - 0x03B, 0x00042080, - 0x03C, 0x00010000, - 0x03A, 0x00000080, - 0x03B, 0x000BA02C, - 0x03C, 0x00004000, - 0x03A, 0x00000400, - 0x03B, 0x000B202C, - 0x03C, 0x00010000, - 0x03A, 0x000000A0, - 0x03B, 0x000AB064, - 0x03C, 0x00004000, - 0x03A, 0x000000D8, - 0x03B, 0x000A3070, - 0x03C, 0x00004000, - 0x03A, 0x00000468, - 0x03B, 0x0009B870, - 0x03C, 0x00010000, - 0x03A, 0x00000098, - 0x03B, 0x00092085, - 0x03C, 0x000E4000, - 0x03A, 0x00000418, - 0x03B, 0x0008A080, - 0x03C, 0x000F0000, - 0x03A, 0x00000418, - 0x03B, 0x00082080, - 0x03C, 0x00010000, - 0x0EF, 0x00001100, - 0xFF0F0740, 0xABCD, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xFF0F01C0, 0xCDEF, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xFF0F07D8, 0xCDEF, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xFF0F07D0, 0xCDEF, - 0x034, 0x0004A0B2, - 0x034, 0x000490AF, - 0x034, 0x00048070, - 0x034, 0x0004706D, - 0x034, 0x00046050, - 0x034, 0x0004504D, - 0x034, 0x0004404A, - 0x034, 0x00043047, - 0x034, 0x0004200A, - 0x034, 0x00041007, - 0x034, 0x00040004, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0004ADF5, - 0x034, 0x00049DF2, - 0x034, 0x00048DEF, - 0x034, 0x00047DEC, - 0x034, 0x00046DE9, - 0x034, 0x00045DC9, - 0x034, 0x00044CE8, - 0x034, 0x000438CA, - 0x034, 0x00042889, - 0x034, 0x0004184A, - 0x034, 0x0004044A, - 0xFF0F0740, 0xDEAD, - 0xFF0F0740, 0xABCD, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xFF0F01C0, 0xCDEF, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xFF0F07D8, 0xCDEF, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xFF0F07D0, 0xCDEF, - 0x034, 0x0002A0B2, - 0x034, 0x000290AF, - 0x034, 0x00028070, - 0x034, 0x0002706D, - 0x034, 0x00026050, - 0x034, 0x0002504D, - 0x034, 0x0002404A, - 0x034, 0x00023047, - 0x034, 0x0002200A, - 0x034, 0x00021007, - 0x034, 0x00020004, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0002ADF5, - 0x034, 0x00029DF2, - 0x034, 0x00028DEF, - 0x034, 0x00027DEC, - 0x034, 0x00026DE9, - 0x034, 0x00025DC9, - 0x034, 0x00024CE8, - 0x034, 0x000238CA, - 0x034, 0x00022889, - 0x034, 0x0002184A, - 0x034, 0x0002044A, - 0xFF0F0740, 0xDEAD, - 0xFF0F0740, 0xABCD, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xFF0F01C0, 0xCDEF, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xFF0F07D8, 0xCDEF, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xFF0F07D0, 0xCDEF, - 0x034, 0x0000A0B2, - 0x034, 0x000090AF, - 0x034, 0x00008070, - 0x034, 0x0000706D, - 0x034, 0x00006050, - 0x034, 0x0000504D, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x0000200A, - 0x034, 0x00001007, - 0x034, 0x00000004, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0000AFF7, - 0x034, 0x00009DF7, - 0x034, 0x00008DF4, - 0x034, 0x00007DF1, - 0x034, 0x00006DEE, - 0x034, 0x00005DCD, - 0x034, 0x00004CEB, - 0x034, 0x000038CC, - 0x034, 0x0000288B, - 0x034, 0x0000184C, - 0x034, 0x0000044C, - 0xFF0F0740, 0xDEAD, - 0x0EF, 0x00000000, - 0xFF0F0740, 0xABCD, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001C5, - 0x035, 0x000081C5, - 0x035, 0x000101C5, - 0x035, 0x00020174, - 0x035, 0x00028174, - 0x035, 0x00030174, - 0x035, 0x00040185, - 0x035, 0x00048185, - 0x035, 0x00050185, - 0x0EF, 0x00000000, - 0xFF0F01C0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001C5, - 0x035, 0x000081C5, - 0x035, 0x000101C5, - 0x035, 0x00020174, - 0x035, 0x00028174, - 0x035, 0x00030174, - 0x035, 0x00040185, - 0x035, 0x00048185, - 0x035, 0x00050185, - 0x0EF, 0x00000000, - 0xFF0F02C0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001C5, - 0x035, 0x000081C5, - 0x035, 0x000101C5, - 0x035, 0x00020174, - 0x035, 0x00028174, - 0x035, 0x00030174, - 0x035, 0x00040185, - 0x035, 0x00048185, - 0x035, 0x00050185, - 0x0EF, 0x00000000, - 0xFF0F07D8, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001C5, - 0x035, 0x000081C5, - 0x035, 0x000101C5, - 0x035, 0x00020174, - 0x035, 0x00028174, - 0x035, 0x00030174, - 0x035, 0x00040185, - 0x035, 0x00048185, - 0x035, 0x00050185, - 0x0EF, 0x00000000, - 0xFF0F07D0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x000001C5, - 0x035, 0x000081C5, - 0x035, 0x000101C5, - 0x035, 0x00020174, - 0x035, 0x00028174, - 0x035, 0x00030174, - 0x035, 0x00040185, - 0x035, 0x00048185, - 0x035, 0x00050185, - 0x0EF, 0x00000000, - 0xCDCDCDCD, 0xCDCD, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0x035, 0x00000186, - 0x035, 0x00008186, - 0x035, 0x00010185, - 0x035, 0x000201D5, - 0x035, 0x000281D5, - 0x035, 0x000301D5, - 0x035, 0x000401D5, - 0x035, 0x000481D5, - 0x035, 0x000501D5, - 0x0EF, 0x00000000, - 0xFF0F0740, 0xDEAD, - 0xFF0F0740, 0xABCD, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00005B8B, - 0x036, 0x0000DB8B, - 0x036, 0x00015B8B, - 0x036, 0x0001DB8B, - 0x036, 0x000262DB, - 0x036, 0x0002E2DB, - 0x036, 0x000362DB, - 0x036, 0x0003E2DB, - 0x036, 0x0004553B, - 0x036, 0x0004D53B, - 0x036, 0x0005553B, - 0x036, 0x0005D53B, - 0xFF0F01C0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00005B8B, - 0x036, 0x0000DB8B, - 0x036, 0x00015B8B, - 0x036, 0x0001DB8B, - 0x036, 0x000262DB, - 0x036, 0x0002E2DB, - 0x036, 0x000362DB, - 0x036, 0x0003E2DB, - 0x036, 0x0004553B, - 0x036, 0x0004D53B, - 0x036, 0x0005553B, - 0x036, 0x0005D53B, - 0xFF0F02C0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00005B8B, - 0x036, 0x0000DB8B, - 0x036, 0x00015B8B, - 0x036, 0x0001DB8B, - 0x036, 0x000262DB, - 0x036, 0x0002E2DB, - 0x036, 0x000362DB, - 0x036, 0x0003E2DB, - 0x036, 0x0004553B, - 0x036, 0x0004D53B, - 0x036, 0x0005553B, - 0x036, 0x0005D53B, - 0xFF0F07D8, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00005B8B, - 0x036, 0x0000DB8B, - 0x036, 0x00015B8B, - 0x036, 0x0001DB8B, - 0x036, 0x000262DB, - 0x036, 0x0002E2DB, - 0x036, 0x000362DB, - 0x036, 0x0003E2DB, - 0x036, 0x0004553B, - 0x036, 0x0004D53B, - 0x036, 0x0005553B, - 0x036, 0x0005D53B, - 0xFF0F07D0, 0xCDEF, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00005B8B, - 0x036, 0x0000DB8B, - 0x036, 0x00015B8B, - 0x036, 0x0001DB8B, - 0x036, 0x000262DB, - 0x036, 0x0002E2DB, - 0x036, 0x000362DB, - 0x036, 0x0003E2DB, - 0x036, 0x0004553B, - 0x036, 0x0004D53B, - 0x036, 0x0005553B, - 0x036, 0x0005D53B, - 0xCDCDCDCD, 0xCDCD, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0x036, 0x00084EB4, - 0x036, 0x0008C9B4, - 0x036, 0x000949B4, - 0x036, 0x0009C9B4, - 0x036, 0x000A4935, - 0x036, 0x000AC935, - 0x036, 0x000B4935, - 0x036, 0x000BC935, - 0x036, 0x000C4EB4, - 0x036, 0x000CCEB4, - 0x036, 0x000D4EB4, - 0x036, 0x000DCEB4, - 0xFF0F0740, 0xDEAD, - 0x0EF, 0x00000000, - 0x0EF, 0x00000008, - 0xFF0F0740, 0xABCD, - 0x03C, 0x000002DC, - 0x03C, 0x00000524, - 0x03C, 0x00000902, - 0xFF0F01C0, 0xCDEF, - 0x03C, 0x000002DC, - 0x03C, 0x00000524, - 0x03C, 0x00000902, - 0xFF0F02C0, 0xCDEF, - 0x03C, 0x000002DC, - 0x03C, 0x00000524, - 0x03C, 0x00000902, - 0xFF0F07D8, 0xCDEF, - 0x03C, 0x000002DC, - 0x03C, 0x00000524, - 0x03C, 0x00000902, - 0xFF0F07D0, 0xCDEF, - 0x03C, 0x000002DC, - 0x03C, 0x00000524, - 0x03C, 0x00000902, - 0xCDCDCDCD, 0xCDCD, - 0x03C, 0x000002AA, - 0x03C, 0x000005A2, - 0x03C, 0x00000880, - 0xFF0F0740, 0xDEAD, - 0x0EF, 0x00000000, - 0x018, 0x0001712A, - 0x0EF, 0x00000002, - 0x0DF, 0x00000080, - 0xFF0F0740, 0xABCD, - 0x061, 0x000EAC43, - 0x062, 0x00038F47, - 0x063, 0x00031157, - 0x064, 0x0001C4AC, - 0x065, 0x000931D1, - 0xFF0F01C0, 0xCDEF, - 0x061, 0x000EAC43, - 0x062, 0x00038F47, - 0x063, 0x00031157, - 0x064, 0x0001C4AC, - 0x065, 0x000931D1, - 0xFF0F02C0, 0xCDEF, - 0x061, 0x000EAC43, - 0x062, 0x00038F47, - 0x063, 0x00031157, - 0x064, 0x0001C4AC, - 0x065, 0x000931D1, - 0xFF0F07D8, 0xCDEF, - 0x061, 0x000EAC43, - 0x062, 0x00038F47, - 0x063, 0x00031157, - 0x064, 0x0001C4AC, - 0x065, 0x000931D1, - 0xFF0F07D0, 0xCDEF, - 0x061, 0x000EAC43, - 0x062, 0x00038F47, - 0x063, 0x00031157, - 0x064, 0x0001C4AC, - 0x065, 0x000931D1, - 0xCDCDCDCD, 0xCDCD, - 0x061, 0x000E5D53, - 0x062, 0x00038FCD, - 0x063, 0x000314EB, - 0x064, 0x000196AC, - 0x065, 0x000931D7, - 0xFF0F0740, 0xDEAD, - 0x008, 0x00008400, -}; - -u32 RTL8821AE_RADIOA_ARRAY[] = { - 0x018, 0x0001712A, - 0x056, 0x00051CF2, - 0x066, 0x00040000, - 0x000, 0x00010000, - 0x01E, 0x00080000, - 0x082, 0x00000830, - 0x083, 0x00021800, - 0x084, 0x00028000, - 0x085, 0x00048000, - 0x086, 0x00094838, - 0x087, 0x00044980, - 0x088, 0x00048000, - 0x089, 0x0000D480, - 0x08A, 0x00042240, - 0x08B, 0x000F0380, - 0x08C, 0x00090000, - 0x08D, 0x00022852, - 0x08E, 0x00065540, - 0x08F, 0x00088001, - 0x0EF, 0x00020000, - 0x03E, 0x00000380, - 0x03F, 0x00090018, - 0x03E, 0x00020380, - 0x03F, 0x000A0018, - 0x03E, 0x00040308, - 0x03F, 0x000A0018, - 0x03E, 0x00060018, - 0x03F, 0x000A0018, - 0x0EF, 0x00000000, - 0x018, 0x0001712A, - 0x089, 0x00000080, - 0x08B, 0x00080180, - 0x0EF, 0x00001000, - 0x03A, 0x00000244, - 0x03B, 0x00038027, - 0x03C, 0x00082000, - 0x03A, 0x00000244, - 0x03B, 0x00030113, - 0x03C, 0x00082000, - 0x03A, 0x0000014C, - 0x03B, 0x00028027, - 0x03C, 0x00082000, - 0x03A, 0x000000CC, - 0x03B, 0x00027027, - 0x03C, 0x00042000, - 0x03A, 0x0000014C, - 0x03B, 0x0001F913, - 0x03C, 0x00042000, - 0x03A, 0x0000010C, - 0x03B, 0x00017F10, - 0x03C, 0x00012000, - 0x03A, 0x000000D0, - 0x03B, 0x00008027, - 0x03C, 0x000CA000, - 0x03A, 0x00000244, - 0x03B, 0x00078027, - 0x03C, 0x00082000, - 0x03A, 0x00000244, - 0x03B, 0x00070113, - 0x03C, 0x00082000, - 0x03A, 0x0000014C, - 0x03B, 0x00068027, - 0x03C, 0x00082000, - 0x03A, 0x000000CC, - 0x03B, 0x00067027, - 0x03C, 0x00042000, - 0x03A, 0x0000014C, - 0x03B, 0x0005F913, - 0x03C, 0x00042000, - 0x03A, 0x0000010C, - 0x03B, 0x00057F10, - 0x03C, 0x00012000, - 0x03A, 0x000000D0, - 0x03B, 0x00048027, - 0x03C, 0x000CA000, - 0x03A, 0x00000244, - 0x03B, 0x000B8027, - 0x03C, 0x00082000, - 0x03A, 0x00000244, - 0x03B, 0x000B0113, - 0x03C, 0x00082000, - 0x03A, 0x0000014C, - 0x03B, 0x000A8027, - 0x03C, 0x00082000, - 0x03A, 0x000000CC, - 0x03B, 0x000A7027, - 0x03C, 0x00042000, - 0x03A, 0x0000014C, - 0x03B, 0x0009F913, - 0x03C, 0x00042000, - 0x03A, 0x0000010C, - 0x03B, 0x00097F10, - 0x03C, 0x00012000, - 0x03A, 0x000000D0, - 0x03B, 0x00088027, - 0x03C, 0x000CA000, - 0x0EF, 0x00000000, - 0x0EF, 0x00001100, - 0xFF0F0104, 0xABCD, - 0x034, 0x0004ADF3, - 0x034, 0x00049DF0, - 0xFF0F0204, 0xCDEF, - 0x034, 0x0004ADF3, - 0x034, 0x00049DF0, - 0xFF0F0404, 0xCDEF, - 0x034, 0x0004ADF3, - 0x034, 0x00049DF0, - 0xFF0F0200, 0xCDEF, - 0x034, 0x0004ADF5, - 0x034, 0x00049DF2, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0004A0F3, - 0x034, 0x000490B1, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0004ADF7, - 0x034, 0x00049DF3, - 0xFF0F0104, 0xDEAD, - 0xFF0F0104, 0xABCD, - 0x034, 0x00048DED, - 0x034, 0x00047DEA, - 0x034, 0x00046DE7, - 0x034, 0x00045CE9, - 0x034, 0x00044CE6, - 0x034, 0x000438C6, - 0x034, 0x00042886, - 0x034, 0x00041486, - 0x034, 0x00040447, - 0xFF0F0204, 0xCDEF, - 0x034, 0x00048DED, - 0x034, 0x00047DEA, - 0x034, 0x00046DE7, - 0x034, 0x00045CE9, - 0x034, 0x00044CE6, - 0x034, 0x000438C6, - 0x034, 0x00042886, - 0x034, 0x00041486, - 0x034, 0x00040447, - 0xFF0F0404, 0xCDEF, - 0x034, 0x00048DED, - 0x034, 0x00047DEA, - 0x034, 0x00046DE7, - 0x034, 0x00045CE9, - 0x034, 0x00044CE6, - 0x034, 0x000438C6, - 0x034, 0x00042886, - 0x034, 0x00041486, - 0x034, 0x00040447, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x000480AE, - 0x034, 0x000470AB, - 0x034, 0x0004608B, - 0x034, 0x00045069, - 0x034, 0x00044048, - 0x034, 0x00043045, - 0x034, 0x00042026, - 0x034, 0x00041023, - 0x034, 0x00040002, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x00048DEF, - 0x034, 0x00047DEC, - 0x034, 0x00046DE9, - 0x034, 0x00045CCB, - 0x034, 0x0004488D, - 0x034, 0x0004348D, - 0x034, 0x0004248A, - 0x034, 0x0004108D, - 0x034, 0x0004008A, - 0xFF0F0104, 0xDEAD, - 0xFF0F0200, 0xABCD, - 0x034, 0x0002ADF4, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0002A0F3, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0002ADF7, - 0xFF0F0200, 0xDEAD, - 0xFF0F0104, 0xABCD, - 0x034, 0x00029DF4, - 0xFF0F0204, 0xCDEF, - 0x034, 0x00029DF4, - 0xFF0F0404, 0xCDEF, - 0x034, 0x00029DF4, - 0xFF0F0200, 0xCDEF, - 0x034, 0x00029DF1, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x000290F0, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x00029DF2, - 0xFF0F0104, 0xDEAD, - 0xFF0F0104, 0xABCD, - 0x034, 0x00028DF1, - 0x034, 0x00027DEE, - 0x034, 0x00026DEB, - 0x034, 0x00025CEC, - 0x034, 0x00024CE9, - 0x034, 0x000238CA, - 0x034, 0x00022889, - 0x034, 0x00021489, - 0x034, 0x0002044A, - 0xFF0F0204, 0xCDEF, - 0x034, 0x00028DF1, - 0x034, 0x00027DEE, - 0x034, 0x00026DEB, - 0x034, 0x00025CEC, - 0x034, 0x00024CE9, - 0x034, 0x000238CA, - 0x034, 0x00022889, - 0x034, 0x00021489, - 0x034, 0x0002044A, - 0xFF0F0404, 0xCDEF, - 0x034, 0x00028DF1, - 0x034, 0x00027DEE, - 0x034, 0x00026DEB, - 0x034, 0x00025CEC, - 0x034, 0x00024CE9, - 0x034, 0x000238CA, - 0x034, 0x00022889, - 0x034, 0x00021489, - 0x034, 0x0002044A, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x000280AF, - 0x034, 0x000270AC, - 0x034, 0x0002608B, - 0x034, 0x00025069, - 0x034, 0x00024048, - 0x034, 0x00023045, - 0x034, 0x00022026, - 0x034, 0x00021023, - 0x034, 0x00020002, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x00028DEE, - 0x034, 0x00027DEB, - 0x034, 0x00026CCD, - 0x034, 0x00025CCA, - 0x034, 0x0002488C, - 0x034, 0x0002384C, - 0x034, 0x00022849, - 0x034, 0x00021449, - 0x034, 0x0002004D, - 0xFF0F0104, 0xDEAD, - 0xFF0F02C0, 0xABCD, - 0x034, 0x0000A0D7, - 0x034, 0x000090D3, - 0x034, 0x000080B1, - 0x034, 0x000070AE, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x0000ADF7, - 0x034, 0x00009DF4, - 0x034, 0x00008DF1, - 0x034, 0x00007DEE, - 0xFF0F02C0, 0xDEAD, - 0xFF0F0104, 0xABCD, - 0x034, 0x00006DEB, - 0x034, 0x00005CEC, - 0x034, 0x00004CE9, - 0x034, 0x000038CA, - 0x034, 0x00002889, - 0x034, 0x00001489, - 0x034, 0x0000044A, - 0xFF0F0204, 0xCDEF, - 0x034, 0x00006DEB, - 0x034, 0x00005CEC, - 0x034, 0x00004CE9, - 0x034, 0x000038CA, - 0x034, 0x00002889, - 0x034, 0x00001489, - 0x034, 0x0000044A, - 0xFF0F0404, 0xCDEF, - 0x034, 0x00006DEB, - 0x034, 0x00005CEC, - 0x034, 0x00004CE9, - 0x034, 0x000038CA, - 0x034, 0x00002889, - 0x034, 0x00001489, - 0x034, 0x0000044A, - 0xFF0F02C0, 0xCDEF, - 0x034, 0x0000608D, - 0x034, 0x0000506B, - 0x034, 0x0000404A, - 0x034, 0x00003047, - 0x034, 0x00002044, - 0x034, 0x00001025, - 0x034, 0x00000004, - 0xCDCDCDCD, 0xCDCD, - 0x034, 0x00006DCD, - 0x034, 0x00005CCD, - 0x034, 0x00004CCA, - 0x034, 0x0000388C, - 0x034, 0x00002888, - 0x034, 0x00001488, - 0x034, 0x00000486, - 0xFF0F0104, 0xDEAD, - 0x0EF, 0x00000000, - 0x018, 0x0001712A, - 0x0EF, 0x00000040, - 0xFF0F0104, 0xABCD, - 0x035, 0x00000187, - 0x035, 0x00008187, - 0x035, 0x00010187, - 0x035, 0x00020188, - 0x035, 0x00028188, - 0x035, 0x00030188, - 0x035, 0x00040188, - 0x035, 0x00048188, - 0x035, 0x00050188, - 0xFF0F0204, 0xCDEF, - 0x035, 0x00000187, - 0x035, 0x00008187, - 0x035, 0x00010187, - 0x035, 0x00020188, - 0x035, 0x00028188, - 0x035, 0x00030188, - 0x035, 0x00040188, - 0x035, 0x00048188, - 0x035, 0x00050188, - 0xFF0F0404, 0xCDEF, - 0x035, 0x00000187, - 0x035, 0x00008187, - 0x035, 0x00010187, - 0x035, 0x00020188, - 0x035, 0x00028188, - 0x035, 0x00030188, - 0x035, 0x00040188, - 0x035, 0x00048188, - 0x035, 0x00050188, - 0xCDCDCDCD, 0xCDCD, - 0x035, 0x00000145, - 0x035, 0x00008145, - 0x035, 0x00010145, - 0x035, 0x00020196, - 0x035, 0x00028196, - 0x035, 0x00030196, - 0x035, 0x000401C7, - 0x035, 0x000481C7, - 0x035, 0x000501C7, - 0xFF0F0104, 0xDEAD, - 0x0EF, 0x00000000, - 0x018, 0x0001712A, - 0x0EF, 0x00000010, - 0xFF0F0104, 0xABCD, - 0x036, 0x00085733, - 0x036, 0x0008D733, - 0x036, 0x00095733, - 0x036, 0x0009D733, - 0x036, 0x000A64B4, - 0x036, 0x000AE4B4, - 0x036, 0x000B64B4, - 0x036, 0x000BE4B4, - 0x036, 0x000C64B4, - 0x036, 0x000CE4B4, - 0x036, 0x000D64B4, - 0x036, 0x000DE4B4, - 0xFF0F0204, 0xCDEF, - 0x036, 0x00085733, - 0x036, 0x0008D733, - 0x036, 0x00095733, - 0x036, 0x0009D733, - 0x036, 0x000A64B4, - 0x036, 0x000AE4B4, - 0x036, 0x000B64B4, - 0x036, 0x000BE4B4, - 0x036, 0x000C64B4, - 0x036, 0x000CE4B4, - 0x036, 0x000D64B4, - 0x036, 0x000DE4B4, - 0xFF0F0404, 0xCDEF, - 0x036, 0x00085733, - 0x036, 0x0008D733, - 0x036, 0x00095733, - 0x036, 0x0009D733, - 0x036, 0x000A64B4, - 0x036, 0x000AE4B4, - 0x036, 0x000B64B4, - 0x036, 0x000BE4B4, - 0x036, 0x000C64B4, - 0x036, 0x000CE4B4, - 0x036, 0x000D64B4, - 0x036, 0x000DE4B4, - 0xCDCDCDCD, 0xCDCD, - 0x036, 0x000056B3, - 0x036, 0x0000D6B3, - 0x036, 0x000156B3, - 0x036, 0x0001D6B3, - 0x036, 0x00026634, - 0x036, 0x0002E634, - 0x036, 0x00036634, - 0x036, 0x0003E634, - 0x036, 0x000467B4, - 0x036, 0x0004E7B4, - 0x036, 0x000567B4, - 0x036, 0x0005E7B4, - 0xFF0F0104, 0xDEAD, - 0x0EF, 0x00000000, - 0x0EF, 0x00000008, - 0xFF0F0104, 0xABCD, - 0x03C, 0x000001C8, - 0x03C, 0x00000492, - 0xFF0F0204, 0xCDEF, - 0x03C, 0x000001C8, - 0x03C, 0x00000492, - 0xFF0F0404, 0xCDEF, - 0x03C, 0x000001C8, - 0x03C, 0x00000492, - 0xCDCDCDCD, 0xCDCD, - 0x03C, 0x0000022A, - 0x03C, 0x00000594, - 0xFF0F0104, 0xDEAD, - 0xFF0F0104, 0xABCD, - 0x03C, 0x00000800, - 0xFF0F0204, 0xCDEF, - 0x03C, 0x00000800, - 0xFF0F0404, 0xCDEF, - 0x03C, 0x00000800, - 0xFF0F02C0, 0xCDEF, - 0x03C, 0x00000820, - 0xCDCDCDCD, 0xCDCD, - 0x03C, 0x00000900, - 0xFF0F0104, 0xDEAD, - 0x0EF, 0x00000000, - 0x018, 0x0001712A, - 0x0EF, 0x00000002, - 0xFF0F0104, 0xABCD, - 0x008, 0x0004E400, - 0xFF0F0204, 0xCDEF, - 0x008, 0x0004E400, - 0xFF0F0404, 0xCDEF, - 0x008, 0x0004E400, - 0xCDCDCDCD, 0xCDCD, - 0x008, 0x00002000, - 0xFF0F0104, 0xDEAD, - 0x0EF, 0x00000000, - 0x0DF, 0x000000C0, - 0x01F, 0x00040064, - 0xFF0F0104, 0xABCD, - 0x058, 0x000A7284, - 0x059, 0x000600EC, - 0xFF0F0204, 0xCDEF, - 0x058, 0x000A7284, - 0x059, 0x000600EC, - 0xFF0F0404, 0xCDEF, - 0x058, 0x000A7284, - 0x059, 0x000600EC, - 0xCDCDCDCD, 0xCDCD, - 0x058, 0x00081184, - 0x059, 0x0006016C, - 0xFF0F0104, 0xDEAD, - 0xFF0F0104, 0xABCD, - 0x061, 0x000E8D73, - 0x062, 0x00093FC5, - 0xFF0F0204, 0xCDEF, - 0x061, 0x000E8D73, - 0x062, 0x00093FC5, - 0xFF0F0404, 0xCDEF, - 0x061, 0x000E8D73, - 0x062, 0x00093FC5, - 0xCDCDCDCD, 0xCDCD, - 0x061, 0x000EAD53, - 0x062, 0x00093BC4, - 0xFF0F0104, 0xDEAD, - 0xFF0F0104, 0xABCD, - 0x063, 0x000110E9, - 0xFF0F0204, 0xCDEF, - 0x063, 0x000110E9, - 0xFF0F0404, 0xCDEF, - 0x063, 0x000110E9, - 0xFF0F0200, 0xCDEF, - 0x063, 0x000710E9, - 0xFF0F02C0, 0xCDEF, - 0x063, 0x000110E9, - 0xCDCDCDCD, 0xCDCD, - 0x063, 0x000714E9, - 0xFF0F0104, 0xDEAD, - 0xFF0F0104, 0xABCD, - 0x064, 0x0001C27C, - 0xFF0F0204, 0xCDEF, - 0x064, 0x0001C27C, - 0xFF0F0404, 0xCDEF, - 0x064, 0x0001C27C, - 0xCDCDCDCD, 0xCDCD, - 0x064, 0x0001C67C, - 0xFF0F0104, 0xDEAD, - 0xFF0F0200, 0xABCD, - 0x065, 0x00093016, - 0xFF0F02C0, 0xCDEF, - 0x065, 0x00093015, - 0xCDCDCDCD, 0xCDCD, - 0x065, 0x00091016, - 0xFF0F0200, 0xDEAD, - 0x018, 0x00000006, - 0x0EF, 0x00002000, - 0x03B, 0x0003824B, - 0x03B, 0x0003024B, - 0x03B, 0x0002844B, - 0x03B, 0x00020F4B, - 0x03B, 0x00018F4B, - 0x03B, 0x000104B2, - 0x03B, 0x00008049, - 0x03B, 0x00000148, - 0x03B, 0x0007824B, - 0x03B, 0x0007024B, - 0x03B, 0x0006824B, - 0x03B, 0x00060F4B, - 0x03B, 0x00058F4B, - 0x03B, 0x000504B2, - 0x03B, 0x00048049, - 0x03B, 0x00040148, - 0x0EF, 0x00000000, - 0x0EF, 0x00000100, - 0x034, 0x0000ADF3, - 0x034, 0x00009DEF, - 0x034, 0x00008DEC, - 0x034, 0x00007DE9, - 0x034, 0x00006CED, - 0x034, 0x00005CE9, - 0x034, 0x000044E9, - 0x034, 0x000034E6, - 0x034, 0x0000246A, - 0x034, 0x00001467, - 0x034, 0x00000068, - 0x0EF, 0x00000000, - 0x0ED, 0x00000010, - 0x044, 0x0000ADF2, - 0x044, 0x00009DEF, - 0x044, 0x00008DEC, - 0x044, 0x00007DE9, - 0x044, 0x00006CEC, - 0x044, 0x00005CE9, - 0x044, 0x000044EC, - 0x044, 0x000034E9, - 0x044, 0x0000246C, - 0x044, 0x00001469, - 0x044, 0x0000006C, - 0x0ED, 0x00000000, - 0x0ED, 0x00000001, - 0x040, 0x00038DA7, - 0x040, 0x000300C2, - 0x040, 0x000288E2, - 0x040, 0x000200B8, - 0x040, 0x000188A5, - 0x040, 0x00010FBC, - 0x040, 0x00008F71, - 0x040, 0x00000240, - 0x0ED, 0x00000000, - 0x0EF, 0x000020A2, - 0x0DF, 0x00000080, - 0x035, 0x00000120, - 0x035, 0x00008120, - 0x035, 0x00010120, - 0x036, 0x00000085, - 0x036, 0x00008085, - 0x036, 0x00010085, - 0x036, 0x00018085, - 0x0EF, 0x00000000, - 0x051, 0x00000C31, - 0x052, 0x00000622, - 0x053, 0x000FC70B, - 0x054, 0x0000017E, - 0x056, 0x00051DF3, - 0x051, 0x00000C01, - 0x052, 0x000006D6, - 0x053, 0x000FC649, - 0x070, 0x00049661, - 0x071, 0x0007843E, - 0x072, 0x00000382, - 0x074, 0x00051400, - 0x035, 0x00000160, - 0x035, 0x00008160, - 0x035, 0x00010160, - 0x036, 0x00000124, - 0x036, 0x00008124, - 0x036, 0x00010124, - 0x036, 0x00018124, - 0x0ED, 0x0000000C, - 0x045, 0x00000140, - 0x045, 0x00008140, - 0x045, 0x00010140, - 0x046, 0x00000124, - 0x046, 0x00008124, - 0x046, 0x00010124, - 0x046, 0x00018124, - 0x0DF, 0x00000088, - 0x0B3, 0x000F0E18, - 0x0B4, 0x0001214C, - 0x0B7, 0x0003000C, - 0x01C, 0x000539D2, - 0x018, 0x0001F12A, - 0x0FE, 0x00000000, - 0x0FE, 0x00000000, - 0x018, 0x0001712A, -}; - -u32 RTL8812AE_MAC_REG_ARRAY[] = { - 0x010, 0x0000000C, - 0xFF0F0180, 0xABCD, - 0x025, 0x0000000F, - 0xFF0F01C0, 0xCDEF, - 0x025, 0x0000000F, - 0xCDCDCDCD, 0xCDCD, - 0x025, 0x0000006F, - 0xFF0F0180, 0xDEAD, - 0x072, 0x00000000, - 0x428, 0x0000000A, - 0x429, 0x00000010, - 0x430, 0x00000000, - 0x431, 0x00000000, - 0x432, 0x00000000, - 0x433, 0x00000001, - 0x434, 0x00000004, - 0x435, 0x00000005, - 0x436, 0x00000007, - 0x437, 0x00000008, - 0x43C, 0x00000004, - 0x43D, 0x00000005, - 0x43E, 0x00000007, - 0x43F, 0x00000008, - 0x440, 0x0000005D, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000010, - 0x445, 0x00000000, - 0x446, 0x00000000, - 0x447, 0x00000000, - 0x448, 0x00000000, - 0x449, 0x000000F0, - 0x44A, 0x0000000F, - 0x44B, 0x0000003E, - 0x44C, 0x00000010, - 0x44D, 0x00000000, - 0x44E, 0x00000000, - 0x44F, 0x00000000, - 0x450, 0x00000000, - 0x451, 0x000000F0, - 0x452, 0x0000000F, - 0x453, 0x00000000, - 0x45B, 0x00000080, - 0x460, 0x00000066, - 0x461, 0x00000066, - 0x4C8, 0x000000FF, - 0x4C9, 0x00000008, - 0x4CC, 0x000000FF, - 0x4CD, 0x000000FF, - 0x4CE, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000A2, - 0x502, 0x0000002F, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000A3, - 0x506, 0x0000005E, - 0x507, 0x00000000, - 0x508, 0x0000002B, - 0x509, 0x000000A4, - 0x50A, 0x0000005E, - 0x50B, 0x00000000, - 0x50C, 0x0000004F, - 0x50D, 0x000000A4, - 0x50E, 0x00000000, - 0x50F, 0x00000000, - 0x512, 0x0000001C, - 0x514, 0x0000000A, - 0x516, 0x0000000A, - 0x525, 0x0000004F, - 0x550, 0x00000010, - 0x551, 0x00000010, - 0x559, 0x00000002, - 0x55C, 0x00000050, - 0x55D, 0x000000FF, - 0x604, 0x00000001, - 0x605, 0x00000030, - 0x607, 0x00000003, - 0x608, 0x0000000E, - 0x609, 0x0000002A, - 0x620, 0x000000FF, - 0x621, 0x000000FF, - 0x622, 0x000000FF, - 0x623, 0x000000FF, - 0x624, 0x000000FF, - 0x625, 0x000000FF, - 0x626, 0x000000FF, - 0x627, 0x000000FF, - 0x638, 0x00000050, - 0x63C, 0x0000000A, - 0x63D, 0x0000000A, - 0x63E, 0x0000000E, - 0x63F, 0x0000000E, - 0x640, 0x00000080, - 0x642, 0x00000040, - 0x643, 0x00000000, - 0x652, 0x000000C8, - 0x66E, 0x00000005, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70A, 0x00000065, - 0x70B, 0x00000087, - 0x718, 0x00000040, -}; - -u32 RTL8821AE_MAC_REG_ARRAY[] = { - 0x428, 0x0000000A, - 0x429, 0x00000010, - 0x430, 0x00000000, - 0x431, 0x00000000, - 0x432, 0x00000000, - 0x433, 0x00000001, - 0x434, 0x00000004, - 0x435, 0x00000005, - 0x436, 0x00000007, - 0x437, 0x00000008, - 0x43C, 0x00000004, - 0x43D, 0x00000005, - 0x43E, 0x00000007, - 0x43F, 0x00000008, - 0x440, 0x0000005D, - 0x441, 0x00000001, - 0x442, 0x00000000, - 0x444, 0x00000010, - 0x445, 0x00000000, - 0x446, 0x00000000, - 0x447, 0x00000000, - 0x448, 0x00000000, - 0x449, 0x000000F0, - 0x44A, 0x0000000F, - 0x44B, 0x0000003E, - 0x44C, 0x00000010, - 0x44D, 0x00000000, - 0x44E, 0x00000000, - 0x44F, 0x00000000, - 0x450, 0x00000000, - 0x451, 0x000000F0, - 0x452, 0x0000000F, - 0x453, 0x00000000, - 0x456, 0x0000005E, - 0x460, 0x00000066, - 0x461, 0x00000066, - 0x4C8, 0x0000003F, - 0x4C9, 0x000000FF, - 0x4CC, 0x000000FF, - 0x4CD, 0x000000FF, - 0x4CE, 0x00000001, - 0x500, 0x00000026, - 0x501, 0x000000A2, - 0x502, 0x0000002F, - 0x503, 0x00000000, - 0x504, 0x00000028, - 0x505, 0x000000A3, - 0x506, 0x0000005E, - 0x507, 0x00000000, - 0x508, 0x0000002B, - 0x509, 0x000000A4, - 0x50A, 0x0000005E, - 0x50B, 0x00000000, - 0x50C, 0x0000004F, - 0x50D, 0x000000A4, - 0x50E, 0x00000000, - 0x50F, 0x00000000, - 0x512, 0x0000001C, - 0x514, 0x0000000A, - 0x516, 0x0000000A, - 0x525, 0x0000004F, - 0x550, 0x00000010, - 0x551, 0x00000010, - 0x559, 0x00000002, - 0x55C, 0x00000050, - 0x55D, 0x000000FF, - 0x605, 0x00000030, - 0x607, 0x00000007, - 0x608, 0x0000000E, - 0x609, 0x0000002A, - 0x620, 0x000000FF, - 0x621, 0x000000FF, - 0x622, 0x000000FF, - 0x623, 0x000000FF, - 0x624, 0x000000FF, - 0x625, 0x000000FF, - 0x626, 0x000000FF, - 0x627, 0x000000FF, - 0x638, 0x00000050, - 0x63C, 0x0000000A, - 0x63D, 0x0000000A, - 0x63E, 0x0000000E, - 0x63F, 0x0000000E, - 0x640, 0x00000040, - 0x642, 0x00000040, - 0x643, 0x00000000, - 0x652, 0x000000C8, - 0x66E, 0x00000005, - 0x700, 0x00000021, - 0x701, 0x00000043, - 0x702, 0x00000065, - 0x703, 0x00000087, - 0x708, 0x00000021, - 0x709, 0x00000043, - 0x70A, 0x00000065, - 0x70B, 0x00000087, - 0x718, 0x00000040, -}; - -u32 RTL8812AE_AGC_TAB_ARRAY[] = { - 0xFF0F07D8, 0xABCD, - 0x81C, 0xFC000001, - 0x81C, 0xFB020001, - 0x81C, 0xFA040001, - 0x81C, 0xF9060001, - 0x81C, 0xF8080001, - 0x81C, 0xF70A0001, - 0x81C, 0xF60C0001, - 0x81C, 0xF50E0001, - 0x81C, 0xF4100001, - 0x81C, 0xF3120001, - 0x81C, 0xF2140001, - 0x81C, 0xF1160001, - 0x81C, 0xF0180001, - 0x81C, 0xEF1A0001, - 0x81C, 0xEE1C0001, - 0x81C, 0xED1E0001, - 0x81C, 0xEC200001, - 0x81C, 0xEB220001, - 0x81C, 0xEA240001, - 0x81C, 0xCD260001, - 0x81C, 0xCC280001, - 0x81C, 0xCB2A0001, - 0x81C, 0xCA2C0001, - 0x81C, 0xC92E0001, - 0x81C, 0xC8300001, - 0x81C, 0xA6320001, - 0x81C, 0xA5340001, - 0x81C, 0xA4360001, - 0x81C, 0xA3380001, - 0x81C, 0xA23A0001, - 0x81C, 0x883C0001, - 0x81C, 0x873E0001, - 0x81C, 0x86400001, - 0x81C, 0x85420001, - 0x81C, 0x84440001, - 0x81C, 0x83460001, - 0x81C, 0x82480001, - 0x81C, 0x814A0001, - 0x81C, 0x484C0001, - 0x81C, 0x474E0001, - 0x81C, 0x46500001, - 0x81C, 0x45520001, - 0x81C, 0x44540001, - 0x81C, 0x43560001, - 0x81C, 0x42580001, - 0x81C, 0x415A0001, - 0x81C, 0x255C0001, - 0x81C, 0x245E0001, - 0x81C, 0x23600001, - 0x81C, 0x22620001, - 0x81C, 0x21640001, - 0x81C, 0x21660001, - 0x81C, 0x21680001, - 0x81C, 0x216A0001, - 0x81C, 0x216C0001, - 0x81C, 0x216E0001, - 0x81C, 0x21700001, - 0x81C, 0x21720001, - 0x81C, 0x21740001, - 0x81C, 0x21760001, - 0x81C, 0x21780001, - 0x81C, 0x217A0001, - 0x81C, 0x217C0001, - 0x81C, 0x217E0001, - 0xFF0F07D0, 0xCDEF, - 0x81C, 0xF9000001, - 0x81C, 0xF8020001, - 0x81C, 0xF7040001, - 0x81C, 0xF6060001, - 0x81C, 0xF5080001, - 0x81C, 0xF40A0001, - 0x81C, 0xF30C0001, - 0x81C, 0xF20E0001, - 0x81C, 0xF1100001, - 0x81C, 0xF0120001, - 0x81C, 0xEF140001, - 0x81C, 0xEE160001, - 0x81C, 0xED180001, - 0x81C, 0xEC1A0001, - 0x81C, 0xEB1C0001, - 0x81C, 0xEA1E0001, - 0x81C, 0xCD200001, - 0x81C, 0xCC220001, - 0x81C, 0xCB240001, - 0x81C, 0xCA260001, - 0x81C, 0xC9280001, - 0x81C, 0xC82A0001, - 0x81C, 0xC72C0001, - 0x81C, 0xC62E0001, - 0x81C, 0xA5300001, - 0x81C, 0xA4320001, - 0x81C, 0xA3340001, - 0x81C, 0xA2360001, - 0x81C, 0x88380001, - 0x81C, 0x873A0001, - 0x81C, 0x863C0001, - 0x81C, 0x853E0001, - 0x81C, 0x84400001, - 0x81C, 0x83420001, - 0x81C, 0x82440001, - 0x81C, 0x81460001, - 0x81C, 0x48480001, - 0x81C, 0x474A0001, - 0x81C, 0x464C0001, - 0x81C, 0x454E0001, - 0x81C, 0x44500001, - 0x81C, 0x43520001, - 0x81C, 0x42540001, - 0x81C, 0x41560001, - 0x81C, 0x25580001, - 0x81C, 0x245A0001, - 0x81C, 0x235C0001, - 0x81C, 0x225E0001, - 0x81C, 0x21600001, - 0x81C, 0x21620001, - 0x81C, 0x21640001, - 0x81C, 0x21660001, - 0x81C, 0x21680001, - 0x81C, 0x216A0001, - 0x81C, 0x236C0001, - 0x81C, 0x226E0001, - 0x81C, 0x21700001, - 0x81C, 0x21720001, - 0x81C, 0x21740001, - 0x81C, 0x21760001, - 0x81C, 0x21780001, - 0x81C, 0x217A0001, - 0x81C, 0x217C0001, - 0x81C, 0x217E0001, - 0xCDCDCDCD, 0xCDCD, - 0x81C, 0xFF000001, - 0x81C, 0xFF020001, - 0x81C, 0xFF040001, - 0x81C, 0xFF060001, - 0x81C, 0xFF080001, - 0x81C, 0xFE0A0001, - 0x81C, 0xFD0C0001, - 0x81C, 0xFC0E0001, - 0x81C, 0xFB100001, - 0x81C, 0xFA120001, - 0x81C, 0xF9140001, - 0x81C, 0xF8160001, - 0x81C, 0xF7180001, - 0x81C, 0xF61A0001, - 0x81C, 0xF51C0001, - 0x81C, 0xF41E0001, - 0x81C, 0xF3200001, - 0x81C, 0xF2220001, - 0x81C, 0xF1240001, - 0x81C, 0xF0260001, - 0x81C, 0xEF280001, - 0x81C, 0xEE2A0001, - 0x81C, 0xED2C0001, - 0x81C, 0xEC2E0001, - 0x81C, 0xEB300001, - 0x81C, 0xEA320001, - 0x81C, 0xE9340001, - 0x81C, 0xE8360001, - 0x81C, 0xE7380001, - 0x81C, 0xE63A0001, - 0x81C, 0xE53C0001, - 0x81C, 0xC73E0001, - 0x81C, 0xC6400001, - 0x81C, 0xC5420001, - 0x81C, 0xC4440001, - 0x81C, 0xC3460001, - 0x81C, 0xC2480001, - 0x81C, 0xC14A0001, - 0x81C, 0xA74C0001, - 0x81C, 0xA64E0001, - 0x81C, 0xA5500001, - 0x81C, 0xA4520001, - 0x81C, 0xA3540001, - 0x81C, 0xA2560001, - 0x81C, 0xA1580001, - 0x81C, 0x675A0001, - 0x81C, 0x665C0001, - 0x81C, 0x655E0001, - 0x81C, 0x64600001, - 0x81C, 0x63620001, - 0x81C, 0x48640001, - 0x81C, 0x47660001, - 0x81C, 0x46680001, - 0x81C, 0x456A0001, - 0x81C, 0x446C0001, - 0x81C, 0x436E0001, - 0x81C, 0x42700001, - 0x81C, 0x41720001, - 0x81C, 0x41740001, - 0x81C, 0x41760001, - 0x81C, 0x41780001, - 0x81C, 0x417A0001, - 0x81C, 0x417C0001, - 0x81C, 0x417E0001, - 0xFF0F07D8, 0xDEAD, - 0xFF0F0180, 0xABCD, - 0x81C, 0xFC800001, - 0x81C, 0xFB820001, - 0x81C, 0xFA840001, - 0x81C, 0xF9860001, - 0x81C, 0xF8880001, - 0x81C, 0xF78A0001, - 0x81C, 0xF68C0001, - 0x81C, 0xF58E0001, - 0x81C, 0xF4900001, - 0x81C, 0xF3920001, - 0x81C, 0xF2940001, - 0x81C, 0xF1960001, - 0x81C, 0xF0980001, - 0x81C, 0xEF9A0001, - 0x81C, 0xEE9C0001, - 0x81C, 0xED9E0001, - 0x81C, 0xECA00001, - 0x81C, 0xEBA20001, - 0x81C, 0xEAA40001, - 0x81C, 0xE9A60001, - 0x81C, 0xE8A80001, - 0x81C, 0xE7AA0001, - 0x81C, 0xE6AC0001, - 0x81C, 0xE5AE0001, - 0x81C, 0xE4B00001, - 0x81C, 0xE3B20001, - 0x81C, 0xA8B40001, - 0x81C, 0xA7B60001, - 0x81C, 0xA6B80001, - 0x81C, 0xA5BA0001, - 0x81C, 0xA4BC0001, - 0x81C, 0xA3BE0001, - 0x81C, 0xA2C00001, - 0x81C, 0xA1C20001, - 0x81C, 0x68C40001, - 0x81C, 0x67C60001, - 0x81C, 0x66C80001, - 0x81C, 0x65CA0001, - 0x81C, 0x64CC0001, - 0x81C, 0x47CE0001, - 0x81C, 0x46D00001, - 0x81C, 0x45D20001, - 0x81C, 0x44D40001, - 0x81C, 0x43D60001, - 0x81C, 0x42D80001, - 0x81C, 0x08DA0001, - 0x81C, 0x07DC0001, - 0x81C, 0x06DE0001, - 0x81C, 0x05E00001, - 0x81C, 0x04E20001, - 0x81C, 0x03E40001, - 0x81C, 0x02E60001, - 0x81C, 0x01E80001, - 0x81C, 0x01EA0001, - 0x81C, 0x01EC0001, - 0x81C, 0x01EE0001, - 0x81C, 0x01F00001, - 0x81C, 0x01F20001, - 0x81C, 0x01F40001, - 0x81C, 0x01F60001, - 0x81C, 0x01F80001, - 0x81C, 0x01FA0001, - 0x81C, 0x01FC0001, - 0x81C, 0x01FE0001, - 0xFF0F0280, 0xCDEF, - 0x81C, 0xFC800001, - 0x81C, 0xFB820001, - 0x81C, 0xFA840001, - 0x81C, 0xF9860001, - 0x81C, 0xF8880001, - 0x81C, 0xF78A0001, - 0x81C, 0xF68C0001, - 0x81C, 0xF58E0001, - 0x81C, 0xF4900001, - 0x81C, 0xF3920001, - 0x81C, 0xF2940001, - 0x81C, 0xF1960001, - 0x81C, 0xF0980001, - 0x81C, 0xEF9A0001, - 0x81C, 0xEE9C0001, - 0x81C, 0xED9E0001, - 0x81C, 0xECA00001, - 0x81C, 0xEBA20001, - 0x81C, 0xEAA40001, - 0x81C, 0xE9A60001, - 0x81C, 0xE8A80001, - 0x81C, 0xE7AA0001, - 0x81C, 0xE6AC0001, - 0x81C, 0xE5AE0001, - 0x81C, 0xE4B00001, - 0x81C, 0xE3B20001, - 0x81C, 0xA8B40001, - 0x81C, 0xA7B60001, - 0x81C, 0xA6B80001, - 0x81C, 0xA5BA0001, - 0x81C, 0xA4BC0001, - 0x81C, 0xA3BE0001, - 0x81C, 0xA2C00001, - 0x81C, 0xA1C20001, - 0x81C, 0x68C40001, - 0x81C, 0x67C60001, - 0x81C, 0x66C80001, - 0x81C, 0x65CA0001, - 0x81C, 0x64CC0001, - 0x81C, 0x47CE0001, - 0x81C, 0x46D00001, - 0x81C, 0x45D20001, - 0x81C, 0x44D40001, - 0x81C, 0x43D60001, - 0x81C, 0x42D80001, - 0x81C, 0x08DA0001, - 0x81C, 0x07DC0001, - 0x81C, 0x06DE0001, - 0x81C, 0x05E00001, - 0x81C, 0x04E20001, - 0x81C, 0x03E40001, - 0x81C, 0x02E60001, - 0x81C, 0x01E80001, - 0x81C, 0x01EA0001, - 0x81C, 0x01EC0001, - 0x81C, 0x01EE0001, - 0x81C, 0x01F00001, - 0x81C, 0x01F20001, - 0x81C, 0x01F40001, - 0x81C, 0x01F60001, - 0x81C, 0x01F80001, - 0x81C, 0x01FA0001, - 0x81C, 0x01FC0001, - 0x81C, 0x01FE0001, - 0xFF0F01C0, 0xCDEF, - 0x81C, 0xFC800001, - 0x81C, 0xFB820001, - 0x81C, 0xFA840001, - 0x81C, 0xF9860001, - 0x81C, 0xF8880001, - 0x81C, 0xF78A0001, - 0x81C, 0xF68C0001, - 0x81C, 0xF58E0001, - 0x81C, 0xF4900001, - 0x81C, 0xF3920001, - 0x81C, 0xF2940001, - 0x81C, 0xF1960001, - 0x81C, 0xF0980001, - 0x81C, 0xEF9A0001, - 0x81C, 0xEE9C0001, - 0x81C, 0xED9E0001, - 0x81C, 0xECA00001, - 0x81C, 0xEBA20001, - 0x81C, 0xEAA40001, - 0x81C, 0xE9A60001, - 0x81C, 0xE8A80001, - 0x81C, 0xE7AA0001, - 0x81C, 0xE6AC0001, - 0x81C, 0xE5AE0001, - 0x81C, 0xE4B00001, - 0x81C, 0xE3B20001, - 0x81C, 0xA8B40001, - 0x81C, 0xA7B60001, - 0x81C, 0xA6B80001, - 0x81C, 0xA5BA0001, - 0x81C, 0xA4BC0001, - 0x81C, 0xA3BE0001, - 0x81C, 0xA2C00001, - 0x81C, 0xA1C20001, - 0x81C, 0x68C40001, - 0x81C, 0x67C60001, - 0x81C, 0x66C80001, - 0x81C, 0x65CA0001, - 0x81C, 0x64CC0001, - 0x81C, 0x47CE0001, - 0x81C, 0x46D00001, - 0x81C, 0x45D20001, - 0x81C, 0x44D40001, - 0x81C, 0x43D60001, - 0x81C, 0x42D80001, - 0x81C, 0x08DA0001, - 0x81C, 0x07DC0001, - 0x81C, 0x06DE0001, - 0x81C, 0x05E00001, - 0x81C, 0x04E20001, - 0x81C, 0x03E40001, - 0x81C, 0x02E60001, - 0x81C, 0x01E80001, - 0x81C, 0x01EA0001, - 0x81C, 0x01EC0001, - 0x81C, 0x01EE0001, - 0x81C, 0x01F00001, - 0x81C, 0x01F20001, - 0x81C, 0x01F40001, - 0x81C, 0x01F60001, - 0x81C, 0x01F80001, - 0x81C, 0x01FA0001, - 0x81C, 0x01FC0001, - 0x81C, 0x01FE0001, - 0xFF0F02C0, 0xCDEF, - 0x81C, 0xFC800001, - 0x81C, 0xFB820001, - 0x81C, 0xFA840001, - 0x81C, 0xF9860001, - 0x81C, 0xF8880001, - 0x81C, 0xF78A0001, - 0x81C, 0xF68C0001, - 0x81C, 0xF58E0001, - 0x81C, 0xF4900001, - 0x81C, 0xF3920001, - 0x81C, 0xF2940001, - 0x81C, 0xF1960001, - 0x81C, 0xF0980001, - 0x81C, 0xEF9A0001, - 0x81C, 0xEE9C0001, - 0x81C, 0xED9E0001, - 0x81C, 0xECA00001, - 0x81C, 0xEBA20001, - 0x81C, 0xEAA40001, - 0x81C, 0xE9A60001, - 0x81C, 0xE8A80001, - 0x81C, 0xE7AA0001, - 0x81C, 0xE6AC0001, - 0x81C, 0xE5AE0001, - 0x81C, 0xE4B00001, - 0x81C, 0xE3B20001, - 0x81C, 0xA8B40001, - 0x81C, 0xA7B60001, - 0x81C, 0xA6B80001, - 0x81C, 0xA5BA0001, - 0x81C, 0xA4BC0001, - 0x81C, 0xA3BE0001, - 0x81C, 0xA2C00001, - 0x81C, 0xA1C20001, - 0x81C, 0x68C40001, - 0x81C, 0x67C60001, - 0x81C, 0x66C80001, - 0x81C, 0x65CA0001, - 0x81C, 0x64CC0001, - 0x81C, 0x47CE0001, - 0x81C, 0x46D00001, - 0x81C, 0x45D20001, - 0x81C, 0x44D40001, - 0x81C, 0x43D60001, - 0x81C, 0x42D80001, - 0x81C, 0x08DA0001, - 0x81C, 0x07DC0001, - 0x81C, 0x06DE0001, - 0x81C, 0x05E00001, - 0x81C, 0x04E20001, - 0x81C, 0x03E40001, - 0x81C, 0x02E60001, - 0x81C, 0x01E80001, - 0x81C, 0x01EA0001, - 0x81C, 0x01EC0001, - 0x81C, 0x01EE0001, - 0x81C, 0x01F00001, - 0x81C, 0x01F20001, - 0x81C, 0x01F40001, - 0x81C, 0x01F60001, - 0x81C, 0x01F80001, - 0x81C, 0x01FA0001, - 0x81C, 0x01FC0001, - 0x81C, 0x01FE0001, - 0xFF0F07D8, 0xCDEF, - 0x81C, 0xFC800001, - 0x81C, 0xFB820001, - 0x81C, 0xFA840001, - 0x81C, 0xF9860001, - 0x81C, 0xF8880001, - 0x81C, 0xF78A0001, - 0x81C, 0xF68C0001, - 0x81C, 0xF58E0001, - 0x81C, 0xF4900001, - 0x81C, 0xF3920001, - 0x81C, 0xF2940001, - 0x81C, 0xF1960001, - 0x81C, 0xF0980001, - 0x81C, 0xEF9A0001, - 0x81C, 0xEE9C0001, - 0x81C, 0xED9E0001, - 0x81C, 0xECA00001, - 0x81C, 0xEBA20001, - 0x81C, 0xEAA40001, - 0x81C, 0xE9A60001, - 0x81C, 0xE8A80001, - 0x81C, 0xE7AA0001, - 0x81C, 0xE6AC0001, - 0x81C, 0xE5AE0001, - 0x81C, 0xE4B00001, - 0x81C, 0xE3B20001, - 0x81C, 0xA8B40001, - 0x81C, 0xA7B60001, - 0x81C, 0xA6B80001, - 0x81C, 0xA5BA0001, - 0x81C, 0xA4BC0001, - 0x81C, 0xA3BE0001, - 0x81C, 0xA2C00001, - 0x81C, 0xA1C20001, - 0x81C, 0x68C40001, - 0x81C, 0x67C60001, - 0x81C, 0x66C80001, - 0x81C, 0x65CA0001, - 0x81C, 0x64CC0001, - 0x81C, 0x47CE0001, - 0x81C, 0x46D00001, - 0x81C, 0x45D20001, - 0x81C, 0x44D40001, - 0x81C, 0x43D60001, - 0x81C, 0x42D80001, - 0x81C, 0x08DA0001, - 0x81C, 0x07DC0001, - 0x81C, 0x06DE0001, - 0x81C, 0x05E00001, - 0x81C, 0x04E20001, - 0x81C, 0x03E40001, - 0x81C, 0x02E60001, - 0x81C, 0x01E80001, - 0x81C, 0x01EA0001, - 0x81C, 0x01EC0001, - 0x81C, 0x01EE0001, - 0x81C, 0x01F00001, - 0x81C, 0x01F20001, - 0x81C, 0x01F40001, - 0x81C, 0x01F60001, - 0x81C, 0x01F80001, - 0x81C, 0x01FA0001, - 0x81C, 0x01FC0001, - 0x81C, 0x01FE0001, - 0xFF0F07D0, 0xCDEF, - 0x81C, 0xFC800001, - 0x81C, 0xFB820001, - 0x81C, 0xFA840001, - 0x81C, 0xF9860001, - 0x81C, 0xF8880001, - 0x81C, 0xF78A0001, - 0x81C, 0xF68C0001, - 0x81C, 0xF58E0001, - 0x81C, 0xF4900001, - 0x81C, 0xF3920001, - 0x81C, 0xF2940001, - 0x81C, 0xF1960001, - 0x81C, 0xF0980001, - 0x81C, 0xEF9A0001, - 0x81C, 0xEE9C0001, - 0x81C, 0xED9E0001, - 0x81C, 0xECA00001, - 0x81C, 0xEBA20001, - 0x81C, 0xEAA40001, - 0x81C, 0xE9A60001, - 0x81C, 0xE8A80001, - 0x81C, 0xE7AA0001, - 0x81C, 0xE6AC0001, - 0x81C, 0xE5AE0001, - 0x81C, 0xE4B00001, - 0x81C, 0xE3B20001, - 0x81C, 0xA8B40001, - 0x81C, 0xA7B60001, - 0x81C, 0xA6B80001, - 0x81C, 0xA5BA0001, - 0x81C, 0xA4BC0001, - 0x81C, 0xA3BE0001, - 0x81C, 0xA2C00001, - 0x81C, 0xA1C20001, - 0x81C, 0x68C40001, - 0x81C, 0x67C60001, - 0x81C, 0x66C80001, - 0x81C, 0x65CA0001, - 0x81C, 0x64CC0001, - 0x81C, 0x47CE0001, - 0x81C, 0x46D00001, - 0x81C, 0x45D20001, - 0x81C, 0x44D40001, - 0x81C, 0x43D60001, - 0x81C, 0x42D80001, - 0x81C, 0x08DA0001, - 0x81C, 0x07DC0001, - 0x81C, 0x06DE0001, - 0x81C, 0x05E00001, - 0x81C, 0x04E20001, - 0x81C, 0x03E40001, - 0x81C, 0x02E60001, - 0x81C, 0x01E80001, - 0x81C, 0x01EA0001, - 0x81C, 0x01EC0001, - 0x81C, 0x01EE0001, - 0x81C, 0x01F00001, - 0x81C, 0x01F20001, - 0x81C, 0x01F40001, - 0x81C, 0x01F60001, - 0x81C, 0x01F80001, - 0x81C, 0x01FA0001, - 0x81C, 0x01FC0001, - 0x81C, 0x01FE0001, - 0xCDCDCDCD, 0xCDCD, - 0x81C, 0xFF800001, - 0x81C, 0xFF820001, - 0x81C, 0xFF840001, - 0x81C, 0xFE860001, - 0x81C, 0xFD880001, - 0x81C, 0xFC8A0001, - 0x81C, 0xFB8C0001, - 0x81C, 0xFA8E0001, - 0x81C, 0xF9900001, - 0x81C, 0xF8920001, - 0x81C, 0xF7940001, - 0x81C, 0xF6960001, - 0x81C, 0xF5980001, - 0x81C, 0xF49A0001, - 0x81C, 0xF39C0001, - 0x81C, 0xF29E0001, - 0x81C, 0xF1A00001, - 0x81C, 0xF0A20001, - 0x81C, 0xEFA40001, - 0x81C, 0xEEA60001, - 0x81C, 0xEDA80001, - 0x81C, 0xECAA0001, - 0x81C, 0xEBAC0001, - 0x81C, 0xEAAE0001, - 0x81C, 0xE9B00001, - 0x81C, 0xE8B20001, - 0x81C, 0xE7B40001, - 0x81C, 0xE6B60001, - 0x81C, 0xE5B80001, - 0x81C, 0xE4BA0001, - 0x81C, 0xE3BC0001, - 0x81C, 0xA8BE0001, - 0x81C, 0xA7C00001, - 0x81C, 0xA6C20001, - 0x81C, 0xA5C40001, - 0x81C, 0xA4C60001, - 0x81C, 0xA3C80001, - 0x81C, 0xA2CA0001, - 0x81C, 0xA1CC0001, - 0x81C, 0x68CE0001, - 0x81C, 0x67D00001, - 0x81C, 0x66D20001, - 0x81C, 0x65D40001, - 0x81C, 0x64D60001, - 0x81C, 0x47D80001, - 0x81C, 0x46DA0001, - 0x81C, 0x45DC0001, - 0x81C, 0x44DE0001, - 0x81C, 0x43E00001, - 0x81C, 0x42E20001, - 0x81C, 0x08E40001, - 0x81C, 0x07E60001, - 0x81C, 0x06E80001, - 0x81C, 0x05EA0001, - 0x81C, 0x04EC0001, - 0x81C, 0x03EE0001, - 0x81C, 0x02F00001, - 0x81C, 0x01F20001, - 0x81C, 0x01F40001, - 0x81C, 0x01F60001, - 0x81C, 0x01F80001, - 0x81C, 0x01FA0001, - 0x81C, 0x01FC0001, - 0x81C, 0x01FE0001, - 0xFF0F0180, 0xDEAD, - 0xC50, 0x00000022, - 0xC50, 0x00000020, - 0xE50, 0x00000022, - 0xE50, 0x00000020, -}; - -u32 RTL8821AE_AGC_TAB_ARRAY[] = { - 0x81C, 0xBF000001, - 0x81C, 0xBF020001, - 0x81C, 0xBF040001, - 0x81C, 0xBF060001, - 0x81C, 0xBE080001, - 0x81C, 0xBD0A0001, - 0x81C, 0xBC0C0001, - 0x81C, 0xBA0E0001, - 0x81C, 0xB9100001, - 0x81C, 0xB8120001, - 0x81C, 0xB7140001, - 0x81C, 0xB6160001, - 0x81C, 0xB5180001, - 0x81C, 0xB41A0001, - 0x81C, 0xB31C0001, - 0x81C, 0xB21E0001, - 0x81C, 0xB1200001, - 0x81C, 0xB0220001, - 0x81C, 0xAF240001, - 0x81C, 0xAE260001, - 0x81C, 0xAD280001, - 0x81C, 0xAC2A0001, - 0x81C, 0xAB2C0001, - 0x81C, 0xAA2E0001, - 0x81C, 0xA9300001, - 0x81C, 0xA8320001, - 0x81C, 0xA7340001, - 0x81C, 0xA6360001, - 0x81C, 0xA5380001, - 0x81C, 0xA43A0001, - 0x81C, 0xA33C0001, - 0x81C, 0x673E0001, - 0x81C, 0x66400001, - 0x81C, 0x65420001, - 0x81C, 0x64440001, - 0x81C, 0x63460001, - 0x81C, 0x62480001, - 0x81C, 0x614A0001, - 0x81C, 0x474C0001, - 0x81C, 0x464E0001, - 0x81C, 0x45500001, - 0x81C, 0x44520001, - 0x81C, 0x43540001, - 0x81C, 0x42560001, - 0x81C, 0x41580001, - 0x81C, 0x285A0001, - 0x81C, 0x275C0001, - 0x81C, 0x265E0001, - 0x81C, 0x25600001, - 0x81C, 0x24620001, - 0x81C, 0x0A640001, - 0x81C, 0x09660001, - 0x81C, 0x08680001, - 0x81C, 0x076A0001, - 0x81C, 0x066C0001, - 0x81C, 0x056E0001, - 0x81C, 0x04700001, - 0x81C, 0x03720001, - 0x81C, 0x02740001, - 0x81C, 0x01760001, - 0x81C, 0x01780001, - 0x81C, 0x017A0001, - 0x81C, 0x017C0001, - 0x81C, 0x017E0001, - 0xFF0F02C0, 0xABCD, - 0x81C, 0xFB000101, - 0x81C, 0xFA020101, - 0x81C, 0xF9040101, - 0x81C, 0xF8060101, - 0x81C, 0xF7080101, - 0x81C, 0xF60A0101, - 0x81C, 0xF50C0101, - 0x81C, 0xF40E0101, - 0x81C, 0xF3100101, - 0x81C, 0xF2120101, - 0x81C, 0xF1140101, - 0x81C, 0xF0160101, - 0x81C, 0xEF180101, - 0x81C, 0xEE1A0101, - 0x81C, 0xED1C0101, - 0x81C, 0xEC1E0101, - 0x81C, 0xEB200101, - 0x81C, 0xEA220101, - 0x81C, 0xE9240101, - 0x81C, 0xE8260101, - 0x81C, 0xE7280101, - 0x81C, 0xE62A0101, - 0x81C, 0xE52C0101, - 0x81C, 0xE42E0101, - 0x81C, 0xE3300101, - 0x81C, 0xA5320101, - 0x81C, 0xA4340101, - 0x81C, 0xA3360101, - 0x81C, 0x87380101, - 0x81C, 0x863A0101, - 0x81C, 0x853C0101, - 0x81C, 0x843E0101, - 0x81C, 0x69400101, - 0x81C, 0x68420101, - 0x81C, 0x67440101, - 0x81C, 0x66460101, - 0x81C, 0x49480101, - 0x81C, 0x484A0101, - 0x81C, 0x474C0101, - 0x81C, 0x2A4E0101, - 0x81C, 0x29500101, - 0x81C, 0x28520101, - 0x81C, 0x27540101, - 0x81C, 0x26560101, - 0x81C, 0x25580101, - 0x81C, 0x245A0101, - 0x81C, 0x235C0101, - 0x81C, 0x055E0101, - 0x81C, 0x04600101, - 0x81C, 0x03620101, - 0x81C, 0x02640101, - 0x81C, 0x01660101, - 0x81C, 0x01680101, - 0x81C, 0x016A0101, - 0x81C, 0x016C0101, - 0x81C, 0x016E0101, - 0x81C, 0x01700101, - 0x81C, 0x01720101, - 0xCDCDCDCD, 0xCDCD, - 0x81C, 0xFF000101, - 0x81C, 0xFF020101, - 0x81C, 0xFE040101, - 0x81C, 0xFD060101, - 0x81C, 0xFC080101, - 0x81C, 0xFD0A0101, - 0x81C, 0xFC0C0101, - 0x81C, 0xFB0E0101, - 0x81C, 0xFA100101, - 0x81C, 0xF9120101, - 0x81C, 0xF8140101, - 0x81C, 0xF7160101, - 0x81C, 0xF6180101, - 0x81C, 0xF51A0101, - 0x81C, 0xF41C0101, - 0x81C, 0xF31E0101, - 0x81C, 0xF2200101, - 0x81C, 0xF1220101, - 0x81C, 0xF0240101, - 0x81C, 0xEF260101, - 0x81C, 0xEE280101, - 0x81C, 0xED2A0101, - 0x81C, 0xEC2C0101, - 0x81C, 0xEB2E0101, - 0x81C, 0xEA300101, - 0x81C, 0xE9320101, - 0x81C, 0xE8340101, - 0x81C, 0xE7360101, - 0x81C, 0xE6380101, - 0x81C, 0xE53A0101, - 0x81C, 0xE43C0101, - 0x81C, 0xE33E0101, - 0x81C, 0xA5400101, - 0x81C, 0xA4420101, - 0x81C, 0xA3440101, - 0x81C, 0x87460101, - 0x81C, 0x86480101, - 0x81C, 0x854A0101, - 0x81C, 0x844C0101, - 0x81C, 0x694E0101, - 0x81C, 0x68500101, - 0x81C, 0x67520101, - 0x81C, 0x66540101, - 0x81C, 0x49560101, - 0x81C, 0x48580101, - 0x81C, 0x475A0101, - 0x81C, 0x2A5C0101, - 0x81C, 0x295E0101, - 0x81C, 0x28600101, - 0x81C, 0x27620101, - 0x81C, 0x26640101, - 0x81C, 0x25660101, - 0x81C, 0x24680101, - 0x81C, 0x236A0101, - 0x81C, 0x056C0101, - 0x81C, 0x046E0101, - 0x81C, 0x03700101, - 0x81C, 0x02720101, - 0xFF0F02C0, 0xDEAD, - 0x81C, 0x01740101, - 0x81C, 0x01760101, - 0x81C, 0x01780101, - 0x81C, 0x017A0101, - 0x81C, 0x017C0101, - 0x81C, 0x017E0101, - 0xC50, 0x00000022, - 0xC50, 0x00000020, - -}; diff --git a/drivers/staging/rtl8821ae/rtl8821ae/table.h b/drivers/staging/rtl8821ae/rtl8821ae/table.h deleted file mode 100644 index b9d7b26..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/table.h +++ /dev/null @@ -1,62 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Created on 2010/ 5/18, 1:41 - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_TABLE__H_ -#define __RTL8821AE_TABLE__H_ - -#include <linux/types.h> -#define RTL8821AEPHY_REG_1TARRAYLEN 344 -extern u32 RTL8821AE_PHY_REG_ARRAY[]; -#define RTL8812AEPHY_REG_1TARRAYLEN 490 -extern u32 RTL8812AE_PHY_REG_ARRAY[]; -#define RTL8821AEPHY_REG_ARRAY_PGLEN 90 -extern u32 RTL8821AE_PHY_REG_ARRAY_PG[]; -#define RTL8812AEPHY_REG_ARRAY_PGLEN 276 -extern u32 RTL8812AE_PHY_REG_ARRAY_PG[]; -//#define RTL8723BE_RADIOA_1TARRAYLEN 206 -//extern u8 *RTL8821AE_TXPWR_LMT_ARRAY[]; -#define RTL8812AE_RADIOA_1TARRAYLEN 1264 -extern u32 RTL8812AE_RADIOA_ARRAY[]; -#define RTL8812AE_RADIOB_1TARRAYLEN 1240 -extern u32 RTL8812AE_RADIOB_ARRAY[]; -#define RTL8821AE_RADIOA_1TARRAYLEN 1176 -extern u32 RTL8821AE_RADIOA_ARRAY[]; -#define RTL8821AEMAC_1T_ARRAYLEN 194 -extern u32 RTL8821AE_MAC_REG_ARRAY[]; -#define RTL8812AEMAC_1T_ARRAYLEN 214 -extern u32 RTL8812AE_MAC_REG_ARRAY[]; -#define RTL8821AEAGCTAB_1TARRAYLEN 382 -extern u32 RTL8821AE_AGC_TAB_ARRAY[]; -#define RTL8812AEAGCTAB_1TARRAYLEN 1312 -extern u32 RTL8812AE_AGC_TAB_ARRAY[]; - - -#endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/trx.c b/drivers/staging/rtl8821ae/rtl8821ae/trx.c deleted file mode 100644 index 75ae438..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/trx.c +++ /dev/null @@ -1,1050 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#include "../wifi.h" -#include "../pci.h" -#include "../base.h" -#include "../stats.h" -#include "reg.h" -#include "def.h" -#include "phy.h" -#include "trx.h" -#include "led.h" -#include "dm.h" -#include "phy.h" -u8 _rtl8821ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) -{ - u16 fc = rtl_get_fc(skb); - - if (unlikely(ieee80211_is_beacon(fc))) - return QSLT_BEACON; - if (ieee80211_is_mgmt(fc) || ieee80211_is_ctl(fc)) - return QSLT_MGNT; - - return skb->priority; -} - -/* mac80211's rate_idx is like this: - * - * 2.4G band:rx_status->band == IEEE80211_BAND_2GHZ - * - * B/G rate: - * (rx_status->flag & RX_FLAG_HT) = 0, - * DESC_RATE1M-->DESC_RATE54M ==> idx is 0-->11, - * - * N rate: - * (rx_status->flag & RX_FLAG_HT) = 1, - * DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15 - * - * 5G band:rx_status->band == IEEE80211_BAND_5GHZ - * A rate: - * (rx_status->flag & RX_FLAG_HT) = 0, - * DESC_RATE6M-->DESC_RATE54M ==> idx is 0-->7, - * - * N rate: - * (rx_status->flag & RX_FLAG_HT) = 1, - * DESC_RATEMCS0-->DESC_RATEMCS15 ==> idx is 0-->15 - */ -static int _rtl8821ae_rate_mapping(struct ieee80211_hw *hw, - bool isht, u8 desc_rate) -{ - int rate_idx; - - if (false == isht) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) - if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) { -#else - if (IEEE80211_BAND_2GHZ == hw->conf.channel->band) { -#endif - switch (desc_rate) { - case DESC_RATE1M: - rate_idx = 0; - break; - case DESC_RATE2M: - rate_idx = 1; - break; - case DESC_RATE5_5M: - rate_idx = 2; - break; - case DESC_RATE11M: - rate_idx = 3; - break; - case DESC_RATE6M: - rate_idx = 4; - break; - case DESC_RATE9M: - rate_idx = 5; - break; - case DESC_RATE12M: - rate_idx = 6; - break; - case DESC_RATE18M: - rate_idx = 7; - break; - case DESC_RATE24M: - rate_idx = 8; - break; - case DESC_RATE36M: - rate_idx = 9; - break; - case DESC_RATE48M: - rate_idx = 10; - break; - case DESC_RATE54M: - rate_idx = 11; - break; - default: - rate_idx = 0; - break; - } - } else { - switch (desc_rate) { - case DESC_RATE6M: - rate_idx = 0; - break; - case DESC_RATE9M: - rate_idx = 1; - break; - case DESC_RATE12M: - rate_idx = 2; - break; - case DESC_RATE18M: - rate_idx = 3; - break; - case DESC_RATE24M: - rate_idx = 4; - break; - case DESC_RATE36M: - rate_idx = 5; - break; - case DESC_RATE48M: - rate_idx = 6; - break; - case DESC_RATE54M: - rate_idx = 7; - break; - default: - rate_idx = 0; - break; - } - } - } else { - switch(desc_rate) { - case DESC_RATEMCS0: - rate_idx = 0; - break; - case DESC_RATEMCS1: - rate_idx = 1; - break; - case DESC_RATEMCS2: - rate_idx = 2; - break; - case DESC_RATEMCS3: - rate_idx = 3; - break; - case DESC_RATEMCS4: - rate_idx = 4; - break; - case DESC_RATEMCS5: - rate_idx = 5; - break; - case DESC_RATEMCS6: - rate_idx = 6; - break; - case DESC_RATEMCS7: - rate_idx = 7; - break; - case DESC_RATEMCS8: - rate_idx = 8; - break; - case DESC_RATEMCS9: - rate_idx = 9; - break; - case DESC_RATEMCS10: - rate_idx = 10; - break; - case DESC_RATEMCS11: - rate_idx = 11; - break; - case DESC_RATEMCS12: - rate_idx = 12; - break; - case DESC_RATEMCS13: - rate_idx = 13; - break; - case DESC_RATEMCS14: - rate_idx = 14; - break; - case DESC_RATEMCS15: - rate_idx = 15; - break; - default: - rate_idx = 0; - break; - } - } - return rate_idx; -} - -static void _rtl8821ae_query_rxphystatus(struct ieee80211_hw *hw, - struct rtl_stats *pstatus, u8 *pdesc, - struct rx_fwinfo_8821ae *p_drvinfo, bool bpacket_match_bssid, - bool bpacket_toself, bool b_packet_beacon) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); - struct phy_sts_cck_8821ae_t *cck_buf; - struct phy_status_rpt *p_phystRpt = (struct phy_status_rpt *)p_drvinfo; - struct rtl_dm *rtldm = rtl_dm(rtl_priv(hw)); - char rx_pwr_all = 0, rx_pwr[4]; - u8 rf_rx_num = 0, evm, pwdb_all; - u8 i, max_spatial_stream; - u32 rssi, total_rssi = 0; - bool b_is_cck = pstatus->b_is_cck; - u8 lan_idx,vga_idx; - - /* Record it for next packet processing */ - pstatus->b_packet_matchbssid = bpacket_match_bssid; - pstatus->b_packet_toself = bpacket_toself; - pstatus->b_packet_beacon = b_packet_beacon; - pstatus->rx_mimo_signalquality[0] = -1; - pstatus->rx_mimo_signalquality[1] = -1; - - if (b_is_cck) { - u8 cck_highpwr; - u8 cck_agc_rpt; - /* CCK Driver info Structure is not the same as OFDM packet. */ - cck_buf = (struct phy_sts_cck_8821ae_t *)p_drvinfo; - cck_agc_rpt = cck_buf->cck_agc_rpt; - - /* (1)Hardware does not provide RSSI for CCK */ - /* (2)PWDB, Average PWDB cacluated by - * hardware (for rate adaptive) */ - if (ppsc->rfpwr_state == ERFON) - cck_highpwr = (u8) rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, - BIT(9)); - else - cck_highpwr = false; - - lan_idx = ((cck_agc_rpt & 0xE0) >> 5); - vga_idx = (cck_agc_rpt & 0x1f); - switch (lan_idx) { - case 7: - if(vga_idx <= 27) - rx_pwr_all = -100 + 2*(27-vga_idx); /*VGA_idx = 27~2*/ - else - rx_pwr_all = -100; - break; - case 6: - rx_pwr_all = -48 + 2*(2-vga_idx); /*VGA_idx = 2~0*/ - break; - case 5: - rx_pwr_all = -42 + 2*(7-vga_idx); /*VGA_idx = 7~5*/ - break; - case 4: - rx_pwr_all = -36 + 2*(7-vga_idx); /*VGA_idx = 7~4*/ - break; - case 3: - rx_pwr_all = -24 + 2*(7-vga_idx); /*VGA_idx = 7~0*/ - break; - case 2: - if(cck_highpwr) - rx_pwr_all = -12 + 2*(5-vga_idx); /*VGA_idx = 5~0*/ - else - rx_pwr_all = -6+ 2*(5-vga_idx); - break; - case 1: - rx_pwr_all = 8-2*vga_idx; - break; - case 0: - rx_pwr_all = 14-2*vga_idx; - break; - default: - break; - } - rx_pwr_all += 6; - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - /* CCK gain is smaller than OFDM/MCS gain, */ - /* so we add gain diff by experiences, - * the val is 6 */ - pwdb_all += 6; - if(pwdb_all > 100) - pwdb_all = 100; - /* modify the offset to make the same - * gain index with OFDM. */ - if(pwdb_all > 34 && pwdb_all <= 42) - pwdb_all -= 2; - else if(pwdb_all > 26 && pwdb_all <= 34) - pwdb_all -= 6; - else if(pwdb_all > 14 && pwdb_all <= 26) - pwdb_all -= 8; - else if(pwdb_all > 4 && pwdb_all <= 14) - pwdb_all -= 4; - if (cck_highpwr == false){ - if (pwdb_all >= 80) - pwdb_all =((pwdb_all-80)<<1)+((pwdb_all-80)>>1)+80; - else if((pwdb_all <= 78) && (pwdb_all >= 20)) - pwdb_all += 3; - if(pwdb_all>100) - pwdb_all = 100; - } - - pstatus->rx_pwdb_all = pwdb_all; - pstatus->recvsignalpower = rx_pwr_all; - - /* (3) Get Signal Quality (EVM) */ - if (bpacket_match_bssid) { - u8 sq; - - if (pstatus->rx_pwdb_all > 40) - sq = 100; - else { - sq = cck_buf->sq_rpt; - if (sq > 64) - sq = 0; - else if (sq < 20) - sq = 100; - else - sq = ((64 - sq) * 100) / 44; - } - - pstatus->signalquality = sq; - pstatus->rx_mimo_signalquality[0] = sq; - pstatus->rx_mimo_signalquality[1] = -1; - } - } else { - rtlpriv->dm.brfpath_rxenable[0] = - rtlpriv->dm.brfpath_rxenable[1] = true; - - /* (1)Get RSSI for HT rate */ - for (i = RF90_PATH_A; i < RF6052_MAX_PATH; i++) { - - /* we will judge RF RX path now. */ - if (rtlpriv->dm.brfpath_rxenable[i]) - rf_rx_num++; - - rx_pwr[i] = ((p_drvinfo->gain_trsw[i] & 0x3f) * 2) - 110; - - /* Translate DBM to percentage. */ - rssi = rtl_query_rxpwrpercentage(rx_pwr[i]); - total_rssi += rssi; - - /* Get Rx snr value in DB */ - rtlpriv->stats.rx_snr_db[i] = (long)(p_drvinfo->rxsnr[i] / 2); - - /* Record Signal Strength for next packet */ - if (bpacket_match_bssid) - pstatus->rx_mimo_signalstrength[i] = (u8) rssi; - } - - /* (2)PWDB, Average PWDB cacluated by - * hardware (for rate adaptive) */ - rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 110; - - pwdb_all = rtl_query_rxpwrpercentage(rx_pwr_all); - pstatus->rx_pwdb_all = pwdb_all; - pstatus->rxpower = rx_pwr_all; - pstatus->recvsignalpower = rx_pwr_all; - - /* (3)EVM of HT rate */ - if (pstatus->b_is_ht && pstatus->rate >= DESC_RATEMCS8 && - pstatus->rate <= DESC_RATEMCS15) - max_spatial_stream = 2; - else - max_spatial_stream = 1; - - for (i = 0; i < max_spatial_stream; i++) { - evm = rtl_evm_db_to_percentage(p_drvinfo->rxevm[i]); - - if (bpacket_match_bssid) { - /* Fill value in RFD, Get the first - * spatial stream only */ - if (i == 0) - pstatus->signalquality = (u8) (evm & 0xff); - pstatus->rx_mimo_signalquality[i] = (u8) (evm & 0xff); - } - } - } - - /* UI BSS List signal strength(in percentage), - * make it good looking, from 0~100. */ - if (b_is_cck) - pstatus->signalstrength = (u8)(rtl_signal_scale_mapping(hw, - pwdb_all)); - else if (rf_rx_num != 0) - pstatus->signalstrength = (u8)(rtl_signal_scale_mapping(hw, - total_rssi /= rf_rx_num)); - /*HW antenna diversity*/ - rtldm->fat_table.antsel_rx_keep_0 = p_phystRpt->ant_sel; - rtldm->fat_table.antsel_rx_keep_1 = p_phystRpt->ant_sel_b; - rtldm->fat_table.antsel_rx_keep_2 = p_phystRpt->antsel_rx_keep_2; - -} -#if 0 -static void _rtl8821ae_smart_antenna(struct ieee80211_hw *hw, - struct rtl_stats *pstatus) -{ - struct rtl_dm *rtldm= rtl_dm(rtl_priv(hw)); - struct rtl_efuse *rtlefuse =rtl_efuse(rtl_priv(hw)); - u8 antsel_tr_mux; - struct fast_ant_trainning *pfat_table = &(rtldm->fat_table); - - if (rtlefuse->antenna_div_type == CG_TRX_SMART_ANTDIV) { - if (pfat_table->fat_state == FAT_TRAINING_STATE) { - if (pstatus->b_packet_toself) { - antsel_tr_mux = (pfat_table->antsel_rx_keep_2 << 2) | - (pfat_table->antsel_rx_keep_1 << 1) | pfat_table->antsel_rx_keep_0; - pfat_table->ant_sum_rssi[antsel_tr_mux] += pstatus->rx_pwdb_all; - pfat_table->ant_rssi_cnt[antsel_tr_mux]++; - } - } - } else if ((rtlefuse->antenna_div_type == CG_TRX_HW_ANTDIV) || - (rtlefuse->antenna_div_type == CGCS_RX_HW_ANTDIV)) { - if (pstatus->b_packet_toself || pstatus->b_packet_matchbssid) { - antsel_tr_mux = (pfat_table->antsel_rx_keep_2 << 2) | - (pfat_table->antsel_rx_keep_1 << 1) | pfat_table->antsel_rx_keep_0; - rtl8821ae_dm_ant_sel_statistics(hw, antsel_tr_mux, 0, pstatus->rx_pwdb_all); - } - - } -} -#endif -static void _rtl8821ae_translate_rx_signal_stuff(struct ieee80211_hw *hw, - struct sk_buff *skb, struct rtl_stats *pstatus, - u8 *pdesc, struct rx_fwinfo_8821ae *p_drvinfo) -{ - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - struct ieee80211_hdr *hdr; - u8 *tmp_buf; - u8 *praddr; - u8 *psaddr; - u16 fc, type; - bool b_packet_matchbssid, b_packet_toself, b_packet_beacon; - - tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift; - - hdr = (struct ieee80211_hdr *)tmp_buf; - fc = le16_to_cpu(hdr->frame_control); - type = WLAN_FC_GET_TYPE(fc); - praddr = hdr->addr1; - psaddr = ieee80211_get_SA(hdr); - memcpy(pstatus->psaddr, psaddr, ETH_ALEN); - - b_packet_matchbssid = ((IEEE80211_FTYPE_CTL != type) && - (!ether_addr_equal(mac->bssid, (fc & IEEE80211_FCTL_TODS) ? - hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? - hdr->addr2 : hdr->addr3)) && (!pstatus->b_hwerror) && - (!pstatus->b_crc) && (!pstatus->b_icv)); - - b_packet_toself = b_packet_matchbssid && - (!ether_addr_equal(praddr, rtlefuse->dev_addr)); - - if (ieee80211_is_beacon(fc)) - b_packet_beacon = true; - else - b_packet_beacon = false; - - if (b_packet_beacon && b_packet_matchbssid) - rtl_priv(hw)->dm.dbginfo.num_qry_beacon_pkt++; - - _rtl8821ae_query_rxphystatus(hw, pstatus, pdesc, p_drvinfo, - b_packet_matchbssid, b_packet_toself, - b_packet_beacon); - /*_rtl8821ae_smart_antenna(hw, pstatus); */ - rtl_process_phyinfo(hw, tmp_buf, pstatus); -} - -static void _rtl8821ae_insert_emcontent(struct rtl_tcb_desc *ptcb_desc, - u8 *virtualaddress) -{ - u32 dwtmp = 0; - memset(virtualaddress, 0, 8); - - SET_EARLYMODE_PKTNUM(virtualaddress, ptcb_desc->empkt_num); - if (ptcb_desc->empkt_num == 1) - dwtmp = ptcb_desc->empkt_len[0]; - else { - dwtmp = ptcb_desc->empkt_len[0]; - dwtmp += ((dwtmp%4)?(4-dwtmp%4):0)+4; - dwtmp += ptcb_desc->empkt_len[1]; - } - SET_EARLYMODE_LEN0(virtualaddress, dwtmp); - - if (ptcb_desc->empkt_num <= 3) - dwtmp = ptcb_desc->empkt_len[2]; - else { - dwtmp = ptcb_desc->empkt_len[2]; - dwtmp += ((dwtmp%4)?(4-dwtmp%4):0)+4; - dwtmp += ptcb_desc->empkt_len[3]; - } - SET_EARLYMODE_LEN1(virtualaddress, dwtmp); - if (ptcb_desc->empkt_num <= 5) - dwtmp = ptcb_desc->empkt_len[4]; - else { - dwtmp = ptcb_desc->empkt_len[4]; - dwtmp += ((dwtmp%4)?(4-dwtmp%4):0)+4; - dwtmp += ptcb_desc->empkt_len[5]; - } - SET_EARLYMODE_LEN2_1(virtualaddress, dwtmp & 0xF); - SET_EARLYMODE_LEN2_2(virtualaddress, dwtmp >> 4); - if (ptcb_desc->empkt_num <= 7) - dwtmp = ptcb_desc->empkt_len[6]; - else { - dwtmp = ptcb_desc->empkt_len[6]; - dwtmp += ((dwtmp%4)?(4-dwtmp%4):0)+4; - dwtmp += ptcb_desc->empkt_len[7]; - } - SET_EARLYMODE_LEN3(virtualaddress, dwtmp); - if (ptcb_desc->empkt_num <= 9) - dwtmp = ptcb_desc->empkt_len[8]; - else { - dwtmp = ptcb_desc->empkt_len[8]; - dwtmp += ((dwtmp%4)?(4-dwtmp%4):0)+4; - dwtmp += ptcb_desc->empkt_len[9]; - } - SET_EARLYMODE_LEN4(virtualaddress, dwtmp); -} - -bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *status, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rx_fwinfo_8821ae *p_drvinfo; - struct ieee80211_hdr *hdr; - - u32 phystatus = GET_RX_DESC_PHYST(pdesc); - - status->length = (u16) GET_RX_DESC_PKT_LEN(pdesc); - status->rx_drvinfo_size = (u8) GET_RX_DESC_DRV_INFO_SIZE(pdesc) * - RX_DRV_INFO_SIZE_UNIT; - status->rx_bufshift = (u8) (GET_RX_DESC_SHIFT(pdesc) & 0x03); - status->b_icv = (u16) GET_RX_DESC_ICV(pdesc); - status->b_crc = (u16) GET_RX_DESC_CRC32(pdesc); - status->b_hwerror = (status->b_crc | status->b_icv); - status->decrypted = !GET_RX_DESC_SWDEC(pdesc); - status->rate = (u8) GET_RX_DESC_RXMCS(pdesc); - status->b_shortpreamble = (u16) GET_RX_DESC_SPLCP(pdesc); - status->b_isampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); - status->b_isfirst_ampdu = (bool) (GET_RX_DESC_PAGGR(pdesc) == 1); - status->timestamp_low = GET_RX_DESC_TSFL(pdesc); - status->rx_is40Mhzpacket = (bool) GET_RX_DESC_BW(pdesc); - status->macid = GET_RX_DESC_MACID(pdesc); - status->b_is_ht = (bool)GET_RX_DESC_RXHT(pdesc); - - status->b_is_cck = RX_HAL_IS_CCK_RATE(status->rate); - - if (GET_RX_STATUS_DESC_RPT_SEL(pdesc)) - status->packet_report_type = C2H_PACKET; - else - status->packet_report_type = NORMAL_RX; - - if (GET_RX_STATUS_DESC_PATTERN_MATCH(pdesc)) - status->wake_match = BIT(2); - else if (GET_RX_STATUS_DESC_MAGIC_MATCH(pdesc)) - status->wake_match = BIT(1); - else if (GET_RX_STATUS_DESC_UNICAST_MATCH(pdesc)) - status->wake_match = BIT(0); - else - status->wake_match = 0; - - if (status->wake_match) - RT_TRACE(COMP_RXDESC,DBG_LOUD, - ("GGGGGGGGGGGGGet Wakeup Packet!! WakeMatch=%d\n",status->wake_match )); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) - rx_status->freq = hw->conf.chandef.chan->center_freq; - rx_status->band = hw->conf.chandef.chan->band; -#else - rx_status->freq = hw->conf.channel->center_freq; - rx_status->band = hw->conf.channel->band; -#endif - - hdr = (struct ieee80211_hdr *)(skb->data + status->rx_drvinfo_size - + status->rx_bufshift); - - if (status->b_crc) - rx_status->flag |= RX_FLAG_FAILED_FCS_CRC; - - if (status->rx_is40Mhzpacket) - rx_status->flag |= RX_FLAG_40MHZ; - - if (status->b_is_ht) - rx_status->flag |= RX_FLAG_HT; - - rx_status->flag |= RX_FLAG_MACTIME_MPDU; - - /* hw will set status->decrypted true, if it finds the - * frame is open data frame or mgmt frame. */ - /* So hw will not decryption robust managment frame - * for IEEE80211w but still set status->decrypted - * true, so here we should set it back to undecrypted - * for IEEE80211w frame, and mac80211 sw will help - * to decrypt it */ - if (status->decrypted) { - if (!hdr) { - WARN_ON_ONCE(true); - pr_err("decrypted is true but hdr NULL, from skb %p\n", - rtl_get_hdr(skb)); - return false; - } - - if ((ieee80211_is_robust_mgmt_frame(hdr)) && - (ieee80211_has_protected(hdr->frame_control))) - rx_status->flag &= ~RX_FLAG_DECRYPTED; - else - rx_status->flag |= RX_FLAG_DECRYPTED; - } - - /* rate_idx: index of data rate into band's - * supported rates or MCS index if HT rates - * are use (RX_FLAG_HT)*/ - /* Notice: this is diff with windows define */ - rx_status->rate_idx = _rtl8821ae_rate_mapping(hw, - status->b_is_ht, status->rate); - - rx_status->mactime = status->timestamp_low; - if (phystatus == true) { - p_drvinfo = (struct rx_fwinfo_8821ae *)(skb->data + - status->rx_bufshift); - - _rtl8821ae_translate_rx_signal_stuff(hw, - skb, status, pdesc, - p_drvinfo); - } - - /*rx_status->qual = status->signal; */ - rx_status->signal = status->recvsignalpower + 10; - /*rx_status->noise = -status->noise; */ - if (status->packet_report_type == TX_REPORT2){ - status->macid_valid_entry[0] = GET_RX_RPT2_DESC_MACID_VALID_1(pdesc); - status->macid_valid_entry[1] = GET_RX_RPT2_DESC_MACID_VALID_2(pdesc); - } - return true; -} - -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) -void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, u8 *txbd, - struct ieee80211_tx_info *info, struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) -#else -/*<delete in kernel end>*/ -void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, u8 *txbd, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtlpriv); -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - struct ieee80211_sta *sta = info->control.sta; -#endif -/*<delete in kernel end>*/ - u8 *pdesc = (u8 *) pdesc_tx; - u16 seq_number; - u16 fc = le16_to_cpu(hdr->frame_control); - unsigned int buf_len = 0; - unsigned int skb_len = skb->len; - u8 fw_qsel = _rtl8821ae_map_hwqueue_to_fwqueue(skb, hw_queue); - bool b_firstseg = ((hdr->seq_ctrl & - cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0); - bool b_lastseg = ((hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) == 0); - dma_addr_t mapping; - u8 bw_40 = 0; - u8 short_gi = 0; - - if (mac->opmode == NL80211_IFTYPE_STATION) { - bw_40 = mac->bw_40; - } else if (mac->opmode == NL80211_IFTYPE_AP || - mac->opmode == NL80211_IFTYPE_ADHOC) { - if (sta) - bw_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40; - } - seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; - rtl_get_tcb_desc(hw, info, sta, skb, ptcb_desc); - /* reserve 8 byte for AMPDU early mode */ - if (rtlhal->b_earlymode_enable) { - skb_push(skb, EM_HDR_LEN); - memset(skb->data, 0, EM_HDR_LEN); - } - buf_len = skb->len; - mapping = pci_map_single(rtlpci->pdev, skb->data, skb->len, - PCI_DMA_TODEVICE); - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(COMP_SEND, DBG_TRACE, - ("DMA mapping error")); - return; - } - CLEAR_PCI_TX_DESC_CONTENT(pdesc, sizeof(struct tx_desc_8821ae)); - if (ieee80211_is_nullfunc(fc) || ieee80211_is_ctl(fc)) { - b_firstseg = true; - b_lastseg = true; - } - if (b_firstseg) { - if (rtlhal->b_earlymode_enable) { - SET_TX_DESC_PKT_OFFSET(pdesc, 1); - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN + EM_HDR_LEN); - if (ptcb_desc->empkt_num) { - RT_TRACE(COMP_SEND, DBG_TRACE, - ("Insert 8 byte.pTcb->EMPktNum:%d\n", - ptcb_desc->empkt_num)); - _rtl8821ae_insert_emcontent(ptcb_desc, (u8 *)(skb->data)); - } - } else { - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - } - - /* ptcb_desc->use_driver_rate = true; */ - SET_TX_DESC_TX_RATE(pdesc, ptcb_desc->hw_rate); - if (ptcb_desc->hw_rate > DESC_RATEMCS0) { - short_gi = (ptcb_desc->use_shortgi) ? 1 : 0; - } else { - short_gi = (ptcb_desc->use_shortpreamble) ? 1 :0; - } - SET_TX_DESC_DATA_SHORTGI(pdesc, short_gi); - - if (info->flags & IEEE80211_TX_CTL_AMPDU) { - SET_TX_DESC_AGG_ENABLE(pdesc, 1); - SET_TX_DESC_MAX_AGG_NUM(pdesc, 0x14); - } - SET_TX_DESC_SEQ(pdesc, seq_number); - SET_TX_DESC_RTS_ENABLE(pdesc, ((ptcb_desc->b_rts_enable && - !ptcb_desc->b_cts_enable) ? 1 : 0)); - SET_TX_DESC_HW_RTS_ENABLE(pdesc,0); - SET_TX_DESC_CTS2SELF(pdesc, ((ptcb_desc->b_cts_enable) ? 1 : 0)); - /* SET_TX_DESC_RTS_STBC(pdesc, ((ptcb_desc->b_rts_stbc) ? 1 : 0));*/ - - SET_TX_DESC_RTS_RATE(pdesc, ptcb_desc->rts_rate); - /* SET_TX_DESC_RTS_BW(pdesc, 0);*/ - SET_TX_DESC_RTS_SC(pdesc, ptcb_desc->rts_sc); - SET_TX_DESC_RTS_SHORT(pdesc, ((ptcb_desc->rts_rate <= DESC_RATE54M) ? - (ptcb_desc->b_rts_use_shortpreamble ? 1 : 0) : - (ptcb_desc->b_rts_use_shortgi ? 1 : 0))); - - if(ptcb_desc->btx_enable_sw_calc_duration) - SET_TX_DESC_NAV_USE_HDR(pdesc, 1); - - if (bw_40) { - if (ptcb_desc->b_packet_bw) { - SET_TX_DESC_DATA_BW(pdesc, 1); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 3); - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, mac->cur_40_prime_sc); - } - } else { - SET_TX_DESC_DATA_BW(pdesc, 0); - SET_TX_DESC_TX_SUB_CARRIER(pdesc, 0); - } - - SET_TX_DESC_LINIP(pdesc, 0); - SET_TX_DESC_PKT_SIZE(pdesc, (u16) skb_len); - if (sta) { - u8 ampdu_density = sta->ht_cap.ampdu_density; - SET_TX_DESC_AMPDU_DENSITY(pdesc, ampdu_density); - } - if (info->control.hw_key) { - struct ieee80211_key_conf *keyconf = info->control.hw_key; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -/*<delete in kernel end>*/ - switch (keyconf->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); - break; - case WLAN_CIPHER_SUITE_CCMP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); - break; - - } -/*<delete in kernel start>*/ -#else - switch (keyconf->alg) { - case ALG_WEP: - case ALG_TKIP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); - break; - case ALG_CCMP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); - break; - - } -#endif -/*<delete in kernel end>*/ - } - - SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel); - SET_TX_DESC_DATA_RATE_FB_LIMIT(pdesc, 0x1F); - SET_TX_DESC_RTS_RATE_FB_LIMIT(pdesc, 0xF); - SET_TX_DESC_DISABLE_FB(pdesc, ptcb_desc->disable_ratefallback ? 1 : 0); - SET_TX_DESC_USE_RATE(pdesc, ptcb_desc->use_driver_rate ? 1 : 0); - -#if 0 - SET_TX_DESC_USE_RATE(pdesc, 1); - SET_TX_DESC_TX_RATE(pdesc, 0x04); - - SET_TX_DESC_RETRY_LIMIT_ENABLE(pdesc, 1); - SET_TX_DESC_DATA_RETRY_LIMIT(pdesc, 0x3f); -#endif - - /*SET_TX_DESC_PWR_STATUS(pdesc, pwr_status);*/ - /* Set TxRate and RTSRate in TxDesc */ - /* This prevent Tx initial rate of new-coming packets */ - /* from being overwritten by retried packet rate.*/ - if (!ptcb_desc->use_driver_rate) { - /*SET_TX_DESC_RTS_RATE(pdesc, 0x08); */ - /* SET_TX_DESC_TX_RATE(pdesc, 0x0b); */ - } - if (ieee80211_is_data_qos(fc)) { - if (mac->rdg_en) { - RT_TRACE(COMP_SEND, DBG_TRACE, - ("Enable RDG function.\n")); - SET_TX_DESC_RDG_ENABLE(pdesc, 1); - SET_TX_DESC_HTC(pdesc, 1); - } - } - } - - SET_TX_DESC_FIRST_SEG(pdesc, (b_firstseg ? 1 : 0)); - SET_TX_DESC_LAST_SEG(pdesc, (b_lastseg ? 1 : 0)); - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) buf_len); - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping)); - //if (rtlpriv->dm.b_useramask) { - if(1){ - SET_TX_DESC_RATE_ID(pdesc, ptcb_desc->ratr_index); - SET_TX_DESC_MACID(pdesc, ptcb_desc->mac_id); - } else { - SET_TX_DESC_RATE_ID(pdesc, 0xC + ptcb_desc->ratr_index); - SET_TX_DESC_MACID(pdesc, ptcb_desc->mac_id); - } -/* if (ieee80211_is_data_qos(fc)) - SET_TX_DESC_QOS(pdesc, 1); -*/ - if (!ieee80211_is_data_qos(fc)) { - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - SET_TX_DESC_HWSEQ_SEL(pdesc, 0); - } - SET_TX_DESC_MORE_FRAG(pdesc, (b_lastseg ? 0 : 1)); - if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || - is_broadcast_ether_addr(ieee80211_get_DA(hdr))) { - SET_TX_DESC_BMC(pdesc, 1); - } - - rtl8821ae_dm_set_tx_ant_by_tx_info(hw,pdesc,ptcb_desc->mac_id); - RT_TRACE(COMP_SEND, DBG_TRACE, ("\n")); -} - -void rtl8821ae_tx_fill_cmddesc(struct ieee80211_hw *hw, - u8 *pdesc, bool b_firstseg, - bool b_lastseg, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 fw_queue = QSLT_BEACON; - - dma_addr_t mapping = pci_map_single(rtlpci->pdev, - skb->data, skb->len, - PCI_DMA_TODEVICE); - - if (pci_dma_mapping_error(rtlpci->pdev, mapping)) { - RT_TRACE(COMP_SEND, DBG_TRACE, - ("DMA mapping error")); - return; - } - CLEAR_PCI_TX_DESC_CONTENT(pdesc, TX_DESC_SIZE); - - SET_TX_DESC_FIRST_SEG(pdesc, 1); - SET_TX_DESC_LAST_SEG(pdesc, 1); - - SET_TX_DESC_PKT_SIZE((u8 *) pdesc, (u16) (skb->len)); - - SET_TX_DESC_OFFSET(pdesc, USB_HWDESC_HEADER_LEN); - - SET_TX_DESC_USE_RATE(pdesc, 1); - SET_TX_DESC_TX_RATE(pdesc, DESC_RATE1M); - SET_TX_DESC_DISABLE_FB(pdesc, 1); - - SET_TX_DESC_DATA_BW(pdesc, 0); - - SET_TX_DESC_HWSEQ_EN(pdesc, 1); - - SET_TX_DESC_QUEUE_SEL(pdesc, fw_queue); -/* - if(IsCtrlNDPA(VirtualAddress) || IsMgntNDPA(VirtualAddress)) - { - SET_TX_DESC_DATA_RETRY_LIMIT_8812(pDesc, 5); - SET_TX_DESC_RETRY_LIMIT_ENABLE_8812(pDesc, 1); - - if(IsMgntNDPA(VirtualAddress)) - { - SET_TX_DESC_NDPA_8812(pDesc, 1); - SET_TX_DESC_RTS_SC_8812(pDesc, SCMapping_8812(Adapter, pTcb)); - } - else - { - SET_TX_DESC_NDPA_8812(pDesc, 2); - SET_TX_DESC_RTS_SC_8812(pDesc, SCMapping_8812(Adapter, pTcb)); - } - }*/ - - SET_TX_DESC_TX_BUFFER_SIZE(pdesc, (u16) (skb->len)); - - SET_TX_DESC_TX_BUFFER_ADDRESS(pdesc, cpu_to_le32(mapping)); - - SET_TX_DESC_MACID(pdesc, 0); - - SET_TX_DESC_OWN(pdesc, 1); - - RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_LOUD, - "H2C Tx Cmd Content\n", - pdesc, TX_DESC_SIZE); -} - -void rtl8821ae_set_desc(struct ieee80211_hw * hw, u8 *pdesc, bool istx, u8 desc_name, u8 *val) -{ - if (istx == true) { - switch (desc_name) { - case HW_DESC_OWN: - SET_TX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_TX_NEXTDESC_ADDR: - SET_TX_DESC_NEXT_DESC_ADDRESS(pdesc, *(u32 *) val); - break; - default: - RT_ASSERT(false, ("ERR txdesc :%d" - " not process\n", desc_name)); - break; - } - } else { - switch (desc_name) { - case HW_DESC_RXOWN: - SET_RX_DESC_OWN(pdesc, 1); - break; - case HW_DESC_RXBUFF_ADDR: - SET_RX_DESC_BUFF_ADDR(pdesc, *(u32 *) val); - break; - case HW_DESC_RXPKT_LEN: - SET_RX_DESC_PKT_LEN(pdesc, *(u32 *) val); - break; - case HW_DESC_RXERO: - SET_RX_DESC_EOR(pdesc, 1); - break; - default: - RT_ASSERT(false, ("ERR rxdesc :%d " - "not process\n", desc_name)); - break; - } - } -} - -u32 rtl8821ae_get_desc(u8 *pdesc, bool istx, u8 desc_name) -{ - u32 ret = 0; - - if (istx == true) { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_TX_DESC_OWN(pdesc); - break; - case HW_DESC_TXBUFF_ADDR: - ret = GET_TX_DESC_TX_BUFFER_ADDRESS(pdesc); - break; - default: - RT_ASSERT(false, ("ERR txdesc :%d " - "not process\n", desc_name)); - break; - } - } else { - switch (desc_name) { - case HW_DESC_OWN: - ret = GET_RX_DESC_OWN(pdesc); - break; - case HW_DESC_RXPKT_LEN: - ret = GET_RX_DESC_PKT_LEN(pdesc); - break; - default: - RT_ASSERT(false, ("ERR rxdesc :%d " - "not process\n", desc_name)); - break; - } - } - return ret; -} - -bool rtl8821ae_is_tx_desc_closed(struct ieee80211_hw *hw, - u8 hw_queue, u16 index) -{ - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; - u8 *entry = (u8 *)(&ring->desc[ring->idx]); - u8 own = (u8) rtl8821ae_get_desc(entry, true, HW_DESC_OWN); - - /* - *beacon packet will only use the first - *descriptor defautly,and the own may not - *be cleared by the hardware - */ - if (own) - return false; - else - return true; -} - - -void rtl8821ae_tx_polling(struct ieee80211_hw *hw, u8 hw_queue) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (hw_queue == BEACON_QUEUE) { - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, BIT(4)); - } else { - rtl_write_word(rtlpriv, REG_PCIE_CTRL_REG, - BIT(0) << (hw_queue)); - } -} diff --git a/drivers/staging/rtl8821ae/rtl8821ae/trx.h b/drivers/staging/rtl8821ae/rtl8821ae/trx.h deleted file mode 100644 index da93e5c..0000000 --- a/drivers/staging/rtl8821ae/rtl8821ae/trx.h +++ /dev/null @@ -1,641 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2009-2010 Realtek Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@xxxxxxxxxxx> - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, - * Hsinchu 300, Taiwan. - * - * Larry Finger <Larry.Finger@xxxxxxxxxxxx> - * - *****************************************************************************/ - -#ifndef __RTL8821AE_TRX_H__ -#define __RTL8821AE_TRX_H__ - -#define TX_DESC_SIZE 40 -#define TX_DESC_AGGR_SUBFRAME_SIZE 32 - -#define RX_DESC_SIZE 32 -#define RX_DRV_INFO_SIZE_UNIT 8 - -#define TX_DESC_NEXT_DESC_OFFSET 40 -#define USB_HWDESC_HEADER_LEN 40 -#define CRCLENGTH 4 - -#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 0, 16, __val) -#define SET_TX_DESC_OFFSET(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 16, 8, __val) -#define SET_TX_DESC_BMC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 24, 1, __val) -#define SET_TX_DESC_HTC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 25, 1, __val) -#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 26, 1, __val) -#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 27, 1, __val) -#define SET_TX_DESC_LINIP(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 28, 1, __val) -#define SET_TX_DESC_NO_ACM(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 29, 1, __val) -#define SET_TX_DESC_GF(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val) -#define SET_TX_DESC_OWN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val) - -#define GET_TX_DESC_PKT_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 0, 16) -#define GET_TX_DESC_OFFSET(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 16, 8) -#define GET_TX_DESC_BMC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 24, 1) -#define GET_TX_DESC_HTC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 25, 1) -#define GET_TX_DESC_LAST_SEG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 26, 1) -#define GET_TX_DESC_FIRST_SEG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 27, 1) -#define GET_TX_DESC_LINIP(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 28, 1) -#define GET_TX_DESC_NO_ACM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 29, 1) -#define GET_TX_DESC_GF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 30, 1) -#define GET_TX_DESC_OWN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 31, 1) - -#define SET_TX_DESC_MACID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 0, 7, __val) -#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 8, 5, __val) -#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 13, 1, __val) -#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 14, 1, __val) -#define SET_TX_DESC_PIFS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 15, 1, __val) -#define SET_TX_DESC_RATE_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 16, 5, __val) -#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 21, 1, __val) -#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 22, 2, __val) -#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+4, 24, 5, __val) - - -#define SET_TX_DESC_PAID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 0, 9, __val) -#define SET_TX_DESC_CCA_RTS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 10, 2, __val) -#define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 12, 1, __val) -#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 13, 1, __val) -#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 14, 2, __val) -#define SET_TX_DESC_AGG_BREAK(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 16, 1, __val) -#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 17, 1, __val) -#define SET_TX_DESC_RAW(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 18, 1, __val) -#define SET_TX_DESC_SPE_RPT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 19, 1, __val) -#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 20, 3, __val) -#define SET_TX_DESC_BT_INT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 23, 1, __val) -#define SET_TX_DESC_GID(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+8, 24, 6, __val) - - -#define SET_TX_DESC_WHEADER_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 0, 4, __val) -#define SET_TX_DESC_CHK_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 4, 1, __val) -#define SET_TX_DESC_EARLY_MODE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 5, 1, __val) -#define SET_TX_DESC_HWSEQ_SEL(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 6, 2, __val) -#define SET_TX_DESC_USE_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 8, 1, __val) -#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 9, 1, __val) -#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 10, 1, __val) -#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 11, 1, __val) -#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 12, 1, __val) -#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 13, 1, __val) -#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 15, 1, __val) -#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 16, 1, __val) -#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 17, 5, __val) -#define SET_TX_DESC_NDPA(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 22, 2, __val) -#define SET_TX_DESC_AMPDU_MAX_TIME(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+12, 24, 8, __val) -#define SET_TX_DESC_TX_ANT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 24, 4, __val) - -#define SET_TX_DESC_TX_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 7, __val) -#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 8, 5, __val) -#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 13, 4, __val) -#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 17, 1, __val) -#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 18, 6, __val) -#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+16, 24, 5, __val) - - -#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 4, __val) -#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \ - SET_BITS_TO_LE_1BYTE(__pdesc+20, 6, 1, __val) -#define SET_TX_DESC_DATA_BW(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 5, 2, __val) -#define SET_TX_DESC_DATA_LDPC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 7, 1, __val) -#define SET_TX_DESC_DATA_STBC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 8, 2, __val) -#define SET_TX_DESC_CTROL_STBC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 10, 2, __val) -#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 12, 1, __val) -#define SET_TX_DESC_RTS_SC(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val) - - -#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val) - -#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 0, 16) - -#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+32, 15, 1, __val) - -#define SET_TX_DESC_SEQ(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+36, 12, 12, __val) - -#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+40, 0, 32, __val) - -#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+40, 0, 32) - - -#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+48, 0, 32, __val) - -#define GET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+48, 0, 32) - -#define GET_RX_DESC_PKT_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 0, 14) -#define GET_RX_DESC_CRC32(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 14, 1) -#define GET_RX_DESC_ICV(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 15, 1) -#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 16, 4) -#define GET_RX_DESC_SECURITY(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 20, 3) -#define GET_RX_DESC_QOS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 23, 1) -#define GET_RX_DESC_SHIFT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 24, 2) -#define GET_RX_DESC_PHYST(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 26, 1) -#define GET_RX_DESC_SWDEC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 27, 1) -#define GET_RX_DESC_LS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 28, 1) -#define GET_RX_DESC_FS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 29, 1) -#define GET_RX_DESC_EOR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 30, 1) -#define GET_RX_DESC_OWN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc, 31, 1) - -#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 0, 14, __val) -#define SET_RX_DESC_EOR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val) -#define SET_RX_DESC_OWN(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val) - -#define GET_RX_DESC_MACID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 0, 7) -#define GET_RX_DESC_TID(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 8, 4) -#define GET_RX_DESC_AMSDU(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 13, 1) -#define GET_RX_STATUS_DESC_RXID_MATCH(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 14, 1) -#define GET_RX_DESC_PAGGR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 15, 1) -#define GET_RX_DESC_A1_FIT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 16, 4) -#define GET_RX_DESC_CHKERR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 20, 1) -#define GET_RX_DESC_IPVER(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 21, 1) -#define GET_RX_STATUS_DESC_IS_TCPUDP(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 22, 1) -#define GET_RX_STATUS_DESC_CHK_VLD(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 23, 1) -#define GET_RX_DESC_PAM(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 24, 1) -#define GET_RX_DESC_PWR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 25, 1) -#define GET_RX_DESC_MD(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 26, 1) -#define GET_RX_DESC_MF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 27, 1) -#define GET_RX_DESC_TYPE(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 28, 2) -#define GET_RX_DESC_MC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 30, 1) -#define GET_RX_DESC_BC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+4, 31, 1) - - -#define GET_RX_DESC_SEQ(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 0, 12) -#define GET_RX_DESC_FRAG(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 12, 4) -#define GET_RX_STATUS_DESC_RX_IS_QOS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 16, 1) -#define GET_RX_STATUS_DESC_WLANHD_IV_LEN(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 18, 6) -#define GET_RX_STATUS_DESC_RPT_SEL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+8, 28, 1) - - -#define GET_RX_DESC_RXMCS(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 0, 7) -#define GET_RX_DESC_RXHT(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 6, 1) -#define GET_RX_STATUS_DESC_RX_GF(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 7, 1) -#define GET_RX_DESC_HTC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+12, 10, 1) -#define GET_RX_STATUS_DESC_EOSP(__pdesc) \ - LE_BITS_TO_4BYTE( __pdesc+12, 11, 1) -#define GET_RX_STATUS_DESC_BSSID_FIT(__pdesc) \ - LE_BITS_TO_4BYTE( __pdesc+12, 12, 2) - -#define GET_RX_STATUS_DESC_PATTERN_MATCH(__pdesc) \ - LE_BITS_TO_4BYTE( __pdesc+12, 29, 1) -#define GET_RX_STATUS_DESC_UNICAST_MATCH(__pdesc) \ - LE_BITS_TO_4BYTE( __pdesc+12, 30, 1) -#define GET_RX_STATUS_DESC_MAGIC_MATCH(__pdesc) \ - LE_BITS_TO_4BYTE( __pdesc+12, 31, 1) - -#define GET_RX_DESC_SPLCP(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 0, 1) -#define GET_RX_STATUS_DESC_LDPC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 1, 1) -#define GET_RX_STATUS_DESC_STBC(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 2, 1) -#define GET_RX_DESC_BW(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+16, 4, 2) - -#define GET_RX_DESC_TSFL(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+20, 0, 32) - -#define GET_RX_DESC_BUFF_ADDR(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+24, 0, 32) -#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \ - LE_BITS_TO_4BYTE(__pdesc+28, 0, 32) - -#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 32, __val) -#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \ - SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 32, __val) - - -/* TX report 2 format in Rx desc*/ - -#define GET_RX_RPT2_DESC_PKT_LEN(__pRxStatusDesc) \ - LE_BITS_TO_4BYTE( __pRxStatusDesc, 0, 9) -#define GET_RX_RPT2_DESC_MACID_VALID_1(__pRxStatusDesc) \ - LE_BITS_TO_4BYTE( __pRxStatusDesc+16, 0, 32) -#define GET_RX_RPT2_DESC_MACID_VALID_2(__pRxStatusDesc) \ - LE_BITS_TO_4BYTE( __pRxStatusDesc+20, 0, 32) - -#define SET_EARLYMODE_PKTNUM(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr, 0, 4, __value) -#define SET_EARLYMODE_LEN0(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr, 4, 12, __value) -#define SET_EARLYMODE_LEN1(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr, 16, 12, __value) -#define SET_EARLYMODE_LEN2_1(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr, 28, 4, __value) -#define SET_EARLYMODE_LEN2_2(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr+4, 0, 8, __value) -#define SET_EARLYMODE_LEN3(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr+4, 8, 12, __value) -#define SET_EARLYMODE_LEN4(__paddr, __value) \ - SET_BITS_TO_LE_4BYTE(__paddr+4, 20, 12, __value) - -#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \ -do { \ - if(_size > TX_DESC_NEXT_DESC_OFFSET) \ - memset(__pdesc, 0, TX_DESC_NEXT_DESC_OFFSET); \ - else \ - memset(__pdesc, 0, _size); \ -} while (0); - -#define RX_HAL_IS_CCK_RATE(rxmcs)\ - (rxmcs == DESC_RATE1M ||\ - rxmcs == DESC_RATE2M ||\ - rxmcs == DESC_RATE5_5M ||\ - rxmcs == DESC_RATE11M) - -#define IS_LITTLE_ENDIAN 1 - -struct phy_rx_agc_info_t { - #if IS_LITTLE_ENDIAN - u8 gain:7,trsw:1; - #else - u8 trsw:1,gain:7; - #endif -}; -struct phy_status_rpt{ - struct phy_rx_agc_info_t path_agc[2]; - u8 ch_corr[2]; - u8 cck_sig_qual_ofdm_pwdb_all; - u8 cck_agc_rpt_ofdm_cfosho_a; - u8 cck_rpt_b_ofdm_cfosho_b; - u8 rsvd_1;//ch_corr_msb; - u8 noise_power_db_msb; - u8 path_cfotail[2]; - u8 pcts_mask[2]; - u8 stream_rxevm[2]; - u8 path_rxsnr[2]; - u8 noise_power_db_lsb; - u8 rsvd_2[3]; - u8 stream_csi[2]; - u8 stream_target_csi[2]; - u8 sig_evm; - u8 rsvd_3; -#if IS_LITTLE_ENDIAN - u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ - u8 sgi_en:1; - u8 rxsc:2; - u8 idle_long:1; - u8 r_ant_train_en:1; - u8 ant_sel_b:1; - u8 ant_sel:1; -#else /* _BIG_ENDIAN_ */ - u8 ant_sel:1; - u8 ant_sel_b:1; - u8 r_ant_train_en:1; - u8 idle_long:1; - u8 rxsc:2; - u8 sgi_en:1; - u8 antsel_rx_keep_2:1; /*ex_intf_flg:1;*/ -#endif -}__packed; - -struct rx_fwinfo_8821ae { - u8 gain_trsw[4]; - u8 pwdb_all; - u8 cfosho[4]; - u8 cfotail[4]; - char rxevm[2]; - char rxsnr[4]; - u8 pdsnr[2]; - u8 csi_current[2]; - u8 csi_target[2]; - u8 sigevm; - u8 max_ex_pwr; - u8 ex_intf_flag:1; - u8 sgi_en:1; - u8 rxsc:2; - u8 reserve:4; -} __packed; - -struct tx_desc_8821ae { - u32 pktsize:16; - u32 offset:8; - u32 bmc:1; - u32 htc:1; - u32 lastseg:1; - u32 firstseg:1; - u32 linip:1; - u32 noacm:1; - u32 gf:1; - u32 own:1; - - u32 macid:6; - u32 rsvd0:2; - u32 queuesel:5; - u32 rd_nav_ext:1; - u32 lsig_txop_en:1; - u32 pifs:1; - u32 rateid:4; - u32 nav_usehdr:1; - u32 en_descid:1; - u32 sectype:2; - u32 pktoffset:8; - - u32 rts_rc:6; - u32 data_rc:6; - u32 agg_en:1; - u32 rdg_en:1; - u32 bar_retryht:2; - u32 agg_break:1; - u32 morefrag:1; - u32 raw:1; - u32 ccx:1; - u32 ampdudensity:3; - u32 bt_int:1; - u32 ant_sela:1; - u32 ant_selb:1; - u32 txant_cck:2; - u32 txant_l:2; - u32 txant_ht:2; - - u32 nextheadpage:8; - u32 tailpage:8; - u32 seq:12; - u32 cpu_handle:1; - u32 tag1:1; - u32 trigger_int:1; - u32 hwseq_en:1; - - u32 rtsrate:5; - u32 apdcfe:1; - u32 qos:1; - u32 hwseq_ssn:1; - u32 userrate:1; - u32 dis_rtsfb:1; - u32 dis_datafb:1; - u32 cts2self:1; - u32 rts_en:1; - u32 hwrts_en:1; - u32 portid:1; - u32 pwr_status:3; - u32 waitdcts:1; - u32 cts2ap_en:1; - u32 txsc:2; - u32 stbc:2; - u32 txshort:1; - u32 txbw:1; - u32 rtsshort:1; - u32 rtsbw:1; - u32 rtssc:2; - u32 rtsstbc:2; - - u32 txrate:6; - u32 shortgi:1; - u32 ccxt:1; - u32 txrate_fb_lmt:5; - u32 rtsrate_fb_lmt:4; - u32 retrylmt_en:1; - u32 txretrylmt:6; - u32 usb_txaggnum:8; - - u32 txagca:5; - u32 txagcb:5; - u32 usemaxlen:1; - u32 maxaggnum:5; - u32 mcsg1maxlen:4; - u32 mcsg2maxlen:4; - u32 mcsg3maxlen:4; - u32 mcs7sgimaxlen:4; - - u32 txbuffersize:16; - u32 sw_offset30:8; - u32 sw_offset31:4; - u32 rsvd1:1; - u32 antsel_c:1; - u32 null_0:1; - u32 null_1:1; - - u32 txbuffaddr; - u32 txbufferaddr64; - u32 nextdescaddress; - u32 nextdescaddress64; - - u32 reserve_pass_pcie_mm_limit[4]; -} __packed; - -struct rx_desc_8821ae { - u32 length:14; - u32 crc32:1; - u32 icverror:1; - u32 drv_infosize:4; - u32 security:3; - u32 qos:1; - u32 shift:2; - u32 phystatus:1; - u32 swdec:1; - u32 lastseg:1; - u32 firstseg:1; - u32 eor:1; - u32 own:1; - - u32 macid:6; - u32 tid:4; - u32 hwrsvd:5; - u32 paggr:1; - u32 faggr:1; - u32 a1_fit:4; - u32 a2_fit:4; - u32 pam:1; - u32 pwr:1; - u32 moredata:1; - u32 morefrag:1; - u32 type:2; - u32 mc:1; - u32 bc:1; - - u32 seq:12; - u32 frag:4; - u32 nextpktlen:14; - u32 nextind:1; - u32 rsvd:1; - - u32 rxmcs:6; - u32 rxht:1; - u32 amsdu:1; - u32 splcp:1; - u32 bandwidth:1; - u32 htc:1; - u32 tcpchk_rpt:1; - u32 ipcchk_rpt:1; - u32 tcpchk_valid:1; - u32 hwpcerr:1; - u32 hwpcind:1; - u32 iv0:16; - - u32 iv1; - - u32 tsfl; - - u32 bufferaddress; - u32 bufferaddress64; - -} __packed; - -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) -void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, u8 *txbd, - struct ieee80211_tx_info *info, struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc); -#else -/*<delete in kernel end>*/ -void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, u8 *txbd, - struct ieee80211_tx_info *info, - struct ieee80211_sta *sta, - struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc); -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ -bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw, - struct rtl_stats *status, - struct ieee80211_rx_status *rx_status, - u8 *pdesc, struct sk_buff *skb); -void rtl8821ae_set_desc(struct ieee80211_hw * hw, u8 *pdesc, bool istx, u8 desc_name, u8 *val); -u32 rtl8821ae_get_desc(u8 *pdesc, bool istx, u8 desc_name); -bool rtl8821ae_is_tx_desc_closed(struct ieee80211_hw *hw, - u8 hw_queue, u16 index); -void rtl8821ae_tx_polling(struct ieee80211_hw *hw, u8 hw_queue); -void rtl8821ae_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc, - bool b_firstseg, bool b_lastseg, - struct sk_buff *skb); -#endif -- 1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html