1
0
mirror of https://github.com/aircrack-ng/rtl8812au.git synced 2024-11-14 18:05:36 +00:00
rtl8812au/hal/phydm/phydm.c

3095 lines
75 KiB
C
Raw Normal View History

2018-06-22 16:48:32 +00:00
/******************************************************************************
*
2018-08-24 20:52:34 +00:00
* Copyright(c) 2007 - 2017 Realtek Corporation.
2018-06-22 16:48:32 +00:00
*
* 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
2018-08-24 20:52:34 +00:00
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
2018-06-22 16:48:32 +00:00
* more details.
*
2018-08-24 20:52:34 +00:00
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* wlanfae <wlanfae@realtek.com>
* Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
* Hsinchu 300, Taiwan.
*
* Larry Finger <Larry.Finger@lwfinger.net>
*
2018-06-22 16:48:32 +00:00
*****************************************************************************/
/* ************************************************************
* include files
* ************************************************************ */
#include "mp_precomp.h"
#include "phydm_precomp.h"
const u16 phy_rate_table[] = { /*20M*/
1, 2, 5, 11,
6, 9, 12, 18, 24, 36, 48, 54,
6, 13, 19, 26, 39, 52, 58, 65, /*MCS0~7*/
13, 26, 39, 52, 78, 104, 117, 130 /*MCS8~15*/
};
void
phydm_traffic_load_decision(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u8 bit_shift_num = 0;
/*---TP & Trafic-load calculation---*/
2018-08-24 20:52:34 +00:00
if (dm->last_tx_ok_cnt > *dm->num_tx_bytes_unicast)
dm->last_tx_ok_cnt = *dm->num_tx_bytes_unicast;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (dm->last_rx_ok_cnt > *dm->num_rx_bytes_unicast)
dm->last_rx_ok_cnt = *dm->num_rx_bytes_unicast;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->cur_tx_ok_cnt = *dm->num_tx_bytes_unicast - dm->last_tx_ok_cnt;
dm->cur_rx_ok_cnt = *dm->num_rx_bytes_unicast - dm->last_rx_ok_cnt;
dm->last_tx_ok_cnt = *dm->num_tx_bytes_unicast;
dm->last_rx_ok_cnt = *dm->num_rx_bytes_unicast;
2018-06-22 16:48:32 +00:00
bit_shift_num = 17 + (PHYDM_WATCH_DOG_PERIOD - 1); /*AP: <<3(8bit), >>20(10^6,M), >>0(1sec)*/
/*WIN&CE: <<3(8bit), >>20(10^6,M), >>1(2sec)*/
2018-08-24 20:52:34 +00:00
dm->tx_tp = ((dm->tx_tp) >> 1) + (u32)(((dm->cur_tx_ok_cnt) >> bit_shift_num) >> 1);
dm->rx_tp = ((dm->rx_tp) >> 1) + (u32)(((dm->cur_rx_ok_cnt) >> bit_shift_num) >> 1);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->total_tp = dm->tx_tp + dm->rx_tp;
2018-06-22 16:48:32 +00:00
/*[Calculate TX/RX state]*/
2018-08-24 20:52:34 +00:00
if (dm->tx_tp > (dm->rx_tp << 1))
dm->txrx_state_all = TX_STATE;
else if (dm->rx_tp > (dm->tx_tp << 1))
dm->txrx_state_all = RX_STATE;
2018-06-22 16:48:32 +00:00
else
2018-08-24 20:52:34 +00:00
dm->txrx_state_all = BI_DIRECTION_STATE;
2018-06-22 16:48:32 +00:00
/*[Calculate consecutive idlel time]*/
2018-08-24 20:52:34 +00:00
if (dm->total_tp == 0)
dm->consecutive_idlel_time += PHYDM_WATCH_DOG_PERIOD;
2018-06-22 16:48:32 +00:00
else
2018-08-24 20:52:34 +00:00
dm->consecutive_idlel_time = 0;
2018-06-22 16:48:32 +00:00
/*[Traffic load decision]*/
2018-08-24 20:52:34 +00:00
dm->pre_traffic_load = dm->traffic_load;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (dm->cur_tx_ok_cnt > 1875000 || dm->cur_rx_ok_cnt > 1875000) { /* ( 1.875M * 8bit ) / 2sec= 7.5M bits /sec )*/
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->traffic_load = TRAFFIC_HIGH;
2018-06-22 16:48:32 +00:00
/**/
2018-08-24 20:52:34 +00:00
} else if (dm->cur_tx_ok_cnt > 500000 || dm->cur_rx_ok_cnt > 500000) { /*( 0.5M * 8bit ) / 2sec = 2M bits /sec )*/
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->traffic_load = TRAFFIC_MID;
2018-06-22 16:48:32 +00:00
/**/
2018-08-24 20:52:34 +00:00
} else if (dm->cur_tx_ok_cnt > 100000 || dm->cur_rx_ok_cnt > 100000) { /*( 0.1M * 8bit ) / 2sec = 0.4M bits /sec )*/
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->traffic_load = TRAFFIC_LOW;
2018-06-22 16:48:32 +00:00
/**/
} else {
2018-08-24 20:52:34 +00:00
dm->traffic_load = TRAFFIC_ULTRA_LOW;
2018-06-22 16:48:32 +00:00
/**/
}
/*
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, DBG_COMMON_FLOW, "cur_tx_ok_cnt = %d, cur_rx_ok_cnt = %d, last_tx_ok_cnt = %d, last_rx_ok_cnt = %d\n",
dm->cur_tx_ok_cnt, dm->cur_rx_ok_cnt, dm->last_tx_ok_cnt, dm->last_rx_ok_cnt);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, DBG_COMMON_FLOW, "tx_tp = %d, rx_tp = %d\n",
dm->tx_tp, dm->rx_tp);
2018-06-22 16:48:32 +00:00
*/
}
void
phydm_init_cck_setting(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (RTL8192E_SUPPORT == 1)
u32 value_824, value_82c;
#endif
2018-08-24 20:52:34 +00:00
dm->is_cck_high_power = (boolean) odm_get_bb_reg(dm, ODM_REG(CCK_RPT_FORMAT, dm), ODM_BIT(CCK_RPT_FORMAT, dm));
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
phydm_config_cck_rx_antenna_init(dm);
phydm_config_cck_rx_path(dm, BB_PATH_A);
2018-06-22 16:48:32 +00:00
#if (RTL8192E_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & (ODM_RTL8192E)) {
2018-06-22 16:48:32 +00:00
/* 0x824[9] = 0x82C[9] = 0xA80[7] those registers setting should be equal or CCK RSSI report may be incorrect */
2018-08-24 20:52:34 +00:00
value_824 = odm_get_bb_reg(dm, 0x824, BIT(9));
value_82c = odm_get_bb_reg(dm, 0x82c, BIT(9));
2018-06-22 16:48:32 +00:00
if (value_824 != value_82c)
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, 0x82c, BIT(9), value_824);
odm_set_bb_reg(dm, 0xa80, BIT(7), value_824);
dm->cck_agc_report_type = (boolean)value_824;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_INIT, "cck_agc_report_type = (( %d )), ext_lna_gain = (( %d ))\n", dm->cck_agc_report_type, dm->ext_lna_gain);
2018-06-22 16:48:32 +00:00
}
#endif
#if ((RTL8703B_SUPPORT == 1) || (RTL8723D_SUPPORT == 1) || (RTL8710B_SUPPORT == 1))
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & (ODM_RTL8703B | ODM_RTL8723D | ODM_RTL8710B)) {
dm->cck_agc_report_type = odm_get_bb_reg(dm, 0x950, BIT(11)) ? 1 : 0; /*1: 4bit LNA, 0: 3bit LNA */
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (dm->cck_agc_report_type != 1) {
pr_debug("[Warning] 8703B/8723D/8710B CCK should be 4bit LNA, ie. 0x950[11] = 1\n");
2018-06-22 16:48:32 +00:00
/**/
}
}
#endif
#if (RTL8821C_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8821C) {
dm->cck_new_agc = odm_get_bb_reg(dm, 0xa9c, BIT(17)) ? true : false; /*1: new agc 0: old agc*/
if (dm->cck_new_agc == 0 && dm->default_rf_set_8821c == SWITCH_TO_BTG)
dm->cck_agc_report_type = 1;
2018-06-22 16:48:32 +00:00
}
#endif
#if ((RTL8723D_SUPPORT == 1) || (RTL8822B_SUPPORT == 1) || (RTL8197F_SUPPORT == 1) || (RTL8710B_SUPPORT == 1))
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & (ODM_RTL8723D | ODM_RTL8822B | ODM_RTL8197F | ODM_RTL8710B))
dm->cck_new_agc = odm_get_bb_reg(dm, 0xa9c, BIT(17)) ? true : false; /*1: new agc 0: old agc*/
2018-06-22 16:48:32 +00:00
else
#endif
{
2018-08-24 20:52:34 +00:00
dm->cck_new_agc = false;
2018-06-22 16:48:32 +00:00
/**/
}
2018-08-24 20:52:34 +00:00
phydm_get_cck_rssi_table_from_reg(dm);
2018-06-22 16:48:32 +00:00
}
void
phydm_init_hw_info_by_rfe(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (RTL8822B_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8822B)
phydm_init_hw_info_by_rfe_type_8822b(dm);
2018-06-22 16:48:32 +00:00
#endif
#if (RTL8821C_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8821C)
phydm_init_hw_info_by_rfe_type_8821c(dm);
2018-06-22 16:48:32 +00:00
#endif
#if (RTL8197F_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8197F)
phydm_init_hw_info_by_rfe_type_8197f(dm);
2018-06-22 16:48:32 +00:00
#endif
}
void
phydm_common_info_self_init(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
phydm_init_cck_setting(dm);
dm->rf_path_rx_enable = (u8) odm_get_bb_reg(dm, ODM_REG(BB_RX_PATH, dm), ODM_BIT(BB_RX_PATH, dm));
2018-06-22 16:48:32 +00:00
#if (DM_ODM_SUPPORT_TYPE != ODM_CE)
2018-08-24 20:52:34 +00:00
dm->is_net_closed = &dm->BOOLEAN_temp;
phydm_init_debug_setting(dm);
#endif
phydm_init_trx_antenna_setting(dm);
phydm_init_soft_ml_setting(dm);
dm->phydm_sys_up_time = 0;
if (dm->support_ic_type & ODM_IC_1SS)
dm->num_rf_path = 1;
else if (dm->support_ic_type & ODM_IC_2SS)
dm->num_rf_path = 2;
else if (dm->support_ic_type & ODM_IC_3SS)
dm->num_rf_path = 3;
else if (dm->support_ic_type & ODM_IC_4SS)
dm->num_rf_path = 4;
else
dm->num_rf_path = 1;
dm->tx_rate = 0xFF;
dm->rssi_min_by_path = 0xFF;
dm->number_linked_client = 0;
dm->pre_number_linked_client = 0;
dm->number_active_client = 0;
dm->pre_number_active_client = 0;
dm->last_tx_ok_cnt = 0;
dm->last_rx_ok_cnt = 0;
dm->tx_tp = 0;
dm->rx_tp = 0;
dm->total_tp = 0;
dm->traffic_load = TRAFFIC_LOW;
dm->nbi_set_result = 0;
dm->is_init_hw_info_by_rfe = false;
dm->pre_dbg_priority = BB_DBGPORT_RELEASE;
dm->tp_active_th = 5;
dm->disable_phydm_watchdog = 0;
dm->u8_dummy = 0xf;
dm->u16_dummy = 0xffff;
dm->u32_dummy = 0xffffffff;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
/*odm_memory_set(dm, &(dm->pause_lv_table.lv_dig), 0, sizeof(struct phydm_pause_lv));*/
dm->pause_lv_table.lv_cckpd = PHYDM_PAUSE_RELEASE;
dm->pause_lv_table.lv_dig = PHYDM_PAUSE_RELEASE;
2018-06-22 16:48:32 +00:00
}
void
phydm_cmn_sta_info_update(
2018-08-24 20:52:34 +00:00
void *dm_void,
2018-06-22 16:48:32 +00:00
u8 macid
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
struct cmn_sta_info *sta = dm->phydm_sta_info[macid];
struct ra_sta_info *ra = NULL;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (is_sta_active(sta)) {
ra = &sta->ra_info;
2018-06-22 16:48:32 +00:00
} else {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, DBG_RA_MASK, "[Warning] %s invalid sta_info\n", __func__);
2018-06-22 16:48:32 +00:00
return;
}
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, DBG_RA_MASK, "%s ======>\n", __func__);
PHYDM_DBG(dm, DBG_RA_MASK, "MACID=%d\n", sta->mac_id);
2018-06-22 16:48:32 +00:00
/*[Calculate TX/RX state]*/
2018-08-24 20:52:34 +00:00
if (sta->tx_moving_average_tp > (sta->rx_moving_average_tp << 1))
ra->txrx_state= TX_STATE;
else if (sta->rx_moving_average_tp > (sta->tx_moving_average_tp << 1))
ra->txrx_state = RX_STATE;
2018-06-22 16:48:32 +00:00
else
2018-08-24 20:52:34 +00:00
ra->txrx_state = BI_DIRECTION_STATE;
ra->is_noisy = dm->noisy_decision;
2018-06-22 16:48:32 +00:00
}
void
phydm_common_info_self_update(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
u8 sta_cnt = 0, num_active_client = 0;
u32 i, one_entry_macid = 0;
u32 ma_rx_tp = 0;
2018-08-24 20:52:34 +00:00
struct cmn_sta_info *sta;
2018-06-22 16:48:32 +00:00
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
2018-08-24 20:52:34 +00:00
PADAPTER adapter = (PADAPTER)dm->adapter;
PMGNT_INFO mgnt_info = &((PADAPTER)adapter)->MgntInfo;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
sta = dm->phydm_sta_info[0];
if (mgnt_info->mAssoc) {
sta->dm_ctrl |= STA_DM_CTRL_ACTIVE;
2018-06-22 16:48:32 +00:00
for (i = 0; i < 6; i++)
2018-08-24 20:52:34 +00:00
sta->mac_addr[i] = mgnt_info->Bssid[i];
2018-06-22 16:48:32 +00:00
} else if (GetFirstClientPort(adapter)) {
2018-08-24 20:52:34 +00:00
//void *client_adapter = GetFirstClientPort(adapter);
struct _ADAPTER *client_adapter = GetFirstClientPort(adapter);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
sta->dm_ctrl |= STA_DM_CTRL_ACTIVE;
2018-06-22 16:48:32 +00:00
for (i = 0; i < 6; i++)
2018-08-24 20:52:34 +00:00
sta->mac_addr[i] = client_adapter->MgntInfo.Bssid[i];
2018-06-22 16:48:32 +00:00
} else {
2018-08-24 20:52:34 +00:00
sta->dm_ctrl = sta->dm_ctrl & (~STA_DM_CTRL_ACTIVE);
2018-06-22 16:48:32 +00:00
for (i = 0; i < 6; i++)
2018-08-24 20:52:34 +00:00
sta->mac_addr[i] = 0;
2018-06-22 16:48:32 +00:00
}
/* STA mode is linked to AP */
2018-08-24 20:52:34 +00:00
if (is_sta_active(sta) && !ACTING_AS_AP(adapter))
dm->bsta_state = true;
2018-06-22 16:48:32 +00:00
else
2018-08-24 20:52:34 +00:00
dm->bsta_state = false;
2018-06-22 16:48:32 +00:00
#endif
for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) {
2018-08-24 20:52:34 +00:00
sta = dm->phydm_sta_info[i];
if (is_sta_active(sta)) {
2018-06-22 16:48:32 +00:00
sta_cnt++;
if (sta_cnt == 1)
one_entry_macid = i;
2018-08-24 20:52:34 +00:00
phydm_cmn_sta_info_update(dm, (u8)i);
#if (BEAMFORMING_SUPPORT == 1)
//phydm_get_txbf_device_num(dm, (u8)i);
#endif
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
ma_rx_tp = sta->rx_moving_average_tp + sta->tx_moving_average_tp;
PHYDM_DBG(dm, DBG_COMMON_FLOW, "TP[%d]: ((%d )) bit/sec\n", i, ma_rx_tp);
2018-06-22 16:48:32 +00:00
if (ma_rx_tp > ACTIVE_TP_THRESHOLD)
num_active_client++;
}
}
2018-08-24 20:52:34 +00:00
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
dm->is_linked = (sta_cnt != 0) ? true : false;
#endif
2018-06-22 16:48:32 +00:00
if (sta_cnt == 1) {
2018-08-24 20:52:34 +00:00
dm->is_one_entry_only = true;
dm->one_entry_macid = one_entry_macid;
dm->one_entry_tp = ma_rx_tp;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->tp_active_occur = 0;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, DBG_COMMON_FLOW, "one_entry_tp=((%d)), pre_one_entry_tp=((%d))\n",
dm->one_entry_tp, dm->pre_one_entry_tp);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if ((dm->one_entry_tp > dm->pre_one_entry_tp) && (dm->pre_one_entry_tp <= 2)) {
if ((dm->one_entry_tp - dm->pre_one_entry_tp) > dm->tp_active_th)
dm->tp_active_occur = 1;
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
dm->pre_one_entry_tp = dm->one_entry_tp;
2018-06-22 16:48:32 +00:00
} else
2018-08-24 20:52:34 +00:00
dm->is_one_entry_only = false;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->pre_number_linked_client = dm->number_linked_client;
dm->pre_number_active_client = dm->number_active_client;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->number_linked_client = sta_cnt;
dm->number_active_client = num_active_client;
2018-06-22 16:48:32 +00:00
/*Traffic load information update*/
2018-08-24 20:52:34 +00:00
phydm_traffic_load_decision(dm);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->phydm_sys_up_time += PHYDM_WATCH_DOG_PERIOD;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->is_dfs_band = phydm_is_dfs_band(dm);
dm->phy_dbg_info.show_phy_sts_cnt = 0;
2018-06-22 16:48:32 +00:00
}
void
phydm_common_info_self_reset(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
2018-08-24 20:52:34 +00:00
dm->phy_dbg_info.num_qry_beacon_pkt = 0;
2018-06-22 16:48:32 +00:00
#endif
}
void *
phydm_get_structure(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm,
2018-06-22 16:48:32 +00:00
u8 structure_type
)
{
2018-08-24 20:52:34 +00:00
void *structure = NULL;
2018-06-22 16:48:32 +00:00
#if RTL8195A_SUPPORT
switch (structure_type) {
case PHYDM_FALSEALMCNT:
2018-08-24 20:52:34 +00:00
structure = &false_alm_cnt;
2018-06-22 16:48:32 +00:00
break;
case PHYDM_CFOTRACK:
2018-08-24 20:52:34 +00:00
structure = &dm_cfo_track;
2018-06-22 16:48:32 +00:00
break;
case PHYDM_ADAPTIVITY:
2018-08-24 20:52:34 +00:00
structure = &dm->adaptivity;
2018-06-22 16:48:32 +00:00
break;
default:
break;
}
#else
switch (structure_type) {
case PHYDM_FALSEALMCNT:
2018-08-24 20:52:34 +00:00
structure = &dm->false_alm_cnt;
2018-06-22 16:48:32 +00:00
break;
case PHYDM_CFOTRACK:
2018-08-24 20:52:34 +00:00
structure = &dm->dm_cfo_track;
2018-06-22 16:48:32 +00:00
break;
case PHYDM_ADAPTIVITY:
2018-08-24 20:52:34 +00:00
structure = &dm->adaptivity;
2018-06-22 16:48:32 +00:00
break;
case PHYDM_DFS:
2018-08-24 20:52:34 +00:00
structure = &dm->dfs;
2018-06-22 16:48:32 +00:00
break;
default:
break;
}
#endif
2018-08-24 20:52:34 +00:00
return structure;
2018-06-22 16:48:32 +00:00
}
void
phydm_hw_setting(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (RTL8821A_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8821)
odm_hw_setting_8821a(dm);
2018-06-22 16:48:32 +00:00
#endif
2018-08-25 16:21:32 +00:00
#if 0 /* TODO: implementation done but may not work and do nothing with current flags. Commenting the code to match previous version behavior*/
2018-06-22 16:48:32 +00:00
#if (RTL8814A_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8814A)
phydm_hwsetting_8814a(dm);
2018-07-13 12:56:34 +00:00
#endif
2018-08-25 16:21:32 +00:00
#endif
2018-06-22 16:48:32 +00:00
#if (RTL8822B_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8822B)
phydm_hwsetting_8822b(dm);
#endif
#if (RTL8812A_SUPPORT == 1)
if (dm->support_ic_type & ODM_RTL8812)
phydm_hwsetting_8812a(dm);
2018-06-22 16:48:32 +00:00
#endif
#if (RTL8197F_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_RTL8197F)
phydm_hwsetting_8197f(dm);
2018-06-22 16:48:32 +00:00
#endif
}
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
u64
phydm_supportability_init_win(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u64 support_ability = 0;
2018-08-24 20:52:34 +00:00
switch (dm->support_ic_type) {
2018-06-22 16:48:32 +00:00
/*---------------N Series--------------------*/
#if (RTL8188E_SUPPORT == 1)
case ODM_RTL8188E:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
2018-08-24 20:52:34 +00:00
ODM_BB_ENV_MONITOR |
2018-06-22 16:48:32 +00:00
ODM_BB_PRIMARY_CCA;
break;
#endif
#if (RTL8192E_SUPPORT == 1)
case ODM_RTL8192E:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
2018-08-24 20:52:34 +00:00
ODM_BB_ENV_MONITOR |
2018-06-22 16:48:32 +00:00
ODM_BB_PRIMARY_CCA;
break;
#endif
#if (RTL8723B_SUPPORT == 1)
case ODM_RTL8723B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
2018-08-24 20:52:34 +00:00
ODM_BB_ENV_MONITOR |
2018-06-22 16:48:32 +00:00
ODM_BB_PRIMARY_CCA;
break;
#endif
#if (RTL8703B_SUPPORT == 1)
case ODM_RTL8703B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
break;
#endif
#if (RTL8723D_SUPPORT == 1)
case ODM_RTL8723D:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/* ODM_BB_PWR_TRAIN | */
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
break;
#endif
#if (RTL8710B_SUPPORT == 1)
case ODM_RTL8710B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
break;
#endif
#if (RTL8188F_SUPPORT == 1)
case ODM_RTL8188F:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
break;
#endif
/*---------------AC Series-------------------*/
#if ((RTL8812A_SUPPORT == 1) || (RTL8821A_SUPPORT == 1))
case ODM_RTL8812:
case ODM_RTL8821:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_DYNAMIC_TXPWR |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
break;
#endif
#if (RTL8814A_SUPPORT == 1)
case ODM_RTL8814A:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_DYNAMIC_TXPWR |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
break;
#endif
#if (RTL8814B_SUPPORT == 1)
case ODM_RTL8814B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
break;
#endif
#if (RTL8822B_SUPPORT == 1)
case ODM_RTL8822B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
2018-08-24 20:52:34 +00:00
ODM_BB_ENV_MONITOR |
2018-06-22 16:48:32 +00:00
ODM_BB_ADAPTIVE_SOML;
break;
#endif
#if (RTL8821C_SUPPORT == 1)
case ODM_RTL8821C:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
break;
#endif
default:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
2018-08-24 20:52:34 +00:00
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
pr_debug("[Warning] Supportability Init Warning !!!\n");
2018-06-22 16:48:32 +00:00
break;
}
return support_ability;
}
#endif
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
u64
phydm_supportability_init_ce(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u64 support_ability = 0;
2018-08-24 20:52:34 +00:00
switch (dm->support_ic_type) {
2018-06-22 16:48:32 +00:00
/*---------------N Series--------------------*/
#if (RTL8188E_SUPPORT == 1)
case ODM_RTL8188E:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
ODM_BB_PRIMARY_CCA;
break;
#endif
#if (RTL8192E_SUPPORT == 1)
case ODM_RTL8192E:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
ODM_BB_PRIMARY_CCA;
break;
#endif
#if (RTL8723B_SUPPORT == 1)
case ODM_RTL8723B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
ODM_BB_PRIMARY_CCA;
break;
#endif
#if (RTL8703B_SUPPORT == 1)
case ODM_RTL8703B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8723D_SUPPORT == 1)
case ODM_RTL8723D:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/* ODM_BB_PWR_TRAIN | */
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8710B_SUPPORT == 1)
case ODM_RTL8710B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8188F_SUPPORT == 1)
case ODM_RTL8188F:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
/*---------------AC Series-------------------*/
#if ((RTL8812A_SUPPORT == 1) || (RTL8821A_SUPPORT == 1))
case ODM_RTL8812:
case ODM_RTL8821:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8814A_SUPPORT == 1)
case ODM_RTL8814A:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8814B_SUPPORT == 1)
case ODM_RTL8814B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8822B_SUPPORT == 1)
case ODM_RTL8822B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8821C_SUPPORT == 1)
case ODM_RTL8821C:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
default:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-08-24 20:52:34 +00:00
pr_debug("[Warning] Supportability Init Warning !!!\n");
2018-06-22 16:48:32 +00:00
break;
}
2018-07-02 16:49:32 +00:00
2018-06-22 16:48:32 +00:00
return support_ability;
}
#endif
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
u64
phydm_supportability_init_ap(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u64 support_ability = 0;
2018-08-24 20:52:34 +00:00
switch (dm->support_ic_type) {
2018-06-22 16:48:32 +00:00
/*---------------N Series--------------------*/
#if (RTL8188E_SUPPORT == 1)
case ODM_RTL8188E:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
ODM_BB_PRIMARY_CCA;
break;
#endif
#if (RTL8192E_SUPPORT == 1)
case ODM_RTL8192E:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR |
ODM_BB_PRIMARY_CCA;
break;
#endif
#if (RTL8723B_SUPPORT == 1)
case ODM_RTL8723B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if ((RTL8198F_SUPPORT == 1) || (RTL8197F_SUPPORT == 1))
case ODM_RTL8198F:
case ODM_RTL8197F:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ADAPTIVE_SOML |
ODM_BB_ENV_MONITOR |
ODM_BB_LNA_SAT_CHK |
ODM_BB_PRIMARY_CCA;
break;
#endif
/*---------------AC Series-------------------*/
#if (RTL8881A_SUPPORT == 1)
case ODM_RTL8881A:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8814A_SUPPORT == 1)
case ODM_RTL8814A:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8814B_SUPPORT == 1)
case ODM_RTL8814B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8822B_SUPPORT == 1)
case ODM_RTL8822B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
2018-08-24 20:52:34 +00:00
/*ODM_BB_ADAPTIVE_SOML |*/
2018-06-22 16:48:32 +00:00
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
2018-08-24 20:52:34 +00:00
ODM_BB_ENV_MONITOR ;
2018-06-22 16:48:32 +00:00
break;
#endif
#if (RTL8821C_SUPPORT == 1)
case ODM_RTL8821C:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
default:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-08-24 20:52:34 +00:00
pr_debug("[Warning] Supportability Init Warning !!!\n");
2018-06-22 16:48:32 +00:00
break;
}
#if 0
/*[Config Antenna Diveristy]*/
2018-08-24 20:52:34 +00:00
if (*(dm->enable_antdiv))
2018-06-22 16:48:32 +00:00
support_ability |= ODM_BB_ANT_DIV;
/*[Config Adaptivity]*/
2018-08-24 20:52:34 +00:00
if (*(dm->enable_adaptivity))
2018-06-22 16:48:32 +00:00
support_ability |= ODM_BB_ADAPTIVITY;
#endif
return support_ability;
}
#endif
#if (DM_ODM_SUPPORT_TYPE & (ODM_IOT))
u64
phydm_supportability_init_iot(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u64 support_ability = 0;
2018-08-24 20:52:34 +00:00
switch (dm->support_ic_type) {
2018-06-22 16:48:32 +00:00
#if (RTL8710B_SUPPORT == 1)
case ODM_RTL8710B:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
#if (RTL8195A_SUPPORT == 1)
case ODM_RTL8195A:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
break;
#endif
default:
support_ability |=
ODM_BB_DIG |
ODM_BB_RA_MASK |
/*ODM_BB_DYNAMIC_TXPWR |*/
ODM_BB_FA_CNT |
ODM_BB_RSSI_MONITOR |
ODM_BB_CCK_PD |
/*ODM_BB_PWR_TRAIN |*/
ODM_BB_RATE_ADAPTIVE |
ODM_BB_CFO_TRACKING |
ODM_BB_ENV_MONITOR;
2018-08-24 20:52:34 +00:00
pr_debug("[Warning] Supportability Init Warning !!!\n");
2018-06-22 16:48:32 +00:00
break;
}
2018-07-02 16:49:32 +00:00
2018-06-22 16:48:32 +00:00
return support_ability;
}
#endif
void
phydm_fwoffload_ability_init(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm,
2018-06-22 16:48:32 +00:00
enum phydm_offload_ability offload_ability
)
{
switch (offload_ability) {
case PHYDM_PHY_PARAM_OFFLOAD:
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8821C))
dm->fw_offload_ability |= PHYDM_PHY_PARAM_OFFLOAD;
2018-06-22 16:48:32 +00:00
break;
case PHYDM_RF_IQK_OFFLOAD:
2018-08-24 20:52:34 +00:00
dm->fw_offload_ability |= PHYDM_RF_IQK_OFFLOAD;
2018-06-22 16:48:32 +00:00
break;
default:
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_INIT, "fwofflad, wrong init type!!\n");
2018-06-22 16:48:32 +00:00
break;
}
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_INIT,
"fw_offload_ability = %x\n", dm->fw_offload_ability);
2018-06-22 16:48:32 +00:00
}
void
phydm_fwoffload_ability_clear(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm,
2018-06-22 16:48:32 +00:00
enum phydm_offload_ability offload_ability
)
{
switch (offload_ability) {
case PHYDM_PHY_PARAM_OFFLOAD:
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & (ODM_RTL8814A | ODM_RTL8822B | ODM_RTL8821C))
dm->fw_offload_ability &= (~PHYDM_PHY_PARAM_OFFLOAD);
2018-06-22 16:48:32 +00:00
break;
case PHYDM_RF_IQK_OFFLOAD:
2018-08-24 20:52:34 +00:00
dm->fw_offload_ability &= (~PHYDM_RF_IQK_OFFLOAD);
2018-06-22 16:48:32 +00:00
break;
default:
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_INIT, "fwofflad, wrong init type!!\n");
2018-06-22 16:48:32 +00:00
break;
}
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_INIT,
"fw_offload_ability = %x\n", dm->fw_offload_ability);
2018-06-22 16:48:32 +00:00
}
void
phydm_supportability_init(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u64 support_ability;
2018-08-24 20:52:34 +00:00
if (*dm->mp_mode == true) {
2018-06-22 16:48:32 +00:00
support_ability = 0;
/**/
} else {
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN))
2018-08-24 20:52:34 +00:00
support_ability = phydm_supportability_init_win(dm);
2018-06-22 16:48:32 +00:00
#elif (DM_ODM_SUPPORT_TYPE & (ODM_AP))
2018-08-24 20:52:34 +00:00
support_ability = phydm_supportability_init_ap(dm);
2018-06-22 16:48:32 +00:00
#elif(DM_ODM_SUPPORT_TYPE & (ODM_CE))
2018-08-24 20:52:34 +00:00
support_ability = phydm_supportability_init_ce(dm);
2018-06-22 16:48:32 +00:00
#elif(DM_ODM_SUPPORT_TYPE & (ODM_IOT))
2018-08-24 20:52:34 +00:00
support_ability = phydm_supportability_init_iot(dm);
2018-06-22 16:48:32 +00:00
#endif
2018-07-02 16:49:32 +00:00
/*[Config Antenna Diveristy]*/
2018-08-24 20:52:34 +00:00
if (IS_FUNC_EN(dm->enable_antdiv))
2018-07-02 16:49:32 +00:00
support_ability |= ODM_BB_ANT_DIV;
/*[Config Adaptive SOML]*/
2018-08-24 20:52:34 +00:00
if (IS_FUNC_EN(dm->en_adap_soml))
2018-07-02 16:49:32 +00:00
support_ability |= ODM_BB_ADAPTIVE_SOML;
/*[Config Adaptivity]*/
2018-08-24 20:52:34 +00:00
if (IS_FUNC_EN(dm->enable_adaptivity))
2018-07-02 16:49:32 +00:00
support_ability |= ODM_BB_ADAPTIVITY;
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
odm_cmn_info_init(dm, ODM_CMNINFO_ABILITY, support_ability);
PHYDM_DBG(dm, ODM_COMP_INIT, "IC = ((0x%x)), Supportability Init = ((0x%llx))\n", dm->support_ic_type, dm->support_ability);
2018-06-22 16:48:32 +00:00
}
void
phydm_rfe_init(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_INIT, "RFE_Init\n");
2018-06-22 16:48:32 +00:00
#if (RTL8822B_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type == ODM_RTL8822B) {
phydm_rfe_8822b_init(dm);
2018-06-22 16:48:32 +00:00
/**/
}
#endif
}
void
phydm_dm_early_init(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
2018-08-24 20:52:34 +00:00
halrf_init(dm);
2018-06-22 16:48:32 +00:00
#endif
}
void
odm_dm_init(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
halrf_init(dm);
phydm_supportability_init(dm);
phydm_rfe_init(dm);
phydm_common_info_self_init(dm);
phydm_rx_phy_status_init(dm);
phydm_auto_dbg_engine_init(dm);
phydm_dig_init(dm);
phydm_cck_pd_init(dm);
phydm_env_monitor_init(dm);
phydm_adaptivity_init(dm);
phydm_ra_info_init(dm);
phydm_rssi_monitor_init(dm);
phydm_cfo_tracking_init(dm);
phydm_rf_init(dm);
phydm_dc_cancellation(dm);
2018-06-22 16:48:32 +00:00
#ifdef PHYDM_TXA_CALIBRATION
2018-08-24 20:52:34 +00:00
phydm_txcurrentcalibration(dm);
phydm_get_pa_bias_offset(dm);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
odm_antenna_diversity_init(dm);
phydm_adaptive_soml_init(dm);
2018-06-22 16:48:32 +00:00
#ifdef CONFIG_DYNAMIC_RX_PATH
2018-08-24 20:52:34 +00:00
phydm_dynamic_rx_path_init(dm);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
phydm_path_diversity_init(dm);
phydm_pow_train_init(dm);
phydm_dynamic_tx_power_init(dm);
2018-06-22 16:48:32 +00:00
#if (PHYDM_LA_MODE_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
adc_smp_init(dm);
2018-06-22 16:48:32 +00:00
#endif
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
2018-08-24 20:52:34 +00:00
phydm_beamforming_init(dm);
2018-06-22 16:48:32 +00:00
#endif
#if (RTL8188E_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_ra_info_init_all(dm);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
phydm_primary_cca_init(dm);
2018-06-22 16:48:32 +00:00
#ifdef CONFIG_PSD_TOOL
2018-08-24 20:52:34 +00:00
phydm_psd_init(dm);
2018-06-22 16:48:32 +00:00
#endif
#ifdef CONFIG_SMART_ANTENNA
2018-08-24 20:52:34 +00:00
phydm_smt_ant_init(dm);
2018-06-22 16:48:32 +00:00
#endif
}
void
odm_dm_reset(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct phydm_dig_struct *dig_t = &dm->dm_dig_table;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
odm_ant_div_reset(dm);
phydm_set_edcca_threshold_api(dm, dig_t->cur_ig_value);
2018-06-22 16:48:32 +00:00
}
void
phydm_support_ability_debug(
2018-08-24 20:52:34 +00:00
void *dm_void,
2018-06-22 16:48:32 +00:00
u32 *const dm_value,
u32 *_used,
char *output,
u32 *_out_len
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
u64 pre_support_ability, one = 1;
u32 used = *_used;
u32 out_len = *_out_len;
2018-08-24 20:52:34 +00:00
pre_support_ability = dm->support_ability;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "\n%s\n",
"================================");
2018-06-22 16:48:32 +00:00
if (dm_value[0] == 100) {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used,
"[Supportability] PhyDM Selection\n");
PDM_SNPF(out_len, used, output + used, out_len - used,
"%s\n", "================================");
PDM_SNPF(out_len, used, output + used, out_len - used,
"00. (( %s ))DIG\n",
((dm->support_ability & ODM_BB_DIG) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"01. (( %s ))RA_MASK\n",
((dm->support_ability & ODM_BB_RA_MASK) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"02. (( %s ))DYN_TXPWR\n",
((dm->support_ability & ODM_BB_DYNAMIC_TXPWR) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"03. (( %s ))FA_CNT\n",
((dm->support_ability & ODM_BB_FA_CNT) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"04. (( %s ))RSSI_MNTR\n",
((dm->support_ability & ODM_BB_RSSI_MONITOR) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"05. (( %s ))CCK_PD\n",
((dm->support_ability & ODM_BB_CCK_PD) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"06. (( %s ))ANT_DIV\n",
((dm->support_ability & ODM_BB_ANT_DIV) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"07. (( %s ))SMT_ANT\n",
((dm->support_ability & ODM_BB_SMT_ANT) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"08. (( %s ))PWR_TRAIN\n",
((dm->support_ability & ODM_BB_PWR_TRAIN) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"09. (( %s ))RA\n",
((dm->support_ability & ODM_BB_RATE_ADAPTIVE) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"10. (( %s ))PATH_DIV\n",
((dm->support_ability & ODM_BB_PATH_DIV) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"11. (( %s ))DFS\n",
((dm->support_ability & ODM_BB_DFS) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"12. (( %s ))DYN_ARFR\n",
((dm->support_ability & ODM_BB_DYNAMIC_ARFR) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"13. (( %s ))ADAPTIVITY\n",
((dm->support_ability & ODM_BB_ADAPTIVITY) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"14. (( %s ))CFO_TRACK\n",
((dm->support_ability & ODM_BB_CFO_TRACKING) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"15. (( %s ))ENV_MONITOR\n",
((dm->support_ability & ODM_BB_ENV_MONITOR) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"16. (( %s ))PRI_CCA\n",
((dm->support_ability & ODM_BB_PRIMARY_CCA) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"17. (( %s ))ADPTV_SOML\n",
((dm->support_ability & ODM_BB_ADAPTIVE_SOML) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"18. (( %s ))NA_SAT_CHK\n",
((dm->support_ability & ODM_BB_LNA_SAT_CHK) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"19. (( %s ))DYN_RX_PATH\n",
((dm->support_ability & ODM_BB_DYNAMIC_RX_PATH) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"%s\n", "================================");
PDM_SNPF(out_len, used, output + used, out_len - used,
"[Supportability] PhyDM offload ability\n");
PDM_SNPF(out_len, used, output + used, out_len - used,
"%s\n", "================================");
PDM_SNPF(out_len, used, output + used, out_len - used,
"00. (( %s ))PHY PARAM OFFLOAD\n",
((dm->fw_offload_ability & PHYDM_PHY_PARAM_OFFLOAD) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"01. (( %s ))RF IQK OFFLOAD\n",
((dm->fw_offload_ability & PHYDM_RF_IQK_OFFLOAD) ? ("V") : (".")));
PDM_SNPF(out_len, used, output + used, out_len - used,
"%s\n", "================================");
2018-06-22 16:48:32 +00:00
}
/*
else if(dm_value[0] == 101)
{
2018-08-24 20:52:34 +00:00
dm->support_ability = 0 ;
2018-06-22 16:48:32 +00:00
dbg_print("Disable all support_ability components\n");
2018-08-24 20:52:34 +00:00
PDM_SNPF((output+used, out_len-used,"%s\n", "Disable all support_ability components"));
2018-06-22 16:48:32 +00:00
}
*/
else {
if (dm_value[1] == 1) { /* enable */
2018-08-24 20:52:34 +00:00
dm->support_ability |= (one << dm_value[0]);
2018-06-22 16:48:32 +00:00
if (BIT(dm_value[0]) & ODM_BB_PATH_DIV)
2018-08-24 20:52:34 +00:00
phydm_path_diversity_init(dm);
2018-06-22 16:48:32 +00:00
} else if (dm_value[1] == 2) /* disable */
2018-08-24 20:52:34 +00:00
dm->support_ability &= ~(one << dm_value[0]);
2018-06-22 16:48:32 +00:00
else
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used,
out_len - used, "%s\n",
"[Warning!!!] 1:enable, 2:disable");
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used,
"pre-support_ability = 0x%llx\n",
pre_support_ability);
PDM_SNPF(out_len, used, output + used, out_len - used,
"Curr-support_ability = 0x%llx\n",
dm->support_ability);
PDM_SNPF(out_len, used, output + used, out_len - used, "%s\n",
"================================");
2018-06-22 16:48:32 +00:00
*_used = used;
*_out_len = out_len;
}
void
phydm_watchdog_lps_32k(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, DBG_COMMON_FLOW, "%s ======>\n", __func__);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
phydm_common_info_self_update(dm);
phydm_rssi_monitor_check(dm);
phydm_dig_lps_32k(dm);
phydm_common_info_self_reset(dm);
2018-06-22 16:48:32 +00:00
}
void
phydm_watchdog_lps(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, DBG_COMMON_FLOW, "%s ======>\n", __func__);
phydm_common_info_self_update(dm);
phydm_rssi_monitor_check(dm);
phydm_basic_dbg_message(dm);
phydm_receiver_blocking(dm);
odm_false_alarm_counter_statistics(dm);
phydm_dig_by_rssi_lps(dm);
phydm_cck_pd_th(dm);
phydm_adaptivity(dm);
2018-06-22 16:48:32 +00:00
#if (DM_ODM_SUPPORT_TYPE & (ODM_CE))
2018-08-24 20:52:34 +00:00
odm_antenna_diversity(dm); /*enable AntDiv in PS mode, request from SD4 Jeff*/
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
phydm_common_info_self_reset(dm);
2018-06-22 16:48:32 +00:00
#endif
}
void
phydm_watchdog_mp(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#ifdef CONFIG_DYNAMIC_RX_PATH
2018-08-24 20:52:34 +00:00
phydm_dynamic_rx_path_caller(dm);
2018-06-22 16:48:32 +00:00
#endif
}
void
phydm_pause_dm_watchdog(
2018-08-24 20:52:34 +00:00
void *dm_void,
2018-06-22 16:48:32 +00:00
enum phydm_pause_type pause_type
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
if (pause_type == PHYDM_PAUSE) {
2018-08-24 20:52:34 +00:00
dm->disable_phydm_watchdog = 1;
PHYDM_DBG(dm, ODM_COMP_API, "PHYDM Stop\n");
2018-06-22 16:48:32 +00:00
} else {
2018-08-24 20:52:34 +00:00
dm->disable_phydm_watchdog = 0;
PHYDM_DBG(dm, ODM_COMP_API, "PHYDM Start\n");
2018-06-22 16:48:32 +00:00
}
}
u8
phydm_pause_func(
2018-08-24 20:52:34 +00:00
void *dm_void,
enum phydm_func_idx pause_func,
2018-06-22 16:48:32 +00:00
enum phydm_pause_type pause_type,
enum phydm_pause_level pause_lv,
u8 val_lehgth,
u32 *val_buf
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
s8 *pause_lv_pre = &dm->s8_dummy;
u32 *bkp_val = &dm->u32_dummy;
2018-06-22 16:48:32 +00:00
u32 ori_val[5] = {0};
u64 pause_func_bitmap = (u64)BIT(pause_func);
u8 i;
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[%s][%s] LV=%d, Len=%d\n", __func__,
((pause_type == PHYDM_PAUSE) ? "Pause" : "Resume"), pause_lv, val_lehgth);
2018-06-22 16:48:32 +00:00
if (pause_lv >= PHYDM_PAUSE_MAX_NUM) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[WARNING] Wrong LV=%d\n", pause_lv);
2018-06-22 16:48:32 +00:00
return PAUSE_FAIL;
}
if (pause_func == F00_DIG) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[DIG]\n");
2018-06-22 16:48:32 +00:00
if (val_lehgth != 1) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[WARNING] val_length != 1\n");
2018-06-22 16:48:32 +00:00
return PAUSE_FAIL;
}
2018-08-24 20:52:34 +00:00
ori_val[0] = (u32)(dm->dm_dig_table.cur_ig_value); /*0xc50*/
pause_lv_pre = &dm->pause_lv_table.lv_dig;
bkp_val = (u32*)(&dm->dm_dig_table.rvrt_val);
dm->phydm_func_handler.pause_phydm_handler = phydm_set_dig_val; /*function pointer hook*/
2018-06-22 16:48:32 +00:00
} else
#ifdef PHYDM_SUPPORT_CCKPD
if (pause_func == F05_CCK_PD) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[CCK_PD]\n");
2018-06-22 16:48:32 +00:00
if (val_lehgth != 2) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[WARNING] val_length != 2\n");
2018-06-22 16:48:32 +00:00
return PAUSE_FAIL;
}
2018-08-24 20:52:34 +00:00
ori_val[0] = dm->dm_cckpd_table.cur_cck_cca_thres; /*0xa0a*/
ori_val[1] = dm->dm_cckpd_table.cck_cca_th_aaa; /*0xaaa*/
pause_lv_pre = &dm->pause_lv_table.lv_cckpd;
bkp_val = &dm->dm_cckpd_table.rvrt_val[0];
dm->phydm_func_handler.pause_phydm_handler = phydm_set_cckpd_val; /*function pointer hook*/
2018-06-22 16:48:32 +00:00
} else
#endif
#ifdef CONFIG_PHYDM_ANTENNA_DIVERSITY
if (pause_func == F06_ANT_DIV) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[AntDiv]\n");
2018-06-22 16:48:32 +00:00
if (val_lehgth != 1) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[WARNING] val_length != 1\n");
2018-06-22 16:48:32 +00:00
return PAUSE_FAIL;
}
2018-08-24 20:52:34 +00:00
ori_val[0] = (u32)(dm->dm_fat_table.rx_idle_ant); /*default antenna*/
pause_lv_pre = &dm->pause_lv_table.lv_antdiv;
bkp_val = (u32*)(&dm->dm_fat_table.rvrt_val);
dm->phydm_func_handler.pause_phydm_handler = phydm_set_antdiv_val; /*function pointer hook*/
2018-06-22 16:48:32 +00:00
} else
#endif
if (pause_func == F13_ADPTVTY) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[Adaptivity]\n");
2018-06-22 16:48:32 +00:00
if (val_lehgth != 2) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[WARNING] val_length != 2\n");
2018-06-22 16:48:32 +00:00
return PAUSE_FAIL;
}
2018-08-24 20:52:34 +00:00
ori_val[0] = (u32)(dm->adaptivity.th_l2h); /*th_l2h*/
ori_val[1] = (u32)(dm->adaptivity.th_h2l); /*th_h2l*/
pause_lv_pre = &dm->pause_lv_table.lv_adapt;
bkp_val = (u32 *)(&dm->adaptivity.rvrt_val);
dm->phydm_func_handler.pause_phydm_handler = phydm_set_edcca_val; /*function pointer hook*/
2018-06-22 16:48:32 +00:00
} else
{
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[WARNING] error func idx\n");
2018-06-22 16:48:32 +00:00
return PAUSE_FAIL;
}
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "Pause_LV{new , pre} = {%d ,%d}\n", pause_lv, *pause_lv_pre);
2018-06-22 16:48:32 +00:00
if ((pause_type == PHYDM_PAUSE) || (pause_type == PHYDM_PAUSE_NO_SET)) {
2018-08-24 20:52:34 +00:00
if (pause_lv <= *pause_lv_pre) {
PHYDM_DBG(dm, ODM_COMP_API, "[PAUSE FAIL] Pre_LV >= Curr_LV\n");
return PAUSE_FAIL;
}
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (!(dm->pause_ability & pause_func_bitmap)) {
for (i = 0; i < val_lehgth; i ++)
bkp_val[i] = ori_val[i];
}
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
dm->pause_ability |= pause_func_bitmap;
PHYDM_DBG(dm, ODM_COMP_API, "pause_ability=0x%llx\n", dm->pause_ability);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (pause_type == PHYDM_PAUSE) {
for (i = 0; i < val_lehgth; i ++) {
PHYDM_DBG(dm, ODM_COMP_API, "[PAUSE SUCCESS] val_idx[%d]{New, Ori}={0x%x, 0x%x}\n",i, val_buf[i], bkp_val[i]);
2018-06-22 16:48:32 +00:00
/**/
}
2018-08-24 20:52:34 +00:00
dm->phydm_func_handler.pause_phydm_handler(dm, val_buf, val_lehgth);
2018-06-22 16:48:32 +00:00
} else {
2018-08-24 20:52:34 +00:00
for (i = 0; i < val_lehgth; i ++) {
PHYDM_DBG(dm, ODM_COMP_API, "[PAUSE NO Set: SUCCESS] val_idx[%d]{Ori}={0x%x}\n",i, bkp_val[i]);
/**/
}
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
*pause_lv_pre = pause_lv;
return PAUSE_SUCCESS;
2018-06-22 16:48:32 +00:00
} else if (pause_type == PHYDM_RESUME) {
2018-08-24 20:52:34 +00:00
dm->pause_ability &= ~pause_func_bitmap;
PHYDM_DBG(dm, ODM_COMP_API, "pause_ability=0x%llx\n", dm->pause_ability);
2018-06-22 16:48:32 +00:00
*pause_lv_pre = PHYDM_PAUSE_RELEASE;
for (i = 0; i < val_lehgth; i ++) {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[RESUME] val_idx[%d]={0x%x}\n", i, bkp_val[i]);
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
dm->phydm_func_handler.pause_phydm_handler(dm, bkp_val, val_lehgth);
2018-06-22 16:48:32 +00:00
return PAUSE_SUCCESS;
} else {
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "[WARNING] error pause_type\n");
2018-06-22 16:48:32 +00:00
return PAUSE_FAIL;
}
}
void
phydm_pause_func_console(
2018-08-24 20:52:34 +00:00
void *dm_void,
2018-06-22 16:48:32 +00:00
char input[][16],
u32 *_used,
char *output,
u32 *_out_len,
u32 input_num
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
char help[] = "-h";
u32 var1[10] = {0};
u32 used = *_used;
u32 out_len = *_out_len;
u32 i;
u8 val_length = 0;
u32 val_buf[5] = {0};
u8 set_result = 0;
2018-08-24 20:52:34 +00:00
enum phydm_func_idx func = (enum phydm_func_idx)0;
enum phydm_pause_type pause_type = (enum phydm_pause_type)0;
enum phydm_pause_level pause_lv = (enum phydm_pause_level)0;
2018-06-22 16:48:32 +00:00
if ((strcmp(input[1], help) == 0)) {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "{Func} {1:pause, 2:Resume} {lv} Val[5:0]\n");
2018-06-22 16:48:32 +00:00
} else {
for (i = 0; i < 10; i++) {
if (input[i + 1]) {
PHYDM_SSCANF(input[i + 1], DCMD_HEX, &var1[i]);
}
}
2018-08-24 20:52:34 +00:00
func = (enum phydm_func_idx)var1[0];
2018-06-22 16:48:32 +00:00
pause_type = (enum phydm_pause_type)var1[1];
pause_lv = (enum phydm_pause_level)var1[2];
for (i = 0; i < 5; i++) {
val_buf[i] = var1[3 + i];
}
if (func == F00_DIG) {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "[DIG]\n");
2018-06-22 16:48:32 +00:00
val_length = 1;
} else if (func == F05_CCK_PD) {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "[CCK_PD]\n");
2018-06-22 16:48:32 +00:00
val_length = 2;
} else if (func == F06_ANT_DIV) {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "[Ant_Div]\n");
2018-06-22 16:48:32 +00:00
val_length = 1;
} else if (func == F13_ADPTVTY) {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "[Adaptivity]\n");
2018-06-22 16:48:32 +00:00
val_length = 2;
} else {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "[Set Function Error]\n");
2018-06-22 16:48:32 +00:00
val_length = 0;
}
if (val_length != 0) {
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "{%s, lv=%d} val = %d, %d}\n",
((pause_type == PHYDM_PAUSE) ? "Pause" : "Resume"),
pause_lv, var1[3], var1[4]);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
set_result= phydm_pause_func(dm, func, pause_type, pause_lv, val_length, val_buf);
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
PDM_SNPF(out_len, used, output + used, out_len - used, "set_result = %d\n",
set_result);
2018-06-22 16:48:32 +00:00
}
*_used = used;
*_out_len = out_len;
}
u8
phydm_stop_dm_watchdog_check(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (dm->disable_phydm_watchdog == 1) {
PHYDM_DBG(dm, DBG_COMMON_FLOW, "Disable phydm\n");
2018-06-22 16:48:32 +00:00
return true;
} else
return false;
}
/*
* 2011/09/20 MH This is the entry pointer for all team to execute HW out source DM.
* You can not add any dummy function here, be care, you can only use DM structure
* to perform any new ODM_DM.
* */
void
phydm_watchdog(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, DBG_COMMON_FLOW, "%s ======>\n", __func__);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
phydm_common_info_self_update(dm);
phydm_rssi_monitor_check(dm);
phydm_basic_dbg_message(dm);
phydm_auto_dbg_engine(dm);
phydm_receiver_blocking(dm);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (phydm_stop_dm_watchdog_check(dm) == true)
2018-06-22 16:48:32 +00:00
return;
2018-08-24 20:52:34 +00:00
phydm_hw_setting(dm);
2018-06-22 16:48:32 +00:00
#ifdef PHYDM_TDMA_DIG_SUPPORT
2018-08-24 20:52:34 +00:00
if (dm->original_dig_restore == 0)
phydm_tdma_dig_timer_check(dm);
2018-06-22 16:48:32 +00:00
else
#endif
{
2018-08-24 20:52:34 +00:00
odm_false_alarm_counter_statistics(dm);
phydm_noisy_detection(dm);
phydm_dig(dm);
phydm_cck_pd_th(dm);
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
2018-06-22 16:48:32 +00:00
#ifdef PHYDM_POWER_TRAINING_SUPPORT
2018-08-24 20:52:34 +00:00
phydm_update_power_training_state(dm);
#endif
phydm_adaptivity(dm);
phydm_ra_info_watchdog(dm);
odm_path_diversity(dm);
phydm_cfo_tracking(dm);
/* odm_dynamic_tx_power(dm); */
phydm_dynamic_tx_power(dm);
odm_antenna_diversity(dm);
phydm_adaptive_soml(dm);
2018-06-22 16:48:32 +00:00
#ifdef CONFIG_DYNAMIC_RX_PATH
2018-08-24 20:52:34 +00:00
phydm_dynamic_rx_path(dm);
2018-06-22 16:48:32 +00:00
#endif
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
2018-08-24 20:52:34 +00:00
phydm_beamforming_watchdog(dm);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
halrf_watchdog(dm);
phydm_primary_cca(dm);
2018-06-22 16:48:32 +00:00
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
2018-08-24 20:52:34 +00:00
odm_dtc(dm);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
phydm_env_mntr_watchdog(dm);
2018-06-22 16:48:32 +00:00
#ifdef PHYDM_LNA_SAT_CHK_SUPPORT
2018-08-24 20:52:34 +00:00
phydm_lna_sat_chk_watchdog(dm);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
phydm_common_info_self_reset(dm);
2018-06-22 16:48:32 +00:00
}
/*
* Init /.. Fixed HW value. Only init time.
* */
void
odm_cmn_info_init(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm,
enum odm_cmninfo cmn_info,
2018-06-22 16:48:32 +00:00
u64 value
)
{
/* */
/* This section is used for init value */
/* */
switch (cmn_info) {
/* */
/* Fixed ODM value. */
/* */
case ODM_CMNINFO_ABILITY:
2018-08-24 20:52:34 +00:00
dm->support_ability = (u64)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RF_TYPE:
2018-08-24 20:52:34 +00:00
dm->rf_type = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_PLATFORM:
2018-08-24 20:52:34 +00:00
dm->support_platform = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_INTERFACE:
2018-08-24 20:52:34 +00:00
dm->support_interface = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_MP_TEST_CHIP:
2018-08-24 20:52:34 +00:00
dm->is_mp_chip = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_IC_TYPE:
2018-08-24 20:52:34 +00:00
dm->support_ic_type = (u32)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_CUT_VER:
2018-08-24 20:52:34 +00:00
dm->cut_version = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_FAB_VER:
2018-08-24 20:52:34 +00:00
dm->fab_version = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RFE_TYPE:
2018-08-24 20:52:34 +00:00
#if (RTL8821C_SUPPORT == 1)
if (dm->support_ic_type & ODM_RTL8821C)
dm->rfe_type_expand = (u8)value; /**/
else
#endif
dm->rfe_type = (u8)value;
phydm_init_hw_info_by_rfe(dm);
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RF_ANTENNA_TYPE:
2018-08-24 20:52:34 +00:00
dm->ant_div_type = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_WITH_EXT_ANTENNA_SWITCH:
2018-08-24 20:52:34 +00:00
dm->with_extenal_ant_switch = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BE_FIX_TX_ANT:
2018-08-24 20:52:34 +00:00
dm->dm_fat_table.b_fix_tx_ant = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BOARD_TYPE:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->board_type = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_PACKAGE_TYPE:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->package_type = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_EXT_LNA:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->ext_lna = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_5G_EXT_LNA:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->ext_lna_5g = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_EXT_PA:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->ext_pa = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_5G_EXT_PA:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->ext_pa_5g = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_GPA:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->type_gpa = (u16)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_APA:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->type_apa = (u16)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_GLNA:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->type_glna = (u16)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_ALNA:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->type_alna = (u16)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_EXT_TRSW:
2018-08-24 20:52:34 +00:00
if (!dm->is_init_hw_info_by_rfe)
dm->ext_trsw = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_EXT_LNA_GAIN:
2018-08-24 20:52:34 +00:00
dm->ext_lna_gain = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_PATCH_ID:
2018-08-24 20:52:34 +00:00
dm->iot_table.win_patch_id = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BINHCT_TEST:
2018-08-24 20:52:34 +00:00
dm->is_in_hct_test = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BWIFI_TEST:
2018-08-24 20:52:34 +00:00
dm->wifi_test = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SMART_CONCURRENT:
2018-08-24 20:52:34 +00:00
dm->is_dual_mac_smart_concurrent = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_DOMAIN_CODE_2G:
2018-08-24 20:52:34 +00:00
dm->odm_regulation_2_4g = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_DOMAIN_CODE_5G:
2018-08-24 20:52:34 +00:00
dm->odm_regulation_5g = (u8)value;
2018-06-22 16:48:32 +00:00
break;
#if (DM_ODM_SUPPORT_TYPE & (ODM_AP))
case ODM_CMNINFO_CONFIG_BB_RF:
2018-08-24 20:52:34 +00:00
dm->config_bbrf = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
#endif
case ODM_CMNINFO_IQKPAOFF:
2018-08-24 20:52:34 +00:00
dm->rf_calibrate_info.is_iqk_pa_off = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_REGRFKFREEENABLE:
2018-08-24 20:52:34 +00:00
dm->rf_calibrate_info.reg_rf_kfree_enable = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RFKFREEENABLE:
2018-08-24 20:52:34 +00:00
dm->rf_calibrate_info.rf_kfree_enable = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_NORMAL_RX_PATH_CHANGE:
2018-08-24 20:52:34 +00:00
dm->normal_rx_path = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_EFUSE0X3D8:
2018-08-24 20:52:34 +00:00
dm->efuse0x3d8 = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_EFUSE0X3D7:
2018-08-24 20:52:34 +00:00
dm->efuse0x3d7 = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_ADVANCE_OTA:
2018-08-24 20:52:34 +00:00
dm->p_advance_ota = (u8)value;
2018-06-22 16:48:32 +00:00
break;
#ifdef CONFIG_PHYDM_DFS_MASTER
case ODM_CMNINFO_DFS_REGION_DOMAIN:
2018-08-24 20:52:34 +00:00
dm->dfs_region_domain = (u8)value;
2018-06-22 16:48:32 +00:00
break;
#endif
case ODM_CMNINFO_SOFT_AP_SPECIAL_SETTING:
2018-08-24 20:52:34 +00:00
dm->soft_ap_special_setting = (u32)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_DPK_EN:
2018-08-24 20:52:34 +00:00
/*dm->dpk_en = (u1Byte)value;*/
halrf_cmn_info_set(dm, HALRF_CMNINFO_DPK_EN, (u64)value);
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_HP_HWID:
2018-08-24 20:52:34 +00:00
dm->hp_hw_id = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
/* To remove the compiler warning, must add an empty default statement to handle the other values. */
default:
/* do nothing */
break;
}
}
void
odm_cmn_info_hook(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm,
enum odm_cmninfo cmn_info,
void *value
2018-06-22 16:48:32 +00:00
)
{
/* */
/* Hook call by reference pointer. */
/* */
switch (cmn_info) {
/* */
/* Dynamic call by reference pointer. */
/* */
case ODM_CMNINFO_TX_UNI:
2018-08-24 20:52:34 +00:00
dm->num_tx_bytes_unicast = (u64 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RX_UNI:
2018-08-24 20:52:34 +00:00
dm->num_rx_bytes_unicast = (u64 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BAND:
2018-08-24 20:52:34 +00:00
dm->band_type = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SEC_CHNL_OFFSET:
2018-08-24 20:52:34 +00:00
dm->sec_ch_offset = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SEC_MODE:
2018-08-24 20:52:34 +00:00
dm->security = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BW:
2018-08-24 20:52:34 +00:00
dm->band_width = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_CHNL:
2018-08-24 20:52:34 +00:00
dm->channel = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SCAN:
2018-08-24 20:52:34 +00:00
dm->is_scan_in_process = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_POWER_SAVING:
2018-08-24 20:52:34 +00:00
dm->is_power_saving = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_ONE_PATH_CCA:
2018-08-24 20:52:34 +00:00
dm->one_path_cca = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_DRV_STOP:
2018-08-24 20:52:34 +00:00
dm->is_driver_stopped = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_PNP_IN:
2018-08-24 20:52:34 +00:00
dm->is_driver_is_going_to_pnp_set_power_sleep = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_INIT_ON:
2018-08-24 20:52:34 +00:00
dm->pinit_adpt_in_progress = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_ANT_TEST:
2018-08-24 20:52:34 +00:00
dm->antenna_test = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_NET_CLOSED:
2018-08-24 20:52:34 +00:00
dm->is_net_closed = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_FORCED_RATE:
2018-08-24 20:52:34 +00:00
dm->forced_data_rate = (u16 *)value;
2018-06-22 16:48:32 +00:00
break;
2018-08-24 20:52:34 +00:00
case ODM_CMNINFO_ANT_DIV:
dm->enable_antdiv = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
2018-08-24 20:52:34 +00:00
case ODM_CMNINFO_ADAPTIVE_SOML:
dm->en_adap_soml = (u8 *)value;
2018-07-02 16:49:32 +00:00
break;
2018-08-24 20:52:34 +00:00
case ODM_CMNINFO_ADAPTIVITY:
dm->enable_adaptivity = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_P2P_LINK:
2018-08-24 20:52:34 +00:00
dm->dm_dig_table.is_p2p_in_process = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_IS1ANTENNA:
2018-08-24 20:52:34 +00:00
dm->is_1_antenna = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RFDEFAULTPATH:
2018-08-24 20:52:34 +00:00
dm->rf_default_path = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_FCS_MODE:
2018-08-24 20:52:34 +00:00
dm->is_fcs_mode_enable = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
/*add by YuChen for beamforming PhyDM*/
case ODM_CMNINFO_HUBUSBMODE:
2018-08-24 20:52:34 +00:00
dm->hub_usb_mode = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_FWDWRSVDPAGEINPROGRESS:
2018-08-24 20:52:34 +00:00
dm->is_fw_dw_rsvd_page_in_progress = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_TX_TP:
2018-08-24 20:52:34 +00:00
dm->current_tx_tp = (u32 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RX_TP:
2018-08-24 20:52:34 +00:00
dm->current_rx_tp = (u32 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SOUNDING_SEQ:
2018-08-24 20:52:34 +00:00
dm->sounding_seq = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
#ifdef CONFIG_PHYDM_DFS_MASTER
case ODM_CMNINFO_DFS_MASTER_ENABLE:
2018-08-24 20:52:34 +00:00
dm->dfs_master_enabled = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
#endif
case ODM_CMNINFO_FORCE_TX_ANT_BY_TXDESC:
2018-08-24 20:52:34 +00:00
dm->dm_fat_table.p_force_tx_ant_by_desc = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SET_S0S1_DEFAULT_ANTENNA:
2018-08-24 20:52:34 +00:00
dm->dm_fat_table.p_default_s0_s1 = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SOFT_AP_MODE:
2018-08-24 20:52:34 +00:00
dm->soft_ap_mode = (u32 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_MP_MODE:
2018-08-24 20:52:34 +00:00
dm->mp_mode = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_INTERRUPT_MASK:
2018-08-24 20:52:34 +00:00
dm->interrupt_mask = (u32 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BB_OPERATION_MODE:
2018-08-24 20:52:34 +00:00
dm->bb_op_mode = (u8 *)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BF_ANTDIV_DECISION:
2018-08-24 20:52:34 +00:00
dm->dm_fat_table.is_no_csi_feedback = (boolean *)value;
2018-06-22 16:48:32 +00:00
break;
default:
/*do nothing*/
break;
}
}
/*
* Update band/CHannel/.. The values are dynamic but non-per-packet.
* */
void
odm_cmn_info_update(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm,
2018-06-22 16:48:32 +00:00
u32 cmn_info,
u64 value
)
{
/* */
/* This init variable may be changed in run time. */
/* */
switch (cmn_info) {
case ODM_CMNINFO_LINK_IN_PROGRESS:
2018-08-24 20:52:34 +00:00
dm->is_link_in_process = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_ABILITY:
2018-08-24 20:52:34 +00:00
dm->support_ability = (u64)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RF_TYPE:
2018-08-24 20:52:34 +00:00
dm->rf_type = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_WIFI_DIRECT:
2018-08-24 20:52:34 +00:00
dm->is_wifi_direct = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_WIFI_DISPLAY:
2018-08-24 20:52:34 +00:00
dm->is_wifi_display = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_LINK:
2018-08-24 20:52:34 +00:00
dm->is_linked = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_CMW500LINK:
2018-08-24 20:52:34 +00:00
dm->iot_table.is_linked_cmw500 = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_STATION_STATE:
2018-08-24 20:52:34 +00:00
dm->bsta_state = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RSSI_MIN:
2018-08-24 20:52:34 +00:00
dm->rssi_min = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_RSSI_MIN_BY_PATH:
2018-08-24 20:52:34 +00:00
dm->rssi_min_by_path = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_DBG_COMP:
2018-08-24 20:52:34 +00:00
dm->debug_components = (u64)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_DBG_LEVEL:
2018-08-24 20:52:34 +00:00
dm->debug_level = (u32)value;
2018-06-22 16:48:32 +00:00
break;
#ifdef ODM_CONFIG_BT_COEXIST
/* The following is for BT HS mode and BT coexist mechanism. */
case ODM_CMNINFO_BT_ENABLED:
2018-08-24 20:52:34 +00:00
dm->bt_info_table.is_bt_enabled = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BT_HS_CONNECT_PROCESS:
2018-08-24 20:52:34 +00:00
dm->bt_info_table.is_bt_connect_process = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BT_HS_RSSI:
2018-08-24 20:52:34 +00:00
dm->bt_info_table.bt_hs_rssi = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BT_OPERATION:
2018-08-24 20:52:34 +00:00
dm->bt_info_table.is_bt_hs_operation = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BT_LIMITED_DIG:
2018-08-24 20:52:34 +00:00
dm->bt_info_table.is_bt_limited_dig = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
#endif
case ODM_CMNINFO_AP_TOTAL_NUM:
2018-08-24 20:52:34 +00:00
dm->ap_total_num = (u8)value;
2018-06-22 16:48:32 +00:00
break;
#ifdef CONFIG_PHYDM_DFS_MASTER
case ODM_CMNINFO_DFS_REGION_DOMAIN:
2018-08-24 20:52:34 +00:00
dm->dfs_region_domain = (u8)value;
2018-06-22 16:48:32 +00:00
break;
#endif
case ODM_CMNINFO_BT_CONTINUOUS_TURN:
2018-08-24 20:52:34 +00:00
dm->is_bt_continuous_turn = (boolean)value;
2018-06-22 16:48:32 +00:00
break;
#if 0
case ODM_CMNINFO_OP_MODE:
2018-08-24 20:52:34 +00:00
dm->op_mode = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BAND:
2018-08-24 20:52:34 +00:00
dm->band_type = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SEC_CHNL_OFFSET:
2018-08-24 20:52:34 +00:00
dm->sec_ch_offset = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_SEC_MODE:
2018-08-24 20:52:34 +00:00
dm->security = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_BW:
2018-08-24 20:52:34 +00:00
dm->band_width = (u8)value;
2018-06-22 16:48:32 +00:00
break;
case ODM_CMNINFO_CHNL:
2018-08-24 20:52:34 +00:00
dm->channel = (u8)value;
2018-06-22 16:48:32 +00:00
break;
#endif
default:
/* do nothing */
break;
}
}
u32
phydm_cmn_info_query(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm,
enum phydm_info_query info_type
2018-06-22 16:48:32 +00:00
)
{
2018-08-24 20:52:34 +00:00
struct phydm_fa_struct *fa_t = &dm->false_alm_cnt;
struct phydm_dig_struct *dig_t = &dm->dm_dig_table;
struct ccx_info *ccx_info = &dm->dm_ccx_info;
2018-06-22 16:48:32 +00:00
switch (info_type) {
/*=== [FA Relative] ===========================================*/
case PHYDM_INFO_FA_OFDM:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_ofdm_fail;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_FA_CCK:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_cck_fail;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_FA_TOTAL:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_all;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CCA_OFDM:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_ofdm_cca;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CCA_CCK:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_cck_cca;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CCA_ALL:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_cca_all;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_OK_VHT:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_vht_crc32_ok;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_OK_HT:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_ht_crc32_ok;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_OK_LEGACY:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_ofdm_crc32_ok;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_OK_CCK:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_cck_crc32_ok;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_ERROR_VHT:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_vht_crc32_error;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_ERROR_HT:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_ht_crc32_error;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_ERROR_LEGACY:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_ofdm_crc32_error;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_ERROR_CCK:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_cck_crc32_error;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_EDCCA_FLAG:
2018-08-24 20:52:34 +00:00
return fa_t->edcca_flag;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_OFDM_ENABLE:
2018-08-24 20:52:34 +00:00
return fa_t->ofdm_block_enable;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CCK_ENABLE:
2018-08-24 20:52:34 +00:00
return fa_t->cck_block_enable;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_DBG_PORT_0:
2018-08-24 20:52:34 +00:00
return fa_t->dbg_port0;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_OK_HT_AGG:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_ht_crc32_ok_agg;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CRC32_ERROR_HT_AGG:
2018-08-24 20:52:34 +00:00
return fa_t->cnt_ht_crc32_error_agg;
2018-06-22 16:48:32 +00:00
/*=== [DIG] ================================================*/
case PHYDM_INFO_CURR_IGI:
2018-08-24 20:52:34 +00:00
return dig_t->cur_ig_value;
2018-06-22 16:48:32 +00:00
/*=== [RSSI] ===============================================*/
case PHYDM_INFO_RSSI_MIN:
2018-08-24 20:52:34 +00:00
return (u32)dm->rssi_min;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_RSSI_MAX:
2018-08-24 20:52:34 +00:00
return (u32)dm->rssi_max;
2018-06-22 16:48:32 +00:00
case PHYDM_INFO_CLM_RATIO :
return (u32)ccx_info->clm_ratio;
case PHYDM_INFO_NHM_RATIO :
return (u32)ccx_info->nhm_ratio;
default:
return 0xffffffff;
}
}
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
void
2018-08-24 20:52:34 +00:00
odm_init_all_work_items(struct dm_struct *dm)
2018-06-22 16:48:32 +00:00
{
2018-08-24 20:52:34 +00:00
void *adapter = dm->adapter;
2018-06-22 16:48:32 +00:00
#if USE_WORKITEM
#ifdef CONFIG_DYNAMIC_RX_PATH
2018-08-24 20:52:34 +00:00
odm_initialize_work_item(dm,
&dm->dm_drp_table.phydm_dynamic_rx_path_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)phydm_dynamic_rx_path_workitem_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"DynamicRxPathWorkitem");
#endif
#ifdef CONFIG_ADAPTIVE_SOML
2018-08-24 20:52:34 +00:00
odm_initialize_work_item(dm,
&dm->dm_soml_table.phydm_adaptive_soml_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)phydm_adaptive_soml_workitem_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"AdaptiveSOMLWorkitem");
#endif
#ifdef CONFIG_S0S1_SW_ANTENNA_DIVERSITY
2018-08-24 20:52:34 +00:00
odm_initialize_work_item(dm,
&dm->dm_swat_table.phydm_sw_antenna_switch_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)odm_sw_antdiv_workitem_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"AntennaSwitchWorkitem");
#endif
#if (defined(CONFIG_HL_SMART_ANTENNA))
2018-08-24 20:52:34 +00:00
odm_initialize_work_item(dm,
&dm->dm_sat_table.hl_smart_antenna_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)phydm_beam_switch_workitem_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"hl_smart_ant_workitem");
2018-08-24 20:52:34 +00:00
odm_initialize_work_item(dm,
&dm->dm_sat_table.hl_smart_antenna_decision_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)phydm_beam_decision_workitem_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"hl_smart_ant_decision_workitem");
#endif
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->path_div_switch_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)odm_path_div_chk_ant_switch_workitem_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"SWAS_WorkItem");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->cck_path_diversity_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)odm_cck_tx_path_diversity_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"CCKTXPathDiversityWorkItem");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->ra_rpt_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)halrf_update_init_rate_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"ra_rpt_workitem");
#if (defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY)) || (defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY))
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->fast_ant_training_workitem,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)odm_fast_ant_training_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"fast_ant_training_workitem");
#endif
#endif /*#if USE_WORKITEM*/
#if (BEAMFORMING_SUPPORT == 1)
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->beamforming_info.txbf_info.txbf_enter_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)hal_com_txbf_enter_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"txbf_enter_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->beamforming_info.txbf_info.txbf_leave_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)hal_com_txbf_leave_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"txbf_leave_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->beamforming_info.txbf_info.txbf_fw_ndpa_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)hal_com_txbf_fw_ndpa_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"txbf_fw_ndpa_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->beamforming_info.txbf_info.txbf_clk_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)hal_com_txbf_clk_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"txbf_clk_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->beamforming_info.txbf_info.txbf_rate_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)hal_com_txbf_rate_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"txbf_rate_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->beamforming_info.txbf_info.txbf_status_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)hal_com_txbf_status_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"txbf_status_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->beamforming_info.txbf_info.txbf_reset_tx_path_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)hal_com_txbf_reset_tx_path_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"txbf_reset_tx_path_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->beamforming_info.txbf_info.txbf_get_tx_rate_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)hal_com_txbf_get_tx_rate_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"txbf_get_tx_rate_work_item");
#endif
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->adaptivity.phydm_pause_edcca_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)phydm_pause_edcca_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"phydm_pause_edcca_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->adaptivity.phydm_resume_edcca_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)phydm_resume_edcca_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"phydm_resume_edcca_work_item");
#if (PHYDM_LA_MODE_SUPPORT == 1)
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->adcsmp.adc_smp_work_item,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)adc_smp_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"adc_smp_work_item");
odm_initialize_work_item(
2018-08-24 20:52:34 +00:00
dm,
&dm->adcsmp.adc_smp_work_item_1,
2018-06-22 16:48:32 +00:00
(RT_WORKITEM_CALL_BACK)adc_smp_work_item_callback,
2018-08-24 20:52:34 +00:00
(void *)adapter,
2018-06-22 16:48:32 +00:00
"adc_smp_work_item_1");
#endif
}
void
2018-08-24 20:52:34 +00:00
odm_free_all_work_items(struct dm_struct *dm)
2018-06-22 16:48:32 +00:00
{
#if USE_WORKITEM
#ifdef CONFIG_S0S1_SW_ANTENNA_DIVERSITY
2018-08-24 20:52:34 +00:00
odm_free_work_item(&dm->dm_swat_table.phydm_sw_antenna_switch_workitem);
2018-06-22 16:48:32 +00:00
#endif
#ifdef CONFIG_DYNAMIC_RX_PATH
2018-08-24 20:52:34 +00:00
odm_free_work_item(&dm->dm_drp_table.phydm_dynamic_rx_path_workitem);
2018-06-22 16:48:32 +00:00
#endif
#ifdef CONFIG_ADAPTIVE_SOML
2018-08-24 20:52:34 +00:00
odm_free_work_item(&dm->dm_soml_table.phydm_adaptive_soml_workitem);
2018-06-22 16:48:32 +00:00
#endif
#if (defined(CONFIG_HL_SMART_ANTENNA))
2018-08-24 20:52:34 +00:00
odm_free_work_item(&dm->dm_sat_table.hl_smart_antenna_workitem);
odm_free_work_item(&dm->dm_sat_table.hl_smart_antenna_decision_workitem);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
odm_free_work_item(&dm->path_div_switch_workitem);
odm_free_work_item(&dm->cck_path_diversity_workitem);
2018-06-22 16:48:32 +00:00
#if (defined(CONFIG_5G_CG_SMART_ANT_DIVERSITY)) || (defined(CONFIG_2G_CG_SMART_ANT_DIVERSITY))
2018-08-24 20:52:34 +00:00
odm_free_work_item(&dm->fast_ant_training_workitem);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
odm_free_work_item(&dm->ra_rpt_workitem);
/*odm_free_work_item((&dm->sbdcnt_workitem));*/
2018-06-22 16:48:32 +00:00
#endif
#if (BEAMFORMING_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_free_work_item((&dm->beamforming_info.txbf_info.txbf_enter_work_item));
odm_free_work_item((&dm->beamforming_info.txbf_info.txbf_leave_work_item));
odm_free_work_item((&dm->beamforming_info.txbf_info.txbf_fw_ndpa_work_item));
odm_free_work_item((&dm->beamforming_info.txbf_info.txbf_clk_work_item));
odm_free_work_item((&dm->beamforming_info.txbf_info.txbf_rate_work_item));
odm_free_work_item((&dm->beamforming_info.txbf_info.txbf_status_work_item));
odm_free_work_item((&dm->beamforming_info.txbf_info.txbf_reset_tx_path_work_item));
odm_free_work_item((&dm->beamforming_info.txbf_info.txbf_get_tx_rate_work_item));
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
odm_free_work_item((&dm->adaptivity.phydm_pause_edcca_work_item));
odm_free_work_item((&dm->adaptivity.phydm_resume_edcca_work_item));
2018-06-22 16:48:32 +00:00
#if (PHYDM_LA_MODE_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_free_work_item((&dm->adcsmp.adc_smp_work_item));
odm_free_work_item((&dm->adcsmp.adc_smp_work_item_1));
2018-06-22 16:48:32 +00:00
#endif
}
#endif /*#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)*/
void
odm_init_all_timers(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
2018-08-24 20:52:34 +00:00
odm_ant_div_timers(dm, INIT_ANTDIV_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
phydm_adaptive_soml_timers(dm, INIT_SOML_TIMMER);
2018-06-22 16:48:32 +00:00
#ifdef PHYDM_LNA_SAT_CHK_SUPPORT
2018-08-24 20:52:34 +00:00
phydm_lna_sat_chk_timers(dm, INIT_LNA_SAT_CHK_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
#ifdef CONFIG_DYNAMIC_RX_PATH
2018-08-24 20:52:34 +00:00
phydm_dynamic_rx_path_timers(dm, INIT_DRP_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
2018-08-24 20:52:34 +00:00
odm_initialize_timer(dm, &dm->path_div_switch_timer,
2018-06-22 16:48:32 +00:00
(void *)odm_path_div_chk_ant_switch_callback, NULL, "PathDivTimer");
2018-08-24 20:52:34 +00:00
odm_initialize_timer(dm, &dm->cck_path_diversity_timer,
2018-06-22 16:48:32 +00:00
(void *)odm_cck_tx_path_diversity_callback, NULL, "cck_path_diversity_timer");
2018-08-24 20:52:34 +00:00
odm_initialize_timer(dm, &dm->sbdcnt_timer,
2018-06-22 16:48:32 +00:00
(void *)phydm_sbd_callback, NULL, "SbdTimer");
#if (BEAMFORMING_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_initialize_timer(dm, &dm->beamforming_info.txbf_info.txbf_fw_ndpa_timer,
2018-06-22 16:48:32 +00:00
(void *)hal_com_txbf_fw_ndpa_timer_callback, NULL, "txbf_fw_ndpa_timer");
#endif
#endif
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
#if (BEAMFORMING_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_initialize_timer(dm, &dm->beamforming_info.beamforming_timer,
2018-06-22 16:48:32 +00:00
(void *)beamforming_sw_timer_callback, NULL, "beamforming_timer");
#endif
#endif
}
void
odm_cancel_all_timers(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
2018-08-24 20:52:34 +00:00
/* 2012/01/12 MH Temp BSOD fix. We need to find NIC allocate mem fail reason in win7*/
if (dm->adapter == NULL)
return;
2018-06-22 16:48:32 +00:00
#endif
#if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
2018-08-24 20:52:34 +00:00
odm_ant_div_timers(dm, CANCEL_ANTDIV_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
phydm_adaptive_soml_timers(dm, CANCEL_SOML_TIMMER);
2018-06-22 16:48:32 +00:00
#ifdef PHYDM_LNA_SAT_CHK_SUPPORT
2018-08-24 20:52:34 +00:00
phydm_lna_sat_chk_timers(dm, CANCEL_LNA_SAT_CHK_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
#ifdef CONFIG_DYNAMIC_RX_PATH
2018-08-24 20:52:34 +00:00
phydm_dynamic_rx_path_timers(dm, CANCEL_DRP_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
2018-08-24 20:52:34 +00:00
odm_cancel_timer(dm, &dm->path_div_switch_timer);
odm_cancel_timer(dm, &dm->cck_path_diversity_timer);
odm_cancel_timer(dm, &dm->sbdcnt_timer);
2018-06-22 16:48:32 +00:00
#if (BEAMFORMING_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_cancel_timer(dm, &dm->beamforming_info.txbf_info.txbf_fw_ndpa_timer);
2018-06-22 16:48:32 +00:00
#endif
#endif
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
#if (BEAMFORMING_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_cancel_timer(dm, &dm->beamforming_info.beamforming_timer);
2018-06-22 16:48:32 +00:00
#endif
#endif
}
void
odm_release_all_timers(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#if (defined(CONFIG_PHYDM_ANTENNA_DIVERSITY))
2018-08-24 20:52:34 +00:00
odm_ant_div_timers(dm, RELEASE_ANTDIV_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
2018-08-24 20:52:34 +00:00
phydm_adaptive_soml_timers(dm, RELEASE_SOML_TIMMER);
2018-06-22 16:48:32 +00:00
#ifdef PHYDM_LNA_SAT_CHK_SUPPORT
2018-08-24 20:52:34 +00:00
phydm_lna_sat_chk_timers(dm, RELEASE_LNA_SAT_CHK_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
#ifdef CONFIG_DYNAMIC_RX_PATH
2018-08-24 20:52:34 +00:00
phydm_dynamic_rx_path_timers(dm, RELEASE_DRP_TIMMER);
2018-06-22 16:48:32 +00:00
#endif
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
2018-08-24 20:52:34 +00:00
odm_release_timer(dm, &dm->path_div_switch_timer);
odm_release_timer(dm, &dm->cck_path_diversity_timer);
odm_release_timer(dm, &dm->sbdcnt_timer);
2018-06-22 16:48:32 +00:00
#if (BEAMFORMING_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_release_timer(dm, &dm->beamforming_info.txbf_info.txbf_fw_ndpa_timer);
2018-06-22 16:48:32 +00:00
#endif
#endif
#if (DM_ODM_SUPPORT_TYPE & (ODM_WIN | ODM_CE))
#if (BEAMFORMING_SUPPORT == 1)
2018-08-24 20:52:34 +00:00
odm_release_timer(dm, &dm->beamforming_info.beamforming_timer);
2018-06-22 16:48:32 +00:00
#endif
#endif
}
#if (DM_ODM_SUPPORT_TYPE == ODM_AP)
void
odm_init_all_threads(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#ifdef TPT_THREAD
2018-08-24 20:52:34 +00:00
k_tpt_task_init(dm->priv);
2018-06-22 16:48:32 +00:00
#endif
}
void
odm_stop_all_threads(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#ifdef TPT_THREAD
2018-08-24 20:52:34 +00:00
k_tpt_task_stop(dm->priv);
2018-06-22 16:48:32 +00:00
#endif
}
#endif
#if (DM_ODM_SUPPORT_TYPE == ODM_CE)
/* Justin: According to the current RRSI to adjust Response Frame TX power, 2012/11/05 */
2018-08-24 20:52:34 +00:00
void odm_dtc(struct dm_struct *dm)
2018-06-22 16:48:32 +00:00
{
#ifdef CONFIG_DM_RESP_TXAGC
#define DTC_BASE 35 /* RSSI higher than this value, start to decade TX power */
#define DTC_DWN_BASE (DTC_BASE-5) /* RSSI lower than this value, start to increase TX power */
/* RSSI vs TX power step mapping: decade TX power */
static const u8 dtc_table_down[] = {
DTC_BASE,
(DTC_BASE + 5),
(DTC_BASE + 10),
(DTC_BASE + 15),
(DTC_BASE + 20),
(DTC_BASE + 25)
};
/* RSSI vs TX power step mapping: increase TX power */
static const u8 dtc_table_up[] = {
DTC_DWN_BASE,
(DTC_DWN_BASE - 5),
(DTC_DWN_BASE - 10),
(DTC_DWN_BASE - 15),
(DTC_DWN_BASE - 15),
(DTC_DWN_BASE - 20),
(DTC_DWN_BASE - 20),
(DTC_DWN_BASE - 25),
(DTC_DWN_BASE - 25),
(DTC_DWN_BASE - 30),
(DTC_DWN_BASE - 35)
};
u8 i;
u8 dtc_steps = 0;
u8 sign;
u8 resp_txagc = 0;
#if 0
/* As DIG is disabled, DTC is also disable */
2018-08-24 20:52:34 +00:00
if (!(dm->support_ability & ODM_XXXXXX))
2018-06-22 16:48:32 +00:00
return;
#endif
2018-08-24 20:52:34 +00:00
if (dm->rssi_min > DTC_BASE) {
2018-06-22 16:48:32 +00:00
/* need to decade the CTS TX power */
sign = 1;
for (i = 0; i < ARRAY_SIZE(dtc_table_down); i++) {
2018-08-24 20:52:34 +00:00
if ((dtc_table_down[i] >= dm->rssi_min) || (dtc_steps >= 6))
2018-06-22 16:48:32 +00:00
break;
else
dtc_steps++;
}
}
#if 0
2018-08-24 20:52:34 +00:00
else if (dm->rssi_min > DTC_DWN_BASE) {
2018-06-22 16:48:32 +00:00
/* needs to increase the CTS TX power */
sign = 0;
dtc_steps = 1;
for (i = 0; i < ARRAY_SIZE(dtc_table_up); i++) {
2018-08-24 20:52:34 +00:00
if ((dtc_table_up[i] <= dm->rssi_min) || (dtc_steps >= 10))
2018-06-22 16:48:32 +00:00
break;
else
dtc_steps++;
}
}
#endif
else {
sign = 0;
dtc_steps = 0;
}
resp_txagc = dtc_steps | (sign << 4);
resp_txagc = resp_txagc | (resp_txagc << 5);
2018-08-24 20:52:34 +00:00
odm_write_1byte(dm, 0x06d9, resp_txagc);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_PWR_TRAIN, "%s rssi_min:%u, set RESP_TXAGC to %s %u\n",
__func__, dm->rssi_min, sign ? "minus" : "plus", dtc_steps);
2018-06-22 16:48:32 +00:00
#endif /* CONFIG_RESP_TXAGC_ADJUST */
}
#endif /* #if (DM_ODM_SUPPORT_TYPE == ODM_CE) */
/*<20170126, BB-Kevin>8188F D-CUT DC cancellation and 8821C*/
void
phydm_dc_cancellation(
2018-08-24 20:52:34 +00:00
struct dm_struct *dm
2018-06-22 16:48:32 +00:00
)
{
#ifdef PHYDM_DC_CANCELLATION
2018-08-24 20:52:34 +00:00
u32 offset_i_hex[PHYDM_MAX_RF_PATH] = {0};
u32 offset_q_hex[PHYDM_MAX_RF_PATH] = {0};
u32 reg_value32[PHYDM_MAX_RF_PATH] = {0};
2018-06-22 16:48:32 +00:00
u8 path = RF_PATH_A;
2018-08-24 20:52:34 +00:00
if (!(dm->support_ic_type & ODM_DC_CANCELLATION_SUPPORT))
2018-06-22 16:48:32 +00:00
return;
2018-08-24 20:52:34 +00:00
if ((dm->support_ic_type & ODM_RTL8188F) && (dm->cut_version < ODM_CUT_D))
2018-06-22 16:48:32 +00:00
return;
/*DC_Estimation (only for 2x2 ic now) */
2018-08-24 20:52:34 +00:00
for (path = RF_PATH_A; path < PHYDM_MAX_RF_PATH; path++) {
if (dm->support_ic_type & (ODM_RTL8188F | ODM_RTL8710B)) {
if (!phydm_set_bb_dbg_port(dm,
2018-06-22 16:48:32 +00:00
BB_DBGPORT_PRIORITY_2, 0x235)) {/*set debug port to 0x235*/
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API,
"[DC Cancellation] Set Debug port Fail");
2018-06-22 16:48:32 +00:00
return;
}
2018-08-24 20:52:34 +00:00
} else if (dm->support_ic_type & (ODM_RTL8821C | ODM_RTL8822B)) {
if (!phydm_set_bb_dbg_port(dm, BB_DBGPORT_PRIORITY_2, 0x200)) {
2018-06-22 16:48:32 +00:00
/*set debug port to 0x200*/
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API,
"[DC Cancellation] Set Debug port Fail");
2018-06-22 16:48:32 +00:00
return;
}
2018-08-24 20:52:34 +00:00
phydm_bb_dbg_port_header_sel(dm, 0x0);
if (dm->rf_type > RF_1T1R) {
if (!phydm_set_bb_dbg_port(dm, BB_DBGPORT_PRIORITY_2, 0x202)) {
2018-06-22 16:48:32 +00:00
/*set debug port to 0x200*/
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API,
"[DC Cancellation] Set Debug port Fail");
2018-06-22 16:48:32 +00:00
return;
}
2018-08-24 20:52:34 +00:00
phydm_bb_dbg_port_header_sel(dm, 0x0);
2018-06-22 16:48:32 +00:00
}
}
2018-08-24 20:52:34 +00:00
odm_write_dig(dm, 0x7E);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_IC_11N_SERIES)
odm_set_bb_reg(dm, 0x88c, BIT(21)|BIT(20), 0x3);
2018-06-22 16:48:32 +00:00
else {
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, 0xc00, BIT(1)|BIT(0), 0x0);
if (dm->rf_type > RF_1T1R)
odm_set_bb_reg(dm, 0xe00, BIT(1)|BIT(0), 0x0);
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, 0xa78, MASKBYTE1, 0x0); /*disable CCK DCNF*/
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "DC cancellation Begin!!!");
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
phydm_stop_ck320(dm, true); /*stop ck320*/
2018-06-22 16:48:32 +00:00
/* the same debug port both for path-a and path-b*/
2018-08-24 20:52:34 +00:00
reg_value32[path] = phydm_get_bb_dbg_port_value(dm);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
phydm_stop_ck320(dm, false); /*start ck320*/
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (dm->support_ic_type & ODM_IC_11N_SERIES) {
odm_set_bb_reg(dm, 0x88c, BIT(21)|BIT(20), 0x0);
2018-06-22 16:48:32 +00:00
} else {
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, 0xc00, BIT(1)|BIT(0), 0x3);
odm_set_bb_reg(dm, 0xe00, BIT(1)|BIT(0), 0x3);
2018-06-22 16:48:32 +00:00
}
2018-08-24 20:52:34 +00:00
odm_write_dig(dm, 0x20);
phydm_release_bb_dbg_port(dm);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
PHYDM_DBG(dm, ODM_COMP_API, "DC cancellation OK!!!");
2018-06-22 16:48:32 +00:00
}
/*DC_Cancellation*/
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, 0xa9c, BIT(20), 0x1); /*DC compensation to CCK data path*/
if (dm->support_ic_type & (ODM_RTL8188F | ODM_RTL8710B)) {
2018-06-22 16:48:32 +00:00
offset_i_hex[0] = (reg_value32[0] & 0xffc0000) >> 18;
offset_q_hex[0] = (reg_value32[0] & 0x3ff00) >> 8;
/*Before filling into registers, offset should be multiplexed (-1)*/
offset_i_hex[0] = (offset_i_hex[0] >= 0x200) ? (0x400 - offset_i_hex[1]) : (0x1ff - offset_i_hex[1]);
offset_q_hex[0] = (offset_q_hex[0] >= 0x200) ? (0x400 - offset_q_hex[1]) : (0x1ff - offset_q_hex[1]);
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, 0x950, 0x1ff, offset_i_hex[1]);
odm_set_bb_reg(dm, 0x950, 0x1ff0000, offset_q_hex[1]);
} else if (dm->support_ic_type & (ODM_RTL8821C | ODM_RTL8822B)) {
2018-06-22 16:48:32 +00:00
/* Path-a */
offset_i_hex[0] = (reg_value32[0] & 0xffc00) >> 10;
offset_q_hex[0] = reg_value32[0] & 0x3ff;
/*Before filling into registers, offset should be multiplexed (-1)*/
offset_i_hex[0] = 0x400 - offset_i_hex[0];
offset_q_hex[0] = 0x400 - offset_q_hex[0];
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, 0xc10, 0x3c000000, ((0x3c0 & offset_i_hex[0]) >> 6));
odm_set_bb_reg(dm, 0xc10, 0xfc00, (0x3f & offset_i_hex[0]));
odm_set_bb_reg(dm, 0xc14, 0x3c000000, ((0x3c0 & offset_q_hex[0]) >> 6));
odm_set_bb_reg(dm, 0xc14, 0xfc00, (0x3f & offset_q_hex[0]));
2018-06-22 16:48:32 +00:00
/* Path-b */
2018-08-24 20:52:34 +00:00
if (dm->rf_type > RF_1T1R) {
2018-06-22 16:48:32 +00:00
offset_i_hex[1] = (reg_value32[1] & 0xffc00) >> 10;
offset_q_hex[1] = reg_value32[1] & 0x3ff;
/*Before filling into registers, offset should be multiplexed (-1)*/
offset_i_hex[1] = 0x400 - offset_i_hex[1];
offset_q_hex[1] = 0x400 - offset_q_hex[1];
2018-08-24 20:52:34 +00:00
odm_set_bb_reg(dm, 0xe10, 0x3c000000, ((0x3c0 & offset_i_hex[1]) >> 6));
odm_set_bb_reg(dm, 0xe10, 0xfc00, (0x3f & offset_i_hex[1]));
odm_set_bb_reg(dm, 0xe14, 0x3c000000, ((0x3c0 & offset_q_hex[1]) >> 6));
odm_set_bb_reg(dm, 0xe14, 0xfc00, (0x3f & offset_q_hex[1]));
2018-06-22 16:48:32 +00:00
}
}
#endif
}
void
phydm_receiver_blocking(
2018-08-24 20:52:34 +00:00
void *dm_void
2018-06-22 16:48:32 +00:00
)
{
#ifdef CONFIG_RECEIVER_BLOCKING
2018-08-24 20:52:34 +00:00
struct dm_struct *dm = (struct dm_struct *)dm_void;
u32 channel = *dm->channel;
u8 bw = *dm->band_width;
u32 bb_regf0 = odm_get_bb_reg(dm, 0xf0, MASKDWORD);
2018-06-22 16:48:32 +00:00
2018-08-24 20:52:34 +00:00
if (!(dm->support_ic_type & ODM_RECEIVER_BLOCKING_SUPPORT))
2018-06-22 16:48:32 +00:00
return;
2018-08-24 20:52:34 +00:00
if ((dm->support_ic_type & ODM_RTL8188E && ((bb_regf0 & 0xf000) >> 12) < 8) ||
dm->support_ic_type & ODM_RTL8192E) { /*8188E_T version*/
if (dm->consecutive_idlel_time > 10 && *dm->mp_mode == false && dm->adaptivity_enable == true) {
2018-06-22 16:48:32 +00:00
if ((bw == CHANNEL_WIDTH_20) && (channel == 1)) {
2018-08-24 20:52:34 +00:00
phydm_nbi_setting(dm, FUNC_ENABLE, channel, 20, 2410, PHYDM_DONT_CARE);
dm->is_receiver_blocking_en = true;
2018-06-22 16:48:32 +00:00
} else if ((bw == CHANNEL_WIDTH_20) && (channel == 13)) {
2018-08-24 20:52:34 +00:00
phydm_nbi_setting(dm, FUNC_ENABLE, channel, 20, 2473, PHYDM_DONT_CARE);
dm->is_receiver_blocking_en = true;
} else if (dm->is_receiver_blocking_en && channel != 1 && channel != 13) {
phydm_nbi_enable(dm, FUNC_DISABLE);
odm_set_bb_reg(dm, 0xc40, 0x1f000000, 0x1f);
dm->is_receiver_blocking_en = false;
2018-06-22 16:48:32 +00:00
}
return;
}
2018-08-24 20:52:34 +00:00
} else if ((dm->support_ic_type & ODM_RTL8188E && ((bb_regf0 & 0xf000) >> 12) >= 8)) { /*8188E_S version*/
if (dm->consecutive_idlel_time > 10 && *dm->mp_mode == false && dm->adaptivity_enable == true) {
2018-06-22 16:48:32 +00:00
if ((bw == CHANNEL_WIDTH_20) && (channel == 13)) {
2018-08-24 20:52:34 +00:00
phydm_nbi_setting(dm, FUNC_ENABLE, channel, 20, 2473, PHYDM_DONT_CARE);
dm->is_receiver_blocking_en = true;
} else if (dm->is_receiver_blocking_en && channel != 13) {
phydm_nbi_enable(dm, FUNC_DISABLE);
odm_set_bb_reg(dm, 0xc40, 0x1f000000, 0x1f);
dm->is_receiver_blocking_en = false;
2018-06-22 16:48:32 +00:00
}
return;
}
}
2018-08-24 20:52:34 +00:00
if (dm->is_receiver_blocking_en) {
phydm_nbi_enable(dm, FUNC_DISABLE);
odm_set_bb_reg(dm, 0xc40, 0x1f000000, 0x1f);
dm->is_receiver_blocking_en = false;
2018-06-22 16:48:32 +00:00
}
#endif
}