diff options
Diffstat (limited to 'drivers/staging/rtl8821ae')
24 files changed, 459 insertions, 1387 deletions
diff --git a/drivers/staging/rtl8821ae/base.c b/drivers/staging/rtl8821ae/base.c index e5073fe2477..4a36da06c01 100644 --- a/drivers/staging/rtl8821ae/base.c +++ b/drivers/staging/rtl8821ae/base.c @@ -320,9 +320,6 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw) /* <5> set hw caps */ hw->flags = IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_RX_INCLUDES_FCS | -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)) - IEEE80211_HW_BEACON_FILTER | -#endif IEEE80211_HW_AMPDU_AGGREGATION | IEEE80211_HW_REPORTS_TX_ACK_STATUS | IEEE80211_HW_CONNECTION_MONITOR | @@ -335,8 +332,6 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw) IEEE80211_HW_PS_NULLFUNC_STACK | /* IEEE80211_HW_SUPPORTS_DYNAMIC_PS | */ 0; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_STATION) | @@ -344,23 +339,10 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw) BIT(NL80211_IFTYPE_MESH_POINT) | BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO); -#else -/*<delete in kernel end>*/ - hw->wiphy->interface_modes = - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_STATION) | - BIT(NL80211_IFTYPE_ADHOC) | - BIT(NL80211_IFTYPE_MESH_POINT) ; -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) + hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)) hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; -#endif hw->wiphy->rts_threshold = 2347; @@ -388,7 +370,7 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw) } -static void _rtl_init_deferred_work(struct ieee80211_hw *hw) +static int _rtl_init_deferred_work(struct ieee80211_hw *hw) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -401,15 +383,11 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) rtl_easy_concurrent_retrytimer_callback, (unsigned long)hw); /* <2> work queue */ rtlpriv->works.hw = hw; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) -/*<delete in kernel end>*/ - rtlpriv->works.rtl_wq = alloc_workqueue(rtlpriv->cfg->name, 0, 0); -/*<delete in kernel start>*/ -#else - rtlpriv->works.rtl_wq = create_workqueue(rtlpriv->cfg->name); -#endif -/*<delete in kernel end>*/ + rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, + rtlpriv->cfg->name); + if (!rtlpriv->works.rtl_wq) + return -ENOMEM; + INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, (void *)rtl_watchdog_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, @@ -421,6 +399,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, (void *)rtl_fwevt_wq_callback); + return 0; + } void rtl_deinit_deferred_work(struct ieee80211_hw *hw) @@ -519,7 +499,8 @@ int rtl_init_core(struct ieee80211_hw *hw) INIT_LIST_HEAD(&rtlpriv->entry_list); /* <6> init deferred work */ - _rtl_init_deferred_work(hw); + if (_rtl_init_deferred_work(hw)) + return 1; /* <7> */ #ifdef VIF_TODO @@ -894,13 +875,8 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) hdr->addr3, tid); if (skb_delba) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) rx_status.freq = hw->conf.chandef.chan->center_freq; rx_status.band = hw->conf.chandef.chan->band; -#else - rx_status.freq = hw->conf.channel->center_freq; - rx_status.band = hw->conf.channel->band; -#endif rx_status.flag |= RX_FLAG_DECRYPTED; rx_status.flag |= RX_FLAG_MACTIME_MPDU; rx_status.rate_idx = 0; @@ -1475,21 +1451,8 @@ int rtl_send_smps_action(struct ieee80211_hw *hw, /* rtlpriv->cfg->ops->update_rate_tbl(hw, sta, 0); */ info->control.rates[0].idx = 0; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) info->band = hw->conf.chandef.chan->band; -#else - info->band = hw->conf.channel->band; -#endif -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)) - info->control.sta = sta; - rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc); -#else -/*<delete in kernel end>*/ rtlpriv->intf_ops->adapter_tx(hw, sta, skb, &tcb_desc); -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ } return 1; diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c index 115908928ae..d2381794ecc 100644 --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c @@ -12,7 +12,7 @@ * include files **************************************************************/ #include "halbt_precomp.h" -#if 1 + /************************************************************** * Global variables, these are static variables **************************************************************/ @@ -21,14 +21,14 @@ static struct coex_dm_8192e_2ant *coex_dm = &glcoex_dm_8192e_2ant; static struct coex_sta_8192e_2ant glcoex_sta_8192e_2ant; static struct coex_sta_8192e_2ant *coex_sta = &glcoex_sta_8192e_2ant; -const char *const GLBtInfoSrc8192e2Ant[]={ +static const char *const GLBtInfoSrc8192e2Ant[] = { "BT Info[wifi fw]", "BT Info[bt rsp]", "BT Info[bt auto report]", }; -u32 glcoex_ver_date_8192e_2ant = 20130902; -u32 glcoex_ver_8192e_2ant = 0x34; +static u32 glcoex_ver_date_8192e_2ant = 20130902; +static u32 glcoex_ver_8192e_2ant = 0x34; /************************************************************** * local function proto type if needed @@ -36,13 +36,12 @@ u32 glcoex_ver_8192e_2ant = 0x34; /************************************************************** * local function start with halbtc8192e2ant_ **************************************************************/ -u8 halbtc8192e2ant_btrssi_state(u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) +static u8 halbtc8192e2ant_btrssi_state(u8 level_num, u8 rssi_thresh, + u8 rssi_thresh1) { - int btrssi=0; + int btrssi = coex_sta->bt_rssi; u8 btrssi_state = coex_sta->pre_bt_rssi_state; - btrssi = coex_sta->bt_rssi; - if (level_num == 2) { if ((coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_LOW) || (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) { @@ -82,7 +81,7 @@ u8 halbtc8192e2ant_btrssi_state(u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) (coex_sta->pre_bt_rssi_state == BTC_RSSI_STATE_STAY_LOW)) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, "BT Rssi pre state=LOW\n"); - if(btrssi >= (rssi_thresh + + if (btrssi >= (rssi_thresh + BTC_RSSI_COEX_THRESH_TOL_8192E_2ANT)) { btrssi_state = BTC_RSSI_STATE_MEDIUM; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, @@ -132,8 +131,9 @@ u8 halbtc8192e2ant_btrssi_state(u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) return btrssi_state; } -u8 halbtc8192e2ant_wifirssi_state(struct btc_coexist * btcoexist, u8 index, - u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) +static u8 halbtc8192e2ant_wifirssi_state(struct btc_coexist *btcoexist, + u8 index, u8 level_num, + u8 rssi_thresh, u8 rssi_thresh1) { int wifirssi = 0; u8 wifirssi_state = coex_sta->pre_wifi_rssi_state[index]; @@ -156,8 +156,8 @@ u8 halbtc8192e2ant_wifirssi_state(struct btc_coexist * btcoexist, u8 index, BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, "wifi RSSI state stay at Low\n"); - } - } else { + } + } else { if (wifirssi < rssi_thresh) { wifirssi_state = BTC_RSSI_STATE_LOW; BTC_PRINT(BTC_MSG_ALGORITHM, @@ -234,10 +234,10 @@ u8 halbtc8192e2ant_wifirssi_state(struct btc_coexist * btcoexist, u8 index, return wifirssi_state; } -void halbtc8192e2ant_monitor_bt_enable_disable(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_monitor_bt_enable_disable(struct btc_coexist *btcoexist) { - static bool pre_bt_disabled = false; - static u32 bt_disable_cnt = 0; + static bool pre_bt_disabled; + static u32 bt_disable_cnt; bool bt_active = true, bt_disabled = false; /* This function check if bt is disabled */ @@ -283,7 +283,7 @@ void halbtc8192e2ant_monitor_bt_enable_disable(struct btc_coexist *btcoexist) } } -u32 halbtc8192e2ant_decidera_mask(struct btc_coexist *btcoexist, +static u32 halbtc8192e2ant_decidera_mask(struct btc_coexist *btcoexist, u8 sstype, u32 ra_masktype) { u32 disra_mask = 0x0; @@ -296,13 +296,13 @@ u32 halbtc8192e2ant_decidera_mask(struct btc_coexist *btcoexist, disra_mask = 0xfff00000;/* disable 2ss */ break; case 1: /* disable cck 1/2 */ - if(sstype == 2) + if (sstype == 2) disra_mask = 0x00000003;/* enable 2ss */ else disra_mask = 0xfff00003;/* disable 2ss */ break; case 2: /* disable cck 1/2/5.5, ofdm 6/9/12/18/24, mcs 0/1/2/3/4 */ - if(sstype == 2) + if (sstype == 2) disra_mask = 0x0001f1f7;/* enable 2ss */ else disra_mask = 0xfff1f1f7;/* disable 2ss */ @@ -314,8 +314,8 @@ u32 halbtc8192e2ant_decidera_mask(struct btc_coexist *btcoexist, return disra_mask; } -void halbtc8192e2ant_Updatera_mask(struct btc_coexist *btcoexist, - bool force_exec, u32 dis_ratemask) +static void halbtc8192e2ant_Updatera_mask(struct btc_coexist *btcoexist, + bool force_exec, u32 dis_ratemask) { coex_dm->curra_mask = dis_ratemask; @@ -325,8 +325,8 @@ void halbtc8192e2ant_Updatera_mask(struct btc_coexist *btcoexist, coex_dm->prera_mask = coex_dm->curra_mask; } -void halbtc8192e2ant_autorate_fallback_retry(struct btc_coexist *btcoexist, - bool force_exec, u8 type) +static void halbtc8192e2ant_autorate_fallback_retry(struct btc_coexist *btcoexist, + bool force_exec, u8 type) { bool wifi_under_bmode = false; @@ -364,32 +364,32 @@ void halbtc8192e2ant_autorate_fallback_retry(struct btc_coexist *btcoexist, coex_dm->pre_arfrtype = coex_dm->cur_arfrtype; } -void halbtc8192e2ant_retrylimit(struct btc_coexist *btcoexist, - bool force_exec, u8 type) +static void halbtc8192e2ant_retrylimit(struct btc_coexist *btcoexist, + bool force_exec, u8 type) { coex_dm->cur_retrylimit_type = type; if (force_exec || (coex_dm->pre_retrylimit_type != coex_dm->cur_retrylimit_type)) { switch (coex_dm->cur_retrylimit_type) { - case 0: /* normal mode */ - btcoexist->btc_write_2byte(btcoexist, 0x42a, - coex_dm->backup_retrylimit); - break; - case 1: /* retry limit=8 */ - btcoexist->btc_write_2byte(btcoexist, 0x42a, - 0x0808); - break; - default: - break; + case 0: /* normal mode */ + btcoexist->btc_write_2byte(btcoexist, 0x42a, + coex_dm->backup_retrylimit); + break; + case 1: /* retry limit=8 */ + btcoexist->btc_write_2byte(btcoexist, 0x42a, + 0x0808); + break; + default: + break; } } coex_dm->pre_retrylimit_type = coex_dm->cur_retrylimit_type; } -void halbtc8192e2ant_ampdu_maxtime(struct btc_coexist *btcoexist, - bool force_exec, u8 type) +static void halbtc8192e2ant_ampdu_maxtime(struct btc_coexist *btcoexist, + bool force_exec, u8 type) { coex_dm->cur_ampdutime_type = type; @@ -411,9 +411,10 @@ void halbtc8192e2ant_ampdu_maxtime(struct btc_coexist *btcoexist, coex_dm->pre_ampdutime_type = coex_dm->cur_ampdutime_type; } -void halbtc8192e2ant_limited_tx(struct btc_coexist *btcoexist, - bool force_exec, u8 ra_masktype, u8 arfr_type, - u8 retrylimit_type, u8 ampdutime_type) +static void halbtc8192e2ant_limited_tx(struct btc_coexist *btcoexist, + bool force_exec, u8 ra_masktype, + u8 arfr_type, u8 retrylimit_type, + u8 ampdutime_type) { u32 disra_mask = 0x0; @@ -429,10 +430,10 @@ void halbtc8192e2ant_limited_tx(struct btc_coexist *btcoexist, halbtc8192e2ant_ampdu_maxtime(btcoexist, force_exec, ampdutime_type); } -void halbtc8192e2ant_limited_rx(struct btc_coexist *btcoexist, - bool force_exec, bool rej_ap_agg_pkt, - bool b_bt_ctrl_agg_buf_size, - u8 agg_buf_size) +static void halbtc8192e2ant_limited_rx(struct btc_coexist *btcoexist, + bool force_exec, bool rej_ap_agg_pkt, + bool b_bt_ctrl_agg_buf_size, + u8 agg_buf_size) { bool reject_rx_agg = rej_ap_agg_pkt; bool bt_ctrl_rx_agg_size = b_bt_ctrl_agg_buf_size; @@ -455,7 +456,7 @@ void halbtc8192e2ant_limited_rx(struct btc_coexist *btcoexist, } -void halbtc8192e2ant_monitor_bt_ctr(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_monitor_bt_ctr(struct btc_coexist *btcoexist) { u32 reg_hp_txrx, reg_lp_txrx, u32tmp; u32 reg_hp_tx = 0, reg_hp_rx = 0, reg_lp_tx = 0, reg_lp_rx = 0; @@ -487,9 +488,9 @@ void halbtc8192e2ant_monitor_bt_ctr(struct btc_coexist *btcoexist) btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc); } -void halbtc8192e2ant_querybt_info(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_querybt_info(struct btc_coexist *btcoexist) { - u8 h2c_parameter[1] ={0}; + u8 h2c_parameter[1] = {0}; coex_sta->c2h_bt_info_req_sent = true; @@ -502,39 +503,7 @@ void halbtc8192e2ant_querybt_info(struct btc_coexist *btcoexist) btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter); } -bool halbtc8192e2ant_iswifi_status_changed(struct btc_coexist *btcoexist) -{ - static bool pre_wifi_busy = false; - static bool pre_under_4way = false, pre_bt_hson = false; - bool wifi_busy = false, under_4way = false, bt_hson = false; - bool wifi_connected = false; - - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED, - &wifi_connected); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy); - btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hson); - btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, - &under_4way); - - if (wifi_connected) { - if (wifi_busy != pre_wifi_busy) { - pre_wifi_busy = wifi_busy; - return true; - } - if (under_4way != pre_under_4way) { - pre_under_4way = under_4way; - return true; - } - if (bt_hson != pre_bt_hson) { - pre_bt_hson = bt_hson; - return true; - } - } - - return false; -} - -void halbtc8192e2ant_update_btlink_info(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_update_btlink_info(struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; bool bt_hson = false; @@ -590,11 +559,11 @@ void halbtc8192e2ant_update_btlink_info(struct btc_coexist *btcoexist) bt_link_info->hid_only = false; } -u8 halbtc8192e2ant_action_algorithm(struct btc_coexist *btcoexist) +static u8 halbtc8192e2ant_action_algorithm(struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; struct btc_stack_info *stack_info = &btcoexist->stack_info; - bool bt_hson=false; + bool bt_hson = false; u8 algorithm = BT_8192E_2ANT_COEX_ALGO_UNDEFINED; u8 numOfDiffProfile = 0; @@ -777,10 +746,10 @@ u8 halbtc8192e2ant_action_algorithm(struct btc_coexist *btcoexist) return algorithm; } -void halbtc8192e2ant_setfw_dac_swinglevel(struct btc_coexist *btcoexist, - u8 dac_swinglvl) +static void halbtc8192e2ant_setfw_dac_swinglevel(struct btc_coexist *btcoexist, + u8 dac_swinglvl) { - u8 h2c_parameter[1] ={0}; + u8 h2c_parameter[1] = {0}; /* There are several type of dacswing * 0x18/ 0x10/ 0xc/ 0x8/ 0x4/ 0x6 */ @@ -794,10 +763,10 @@ void halbtc8192e2ant_setfw_dac_swinglevel(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x64, 1, h2c_parameter); } -void halbtc8192e2ant_set_fwdec_btpwr(struct btc_coexist *btcoexist, - u8 dec_btpwr_lvl) +static void halbtc8192e2ant_set_fwdec_btpwr(struct btc_coexist *btcoexist, + u8 dec_btpwr_lvl) { - u8 h2c_parameter[1] ={0}; + u8 h2c_parameter[1] = {0}; h2c_parameter[0] = dec_btpwr_lvl; @@ -808,12 +777,12 @@ void halbtc8192e2ant_set_fwdec_btpwr(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x62, 1, h2c_parameter); } -void halbtc8192e2ant_dec_btpwr(struct btc_coexist *btcoexist, - bool force_exec, u8 dec_btpwr_lvl) +static void halbtc8192e2ant_dec_btpwr(struct btc_coexist *btcoexist, + bool force_exec, u8 dec_btpwr_lvl) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, "[BTCoex], %s Dec BT power level = %d\n", - (force_exec? "force to":""), dec_btpwr_lvl); + (force_exec ? "force to":""), dec_btpwr_lvl); coex_dm->cur_dec_bt_pwr = dec_btpwr_lvl; if (!force_exec) { @@ -826,10 +795,10 @@ void halbtc8192e2ant_dec_btpwr(struct btc_coexist *btcoexist, coex_dm->pre_dec_bt_pwr = coex_dm->cur_dec_bt_pwr; } -void halbtc8192e2ant_set_bt_autoreport(struct btc_coexist *btcoexist, - bool enable_autoreport) +static void halbtc8192e2ant_set_bt_autoreport(struct btc_coexist *btcoexist, + bool enable_autoreport) { - u8 h2c_parameter[1] ={0}; + u8 h2c_parameter[1] = {0}; h2c_parameter[0] = 0; @@ -838,19 +807,20 @@ void halbtc8192e2ant_set_bt_autoreport(struct btc_coexist *btcoexist, BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, "[BTCoex], BT FW auto report : %s, FW write 0x68=0x%x\n", - (enable_autoreport? "Enabled!!":"Disabled!!"), + (enable_autoreport ? "Enabled!!":"Disabled!!"), h2c_parameter[0]); btcoexist->btc_fill_h2c(btcoexist, 0x68, 1, h2c_parameter); } -void halbtc8192e2ant_bt_autoreport(struct btc_coexist *btcoexist, - bool force_exec, bool enable_autoreport) +static void halbtc8192e2ant_bt_autoreport(struct btc_coexist *btcoexist, + bool force_exec, + bool enable_autoreport) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, "[BTCoex], %s BT Auto report = %s\n", - (force_exec? "force to":""), - ((enable_autoreport)? "Enabled":"Disabled")); + (force_exec ? "force to":""), + ((enable_autoreport) ? "Enabled":"Disabled")); coex_dm->cur_bt_auto_report = enable_autoreport; if (!force_exec) { @@ -868,12 +838,12 @@ void halbtc8192e2ant_bt_autoreport(struct btc_coexist *btcoexist, coex_dm->pre_bt_auto_report = coex_dm->cur_bt_auto_report; } -void halbtc8192e2ant_fw_dac_swinglvl(struct btc_coexist *btcoexist, - bool force_exec, u8 fw_dac_swinglvl) +static void halbtc8192e2ant_fw_dac_swinglvl(struct btc_coexist *btcoexist, + bool force_exec, u8 fw_dac_swinglvl) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, "[BTCoex], %s set FW Dac Swing level = %d\n", - (force_exec? "force to":""), fw_dac_swinglvl); + (force_exec ? "force to":""), fw_dac_swinglvl); coex_dm->cur_fw_dac_swing_lvl = fw_dac_swinglvl; if (!force_exec) { @@ -893,8 +863,8 @@ void halbtc8192e2ant_fw_dac_swinglvl(struct btc_coexist *btcoexist, coex_dm->pre_fw_dac_swing_lvl = coex_dm->cur_fw_dac_swing_lvl; } -void halbtc8192e2ant_set_sw_rf_rx_lpf_corner(struct btc_coexist *btcoexist, - bool rx_rf_shrink_on) +static void halbtc8192e2ant_set_sw_rf_rx_lpf_corner(struct btc_coexist *btcoexist, + bool rx_rf_shrink_on) { if (rx_rf_shrink_on) { /* Shrink RF Rx LPF corner */ @@ -915,12 +885,12 @@ void halbtc8192e2ant_set_sw_rf_rx_lpf_corner(struct btc_coexist *btcoexist, } } -void halbtc8192e2ant_rf_shrink(struct btc_coexist *btcoexist, - bool force_exec, bool rx_rf_shrink_on) +static void halbtc8192e2ant_rf_shrink(struct btc_coexist *btcoexist, + bool force_exec, bool rx_rf_shrink_on) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, "[BTCoex], %s turn Rx RF Shrink = %s\n", - (force_exec? "force to":""), ((rx_rf_shrink_on)? "ON":"OFF")); + (force_exec ? "force to":""), ((rx_rf_shrink_on) ? "ON":"OFF")); coex_dm->cur_rf_rx_lpf_shrink = rx_rf_shrink_on; if (!force_exec) { @@ -939,56 +909,8 @@ void halbtc8192e2ant_rf_shrink(struct btc_coexist *btcoexist, coex_dm->pre_rf_rx_lpf_shrink = coex_dm->cur_rf_rx_lpf_shrink; } -void halbtc8192e2ant_set_sw_penalty_tx_rateadaptive( - struct btc_coexist *btcoexist, - bool low_penalty_ra) -{ - u8 h2c_parameter[6] ={0}; - - h2c_parameter[0] = 0x6; /* opCode, 0x6= Retry_Penalty */ - - if (low_penalty_ra) { - h2c_parameter[1] |= BIT0; - /* normal rate except MCS7/6/5, OFDM54/48/36 */ - h2c_parameter[2] = 0x00; - h2c_parameter[3] = 0xf7; /* MCS7 or OFDM54 */ - h2c_parameter[4] = 0xf8; /* MCS6 or OFDM48 */ - h2c_parameter[5] = 0xf9; /* MCS5 or OFDM36 */ - } - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, - "[BTCoex], set WiFi Low-Penalty Retry: %s", - (low_penalty_ra? "ON!!":"OFF!!")); - - btcoexist->btc_fill_h2c(btcoexist, 0x69, 6, h2c_parameter); -} - -void halbtc8192e2ant_low_penalty_ra(struct btc_coexist *btcoexist, - bool force_exec, bool low_penalty_ra) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, - "[BTCoex], %s turn LowPenaltyRA = %s\n", - (force_exec? "force to":""), ((low_penalty_ra)? "ON":"OFF")); - coex_dm->cur_low_penalty_ra = low_penalty_ra; - - if (!force_exec) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, - "[BTCoex] bPreLowPenaltyRa=%d, bCurLowPenaltyRa=%d\n", - coex_dm->pre_low_penalty_ra, - coex_dm->cur_low_penalty_ra); - - if (coex_dm->pre_low_penalty_ra == - coex_dm->cur_low_penalty_ra) - return; - } - halbtc8192e2ant_set_sw_penalty_tx_rateadaptive(btcoexist, - coex_dm->cur_low_penalty_ra); - - coex_dm->pre_low_penalty_ra = coex_dm->cur_low_penalty_ra; -} - -void halbtc8192e2ant_set_dac_swingreg(struct btc_coexist *btcoexist, - u32 level) +static void halbtc8192e2ant_set_dac_swingreg(struct btc_coexist *btcoexist, + u32 level) { u8 val = (u8)level; @@ -997,9 +919,9 @@ void halbtc8192e2ant_set_dac_swingreg(struct btc_coexist *btcoexist, btcoexist->btc_write_1byte_bitmask(btcoexist, 0x883, 0x3e, val); } -void halbtc8192e2ant_setsw_fulltime_dacswing(struct btc_coexist *btcoexist, - bool sw_dac_swingon, - u32 sw_dac_swinglvl) +static void halbtc8192e2ant_setsw_fulltime_dacswing(struct btc_coexist *btcoexist, + bool sw_dac_swingon, + u32 sw_dac_swinglvl) { if (sw_dac_swingon) halbtc8192e2ant_set_dac_swingreg(btcoexist, sw_dac_swinglvl); @@ -1007,15 +929,14 @@ void halbtc8192e2ant_setsw_fulltime_dacswing(struct btc_coexist *btcoexist, halbtc8192e2ant_set_dac_swingreg(btcoexist, 0x18); } - -void halbtc8192e2ant_DacSwing(struct btc_coexist *btcoexist, - bool force_exec, bool dac_swingon, - u32 dac_swinglvl) +static void halbtc8192e2ant_DacSwing(struct btc_coexist *btcoexist, + bool force_exec, bool dac_swingon, + u32 dac_swinglvl) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, "[BTCoex], %s turn DacSwing=%s, dac_swinglvl=0x%x\n", - (force_exec? "force to":""), - ((dac_swingon)? "ON":"OFF"), dac_swinglvl); + (force_exec ? "force to":""), + ((dac_swingon) ? "ON":"OFF"), dac_swinglvl); coex_dm->cur_dac_swing_on = dac_swingon; coex_dm->cur_dac_swing_lvl = dac_swinglvl; @@ -1041,46 +962,8 @@ void halbtc8192e2ant_DacSwing(struct btc_coexist *btcoexist, coex_dm->pre_dac_swing_lvl = coex_dm->cur_dac_swing_lvl; } -void halbtc8192e2ant_set_adc_backoff(struct btc_coexist *btcoexist, - bool adc_backoff) -{ - if(adc_backoff) - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], BB BackOff Level On!\n"); - btcoexist->btc_write_1byte_bitmask(btcoexist, 0xc05, 0x30, 0x3); - } - else - { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], BB BackOff Level Off!\n"); - btcoexist->btc_write_1byte_bitmask(btcoexist, 0xc05, 0x30, 0x1); - } -} - -void halbtc8192e2ant_adc_backoff(struct btc_coexist *btcoexist, - bool force_exec, bool adc_backoff) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, - "[BTCoex], %s turn AdcBackOff = %s\n", - (force_exec? "force to":""), ((adc_backoff)? "ON":"OFF")); - coex_dm->cur_adc_back_off = adc_backoff; - - if (!force_exec) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, - "[BTCoex], bPreAdcBackOff=%d, bCurAdcBackOff=%d\n", - coex_dm->pre_adc_back_off, coex_dm->cur_adc_back_off); - - if (coex_dm->pre_adc_back_off == coex_dm->cur_adc_back_off) - return; - } - halbtc8192e2ant_set_adc_backoff(btcoexist, coex_dm->cur_adc_back_off); - - coex_dm->pre_adc_back_off = coex_dm->cur_adc_back_off; -} - -void halbtc8192e2ant_set_agc_table(struct btc_coexist *btcoexist, - bool agc_table_en) +static void halbtc8192e2ant_set_agc_table(struct btc_coexist *btcoexist, + bool agc_table_en) { /* BB AGC Gain Table */ @@ -1096,7 +979,7 @@ void halbtc8192e2ant_set_agc_table(struct btc_coexist *btcoexist, } else { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, "[BTCoex], BB Agc Table Off!\n"); - btcoexist->btc_write_4byte(btcoexist, 0xc78, 0xaa1A0001); + btcoexist->btc_write_4byte(btcoexist, 0xc78, 0xaa1A0001); btcoexist->btc_write_4byte(btcoexist, 0xc78, 0xa91B0001); btcoexist->btc_write_4byte(btcoexist, 0xc78, 0xa81C0001); btcoexist->btc_write_4byte(btcoexist, 0xc78, 0xa71D0001); @@ -1105,13 +988,13 @@ void halbtc8192e2ant_set_agc_table(struct btc_coexist *btcoexist, } } -void halbtc8192e2ant_AgcTable(struct btc_coexist *btcoexist, - bool force_exec, bool agc_table_en) +static void halbtc8192e2ant_AgcTable(struct btc_coexist *btcoexist, + bool force_exec, bool agc_table_en) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, "[BTCoex], %s %s Agc Table\n", - (force_exec? "force to":""), - ((agc_table_en)? "Enable":"Disable")); + (force_exec ? "force to":""), + ((agc_table_en) ? "Enable":"Disable")); coex_dm->cur_agc_table_en = agc_table_en; if (!force_exec) { @@ -1127,9 +1010,9 @@ void halbtc8192e2ant_AgcTable(struct btc_coexist *btcoexist, coex_dm->pre_agc_table_en = coex_dm->cur_agc_table_en; } -void halbtc8192e2ant_set_coex_table(struct btc_coexist *btcoexist, - u32 val0x6c0, u32 val0x6c4, - u32 val0x6c8, u8 val0x6cc) +static void halbtc8192e2ant_set_coex_table(struct btc_coexist *btcoexist, + u32 val0x6c0, u32 val0x6c4, + u32 val0x6c8, u8 val0x6cc) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, "[BTCoex], set coex table, set 0x6c0=0x%x\n", val0x6c0); @@ -1148,13 +1031,14 @@ void halbtc8192e2ant_set_coex_table(struct btc_coexist *btcoexist, btcoexist->btc_write_1byte(btcoexist, 0x6cc, val0x6cc); } -void halbtc8192e2ant_coex_table(struct btc_coexist *btcoexist, bool force_exec, - u32 val0x6c0, u32 val0x6c4, - u32 val0x6c8, u8 val0x6cc) +static void halbtc8192e2ant_coex_table(struct btc_coexist *btcoexist, + bool force_exec, + u32 val0x6c0, u32 val0x6c4, + u32 val0x6c8, u8 val0x6cc) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, "[BTCoex], %s write Coex Table 0x6c0=0x%x, ", - (force_exec? "force to":""), val0x6c0); + (force_exec ? "force to":""), val0x6c0); BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, "0x6c4=0x%x, 0x6c8=0x%x, 0x6cc=0x%x\n", val0x6c4, val0x6c8, val0x6cc); @@ -1171,7 +1055,7 @@ void halbtc8192e2ant_coex_table(struct btc_coexist *btcoexist, bool force_exec, "preVal0x6c8=0x%x, preVal0x6cc=0x%x !!\n", coex_dm->pre_val0x6c8, coex_dm->pre_val0x6cc); BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, - "[BTCoex], curVal0x6c0=0x%x, curVal0x6c4=0x%x, \n", + "[BTCoex], curVal0x6c0=0x%x, curVal0x6c4=0x%x,\n", coex_dm->cur_val0x6c0, coex_dm->cur_val0x6c4); BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, "curVal0x6c8=0x%x, curVal0x6cc=0x%x !!\n", @@ -1192,8 +1076,8 @@ void halbtc8192e2ant_coex_table(struct btc_coexist *btcoexist, bool force_exec, coex_dm->pre_val0x6cc = coex_dm->cur_val0x6cc; } -void halbtc8192e2ant_coex_table_with_type(struct btc_coexist *btcoexist, - bool force_exec, u8 type) +static void halbtc8192e2ant_coex_table_with_type(struct btc_coexist *btcoexist, + bool force_exec, u8 type) { switch (type) { case 0: @@ -1221,10 +1105,10 @@ void halbtc8192e2ant_coex_table_with_type(struct btc_coexist *btcoexist, } } -void halbtc8192e2ant_set_fw_ignore_wlanact(struct btc_coexist *btcoexist, - bool enable) +static void halbtc8192e2ant_set_fw_ignore_wlanact(struct btc_coexist *btcoexist, + bool enable) { - u8 h2c_parameter[1] ={0}; + u8 h2c_parameter[1] = {0}; if (enable) h2c_parameter[0] |= BIT0; /* function enable */ @@ -1236,12 +1120,12 @@ void halbtc8192e2ant_set_fw_ignore_wlanact(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x63, 1, h2c_parameter); } -void halbtc8192e2ant_IgnoreWlanAct(struct btc_coexist *btcoexist, - bool force_exec, bool enable) +static void halbtc8192e2ant_IgnoreWlanAct(struct btc_coexist *btcoexist, + bool force_exec, bool enable) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, "[BTCoex], %s turn Ignore WlanAct %s\n", - (force_exec? "force to":""), (enable? "ON":"OFF")); + (force_exec ? "force to":""), (enable ? "ON":"OFF")); coex_dm->cur_ignore_wlan_act = enable; if (!force_exec) { @@ -1261,10 +1145,10 @@ void halbtc8192e2ant_IgnoreWlanAct(struct btc_coexist *btcoexist, coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act; } -void halbtc8192e2ant_SetFwPstdma(struct btc_coexist *btcoexist, u8 byte1, - u8 byte2, u8 byte3, u8 byte4, u8 byte5) +static void halbtc8192e2ant_SetFwPstdma(struct btc_coexist *btcoexist, u8 byte1, + u8 byte2, u8 byte3, u8 byte4, u8 byte5) { - u8 h2c_parameter[5] ={0}; + u8 h2c_parameter[5] = {0}; h2c_parameter[0] = byte1; h2c_parameter[1] = byte2; @@ -1287,29 +1171,33 @@ void halbtc8192e2ant_SetFwPstdma(struct btc_coexist *btcoexist, u8 byte1, btcoexist->btc_fill_h2c(btcoexist, 0x60, 5, h2c_parameter); } -void halbtc8192e2ant_sw_mechanism1(struct btc_coexist *btcoexist, - bool shrink_rx_lpf, bool low_penalty_ra, - bool limited_dig, bool btlan_constrain) +static void halbtc8192e2ant_sw_mechanism1(struct btc_coexist *btcoexist, + bool shrink_rx_lpf, + bool low_penalty_ra, + bool limited_dig, + bool btlan_constrain) { halbtc8192e2ant_rf_shrink(btcoexist, NORMAL_EXEC, shrink_rx_lpf); } -void halbtc8192e2ant_sw_mechanism2(struct btc_coexist *btcoexist, - bool agc_table_shift, bool adc_backoff, - bool sw_dac_swing, u32 dac_swinglvl) +static void halbtc8192e2ant_sw_mechanism2(struct btc_coexist *btcoexist, + bool agc_table_shift, + bool adc_backoff, + bool sw_dac_swing, + u32 dac_swinglvl) { halbtc8192e2ant_AgcTable(btcoexist, NORMAL_EXEC, agc_table_shift); halbtc8192e2ant_DacSwing(btcoexist, NORMAL_EXEC, sw_dac_swing, dac_swinglvl); } -void halbtc8192e2ant_ps_tdma(struct btc_coexist *btcoexist, - bool force_exec, bool turn_on, u8 type) +static void halbtc8192e2ant_ps_tdma(struct btc_coexist *btcoexist, + bool force_exec, bool turn_on, u8 type) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, "[BTCoex], %s turn %s PS TDMA, type=%d\n", - (force_exec? "force to":""), (turn_on? "ON":"OFF"), type); + (force_exec ? "force to":""), (turn_on ? "ON":"OFF"), type); coex_dm->cur_ps_tdma_on = turn_on; coex_dm->cur_ps_tdma = type; @@ -1440,7 +1328,8 @@ void halbtc8192e2ant_ps_tdma(struct btc_coexist *btcoexist, coex_dm->pre_ps_tdma = coex_dm->cur_ps_tdma; } -void halbtc8192e2ant_set_switch_sstype(struct btc_coexist *btcoexist, u8 sstype) +static void halbtc8192e2ant_set_switch_sstype(struct btc_coexist *btcoexist, + u8 sstype) { u8 mimops = BTC_MIMO_PS_DYNAMIC; u32 disra_mask = 0x0; @@ -1461,7 +1350,7 @@ void halbtc8192e2ant_set_switch_sstype(struct btc_coexist *btcoexist, u8 sstype) /* switch cck patch */ btcoexist->btc_write_1byte_bitmask(btcoexist, 0xe77, 0x4, 0x1); btcoexist->btc_write_1byte(btcoexist, 0xa07, 0x81); - mimops=BTC_MIMO_PS_STATIC; + mimops = BTC_MIMO_PS_STATIC; } else if (sstype == 2) { halbtc8192e2ant_ps_tdma(btcoexist, FORCE_EXEC, false, 0); btcoexist->btc_write_1byte(btcoexist, 0xc04, 0x33); @@ -1469,18 +1358,18 @@ void halbtc8192e2ant_set_switch_sstype(struct btc_coexist *btcoexist, u8 sstype) btcoexist->btc_write_4byte(btcoexist, 0x90c, 0x81121313); btcoexist->btc_write_1byte_bitmask(btcoexist, 0xe77, 0x4, 0x0); btcoexist->btc_write_1byte(btcoexist, 0xa07, 0x41); - mimops=BTC_MIMO_PS_DYNAMIC; + mimops = BTC_MIMO_PS_DYNAMIC; } /* set rx 1ss or 2ss */ btcoexist->btc_set(btcoexist, BTC_SET_ACT_SEND_MIMO_PS, &mimops); } -void halbtc8192e2ant_switch_sstype(struct btc_coexist *btcoexist, +static void halbtc8192e2ant_switch_sstype(struct btc_coexist *btcoexist, bool force_exec, u8 new_sstype) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, "[BTCoex], %s Switch SS Type = %d\n", - (force_exec? "force to":""), new_sstype); + (force_exec ? "force to":""), new_sstype); coex_dm->cur_sstype = new_sstype; if (!force_exec) { @@ -1492,7 +1381,7 @@ void halbtc8192e2ant_switch_sstype(struct btc_coexist *btcoexist, coex_dm->pre_sstype = coex_dm->cur_sstype; } -void halbtc8192e2ant_coex_alloff(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_coex_alloff(struct btc_coexist *btcoexist) { /* fw all off */ halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1); @@ -1507,7 +1396,7 @@ void halbtc8192e2ant_coex_alloff(struct btc_coexist *btcoexist) halbtc8192e2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0); } -void halbtc8192e2ant_init_coex_dm(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_init_coex_dm(struct btc_coexist *btcoexist) { /* force to reset coex mechanism */ @@ -1522,7 +1411,7 @@ void halbtc8192e2ant_init_coex_dm(struct btc_coexist *btcoexist) halbtc8192e2ant_sw_mechanism2(btcoexist, false, false, false, 0x18); } -void halbtc8192e2ant_action_bt_inquiry(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_bt_inquiry(struct btc_coexist *btcoexist) { bool low_pwr_disable = true; @@ -1540,7 +1429,7 @@ void halbtc8192e2ant_action_bt_inquiry(struct btc_coexist *btcoexist) halbtc8192e2ant_sw_mechanism2(btcoexist, false, false, false, 0x18); } -bool halbtc8192e2ant_is_common_action(struct btc_coexist *btcoexist) +static bool halbtc8192e2ant_is_common_action(struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; bool common = false, wifi_connected = false, wifi_busy = false; @@ -1586,7 +1475,7 @@ bool halbtc8192e2ant_is_common_action(struct btc_coexist *btcoexist) halbtc8192e2ant_fw_dac_swinglvl(btcoexist, NORMAL_EXEC, 6); halbtc8192e2ant_dec_btpwr(btcoexist, NORMAL_EXEC, 0); - halbtc8192e2ant_sw_mechanism1(btcoexist, false, false, false, + halbtc8192e2ant_sw_mechanism1(btcoexist, false, false, false, false); halbtc8192e2ant_sw_mechanism2(btcoexist, false, false, false, 0x18); @@ -1685,9 +1574,9 @@ bool halbtc8192e2ant_is_common_action(struct btc_coexist *btcoexist) return common; } -void halbtc8192e2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, - bool sco_hid, bool tx_pause, - u8 max_interval) +static void halbtc8192e2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, + bool sco_hid, bool tx_pause, + u8 max_interval) { static int up, dn, m, n, wait_cnt; /* 0: no change, +1: increase WiFi duration, @@ -1799,7 +1688,7 @@ void halbtc8192e2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, up = 0; dn = 0; m = 1; - n= 3; + n = 3; result = 0; wait_cnt = 0; } else { @@ -2116,7 +2005,7 @@ void halbtc8192e2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, 12; } } else if (result == 1) { - if (coex_dm->cur_ps_tdma == 4) { + if (coex_dm->cur_ps_tdma == 4) { halbtc8192e2ant_ps_tdma( btcoexist, NORMAL_EXEC, @@ -2416,21 +2305,21 @@ void halbtc8192e2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, true, 2); coex_dm->ps_tdma_du_adj_type = 2; - } else if(coex_dm->cur_ps_tdma == 12) { + } else if (coex_dm->cur_ps_tdma == 12) { halbtc8192e2ant_ps_tdma( btcoexist, NORMAL_EXEC, true, 11); coex_dm->ps_tdma_du_adj_type = 11; - } else if(coex_dm->cur_ps_tdma == 11) { + } else if (coex_dm->cur_ps_tdma == 11) { halbtc8192e2ant_ps_tdma( btcoexist, NORMAL_EXEC, true, 10); coex_dm->ps_tdma_du_adj_type = 10; - } else if(coex_dm->cur_ps_tdma == 10) { + } else if (coex_dm->cur_ps_tdma == 10) { halbtc8192e2ant_ps_tdma( btcoexist, NORMAL_EXEC, @@ -2721,7 +2610,7 @@ void halbtc8192e2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, if (coex_dm->cur_ps_tdma != coex_dm->ps_tdma_du_adj_type) { bool scan = false, link = false, roam = false; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, - "[BTCoex], PsTdma type dismatch!!!, " ); + "[BTCoex], PsTdma type dismatch!!!, "); BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, "curPsTdma=%d, recordPsTdma=%d\n", coex_dm->cur_ps_tdma, coex_dm->ps_tdma_du_adj_type); @@ -2730,7 +2619,7 @@ void halbtc8192e2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link); btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam); - if ( !scan && !link && !roam) + if (!scan && !link && !roam) halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, coex_dm->ps_tdma_du_adj_type); @@ -2742,7 +2631,7 @@ void halbtc8192e2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, } /* SCO only or SCO+PAN(HS) */ -void halbtc8192e2ant_action_sco(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_sco(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_STAY_LOW; u32 wifi_bw; @@ -2804,7 +2693,7 @@ void halbtc8192e2ant_action_sco(struct btc_coexist *btcoexist) } } -void halbtc8192e2ant_action_sco_pan(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_sco_pan(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_STAY_LOW; u32 wifi_bw; @@ -2866,9 +2755,9 @@ void halbtc8192e2ant_action_sco_pan(struct btc_coexist *btcoexist) } } -void halbtc8192e2ant_action_hid(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_hid(struct btc_coexist *btcoexist) { - u8 wifirssi_state, btrssi_state=BTC_RSSI_STATE_HIGH; + u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; wifirssi_state = halbtc8192e2ant_wifirssi_state(btcoexist, 0, 2, 15, 0); @@ -2906,7 +2795,7 @@ void halbtc8192e2ant_action_hid(struct btc_coexist *btcoexist) halbtc8192e2ant_sw_mechanism2(btcoexist, true, false, false, 0x18); } else { - halbtc8192e2ant_sw_mechanism1(btcoexist, true, true, + halbtc8192e2ant_sw_mechanism1(btcoexist, true, true, false, false); halbtc8192e2ant_sw_mechanism2(btcoexist, false, false, false, 0x18); @@ -2918,8 +2807,8 @@ void halbtc8192e2ant_action_hid(struct btc_coexist *btcoexist) false, false); halbtc8192e2ant_sw_mechanism2(btcoexist, true, false, false, 0x18); - } else { - halbtc8192e2ant_sw_mechanism1(btcoexist, false, true, + } else { + halbtc8192e2ant_sw_mechanism1(btcoexist, false, true, false, false); halbtc8192e2ant_sw_mechanism2(btcoexist, false, false, false, 0x18); @@ -2928,7 +2817,7 @@ void halbtc8192e2ant_action_hid(struct btc_coexist *btcoexist) } /* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */ -void halbtc8192e2ant_action_a2dp(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_a2dp(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; @@ -2991,7 +2880,7 @@ void halbtc8192e2ant_action_a2dp(struct btc_coexist *btcoexist) if (BTC_WIFI_BW_HT40 == wifi_bw) { if ((wifirssi_state == BTC_RSSI_STATE_HIGH) || (wifirssi_state == BTC_RSSI_STATE_STAY_HIGH)) { - halbtc8192e2ant_sw_mechanism1(btcoexist, true, false, + halbtc8192e2ant_sw_mechanism1(btcoexist, true, false, false, false); halbtc8192e2ant_sw_mechanism2(btcoexist, true, false, false, 0x18); @@ -3017,7 +2906,7 @@ void halbtc8192e2ant_action_a2dp(struct btc_coexist *btcoexist) } } -void halbtc8192e2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; @@ -3052,7 +2941,7 @@ void halbtc8192e2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) if (BTC_WIFI_BW_HT40 == wifi_bw) { if ((wifirssi_state == BTC_RSSI_STATE_HIGH) || (wifirssi_state == BTC_RSSI_STATE_STAY_HIGH)) { - halbtc8192e2ant_sw_mechanism1(btcoexist, true, false, + halbtc8192e2ant_sw_mechanism1(btcoexist, true, false, false, false); halbtc8192e2ant_sw_mechanism2(btcoexist, true, false, true, 0x6); @@ -3078,7 +2967,7 @@ void halbtc8192e2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) } } -void halbtc8192e2ant_action_pan_edr(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_pan_edr(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; @@ -3139,7 +3028,7 @@ void halbtc8192e2ant_action_pan_edr(struct btc_coexist *btcoexist) } /* PAN(HS) only */ -void halbtc8192e2ant_action_pan_hs(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_pan_hs(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; @@ -3197,9 +3086,9 @@ void halbtc8192e2ant_action_pan_hs(struct btc_coexist *btcoexist) } /* PAN(EDR)+A2DP */ -void halbtc8192e2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) { - u8 wifirssi_state, btrssi_state=BTC_RSSI_STATE_HIGH; + u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; wifirssi_state = halbtc8192e2ant_wifirssi_state(btcoexist, 0, 2, 15, 0); @@ -3260,7 +3149,7 @@ void halbtc8192e2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) } } -void halbtc8192e2ant_action_pan_edr_hid(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_pan_edr_hid(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; @@ -3280,15 +3169,15 @@ void halbtc8192e2ant_action_pan_edr_hid(struct btc_coexist *btcoexist) if ((btrssi_state == BTC_RSSI_STATE_LOW) || (btrssi_state == BTC_RSSI_STATE_STAY_LOW)) { halbtc8192e2ant_dec_btpwr(btcoexist, NORMAL_EXEC, 0); - halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 14); + halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 14); } else if ((btrssi_state == BTC_RSSI_STATE_MEDIUM) || (btrssi_state == BTC_RSSI_STATE_STAY_MEDIUM)) { halbtc8192e2ant_dec_btpwr(btcoexist, NORMAL_EXEC, 2); - halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 10); + halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 10); } else if ((btrssi_state == BTC_RSSI_STATE_HIGH) || (btrssi_state == BTC_RSSI_STATE_STAY_HIGH)) { halbtc8192e2ant_dec_btpwr(btcoexist, NORMAL_EXEC, 4); - halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 10); + halbtc8192e2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 10); } /* sw mechanism */ @@ -3322,7 +3211,7 @@ void halbtc8192e2ant_action_pan_edr_hid(struct btc_coexist *btcoexist) } /* HID+A2DP+PAN(EDR) */ -void halbtc8192e2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; @@ -3383,7 +3272,7 @@ void halbtc8192e2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist) } } -void halbtc8192e2ant_action_hid_a2dp(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_action_hid_a2dp(struct btc_coexist *btcoexist) { u8 wifirssi_state, btrssi_state = BTC_RSSI_STATE_HIGH; u32 wifi_bw; @@ -3403,7 +3292,7 @@ void halbtc8192e2ant_action_hid_a2dp(struct btc_coexist *btcoexist) halbtc8192e2ant_dec_btpwr(btcoexist, NORMAL_EXEC, 0); halbtc8192e2ant_tdma_duration_adjust(btcoexist, true, true, 2); } else if ((btrssi_state == BTC_RSSI_STATE_MEDIUM) || - (btrssi_state == BTC_RSSI_STATE_STAY_MEDIUM)) { + (btrssi_state == BTC_RSSI_STATE_STAY_MEDIUM)) { halbtc8192e2ant_dec_btpwr(btcoexist, NORMAL_EXEC, 2); halbtc8192e2ant_tdma_duration_adjust(btcoexist, true, false, 2); } else if ((btrssi_state == BTC_RSSI_STATE_HIGH) || @@ -3442,7 +3331,7 @@ void halbtc8192e2ant_action_hid_a2dp(struct btc_coexist *btcoexist) } } -void halbtc8192e2ant_run_coexist_mechanism(struct btc_coexist *btcoexist) +static void halbtc8192e2ant_run_coexist_mechanism(struct btc_coexist *btcoexist) { u8 algorithm = 0; @@ -3472,7 +3361,7 @@ void halbtc8192e2ant_run_coexist_mechanism(struct btc_coexist *btcoexist) coex_dm->cur_algorithm = algorithm; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, - "[BTCoex], Algorithm = %d \n", coex_dm->cur_algorithm); + "[BTCoex], Algorithm = %d\n", coex_dm->cur_algorithm); if (halbtc8192e2ant_is_common_action(btcoexist)) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, @@ -3552,7 +3441,8 @@ void halbtc8192e2ant_run_coexist_mechanism(struct btc_coexist *btcoexist) } } -void halbtc8192e2ant_init_hwconfig(struct btc_coexist *btcoexist, bool backup) +static void halbtc8192e2ant_init_hwconfig(struct btc_coexist *btcoexist, + bool backup) { u16 u16tmp = 0; u8 u8tmp = 0; @@ -3649,7 +3539,7 @@ void ex_halbtc8192e2ant_init_coex_dm(struct btc_coexist *btcoexist) void ex_halbtc8192e2ant_display_coex_info(struct btc_coexist *btcoexist) { struct btc_board_info *board_info = &btcoexist->board_info; - struct btc_stack_info*stack_info = &btcoexist->stack_info; + struct btc_stack_info *stack_info = &btcoexist->stack_info; u8 *cli_buf = btcoexist->cli_buf; u8 u8tmp[4], i, bt_info_ext, ps_tdma_case = 0; u16 u16tmp[4]; @@ -3735,9 +3625,9 @@ void ex_halbtc8192e2ant_display_coex_info(struct btc_coexist *btcoexist) CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %s/ %s ", "Wifi status", (wifi_under_5g ? "5G" : "2.4G"), ((BTC_WIFI_BW_LEGACY == wifi_bw) ? "Legacy" : - (((BTC_WIFI_BW_HT40 == wifi_bw) ? "HT40" : "HT20"))), + (((BTC_WIFI_BW_HT40 == wifi_bw) ? "HT40" : "HT20"))), ((!wifi_busy) ? "idle" : - ((BTC_WIFI_TRAFFIC_TX == wifi_traffic_dir) ? + ((BTC_WIFI_TRAFFIC_TX == wifi_traffic_dir) ? "uplink" : "downlink"))); CL_PRINTF(cli_buf); @@ -3766,7 +3656,7 @@ void ex_halbtc8192e2ant_display_coex_info(struct btc_coexist *btcoexist) (bt_info_ext&BIT0) ? "Basic rate" : "EDR rate"); CL_PRINTF(cli_buf); - for (i=0; i<BT_INFO_SRC_8192E_2ANT_MAX; i++) { + for (i = 0; i < BT_INFO_SRC_8192E_2ANT_MAX; i++) { if (coex_sta->bt_info_c2h_cnt[i]) { CL_SPRINTF(cli_buf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x ", @@ -3911,9 +3801,6 @@ void ex_halbtc8192e2ant_display_coex_info(struct btc_coexist *btcoexist) "0x774(lp rx[31:16]/tx[15:0])", coex_sta->low_priority_rx, coex_sta->low_priority_tx); CL_PRINTF(cli_buf); -#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 1) - halbtc8192e2ant_monitor_bt_ctr(btcoexist); -#endif btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS); } @@ -3950,7 +3837,7 @@ void ex_halbtc8192e2ant_scan_notify(struct btc_coexist *btcoexist, u8 type) if (BTC_SCAN_START == type) BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, "[BTCoex], SCAN START notify\n"); - else if(BTC_SCAN_FINISH == type) + else if (BTC_SCAN_FINISH == type) BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, "[BTCoex], SCAN FINISH notify\n"); } @@ -3960,7 +3847,7 @@ void ex_halbtc8192e2ant_connect_notify(struct btc_coexist *btcoexist, u8 type) if (BTC_ASSOCIATE_START == type) BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, "[BTCoex], CONNECT START notify\n"); - else if(BTC_ASSOCIATE_FINISH == type) + else if (BTC_ASSOCIATE_FINISH == type) BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, "[BTCoex], CONNECT FINISH notify\n"); } @@ -3968,7 +3855,7 @@ void ex_halbtc8192e2ant_connect_notify(struct btc_coexist *btcoexist, u8 type) void ex_halbtc8192e2ant_media_status_notify(struct btc_coexist *btcoexist, u8 type) { - u8 h2c_parameter[3] ={0}; + u8 h2c_parameter[3] = {0}; u32 wifi_bw; u8 wifi_center_chnl; @@ -4014,12 +3901,12 @@ void ex_halbtc8192e2ant_special_packet_notify(struct btc_coexist *btcoexist, u8 type) { if (type == BTC_PACKET_DHCP) - BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, "[BTCoex], DHCP Packet notify\n"); - } +} void ex_halbtc8192e2ant_bt_info_notify(struct btc_coexist *btcoexist, - u8 *tmp_buf, u8 length ) + u8 *tmp_buf, u8 length) { u8 bt_info = 0; u8 i, rspSource = 0; @@ -4089,18 +3976,16 @@ void ex_halbtc8192e2ant_bt_info_notify(struct btc_coexist *btcoexist, * do nothing here. */ } -#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 0) if ((coex_sta->bt_info_ext & BIT4)) { /* BT auto report already enabled, do nothing */ } else { halbtc8192e2ant_bt_autoreport(btcoexist, FORCE_EXEC, true); } -#endif } /* check BIT2 first ==> check if bt is under inquiry or page scan */ - if(bt_info & BT_INFO_8192E_2ANT_B_INQ_PAGE) + if (bt_info & BT_INFO_8192E_2ANT_B_INQ_PAGE) coex_sta->c2h_bt_inquiry_page = true; else coex_sta->c2h_bt_inquiry_page = false; @@ -4180,10 +4065,10 @@ void ex_halbtc8192e2ant_stack_operation_notify(struct btc_coexist *btcoexist, { if (BTC_STACK_OP_INQ_PAGE_PAIR_START == type) BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, - "[BTCoex] StackOP Inquiry/page/pair start notify\n"); - else if(BTC_STACK_OP_INQ_PAGE_PAIR_FINISH == type) + "[BTCoex] StackOP Inquiry/page/pair start notify\n"); + else if (BTC_STACK_OP_INQ_PAGE_PAIR_FINISH == type) BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, - "[BTCoex] StackOP Inquiry/page/pair finish notify\n"); + "[BTCoex] StackOP Inquiry/page/pair finish notify\n"); } void ex_halbtc8192e2ant_halt_notify(struct btc_coexist *btcoexist) @@ -4196,10 +4081,10 @@ void ex_halbtc8192e2ant_halt_notify(struct btc_coexist *btcoexist) void ex_halbtc8192e2ant_periodical(struct btc_coexist *btcoexist) { - static u8 dis_ver_info_cnt = 0; + static u8 dis_ver_info_cnt; u32 fw_ver = 0, bt_patch_ver = 0; - struct btc_board_info *board_info=&btcoexist->board_info; - struct btc_stack_info *stack_info=&btcoexist->stack_info; + struct btc_board_info *board_info = &btcoexist->board_info; + struct btc_stack_info *stack_info = &btcoexist->stack_info; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, "=======================Periodical=======================\n"); @@ -4226,17 +4111,8 @@ void ex_halbtc8192e2ant_periodical(struct btc_coexist *btcoexist) "************************************************\n"); } -#if(BT_AUTO_REPORT_ONLY_8192E_2ANT == 0) halbtc8192e2ant_querybt_info(btcoexist); halbtc8192e2ant_monitor_bt_ctr(btcoexist); halbtc8192e2ant_monitor_bt_enable_disable(btcoexist); -#else - if (halbtc8192e2ant_iswifi_status_changed(btcoexist) || - coex_dm->auto_tdma_adjust) - halbtc8192e2ant_run_coexist_mechanism(btcoexist); -#endif } - -#endif - diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h index 6d109edb895..416d3ddaed3 100644 --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h @@ -1,8 +1,6 @@ /***************************************************************** * The following is for 8192E 2Ant BT Co-exist definition *****************************************************************/ -#define BT_AUTO_REPORT_ONLY_8192E_2ANT 0 - #define BT_INFO_8192E_2ANT_B_FTP BIT7 #define BT_INFO_8192E_2ANT_B_A2DP BIT6 #define BT_INFO_8192E_2ANT_B_HID BIT5 diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8723b1ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8723b1ant.c index 9677943fc20..c9693944c13 100644 --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8723b1ant.c +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8723b1ant.c @@ -22,14 +22,14 @@ static struct coex_dm_8723b_1ant *coex_dm = &glcoex_dm_8723b_1ant; static struct coex_sta_8723b_1ant glcoex_sta_8723b_1ant; static struct coex_sta_8723b_1ant *coex_sta = &glcoex_sta_8723b_1ant; -const char *const GLBtInfoSrc8723b1Ant[]={ +static const char *const GLBtInfoSrc8723b1Ant[] = { "BT Info[wifi fw]", "BT Info[bt rsp]", "BT Info[bt auto report]", }; -u32 glcoex_ver_date_8723b_1ant = 20130906; -u32 glcoex_ver_8723b_1ant = 0x45; +static u32 glcoex_ver_date_8723b_1ant = 20130906; +static u32 glcoex_ver_8723b_1ant = 0x45; /*************************************************************** * local function proto type if needed @@ -37,7 +37,8 @@ u32 glcoex_ver_8723b_1ant = 0x45; /*************************************************************** * local function start with halbtc8723b1ant_ ***************************************************************/ -u8 halbtc8723b1ant_bt_rssi_state(u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) +static u8 halbtc8723b1ant_bt_rssi_state(u8 level_num, u8 rssi_thresh, + u8 rssi_thresh1) { s32 bt_rssi=0; u8 bt_rssi_state = coex_sta->pre_bt_rssi_state; @@ -134,9 +135,9 @@ u8 halbtc8723b1ant_bt_rssi_state(u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) return bt_rssi_state; } -u8 halbtc8723b1ant_wifi_rssi_state(struct btc_coexist *btcoexist, - u8 index, u8 level_num, - u8 rssi_thresh, u8 rssi_thresh1) +static u8 halbtc8723b1ant_wifi_rssi_state(struct btc_coexist *btcoexist, + u8 index, u8 level_num, + u8 rssi_thresh, u8 rssi_thresh1) { s32 wifi_rssi=0; u8 wifi_rssi_state = coex_sta->pre_wifi_rssi_state[index]; @@ -249,8 +250,8 @@ u8 halbtc8723b1ant_wifi_rssi_state(struct btc_coexist *btcoexist, return wifi_rssi_state; } -void halbtc8723b1ant_updatera_mask(struct btc_coexist *btcoexist, - bool force_exec, u32 dis_rate_mask) +static void halbtc8723b1ant_updatera_mask(struct btc_coexist *btcoexist, + bool force_exec, u32 dis_rate_mask) { coex_dm->curra_mask = dis_rate_mask; @@ -261,8 +262,9 @@ void halbtc8723b1ant_updatera_mask(struct btc_coexist *btcoexist, coex_dm->prera_mask = coex_dm->curra_mask; } -void halbtc8723b1ant_auto_rate_fallback_retry(struct btc_coexist *btcoexist, - bool force_exec, u8 type) +static void halbtc8723b1ant_auto_rate_fallback_retry( + struct btc_coexist *btcoexist, + bool force_exec, u8 type) { bool wifi_under_bmode = false; @@ -300,8 +302,8 @@ void halbtc8723b1ant_auto_rate_fallback_retry(struct btc_coexist *btcoexist, coex_dm->pre_arfr_type = coex_dm->cur_arfr_type; } -void halbtc8723b1ant_retry_limit(struct btc_coexist *btcoexist, - bool force_exec, u8 type) +static void halbtc8723b1ant_retry_limit(struct btc_coexist *btcoexist, + bool force_exec, u8 type) { coex_dm->cur_retry_limit_type = type; @@ -324,8 +326,8 @@ void halbtc8723b1ant_retry_limit(struct btc_coexist *btcoexist, coex_dm->pre_retry_limit_type = coex_dm->cur_retry_limit_type; } -void halbtc8723b1ant_ampdu_maxtime(struct btc_coexist *btcoexist, - bool force_exec, u8 type) +static void halbtc8723b1ant_ampdu_maxtime(struct btc_coexist *btcoexist, + bool force_exec, u8 type) { coex_dm->cur_ampdu_time_type = type; @@ -348,7 +350,7 @@ void halbtc8723b1ant_ampdu_maxtime(struct btc_coexist *btcoexist, coex_dm->pre_ampdu_time_type = coex_dm->cur_ampdu_time_type; } -void halbtc8723b1ant_limited_tx(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_limited_tx(struct btc_coexist *btcoexist, bool force_exec, u8 ra_maskType, u8 arfr_type, u8 retry_limit_type, u8 ampdu_time_type) { @@ -375,7 +377,7 @@ void halbtc8723b1ant_limited_tx(struct btc_coexist *btcoexist, halbtc8723b1ant_ampdu_maxtime(btcoexist, force_exec, ampdu_time_type); } -void halbtc8723b1ant_limited_rx(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_limited_rx(struct btc_coexist *btcoexist, bool force_exec, bool rej_ap_agg_pkt, bool b_bt_ctrl_agg_buf_size, u8 agg_buf_size) { @@ -398,7 +400,7 @@ void halbtc8723b1ant_limited_rx(struct btc_coexist *btcoexist, btcoexist->btc_set(btcoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); } -void halbtc8723b1ant_monitor_bt_ctr(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_monitor_bt_ctr(struct btc_coexist *btcoexist) { u32 reg_hp_txrx, reg_lp_txrx, u32tmp; u32 reg_hp_tx = 0, reg_hp_rx = 0; @@ -424,7 +426,7 @@ void halbtc8723b1ant_monitor_bt_ctr(struct btc_coexist *btcoexist) btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc); } -void halbtc8723b1ant_query_bt_info(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_query_bt_info(struct btc_coexist *btcoexist) { u8 h2c_parameter[1] = {0}; @@ -439,7 +441,8 @@ void halbtc8723b1ant_query_bt_info(struct btc_coexist *btcoexist) btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter); } -bool halbtc8723b1ant_is_wifi_status_changed(struct btc_coexist *btcoexist) +static bool halbtc8723b1ant_is_wifi_status_changed( + struct btc_coexist *btcoexist) { static bool pre_wifi_busy = false; static bool pre_under_4way = false, pre_bt_hs_on = false; @@ -471,7 +474,7 @@ bool halbtc8723b1ant_is_wifi_status_changed(struct btc_coexist *btcoexist) return false; } -void halbtc8723b1ant_update_bt_link_info(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_update_bt_link_info(struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; bool bt_hs_on = false; @@ -519,7 +522,7 @@ void halbtc8723b1ant_update_bt_link_info(struct btc_coexist *btcoexist) bt_link_info->hid_only = false; } -u8 halbtc8723b1ant_action_algorithm(struct btc_coexist *btcoexist) +static u8 halbtc8723b1ant_action_algorithm(struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; bool bt_hs_on = false; @@ -719,7 +722,7 @@ u8 halbtc8723b1ant_action_algorithm(struct btc_coexist *btcoexist) return algorithm; } -bool halbtc8723b1ant_need_to_dec_bt_pwr(struct btc_coexist *btcoexist) +static bool halbtc8723b1ant_need_to_dec_bt_pwr(struct btc_coexist *btcoexist) { bool ret = false; bool bt_hs_on = false, wifi_connected = false; @@ -750,8 +753,9 @@ bool halbtc8723b1ant_need_to_dec_bt_pwr(struct btc_coexist *btcoexist) return ret; } -void halbtc8723b1ant_set_fw_dac_swing_level(struct btc_coexist *btcoexist, - u8 dac_swing_lvl) +static void halbtc8723b1ant_set_fw_dac_swing_level( + struct btc_coexist *btcoexist, + u8 dac_swing_lvl) { u8 h2c_parameter[1] = {0}; @@ -767,7 +771,7 @@ void halbtc8723b1ant_set_fw_dac_swing_level(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x64, 1, h2c_parameter); } -void halbtc8723b1ant_set_fw_dec_bt_pwr(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_set_fw_dec_bt_pwr(struct btc_coexist *btcoexist, bool dec_bt_pwr) { u8 h2c_parameter[1] = {0}; @@ -784,7 +788,7 @@ void halbtc8723b1ant_set_fw_dec_bt_pwr(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x62, 1, h2c_parameter); } -void halbtc8723b1ant_dec_bt_pwr(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_dec_bt_pwr(struct btc_coexist *btcoexist, bool force_exec, bool dec_bt_pwr) { return; @@ -806,7 +810,8 @@ void halbtc8723b1ant_dec_bt_pwr(struct btc_coexist *btcoexist, coex_dm->pre_dec_bt_pwr = coex_dm->cur_dec_bt_pwr; } -void halbtc8723b1ant_set_bt_auto_report(struct btc_coexist *btcoexist, +#if (BT_AUTO_REPORT_ONLY_8723B_1ANT == 0) +static void halbtc8723b1ant_set_bt_auto_report(struct btc_coexist *btcoexist, bool enable_auto_report) { u8 h2c_parameter[1] = {0}; @@ -824,7 +829,7 @@ void halbtc8723b1ant_set_bt_auto_report(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x68, 1, h2c_parameter); } -void halbtc8723b1ant_bt_auto_report(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_bt_auto_report(struct btc_coexist *btcoexist, bool force_exec, bool enable_auto_report) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, @@ -848,8 +853,9 @@ void halbtc8723b1ant_bt_auto_report(struct btc_coexist *btcoexist, coex_dm->pre_bt_auto_report = coex_dm->cur_bt_auto_report; } +#endif -void halbtc8723b1ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist, bool force_exec, u8 fw_dac_swing_lvl) { return; @@ -876,55 +882,7 @@ void halbtc8723b1ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist, coex_dm->pre_fw_dac_swing_lvl = coex_dm->cur_fw_dac_swing_lvl; } -void halbtc8723b1ant_set_sw_rf_rx_lpf_corner(struct btc_coexist *btcoexist, - bool rx_rf_shrink_on) -{ - if (rx_rf_shrink_on) { - /*Shrink RF Rx LPF corner */ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], Shrink RF Rx LPF corner!!\n"); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x1e, - 0xfffff, 0xffff7); - } else { - /*Resume RF Rx LPF corner - * After initialized, we can use coex_dm->btRf0x1eBackup */ - if (btcoexist->initilized) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], Resume RF Rx LPF corner!!\n"); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, - 0x1e, 0xfffff, - coex_dm->bt_rf0x1e_backup); - } - } -} - -void halbtc8723b1ant_rf_shrink(struct btc_coexist *btcoexist, - bool force_exec, bool rx_rf_shrink_on) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, - "[BTCoex], %s turn Rx RF Shrink = %s\n", - (force_exec? "force to":""), - ((rx_rf_shrink_on)? "ON":"OFF")); - coex_dm->cur_rf_rx_lpf_shrink = rx_rf_shrink_on; - - if (!force_exec) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, - "[BTCoex], bPreRfRxLpfShrink=%d, " - "bCurRfRxLpfShrink=%d\n", - coex_dm->pre_rf_rx_lpf_shrink, - coex_dm->cur_rf_rx_lpf_shrink); - - if (coex_dm->pre_rf_rx_lpf_shrink == - coex_dm->cur_rf_rx_lpf_shrink) - return; - } - halbtc8723b1ant_set_sw_rf_rx_lpf_corner(btcoexist, - coex_dm->cur_rf_rx_lpf_shrink); - - coex_dm->pre_rf_rx_lpf_shrink = coex_dm->cur_rf_rx_lpf_shrink; -} - -void halbtc8723b1ant_set_sw_penalty_tx_rate_adaptive( +static void halbtc8723b1ant_set_sw_penalty_tx_rate_adaptive( struct btc_coexist *btcoexist, bool low_penalty_ra) { @@ -948,7 +906,7 @@ void halbtc8723b1ant_set_sw_penalty_tx_rate_adaptive( btcoexist->btc_fill_h2c(btcoexist, 0x69, 6, h2c_parameter); } -void halbtc8723b1ant_low_penalty_ra(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_low_penalty_ra(struct btc_coexist *btcoexist, bool force_exec, bool low_penalty_ra) { coex_dm->cur_low_penalty_ra = low_penalty_ra; @@ -963,152 +921,7 @@ void halbtc8723b1ant_low_penalty_ra(struct btc_coexist *btcoexist, coex_dm->pre_low_penalty_ra = coex_dm->cur_low_penalty_ra; } -void halbtc8723b1ant_set_dac_swing_reg(struct btc_coexist *btcoexist, u32 level) -{ - u8 val = (u8) level; - - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], Write SwDacSwing = 0x%x\n", level); - btcoexist->btc_write_1byte_bitmask(btcoexist, 0x883, 0x3e, val); -} - -void halbtc8723b1ant_set_sw_full_time_dac_swing(struct btc_coexist *btcoexist, - bool sw_dac_swing_on, - u32 sw_dac_swing_lvl) -{ - if (sw_dac_swing_on) - halbtc8723b1ant_set_dac_swing_reg(btcoexist, sw_dac_swing_lvl); - else - halbtc8723b1ant_set_dac_swing_reg(btcoexist, 0x18); -} - - -void halbtc8723b1ant_dac_swing(struct btc_coexist *btcoexist, bool force_exec, - bool dac_swing_on, u32 dac_swing_lvl) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, - "[BTCoex], %s turn DacSwing=%s, dac_swing_lvl=0x%x\n", - (force_exec ? "force to" : ""), (dac_swing_on ? "ON" : "OFF"), - dac_swing_lvl); - - coex_dm->cur_dac_swing_on = dac_swing_on; - coex_dm->cur_dac_swing_lvl = dac_swing_lvl; - - if (!force_exec) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, - "[BTCoex], bPreDacSwingOn=%d, preDacSwingLvl=0x%x, " - "bCurDacSwingOn=%d, curDacSwingLvl=0x%x\n", - coex_dm->pre_dac_swing_on, coex_dm->pre_dac_swing_lvl, - coex_dm->cur_dac_swing_on, - coex_dm->cur_dac_swing_lvl); - - if ((coex_dm->pre_dac_swing_on == coex_dm->cur_dac_swing_on) && - (coex_dm->pre_dac_swing_lvl == coex_dm->cur_dac_swing_lvl)) - return; - } - mdelay(30); - halbtc8723b1ant_set_sw_full_time_dac_swing(btcoexist, dac_swing_on, - dac_swing_lvl); - - coex_dm->pre_dac_swing_on = coex_dm->cur_dac_swing_on; - coex_dm->pre_dac_swing_lvl = coex_dm->cur_dac_swing_lvl; -} - -void halbtc8723b1ant_set_adc_backoff(struct btc_coexist *btcoexist, - bool adc_backoff) -{ - if (adc_backoff) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], BB BackOff Level On!\n"); - btcoexist->btc_write_1byte_bitmask(btcoexist, 0x8db, 0x60, 0x3); - } else { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], BB BackOff Level Off!\n"); - btcoexist->btc_write_1byte_bitmask(btcoexist, 0x8db, 0x60, 0x1); - } -} - -void halbtc8723b1ant_adc_backoff(struct btc_coexist *btcoexist, - bool force_exec, bool adc_backoff) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, - "[BTCoex], %s turn AdcBackOff = %s\n", - (force_exec ? "force to" : ""), (adc_backoff ? "ON" : "OFF")); - coex_dm->cur_adc_backoff = adc_backoff; - - if (!force_exec) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, - "[BTCoex], bPreAdcBackOff=%d, bCurAdcBackOff=%d\n", - coex_dm->pre_adc_backoff, coex_dm->cur_adc_backoff); - - if(coex_dm->pre_adc_backoff == coex_dm->cur_adc_backoff) - return; - } - halbtc8723b1ant_set_adc_backoff(btcoexist, coex_dm->cur_adc_backoff); - - coex_dm->pre_adc_backoff = - coex_dm->cur_adc_backoff; -} - -void halbtc8723b1ant_set_agc_table(struct btc_coexist *btcoexist, - bool adc_table_en) -{ - u8 rssi_adjust_val = 0; - - btcoexist->btc_set_rf_reg(btcoexist, - BTC_RF_A, 0xef, 0xfffff, 0x02000); - if (adc_table_en) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], Agc Table On!\n"); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, - 0xfffff, 0x3fa58); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, - 0xfffff, 0x37a58); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, - 0xfffff, 0x2fa58); - rssi_adjust_val = 8; - } else { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, - "[BTCoex], Agc Table Off!\n"); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, - 0xfffff, 0x39258); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, - 0xfffff, 0x31258); - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0x3b, - 0xfffff, 0x29258); - } - btcoexist->btc_set_rf_reg(btcoexist, BTC_RF_A, 0xef, 0xfffff, 0x0); - - /* set rssi_adjust_val for wifi module. */ - btcoexist->btc_set(btcoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, - &rssi_adjust_val); -} - - -void halbtc8723b1ant_agc_table(struct btc_coexist *btcoexist, - bool force_exec, bool adc_table_en) -{ - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, - "[BTCoex], %s %s Agc Table\n", - (force_exec ? "force to" : ""), - (adc_table_en ? "Enable" : "Disable")); - coex_dm->cur_agc_table_en = adc_table_en; - - if (!force_exec) { - BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, - "[BTCoex], bPreAgcTableEn=%d, bCurAgcTableEn=%d\n", - coex_dm->pre_agc_table_en, - coex_dm->cur_agc_table_en); - - if(coex_dm->pre_agc_table_en == coex_dm->cur_agc_table_en) - return; - } - halbtc8723b1ant_set_agc_table(btcoexist, adc_table_en); - - coex_dm->pre_agc_table_en = coex_dm->cur_agc_table_en; -} - -void halbtc8723b1ant_set_coex_table(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_set_coex_table(struct btc_coexist *btcoexist, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, u8 val0x6cc) { @@ -1129,7 +942,7 @@ void halbtc8723b1ant_set_coex_table(struct btc_coexist *btcoexist, btcoexist->btc_write_1byte(btcoexist, 0x6cc, val0x6cc); } -void halbtc8723b1ant_coex_table(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_coex_table(struct btc_coexist *btcoexist, bool force_exec, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, u8 val0x6cc) @@ -1159,7 +972,7 @@ void halbtc8723b1ant_coex_table(struct btc_coexist *btcoexist, coex_dm->pre_val0x6cc = coex_dm->cur_val0x6cc; } -void halbtc8723b1ant_coex_table_with_type(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_coex_table_with_type(struct btc_coexist *btcoexist, bool force_exec, u8 type) { switch (type) { @@ -1200,7 +1013,7 @@ void halbtc8723b1ant_coex_table_with_type(struct btc_coexist *btcoexist, } } -void halbtc8723b1ant_SetFwIgnoreWlanAct(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_SetFwIgnoreWlanAct(struct btc_coexist *btcoexist, bool enable) { u8 h2c_parameter[1] = {0}; @@ -1215,7 +1028,7 @@ void halbtc8723b1ant_SetFwIgnoreWlanAct(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x63, 1, h2c_parameter); } -void halbtc8723b1ant_ignore_wlan_act(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_ignore_wlan_act(struct btc_coexist *btcoexist, bool force_exec, bool enable) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, @@ -1239,7 +1052,7 @@ void halbtc8723b1ant_ignore_wlan_act(struct btc_coexist *btcoexist, coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act; } -void halbtc8723b1ant_set_fw_ps_tdma(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_set_fw_ps_tdma(struct btc_coexist *btcoexist, u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5) { @@ -1285,7 +1098,7 @@ void halbtc8723b1ant_set_fw_ps_tdma(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x60, 5, h2c_parameter); } -void halbtc8723b1ant_SetLpsRpwm(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_SetLpsRpwm(struct btc_coexist *btcoexist, u8 lps_val, u8 rpwm_val) { u8 lps = lps_val; @@ -1295,8 +1108,8 @@ void halbtc8723b1ant_SetLpsRpwm(struct btc_coexist *btcoexist, btcoexist->btc_set(btcoexist, BTC_SET_U1_1ANT_RPWM, &rpwm); } -void halbtc8723b1ant_LpsRpwm(struct btc_coexist *btcoexist, bool force_exec, - u8 lps_val, u8 rpwm_val) +static void halbtc8723b1ant_LpsRpwm(struct btc_coexist *btcoexist, + bool force_exec, u8 lps_val, u8 rpwm_val) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, @@ -1326,7 +1139,7 @@ void halbtc8723b1ant_LpsRpwm(struct btc_coexist *btcoexist, bool force_exec, coex_dm->pre_rpwm = coex_dm->cur_rpwm; } -void halbtc8723b1ant_sw_mechanism1(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_sw_mechanism1(struct btc_coexist *btcoexist, bool shrink_rx_lpf, bool low_penalty_ra, bool limited_dig, bool bt_lna_constrain) { @@ -1337,7 +1150,7 @@ void halbtc8723b1ant_sw_mechanism1(struct btc_coexist *btcoexist, halbtc8723b1ant_low_penalty_ra(btcoexist, NORMAL_EXEC, low_penalty_ra); } -void halbtc8723b1ant_sw_mechanism2(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_sw_mechanism2(struct btc_coexist *btcoexist, bool agc_table_shift, bool adc_backoff, bool sw_dac_swing, u32 dac_swing_lvl) { @@ -1346,7 +1159,7 @@ void halbtc8723b1ant_sw_mechanism2(struct btc_coexist *btcoexist, agc_table_shift, adc_backoff, sw_dac_swing); } -void halbtc8723b1ant_SetAntPath(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_SetAntPath(struct btc_coexist *btcoexist, u8 ant_pos_type, bool init_hw_cfg, bool wifi_off) { @@ -1537,8 +1350,8 @@ void halbtc8723b1ant_SetAntPath(struct btc_coexist *btcoexist, } } -void halbtc8723b1ant_ps_tdma(struct btc_coexist *btcoexist, bool force_exec, - bool turn_on, u8 type) +static void halbtc8723b1ant_ps_tdma(struct btc_coexist *btcoexist, + bool force_exec, bool turn_on, u8 type) { bool wifi_busy = false; u8 rssi_adjust_val = 0; @@ -1783,22 +1596,7 @@ void halbtc8723b1ant_ps_tdma(struct btc_coexist *btcoexist, bool force_exec, coex_dm->pre_ps_tdma = coex_dm->cur_ps_tdma; } -void halbtc8723b1ant_coex_alloff(struct btc_coexist *btcoexist) -{ - /* fw all off */ - halbtc8723b1ant_fw_dac_swing_lvl(btcoexist, NORMAL_EXEC, 6); - halbtc8723b1ant_dec_bt_pwr(btcoexist, NORMAL_EXEC, false); - - /* sw all off */ - halbtc8723b1ant_sw_mechanism1(btcoexist, false, false, false, false); - halbtc8723b1ant_sw_mechanism2(btcoexist, false, false, false, 0x18); - - - /* hw all off */ - halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0); -} - -bool halbtc8723b1ant_is_common_action(struct btc_coexist *btcoexist) +static bool halbtc8723b1ant_is_common_action(struct btc_coexist *btcoexist) { bool commom = false, wifi_connected = false; bool wifi_busy = false; @@ -1896,8 +1694,9 @@ bool halbtc8723b1ant_is_common_action(struct btc_coexist *btcoexist) } -void halbtc8723b1ant_tdma_duration_adjust_for_acl(struct btc_coexist *btcoexist, - u8 wifi_status) +static void halbtc8723b1ant_tdma_duration_adjust_for_acl( + struct btc_coexist *btcoexist, + u8 wifi_status) { static s32 up, dn, m, n, wait_count; /* 0: no change, +1: increase WiFi duration, @@ -2082,28 +1881,8 @@ void halbtc8723b1ant_tdma_duration_adjust_for_acl(struct btc_coexist *btcoexist, } } -u8 halbtc8723b1ant_ps_tdma_type_by_wifi_rssi(s32 wifi_rssi, s32 pre_wifi_rssi, - u8 wifi_rssi_thresh) -{ - u8 ps_tdma_type=0; - - if (wifi_rssi > pre_wifi_rssi) { - if (wifi_rssi > (wifi_rssi_thresh + 5)) - ps_tdma_type = 26; - else - ps_tdma_type = 25; - } else { - if (wifi_rssi > wifi_rssi_thresh) - ps_tdma_type = 26; - else - ps_tdma_type = 25; - } - - return ps_tdma_type; -} - -void halbtc8723b1ant_PsTdmaCheckForPowerSaveState(struct btc_coexist *btcoexist, - bool new_ps_state) +static void halbtc8723b1ant_PsTdmaCheckForPowerSaveState( + struct btc_coexist *btcoexist, bool new_ps_state) { u8 lps_mode = 0x0; @@ -2128,7 +1907,7 @@ void halbtc8723b1ant_PsTdmaCheckForPowerSaveState(struct btc_coexist *btcoexist, } } -void halbtc8723b1ant_power_save_state(struct btc_coexist *btcoexist, +static void halbtc8723b1ant_power_save_state(struct btc_coexist *btcoexist, u8 ps_type, u8 lps_val, u8 rpwm_val) { @@ -2162,13 +1941,15 @@ void halbtc8723b1ant_power_save_state(struct btc_coexist *btcoexist, } } -void halbtc8723b1ant_action_wifi_only(struct btc_coexist *btcoexist) +#if (BT_AUTO_REPORT_ONLY_8723B_1ANT == 0) +static void halbtc8723b1ant_action_wifi_only(struct btc_coexist *btcoexist) { halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0); halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 9); } -void halbtc8723b1ant_monitor_bt_enable_disable(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_monitor_bt_enable_disable( + struct btc_coexist *btcoexist) { static bool pre_bt_disabled = false; static u32 bt_disable_cnt = 0; @@ -2224,6 +2005,7 @@ void halbtc8723b1ant_monitor_bt_enable_disable(struct btc_coexist *btcoexist) } } } +#endif /*************************************************** * @@ -2231,7 +2013,7 @@ void halbtc8723b1ant_monitor_bt_enable_disable(struct btc_coexist *btcoexist) * ***************************************************/ /* SCO only or SCO+PAN(HS) */ -void halbtc8723b1ant_action_sco(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_sco(struct btc_coexist *btcoexist) { u8 wifi_rssi_state; u32 wifi_bw; @@ -2280,7 +2062,7 @@ void halbtc8723b1ant_action_sco(struct btc_coexist *btcoexist) } -void halbtc8723b1ant_action_hid(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_hid(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -2331,7 +2113,7 @@ void halbtc8723b1ant_action_hid(struct btc_coexist *btcoexist) } /*A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */ -void halbtc8723b1ant_action_a2dp(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_a2dp(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -2380,7 +2162,7 @@ void halbtc8723b1ant_action_a2dp(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state, bt_info_ext; u32 wifi_bw; @@ -2430,7 +2212,7 @@ void halbtc8723b1ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_action_pan_edr(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_pan_edr(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -2481,7 +2263,7 @@ void halbtc8723b1ant_action_pan_edr(struct btc_coexist *btcoexist) /* PAN(HS) only */ -void halbtc8723b1ant_action_pan_hs(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_pan_hs(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -2544,7 +2326,7 @@ void halbtc8723b1ant_action_pan_hs(struct btc_coexist *btcoexist) } /*PAN(EDR)+A2DP */ -void halbtc8723b1ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state, bt_info_ext; u32 wifi_bw; @@ -2595,7 +2377,7 @@ void halbtc8723b1ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_action_pan_edr_hid(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_pan_edr_hid(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -2645,7 +2427,8 @@ void halbtc8723b1ant_action_pan_edr_hid(struct btc_coexist *btcoexist) } /* HID+A2DP+PAN(EDR) */ -void halbtc8723b1ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_hid_a2dp_pan_edr( + struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state, bt_info_ext; u32 wifi_bw; @@ -2695,7 +2478,7 @@ void halbtc8723b1ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_action_hid_a2dp(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_hid_a2dp(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state, bt_info_ext; u32 wifi_bw; @@ -2748,13 +2531,13 @@ void halbtc8723b1ant_action_hid_a2dp(struct btc_coexist *btcoexist) * Non-Software Coex Mechanism start * *****************************************************/ -void halbtc8723b1ant_action_hs(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_hs(struct btc_coexist *btcoexist) { halbtc8723b1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 5); halbtc8723b1ant_coex_table_with_type(btcoexist, FORCE_EXEC, 2); } -void halbtc8723b1ant_action_bt_inquiry(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_bt_inquiry(struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; bool wifi_connected = false, ap_enable = false; @@ -2790,8 +2573,9 @@ void halbtc8723b1ant_action_bt_inquiry(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_action_bt_sco_hid_only_busy(struct btc_coexist * btcoexist, - u8 wifi_status) +static void halbtc8723b1ant_action_bt_sco_hid_only_busy( + struct btc_coexist *btcoexist, + u8 wifi_status) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; bool wifi_connected = false; @@ -2810,7 +2594,7 @@ void halbtc8723b1ant_action_bt_sco_hid_only_busy(struct btc_coexist * btcoexist, } } -void halbtc8723b1ant_action_wifi_connected_bt_acl_busy( +static void halbtc8723b1ant_action_wifi_connected_bt_acl_busy( struct btc_coexist *btcoexist, u8 wifi_status) { @@ -2870,7 +2654,8 @@ void halbtc8723b1ant_action_wifi_connected_bt_acl_busy( } } -void halbtc8723b1ant_action_wifi_not_connected(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_wifi_not_connected( + struct btc_coexist *btcoexist) { /* power save state */ halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE, @@ -2881,7 +2666,7 @@ void halbtc8723b1ant_action_wifi_not_connected(struct btc_coexist *btcoexist) halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0); } -void halbtc8723b1ant_action_wifi_not_connected_asso_auth_scan( +static void halbtc8723b1ant_action_wifi_not_connected_asso_auth_scan( struct btc_coexist *btcoexist) { halbtc8723b1ant_power_save_state(btcoexist, BTC_PS_WIFI_NATIVE, @@ -2891,7 +2676,8 @@ void halbtc8723b1ant_action_wifi_not_connected_asso_auth_scan( halbtc8723b1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1); } -void halbtc8723b1ant_ActionWifiConnectedScan(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_ActionWifiConnectedScan( + struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; @@ -2921,7 +2707,7 @@ void halbtc8723b1ant_ActionWifiConnectedScan(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_action_wifi_connected_special_packet( +static void halbtc8723b1ant_action_wifi_connected_special_packet( struct btc_coexist *btcoexist) { bool hs_connecting = false; @@ -2951,7 +2737,7 @@ void halbtc8723b1ant_action_wifi_connected_special_packet( } } -void halbtc8723b1ant_action_wifi_connected(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_action_wifi_connected(struct btc_coexist *btcoexist) { bool wifi_busy = false; bool scan = false, link = false, roam = false; @@ -3031,7 +2817,8 @@ void halbtc8723b1ant_action_wifi_connected(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_run_sw_coexist_mechanism(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_run_sw_coexist_mechanism( + struct btc_coexist *btcoexist) { u8 algorithm = 0; @@ -3104,7 +2891,7 @@ void halbtc8723b1ant_run_sw_coexist_mechanism(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_run_coexist_mechanism(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_run_coexist_mechanism(struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; bool wifi_connected = false, bt_hs_on = false; @@ -3218,7 +3005,7 @@ void halbtc8723b1ant_run_coexist_mechanism(struct btc_coexist *btcoexist) } } -void halbtc8723b1ant_init_coex_dm(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_init_coex_dm(struct btc_coexist *btcoexist) { /* force to reset coex mechanism */ halbtc8723b1ant_fw_dac_swing_lvl(btcoexist, FORCE_EXEC, 6); @@ -3232,7 +3019,8 @@ void halbtc8723b1ant_init_coex_dm(struct btc_coexist *btcoexist) halbtc8723b1ant_coex_table_with_type(btcoexist, FORCE_EXEC, 0); } -void halbtc8723b1ant_init_hw_config(struct btc_coexist *btcoexist, bool backup) +static void halbtc8723b1ant_init_hw_config(struct btc_coexist *btcoexist, + bool backup) { u32 u32tmp = 0; u8 u8tmp = 0; @@ -3304,7 +3092,7 @@ void halbtc8723b1ant_init_hw_config(struct btc_coexist *btcoexist, bool backup) } -void halbtc8723b1ant_wifi_off_hw_cfg(struct btc_coexist *btcoexist) +static void halbtc8723b1ant_wifi_off_hw_cfg(struct btc_coexist *btcoexist) { /* set wlan_act to low */ btcoexist->btc_write_1byte(btcoexist, 0x76e, 0); diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8723b2ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8723b2ant.c index d337bd0b3c1..da3f62da4e4 100644 --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8723b2ant.c +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8723b2ant.c @@ -20,14 +20,14 @@ static struct coex_dm_8723b_2ant *coex_dm = &glcoex_dm_8723b_2ant; static struct coex_sta_8723b_2ant glcoex_sta_8723b_2ant; static struct coex_sta_8723b_2ant *coex_sta = &glcoex_sta_8723b_2ant; -const char *const glbt_info_src_8723b_2ant[] = { +static const char *const glbt_info_src_8723b_2ant[] = { "BT Info[wifi fw]", "BT Info[bt rsp]", "BT Info[bt auto report]", }; -u32 glcoex_ver_date_8723b_2ant = 20131113; -u32 glcoex_ver_8723b_2ant = 0x3f; +static u32 glcoex_ver_date_8723b_2ant = 20131113; +static u32 glcoex_ver_8723b_2ant = 0x3f; /************************************************************** * local function proto type if needed @@ -35,7 +35,8 @@ u32 glcoex_ver_8723b_2ant = 0x3f; /************************************************************** * local function start with halbtc8723b2ant_ **************************************************************/ -u8 halbtc8723b2ant_bt_rssi_state(u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) +static u8 halbtc8723b2ant_bt_rssi_state(u8 level_num, u8 rssi_thresh, + u8 rssi_thresh1) { s32 bt_rssi = 0; u8 bt_rssi_state = coex_sta->pre_bt_rssi_state; @@ -132,7 +133,7 @@ u8 halbtc8723b2ant_bt_rssi_state(u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) return bt_rssi_state; } -u8 halbtc8723b2ant_wifi_rssi_state(struct btc_coexist *btcoexist, +static u8 halbtc8723b2ant_wifi_rssi_state(struct btc_coexist *btcoexist, u8 index, u8 level_num, u8 rssi_thresh, u8 rssi_thresh1) { @@ -246,7 +247,9 @@ u8 halbtc8723b2ant_wifi_rssi_state(struct btc_coexist *btcoexist, return wifi_rssi_state; } -void halbtc8723b2ant_monitor_bt_enable_disable(struct btc_coexist *btcoexist) +#if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 0) +static void halbtc8723b2ant_monitor_bt_enable_disable( + struct btc_coexist *btcoexist) { static bool pre_bt_disabled = false; static u32 bt_disable_cnt = 0; @@ -298,8 +301,9 @@ void halbtc8723b2ant_monitor_bt_enable_disable(struct btc_coexist *btcoexist) } } } +#endif -void halbtc8723b2ant_monitor_bt_ctr(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_monitor_bt_ctr(struct btc_coexist *btcoexist) { u32 reg_hp_txrx, reg_lp_txrx, u32tmp; u32 reg_hp_tx = 0, reg_hp_rx = 0; @@ -332,7 +336,7 @@ void halbtc8723b2ant_monitor_bt_ctr(struct btc_coexist *btcoexist) btcoexist->btc_write_1byte(btcoexist, 0x76e, 0xc); } -void halbtc8723b2ant_query_bt_info(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_query_bt_info(struct btc_coexist *btcoexist) { u8 h2c_parameter[1] ={0}; @@ -347,7 +351,8 @@ void halbtc8723b2ant_query_bt_info(struct btc_coexist *btcoexist) btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter); } -bool halbtc8723b2ant_is_wifi_status_changed(struct btc_coexist *btcoexist) +static bool halbtc8723b2ant_is_wifi_status_changed( + struct btc_coexist *btcoexist) { static bool pre_wifi_busy = false; static bool pre_under_4way = false; @@ -382,7 +387,7 @@ bool halbtc8723b2ant_is_wifi_status_changed(struct btc_coexist *btcoexist) return false; } -void halbtc8723b2ant_update_bt_link_info(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_update_bt_link_info(struct btc_coexist *btcoexist) { /*struct btc_stack_info *stack_info = &btcoexist->stack_info;*/ struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info; @@ -446,7 +451,7 @@ void halbtc8723b2ant_update_bt_link_info(struct btc_coexist *btcoexist) bt_link_info->hid_only = false; } -u8 halbtc8723b2ant_action_algorithm(struct btc_coexist *btcoexist) +static u8 halbtc8723b2ant_action_algorithm(struct btc_coexist *btcoexist) { struct btc_bt_link_info *bt_link_info=&btcoexist->bt_link_info; bool bt_hs_on = false; @@ -634,7 +639,7 @@ u8 halbtc8723b2ant_action_algorithm(struct btc_coexist *btcoexist) return algorithm; } -bool halbtc8723b2ant_need_to_dec_bt_pwr(struct btc_coexist *btcoexist) +static bool halbtc8723b2ant_need_to_dec_bt_pwr(struct btc_coexist *btcoexist) { bool bRet = false; bool bt_hs_on = false, wifi_connected = false; @@ -675,8 +680,9 @@ bool halbtc8723b2ant_need_to_dec_bt_pwr(struct btc_coexist *btcoexist) return bRet; } -void halbtc8723b2ant_set_fw_dac_swing_level(struct btc_coexist *btcoexist, - u8 dac_swing_lvl) +static void halbtc8723b2ant_set_fw_dac_swing_level( + struct btc_coexist *btcoexist, + u8 dac_swing_lvl) { u8 h2c_parameter[1] ={0}; @@ -692,7 +698,7 @@ void halbtc8723b2ant_set_fw_dac_swing_level(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x64, 1, h2c_parameter); } -void halbtc8723b2ant_set_fw_dec_bt_pwr(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_set_fw_dec_bt_pwr(struct btc_coexist *btcoexist, bool dec_bt_pwr) { u8 h2c_parameter[1] = {0}; @@ -709,8 +715,8 @@ void halbtc8723b2ant_set_fw_dec_bt_pwr(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x62, 1, h2c_parameter); } -void halbtc8723b2ant_dec_bt_pwr(struct btc_coexist *btcoexist, - bool force_exec, bool dec_bt_pwr) +static void halbtc8723b2ant_dec_bt_pwr(struct btc_coexist *btcoexist, + bool force_exec, bool dec_bt_pwr) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, "[BTCoex], %s Dec BT power = %s\n", @@ -730,7 +736,8 @@ void halbtc8723b2ant_dec_bt_pwr(struct btc_coexist *btcoexist, coex_dm->pre_dec_bt_pwr = coex_dm->cur_dec_bt_pwr; } -void halbtc8723b2ant_set_bt_auto_report(struct btc_coexist *btcoexist, +#if (BT_AUTO_REPORT_ONLY_8723B_2ANT == 0) +static void halbtc8723b2ant_set_bt_auto_report(struct btc_coexist *btcoexist, bool enable_auto_report) { u8 h2c_parameter[1] = {0}; @@ -747,7 +754,7 @@ void halbtc8723b2ant_set_bt_auto_report(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x68, 1, h2c_parameter); } -void halbtc8723b2ant_bt_auto_report(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_bt_auto_report(struct btc_coexist *btcoexist, bool force_exec, bool enable_auto_report) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, @@ -771,8 +778,9 @@ void halbtc8723b2ant_bt_auto_report(struct btc_coexist *btcoexist, coex_dm->pre_bt_auto_report = coex_dm->cur_bt_auto_report; } +#endif -void halbtc8723b2ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist, bool force_exec, u8 fw_dac_swing_lvl) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, @@ -797,8 +805,9 @@ void halbtc8723b2ant_fw_dac_swing_lvl(struct btc_coexist *btcoexist, coex_dm->pre_fw_dac_swing_lvl = coex_dm->cur_fw_dac_swing_lvl; } -void halbtc8723b2ant_set_sw_rf_rx_lpf_corner(struct btc_coexist *btcoexist, - bool rx_rf_shrink_on) +static void halbtc8723b2ant_set_sw_rf_rx_lpf_corner( + struct btc_coexist *btcoexist, + bool rx_rf_shrink_on) { if (rx_rf_shrink_on) { /* Shrink RF Rx LPF corner */ @@ -819,7 +828,7 @@ void halbtc8723b2ant_set_sw_rf_rx_lpf_corner(struct btc_coexist *btcoexist, } } -void halbtc8723b2ant_rf_shrink(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_rf_shrink(struct btc_coexist *btcoexist, bool force_exec, bool rx_rf_shrink_on) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, @@ -844,7 +853,7 @@ void halbtc8723b2ant_rf_shrink(struct btc_coexist *btcoexist, coex_dm->pre_rf_rx_lpf_shrink = coex_dm->cur_rf_rx_lpf_shrink; } -void halbtc8723b2ant_set_sw_penalty_txrate_adaptive( +static void halbtc8723b2ant_set_sw_penalty_txrate_adaptive( struct btc_coexist *btcoexist, bool low_penalty_ra) { @@ -868,7 +877,7 @@ void halbtc8723b2ant_set_sw_penalty_txrate_adaptive( btcoexist->btc_fill_h2c(btcoexist, 0x69, 6, h2c_parameter); } -void halbtc8723b2ant_low_penalty_ra(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_low_penalty_ra(struct btc_coexist *btcoexist, bool force_exec, bool low_penalty_ra) { /*return; */ @@ -893,7 +902,7 @@ void halbtc8723b2ant_low_penalty_ra(struct btc_coexist *btcoexist, coex_dm->pre_low_penalty_ra = coex_dm->cur_low_penalty_ra; } -void halbtc8723b2ant_set_dac_swing_reg(struct btc_coexist * btcoexist, +static void halbtc8723b2ant_set_dac_swing_reg(struct btc_coexist *btcoexist, u32 level) { u8 val = (u8) level; @@ -902,9 +911,10 @@ void halbtc8723b2ant_set_dac_swing_reg(struct btc_coexist * btcoexist, btcoexist->btc_write_1byte_bitmask(btcoexist, 0x883, 0x3e, val); } -void halbtc8723b2ant_set_sw_fulltime_dac_swing(struct btc_coexist *btcoexist, - bool sw_dac_swing_on, - u32 sw_dac_swing_lvl) +static void halbtc8723b2ant_set_sw_fulltime_dac_swing( + struct btc_coexist *btcoexist, + bool sw_dac_swing_on, + u32 sw_dac_swing_lvl) { if(sw_dac_swing_on) halbtc8723b2ant_set_dac_swing_reg(btcoexist, sw_dac_swing_lvl); @@ -913,7 +923,7 @@ void halbtc8723b2ant_set_sw_fulltime_dac_swing(struct btc_coexist *btcoexist, } -void halbtc8723b2ant_dac_swing(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_dac_swing(struct btc_coexist *btcoexist, bool force_exec, bool dac_swing_on, u32 dac_swing_lvl) { @@ -944,7 +954,8 @@ void halbtc8723b2ant_dac_swing(struct btc_coexist *btcoexist, coex_dm->pre_dac_swing_lvl = coex_dm->cur_dac_swing_lvl; } -void halbtc8723b2ant_set_adc_backoff(struct btc_coexist *btcoexist, +#if 0 +static void halbtc8723b2ant_set_adc_backoff(struct btc_coexist *btcoexist, bool adc_backoff) { if (adc_backoff) { @@ -958,7 +969,7 @@ void halbtc8723b2ant_set_adc_backoff(struct btc_coexist *btcoexist, } } -void halbtc8723b2ant_adc_backoff(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_adc_backoff(struct btc_coexist *btcoexist, bool force_exec, bool adc_backoff) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, @@ -979,8 +990,9 @@ void halbtc8723b2ant_adc_backoff(struct btc_coexist *btcoexist, coex_dm->pre_adc_back_off = coex_dm->cur_adc_back_off; } +#endif -void halbtc8723b2ant_set_agc_table(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_set_agc_table(struct btc_coexist *btcoexist, bool agc_table_en) { u8 rssi_adjust_val = 0; @@ -1054,7 +1066,7 @@ void halbtc8723b2ant_set_agc_table(struct btc_coexist *btcoexist, &rssi_adjust_val); } -void halbtc8723b2ant_agc_table(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_agc_table(struct btc_coexist *btcoexist, bool force_exec, bool agc_table_en) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, @@ -1076,7 +1088,7 @@ void halbtc8723b2ant_agc_table(struct btc_coexist *btcoexist, coex_dm->pre_agc_table_en = coex_dm->cur_agc_table_en; } -void halbtc8723b2ant_set_coex_table(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_set_coex_table(struct btc_coexist *btcoexist, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, u8 val0x6cc) { @@ -1097,7 +1109,7 @@ void halbtc8723b2ant_set_coex_table(struct btc_coexist *btcoexist, btcoexist->btc_write_1byte(btcoexist, 0x6cc, val0x6cc); } -void halbtc8723b2ant_coex_table(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_coex_table(struct btc_coexist *btcoexist, bool force_exec, u32 val0x6c0, u32 val0x6c4, u32 val0x6c8, u8 val0x6cc) @@ -1141,7 +1153,7 @@ void halbtc8723b2ant_coex_table(struct btc_coexist *btcoexist, coex_dm->pre_val0x6cc = coex_dm->cur_val0x6cc; } -void halbtc8723b2ant_coex_table_with_type(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_coex_table_with_type(struct btc_coexist *btcoexist, bool force_exec, u8 type) { switch (type) { @@ -1202,8 +1214,9 @@ void halbtc8723b2ant_coex_table_with_type(struct btc_coexist *btcoexist, } } -void halbtc8723b2ant_set_fw_ignore_wlan_act(struct btc_coexist *btcoexist, - bool enable) +static void halbtc8723b2ant_set_fw_ignore_wlan_act( + struct btc_coexist *btcoexist, + bool enable) { u8 h2c_parameter[1] ={0}; @@ -1217,7 +1230,7 @@ void halbtc8723b2ant_set_fw_ignore_wlan_act(struct btc_coexist *btcoexist, btcoexist->btc_fill_h2c(btcoexist, 0x63, 1, h2c_parameter); } -void halbtc8723b2ant_ignore_wlan_act(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_ignore_wlan_act(struct btc_coexist *btcoexist, bool force_exec, bool enable) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, @@ -1241,8 +1254,8 @@ void halbtc8723b2ant_ignore_wlan_act(struct btc_coexist *btcoexist, coex_dm->pre_ignore_wlan_act = coex_dm->cur_ignore_wlan_act; } -void halbtc8723b2ant_set_fw_ps_tdma(struct btc_coexist *btcoexist, u8 byte1, - u8 byte2, u8 byte3, u8 byte4, u8 byte5) +static void halbtc8723b2ant_set_fw_ps_tdma(struct btc_coexist *btcoexist, + u8 byte1, u8 byte2, u8 byte3, u8 byte4, u8 byte5) { u8 h2c_parameter[5] ={0}; @@ -1267,7 +1280,7 @@ void halbtc8723b2ant_set_fw_ps_tdma(struct btc_coexist *btcoexist, u8 byte1, btcoexist->btc_fill_h2c(btcoexist, 0x60, 5, h2c_parameter); } -void halbtc8723b2ant_sw_mechanism1(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_sw_mechanism1(struct btc_coexist *btcoexist, bool shrink_rx_lpf, bool low_penalty_ra, bool limited_dig, bool bt_lna_constrain) { @@ -1287,7 +1300,7 @@ void halbtc8723b2ant_sw_mechanism1(struct btc_coexist *btcoexist, halbtc8723b2ant_low_penalty_ra(btcoexist, NORMAL_EXEC, low_penalty_ra); } -void halbtc8723b2ant_sw_mechanism2(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_sw_mechanism2(struct btc_coexist *btcoexist, bool agc_table_shift, bool adc_backoff, bool sw_dac_swing, u32 dac_swing_lvl) { @@ -1297,7 +1310,7 @@ void halbtc8723b2ant_sw_mechanism2(struct btc_coexist *btcoexist, dac_swing_lvl); } -void halbtc8723b2ant_set_ant_path(struct btc_coexist *btcoexist, +static void halbtc8723b2ant_set_ant_path(struct btc_coexist *btcoexist, u8 antpos_type, bool init_hwcfg, bool wifi_off) { @@ -1377,8 +1390,9 @@ void halbtc8723b2ant_set_ant_path(struct btc_coexist *btcoexist, } -void halbtc8723b2ant_ps_tdma(struct btc_coexist *btcoexist, bool force_exec, - bool turn_on, u8 type) +static void halbtc8723b2ant_ps_tdma(struct btc_coexist *btcoexist, + bool force_exec, + bool turn_on, u8 type) { BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, @@ -1514,7 +1528,7 @@ void halbtc8723b2ant_ps_tdma(struct btc_coexist *btcoexist, bool force_exec, coex_dm->pre_ps_tdma = coex_dm->cur_ps_tdma; } -void halbtc8723b2ant_coex_alloff(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_coex_alloff(struct btc_coexist *btcoexist) { /* fw all off */ halbtc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, false, 1); @@ -1530,7 +1544,7 @@ void halbtc8723b2ant_coex_alloff(struct btc_coexist *btcoexist) halbtc8723b2ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 0); } -void halbtc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist) { /* force to reset coex mechanism*/ @@ -1542,7 +1556,7 @@ void halbtc8723b2ant_init_coex_dm(struct btc_coexist *btcoexist) halbtc8723b2ant_sw_mechanism2(btcoexist, false, false, false, 0x18); } -void halbtc8723b2ant_action_bt_inquiry(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_bt_inquiry(struct btc_coexist *btcoexist) { bool wifi_connected = false; bool low_pwr_disable = true; @@ -1572,7 +1586,7 @@ void halbtc8723b2ant_action_bt_inquiry(struct btc_coexist *btcoexist) false, false); } -bool halbtc8723b2ant_is_common_action(struct btc_coexist *btcoexist) +static bool halbtc8723b2ant_is_common_action(struct btc_coexist *btcoexist) { bool bCommon = false, wifi_connected = false; bool wifi_busy = false; @@ -1713,7 +1727,8 @@ bool halbtc8723b2ant_is_common_action(struct btc_coexist *btcoexist) return bCommon; } -void halbtc8723b2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, + +static void halbtc8723b2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, bool sco_hid, bool tx_pause, u8 max_interval) { @@ -2772,7 +2787,7 @@ void halbtc8723b2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, } /* SCO only or SCO+PAN(HS) */ -void halbtc8723b2ant_action_sco(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_sco(struct btc_coexist *btcoexist) { u8 wifi_rssi_state; u32 wifi_bw; @@ -2830,8 +2845,7 @@ void halbtc8723b2ant_action_sco(struct btc_coexist *btcoexist) } } - -void halbtc8723b2ant_action_hid(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_hid(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -2893,7 +2907,7 @@ void halbtc8723b2ant_action_hid(struct btc_coexist *btcoexist) } /*A2DP only / PAN(EDR) only/ A2DP+PAN(HS)*/ -void halbtc8723b2ant_action_a2dp(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_a2dp(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, wifi_rssi_state1, bt_rssi_state; u32 wifi_bw; @@ -2981,7 +2995,7 @@ void halbtc8723b2ant_action_a2dp(struct btc_coexist *btcoexist) } } -void halbtc8723b2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) { u8 wifi_rssi_state; u32 wifi_bw; @@ -3034,7 +3048,7 @@ void halbtc8723b2ant_action_a2dp_pan_hs(struct btc_coexist *btcoexist) } } -void halbtc8723b2ant_action_pan_edr(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_pan_edr(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -3091,9 +3105,8 @@ void halbtc8723b2ant_action_pan_edr(struct btc_coexist *btcoexist) } } - /*PAN(HS) only*/ -void halbtc8723b2ant_action_pan_hs(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_pan_hs(struct btc_coexist *btcoexist) { u8 wifi_rssi_state; u32 wifi_bw; @@ -3146,7 +3159,7 @@ void halbtc8723b2ant_action_pan_hs(struct btc_coexist *btcoexist) } /*PAN(EDR)+A2DP*/ -void halbtc8723b2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -3210,7 +3223,7 @@ void halbtc8723b2ant_action_pan_edr_a2dp(struct btc_coexist *btcoexist) } } -void halbtc8723b2ant_action_pan_edr_hid(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_pan_edr_hid(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -3282,7 +3295,8 @@ void halbtc8723b2ant_action_pan_edr_hid(struct btc_coexist *btcoexist) } /* HID+A2DP+PAN(EDR) */ -void halbtc8723b2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_hid_a2dp_pan_edr( + struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -3346,7 +3360,7 @@ void halbtc8723b2ant_action_hid_a2dp_pan_edr(struct btc_coexist *btcoexist) } } -void halbtc8723b2ant_action_hid_a2dp(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_action_hid_a2dp(struct btc_coexist *btcoexist) { u8 wifi_rssi_state, bt_rssi_state; u32 wifi_bw; @@ -3404,7 +3418,8 @@ void halbtc8723b2ant_action_hid_a2dp(struct btc_coexist *btcoexist) } } -void halbtc8723b2ant_run_coexist_mechanism(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_run_coexist_mechanism( + struct btc_coexist *btcoexist) { u8 algorithm = 0; @@ -3525,7 +3540,7 @@ void halbtc8723b2ant_run_coexist_mechanism(struct btc_coexist *btcoexist) } } -void halbtc8723b2ant_wifioff_hwcfg(struct btc_coexist *btcoexist) +static void halbtc8723b2ant_wifioff_hwcfg(struct btc_coexist *btcoexist) { /* set wlan_act to low */ btcoexist->btc_write_1byte(btcoexist, 0x76e, 0x4); diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.c b/drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.c index c4e83773ec9..01f5a74028a 100644 --- a/drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.c +++ b/drivers/staging/rtl8821ae/btcoexist/halbtcoutsrc.c @@ -25,7 +25,7 @@ /*********************************************** * Global variables ***********************************************/ -const char *const bt_profile_string[]={ +static const char *const bt_profile_string[] = { "NONE", "A2DP", "PAN", @@ -33,7 +33,7 @@ const char *const bt_profile_string[]={ "SCO", }; -const char *const bt_spec_string[]={ +static const char *const bt_spec_string[] = { "1.0b", "1.1", "1.2", @@ -43,19 +43,19 @@ const char *const bt_spec_string[]={ "4.0", }; -const char *const bt_link_role_string[]={ +static const char *const bt_link_role_string[] = { "Master", "Slave", }; -const char *const h2c_state_string[]={ +static const char *const h2c_state_string[] = { "successful", "h2c busy", "rf off", "fw not read", }; -const char *const io_state_string[]={ +static const char *const io_state_string[] = { "IO_STATUS_SUCCESS", "IO_STATUS_FAIL_CANNOT_IO", "IO_STATUS_FAIL_RF_OFF", @@ -72,12 +72,12 @@ const char *const io_state_string[]={ struct btc_coexist gl_bt_coexist; u32 btc_dbg_type[BTC_MSG_MAX]; -u8 btc_dbg_buf[100]; +static u8 btc_dbg_buf[100]; /*************************************************** * Debug related function ***************************************************/ -bool halbtc_is_bt_coexist_available(struct btc_coexist *btcoexist) +static bool halbtc_is_bt_coexist_available(struct btc_coexist *btcoexist) { if (!btcoexist->binded || NULL == btcoexist->adapter) return false; @@ -85,7 +85,7 @@ bool halbtc_is_bt_coexist_available(struct btc_coexist *btcoexist) return true; } -bool halbtc_is_wifi_busy(struct rtl_priv *rtlpriv) +static bool halbtc_is_wifi_busy(struct rtl_priv *rtlpriv) { if (rtlpriv->link_info.b_busytraffic) @@ -95,7 +95,7 @@ bool halbtc_is_wifi_busy(struct rtl_priv *rtlpriv) } -void halbtc_dbg_init(void) +static void halbtc_dbg_init(void) { u8 i; @@ -121,12 +121,7 @@ void halbtc_dbg_init(void) 0; } -bool halbtc_is_hw_mailbox_exist(struct btc_coexist *btcoexist) -{ - return true; -} - -bool halbtc_is_bt40(struct rtl_priv *adapter) +static bool halbtc_is_bt40(struct rtl_priv *adapter) { struct rtl_priv *rtlpriv = adapter; struct rtl_phy *rtlphy = &(rtlpriv->phy); @@ -142,7 +137,7 @@ bool halbtc_is_bt40(struct rtl_priv *adapter) return is_ht40; } -bool halbtc_legacy(struct rtl_priv *adapter) +static bool halbtc_legacy(struct rtl_priv *adapter) { struct rtl_priv *rtlpriv = adapter; struct rtl_mac *mac = rtl_mac(rtlpriv); @@ -165,7 +160,7 @@ bool halbtc_is_wifi_uplink(struct rtl_priv *adapter) return false; } -u32 halbtc_get_wifi_bw(struct btc_coexist *btcoexist) +static u32 halbtc_get_wifi_bw(struct btc_coexist *btcoexist) { struct rtl_priv *rtlpriv = (struct rtl_priv *)btcoexist->adapter; @@ -182,7 +177,7 @@ u32 halbtc_get_wifi_bw(struct btc_coexist *btcoexist) return wifi_bw; } -u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist) +static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist) { struct rtl_priv *rtlpriv = btcoexist->adapter; struct rtl_phy *rtlphy = &(rtlpriv->phy); @@ -196,7 +191,7 @@ u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist) return chnl; } -void halbtc_leave_lps(struct btc_coexist *btcoexist) +static void halbtc_leave_lps(struct btc_coexist *btcoexist) { struct rtl_priv *rtlpriv; struct rtl_ps_ctl *ppsc; @@ -217,7 +212,7 @@ void halbtc_leave_lps(struct btc_coexist *btcoexist) btcoexist->bt_info.bt_lps_on = false; } -void halbtc_enter_lps(struct btc_coexist *btcoexist) +static void halbtc_enter_lps(struct btc_coexist *btcoexist) { struct rtl_priv *rtlpriv; struct rtl_ps_ctl *ppsc; @@ -238,7 +233,7 @@ void halbtc_enter_lps(struct btc_coexist *btcoexist) btcoexist->bt_info.bt_lps_on = false; } -void halbtc_normal_lps(struct btc_coexist *btcoexist) +static void halbtc_normal_lps(struct btc_coexist *btcoexist) { if (btcoexist->bt_info.bt_ctrl_lps) { btcoexist->bt_info.bt_lps_on = false; @@ -247,29 +242,29 @@ void halbtc_normal_lps(struct btc_coexist *btcoexist) } -void halbtc_leave_low_power(void) +static void halbtc_leave_low_power(void) { } -void halbtc_nomal_low_power(void) +static void halbtc_nomal_low_power(void) { } -void halbtc_disable_low_power(void) +static void halbtc_disable_low_power(void) { } -void halbtc_aggregation_check(void) +static void halbtc_aggregation_check(void) { } -u32 halbtc_get_bt_patch_version(struct btc_coexist *btcoexist) +static u32 halbtc_get_bt_patch_version(struct btc_coexist *btcoexist) { return 0; } -s32 halbtc_get_wifi_rssi(struct rtl_priv *adapter) +static s32 halbtc_get_wifi_rssi(struct rtl_priv *adapter) { struct rtl_priv *rtlpriv = adapter; s32 undecorated_smoothed_pwdb = 0; @@ -283,7 +278,7 @@ s32 halbtc_get_wifi_rssi(struct rtl_priv *adapter) return undecorated_smoothed_pwdb; } -bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf) +static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf) { struct btc_coexist *btcoexist = (struct btc_coexist *)void_btcoexist; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -422,7 +417,7 @@ bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf) return true; } -bool halbtc_set(void *void_btcoexist, u8 set_type, void *in_buf) +static bool halbtc_set(void *void_btcoexist, u8 set_type, void *in_buf) { struct btc_coexist *btcoexist = (struct btc_coexist *)void_btcoexist; bool *bool_tmp = (bool *)in_buf; @@ -516,26 +511,26 @@ bool halbtc_set(void *void_btcoexist, u8 set_type, void *in_buf) return true; } -void halbtc_display_coex_statistics(struct btc_coexist *btcoexist) +static void halbtc_display_coex_statistics(struct btc_coexist *btcoexist) { } -void halbtc_display_bt_link_info(struct btc_coexist *btcoexist) +static void halbtc_display_bt_link_info(struct btc_coexist *btcoexist) { } -void halbtc_display_bt_fw_info(struct btc_coexist *btcoexist) +static void halbtc_display_bt_fw_info(struct btc_coexist *btcoexist) { } -void halbtc_display_fw_pwr_mode_cmd(struct btc_coexist *btcoexist) +static void halbtc_display_fw_pwr_mode_cmd(struct btc_coexist *btcoexist) { } /************************************************************ * IO related function ************************************************************/ -u8 halbtc_read_1byte(void *bt_context, u32 reg_addr) +static u8 halbtc_read_1byte(void *bt_context, u32 reg_addr) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -544,7 +539,7 @@ u8 halbtc_read_1byte(void *bt_context, u32 reg_addr) } -u16 halbtc_read_2byte(void *bt_context, u32 reg_addr) +static u16 halbtc_read_2byte(void *bt_context, u32 reg_addr) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -553,7 +548,7 @@ u16 halbtc_read_2byte(void *bt_context, u32 reg_addr) } -u32 halbtc_read_4byte(void *bt_context, u32 reg_addr) +static u32 halbtc_read_4byte(void *bt_context, u32 reg_addr) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -562,7 +557,7 @@ u32 halbtc_read_4byte(void *bt_context, u32 reg_addr) } -void halbtc_write_1byte(void *bt_context, u32 reg_addr, u8 data) +static void halbtc_write_1byte(void *bt_context, u32 reg_addr, u8 data) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -570,7 +565,7 @@ void halbtc_write_1byte(void *bt_context, u32 reg_addr, u8 data) rtl_write_byte(rtlpriv, reg_addr, data); } -void halbtc_bitmask_write_1byte(void *bt_context, u32 reg_addr, +static void halbtc_bitmask_write_1byte(void *bt_context, u32 reg_addr, u8 bit_mask, u8 data) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; @@ -592,7 +587,7 @@ void halbtc_bitmask_write_1byte(void *bt_context, u32 reg_addr, } -void halbtc_write_2byte(void *bt_context, u32 reg_addr, u16 data) +static void halbtc_write_2byte(void *bt_context, u32 reg_addr, u16 data) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -601,7 +596,7 @@ void halbtc_write_2byte(void *bt_context, u32 reg_addr, u16 data) } -void halbtc_write_4byte(void *bt_context, u32 reg_addr, u32 data) +static void halbtc_write_4byte(void *bt_context, u32 reg_addr, u32 data) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; @@ -610,26 +605,8 @@ void halbtc_write_4byte(void *bt_context, u32 reg_addr, u32 data) rtl_write_dword(rtlpriv, reg_addr, data); } - -void halbtc_set_macreg(void *bt_context, u32 reg_addr, u32 bit_mask, u32 data) -{ - struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; - struct rtl_priv *rtlpriv = btcoexist->adapter; - - rtl_set_bbreg(rtlpriv->mac80211.hw, reg_addr, bit_mask, data); -} - - -u32 halbtc_get_macreg(void *bt_context, u32 reg_addr, u32 bit_mask) -{ - struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; - struct rtl_priv *rtlpriv = btcoexist->adapter; - - return rtl_get_bbreg(rtlpriv->mac80211.hw, reg_addr, bit_mask); -} - - -void halbtc_set_bbreg(void *bt_context, u32 reg_addr, u32 bit_mask, u32 data) +static void halbtc_set_bbreg(void *bt_context, u32 reg_addr, + u32 bit_mask, u32 data) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -638,7 +615,7 @@ void halbtc_set_bbreg(void *bt_context, u32 reg_addr, u32 bit_mask, u32 data) } -u32 halbtc_get_bbreg(void *bt_context, u32 reg_addr, u32 bit_mask) +static u32 halbtc_get_bbreg(void *bt_context, u32 reg_addr, u32 bit_mask) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -647,7 +624,7 @@ u32 halbtc_get_bbreg(void *bt_context, u32 reg_addr, u32 bit_mask) } -void halbtc_set_rfreg(void *bt_context, u8 rf_path, u32 reg_addr, +static void halbtc_set_rfreg(void *bt_context, u8 rf_path, u32 reg_addr, u32 bit_mask, u32 data) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; @@ -657,7 +634,8 @@ void halbtc_set_rfreg(void *bt_context, u8 rf_path, u32 reg_addr, } -u32 halbtc_get_rfreg(void *bt_context, u8 rf_path, u32 reg_addr, u32 bit_mask) +static u32 halbtc_get_rfreg(void *bt_context, u8 rf_path, + u32 reg_addr, u32 bit_mask) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; struct rtl_priv *rtlpriv = btcoexist->adapter; @@ -666,7 +644,7 @@ u32 halbtc_get_rfreg(void *bt_context, u8 rf_path, u32 reg_addr, u32 bit_mask) } -void halbtc_fill_h2c_cmd(void *bt_context, u8 element_id, +static void halbtc_fill_h2c_cmd(void *bt_context, u8 element_id, u32 cmd_len, u8 *cmd_buf) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; @@ -676,7 +654,7 @@ void halbtc_fill_h2c_cmd(void *bt_context, u8 element_id, cmd_len, cmd_buf); } -void halbtc_display_dbg_msg(void *bt_context, u8 disp_type) +static void halbtc_display_dbg_msg(void *bt_context, u8 disp_type) { struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context; switch (disp_type) { @@ -697,25 +675,6 @@ void halbtc_display_dbg_msg(void *bt_context, u8 disp_type) } } -bool halbtc_under_ips(struct btc_coexist *btcoexist) -{ - struct rtl_priv *rtlpriv = btcoexist->adapter; - struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv); - enum rf_pwrstate rtstate; - - if (ppsc->b_inactiveps) { - rtstate = ppsc->rfpwr_state; - - if (rtstate != ERFON && - ppsc->rfoff_reason == RF_CHANGE_BY_IPS) { - - return true; - } - } - - return false; -} - /***************************************************************** * Extern functions called by other module *****************************************************************/ diff --git a/drivers/staging/rtl8821ae/btcoexist/rtl_btc.c b/drivers/staging/rtl8821ae/btcoexist/rtl_btc.c index 6653f147757..6be0acafba5 100644 --- a/drivers/staging/rtl8821ae/btcoexist/rtl_btc.c +++ b/drivers/staging/rtl8821ae/btcoexist/rtl_btc.c @@ -32,7 +32,7 @@ #include "rtl_btc.h" #include "halbt_precomp.h" -struct rtl_btc_ops rtl_btc_operation ={ +static struct rtl_btc_ops rtl_btc_operation = { .btc_init_variables = rtl_btc_init_variables, .btc_init_hal_vars = rtl_btc_init_hal_vars, .btc_init_hw_config = rtl_btc_init_hw_config, diff --git a/drivers/staging/rtl8821ae/cam.c b/drivers/staging/rtl8821ae/cam.c index 72743e78954..3bc6b3d0651 100644 --- a/drivers/staging/rtl8821ae/cam.c +++ b/drivers/staging/rtl8821ae/cam.c @@ -28,9 +28,7 @@ *****************************************************************************/ #include "wifi.h" #include "cam.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) #include <linux/export.h> -#endif void rtl_cam_reset_sec_info(struct ieee80211_hw *hw) { diff --git a/drivers/staging/rtl8821ae/compat.h b/drivers/staging/rtl8821ae/compat.h index 68269cc2d47..ffb5f8b07bd 100644 --- a/drivers/staging/rtl8821ae/compat.h +++ b/drivers/staging/rtl8821ae/compat.h @@ -1,65 +1,8 @@ #ifndef __RTL_COMPAT_H__ #define __RTL_COMPAT_H__ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -/* - * Use this if you want to use the same suspend and resume callbacks for suspend - * to RAM and hibernation. - */ -#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ -struct dev_pm_ops name = { \ - .suspend = suspend_fn, \ - .resume = resume_fn, \ - .freeze = suspend_fn, \ - .thaw = resume_fn, \ - .poweroff = suspend_fn, \ - .restore = resume_fn, \ -} - -#define compat_pci_suspend(fn) \ - int fn##_compat(struct pci_dev *pdev, pm_message_t state) \ - { \ - int r; \ - \ - r = fn(&pdev->dev); \ - if (r) \ - return r; \ - \ - pci_save_state(pdev); \ - pci_disable_device(pdev); \ - pci_set_power_state(pdev, PCI_D3hot); \ - \ - return 0; \ - } - -#define compat_pci_resume(fn) \ - int fn##_compat(struct pci_dev *pdev) \ - { \ - int r; \ - \ - pci_set_power_state(pdev, PCI_D0); \ - r = pci_enable_device(pdev); \ - if (r) \ - return r; \ - pci_restore_state(pdev); \ - \ - return fn(&pdev->dev); \ - } -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) -#define RX_FLAG_MACTIME_MPDU RX_FLAG_TSFT -#else -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) #define RX_FLAG_MACTIME_MPDU RX_FLAG_MACTIME_START -#else -#endif -//#define NETDEV_TX_OK -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) #define IEEE80211_KEY_FLAG_SW_MGMT IEEE80211_KEY_FLAG_SW_MGMT_TX -#endif struct ieee80211_mgmt_compat { __le16 frame_control; diff --git a/drivers/staging/rtl8821ae/core.c b/drivers/staging/rtl8821ae/core.c index ff3139b6da6..046be2ce9c1 100644 --- a/drivers/staging/rtl8821ae/core.c +++ b/drivers/staging/rtl8821ae/core.c @@ -88,42 +88,9 @@ static void rtl_op_stop(struct ieee80211_hw *hw) mutex_unlock(&rtlpriv->locks.conf_mutex); } -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) -static int rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); - struct rtl_tcb_desc tcb_desc; - memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); - - if (unlikely(is_hal_stop(rtlhal) || ppsc->rfpwr_state != ERFON)) - goto err_free; - - if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) - goto err_free; - - if (!rtlpriv->intf_ops->waitq_insert(hw, skb)) - rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc); - - return NETDEV_TX_OK; - -err_free: - dev_kfree_skb_any(skb); - return NETDEV_TX_OK; -} -#else -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) -static void rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) -#else -/*<delete in kernel end>*/ static void rtl_op_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct sk_buff *skb) -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ { struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); @@ -137,26 +104,14 @@ static void rtl_op_tx(struct ieee80211_hw *hw, if (!test_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status)) goto err_free; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - if (!rtlpriv->intf_ops->waitq_insert(hw, skb)) - rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc); -#else -/*<delete in kernel end>*/ if (!rtlpriv->intf_ops->waitq_insert(hw, control->sta, skb)) rtlpriv->intf_ops->adapter_tx(hw, control->sta, skb, &tcb_desc); -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ return; err_free: dev_kfree_skb_any(skb); return; } -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ static int rtl_op_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) @@ -171,26 +126,15 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw, return -EOPNOTSUPP; } -/*This flag is not defined before kernel 3.4*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER; -#endif rtl_ips_nic_on(hw); mutex_lock(&rtlpriv->locks.conf_mutex); -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) switch (ieee80211_vif_type_p2p(vif)) { case NL80211_IFTYPE_P2P_CLIENT: mac->p2p = P2P_ROLE_CLIENT; /*fall through*/ -#else -/*<delete in kernel end>*/ - switch (vif->type) { -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ case NL80211_IFTYPE_STATION: if (mac->beacon_enabled == 1) { RT_TRACE(COMP_MAC80211, DBG_LOUD, @@ -214,13 +158,9 @@ static int rtl_op_add_interface(struct ieee80211_hw *hw, (u8 *) (&mac->basic_rates)); break; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) case NL80211_IFTYPE_P2P_GO: mac->p2p = P2P_ROLE_GO; /*fall through*/ -#endif -/*<delete in kernel end>*/ case NL80211_IFTYPE_AP: RT_TRACE(COMP_MAC80211, DBG_LOUD, ("NL80211_IFTYPE_AP \n")); @@ -310,9 +250,7 @@ static void rtl_op_remove_interface(struct ieee80211_hw *hw, mutex_unlock(&rtlpriv->locks.conf_mutex); } -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -/*<delete in kernel end>*/ + static int rtl_op_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum nl80211_iftype new_type, bool p2p) @@ -328,9 +266,7 @@ static int rtl_op_change_interface(struct ieee80211_hw *hw, (" p2p %x\n",p2p)); return ret; } -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ + static int rtl_op_config(struct ieee80211_hw *hw, u32 changed) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -398,14 +334,9 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed) } if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) struct ieee80211_channel *channel = hw->conf.chandef.chan; enum nl80211_channel_type channel_type = cfg80211_get_chandef_type(&(hw->conf.chandef)); -#else - struct ieee80211_channel *channel = hw->conf.channel; - enum nl80211_channel_type channel_type = hw->conf.channel_type; -#endif u8 wide_chan = (u8) channel->hw_value; if (mac->act_scanning) @@ -661,14 +592,9 @@ static int _rtl_get_hal_qnum(u16 queue) *for mac80211 VO=0, VI=1, BE=2, BK=3 *for rtl819x BE=0, BK=1, VI=2, VO=3 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) static int rtl_op_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *param) -#else -static int rtl_op_conf_tx(struct ieee80211_hw *hw, u16 queue, - const struct ieee80211_tx_queue_params *param) -#endif { struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); @@ -964,11 +890,7 @@ out: mutex_unlock(&rtlpriv->locks.conf_mutex); } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) static u64 rtl_op_get_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -#else -static u64 rtl_op_get_tsf(struct ieee80211_hw *hw) -#endif { struct rtl_priv *rtlpriv = rtl_priv(hw); u64 tsf; @@ -977,12 +899,8 @@ static u64 rtl_op_get_tsf(struct ieee80211_hw *hw) return tsf; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) static void rtl_op_set_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u64 tsf) -#else -static void rtl_op_set_tsf(struct ieee80211_hw *hw, u64 tsf) -#endif { struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); @@ -992,11 +910,7 @@ static void rtl_op_set_tsf(struct ieee80211_hw *hw, u64 tsf) rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_CORRECT_TSF, (u8 *) (&bibss)); } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) static void rtl_op_reset_tsf(struct ieee80211_hw *hw, struct ieee80211_vif *vif) -#else -static void rtl_op_reset_tsf(struct ieee80211_hw *hw) -#endif { struct rtl_priv *rtlpriv = rtl_priv(hw); u8 tmp = 0; @@ -1023,13 +937,7 @@ static int rtl_op_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum ieee80211_ampdu_mlme_action action, struct ieee80211_sta *sta, u16 tid, u16 * ssn -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) -/*<delete in kernel end>*/ ,u8 buf_size -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ ) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -1040,13 +948,9 @@ static int rtl_op_ampdu_action(struct ieee80211_hw *hw, ("IEEE80211_AMPDU_TX_START: TID:%d\n", tid)); return rtl_tx_agg_start(hw, vif, sta, tid, ssn); break; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) case IEEE80211_AMPDU_TX_STOP_CONT: case IEEE80211_AMPDU_TX_STOP_FLUSH: case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: -#else - case IEEE80211_AMPDU_TX_STOP: -#endif RT_TRACE(COMP_MAC80211, DBG_TRACE, ("IEEE80211_AMPDU_TX_STOP: TID:%d\n", tid)); return rtl_tx_agg_stop(hw, vif, sta, tid); @@ -1174,9 +1078,6 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mutex_lock(&rtlpriv->locks.conf_mutex); /* <1> get encryption alg */ -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -/*<delete in kernel end>*/ switch (key->cipher) { case WLAN_CIPHER_SUITE_WEP40: key_type = WEP40_ENCRYPTION; @@ -1209,43 +1110,6 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ("alg_err:%x!!!!:\n", key->cipher)); goto out_unlock; } -/*<delete in kernel start>*/ -#else - switch (key->alg) { - case ALG_WEP: - if (key->keylen == WLAN_KEY_LEN_WEP40) { - key_type = WEP40_ENCRYPTION; - RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:WEP40\n")); - } else { - RT_TRACE(COMP_SEC, DBG_DMESG, - ("alg:WEP104\n")); - key_type = WEP104_ENCRYPTION; - } - break; - case ALG_TKIP: - key_type = TKIP_ENCRYPTION; - RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:TKIP\n")); - break; - case ALG_CCMP: - key_type = AESCCMP_ENCRYPTION; - RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:CCMP\n")); - break; - case ALG_AES_CMAC: - /*HW don't support CMAC encryption, use software CMAC encryption */ - key_type = AESCMAC_ENCRYPTION; - RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:CMAC\n")); - RT_TRACE(COMP_SEC, DBG_DMESG, - ("HW don't support CMAC encryption, " - "use software CMAC encryption\n")); - err = -EOPNOTSUPP; - goto out_unlock; - default: - RT_TRACE(COMP_ERR, DBG_EMERG, - ("alg_err:%x!!!!:\n", key->alg)); - goto out_unlock; - } -#endif -/*<delete in kernel end>*/ if(key_type == WEP40_ENCRYPTION || key_type == WEP104_ENCRYPTION || vif->type == NL80211_IFTYPE_ADHOC) @@ -1414,23 +1278,15 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw) * before switch channel or power save, or tx buffer packet * maybe send after offchannel or rf sleep, this may cause * dis-association by AP */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) -static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop) +static void rtl_op_flush(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + u32 queues, bool drop) { struct rtl_priv *rtlpriv = rtl_priv(hw); if (rtlpriv->intf_ops->flush) rtlpriv->intf_ops->flush(hw, queues, drop); } -#else -static void rtl_op_flush(struct ieee80211_hw *hw, bool drop) -{ - struct rtl_priv *rtlpriv = rtl_priv(hw); - - if (rtlpriv->intf_ops->flush) - rtlpriv->intf_ops->flush(hw, drop); -} -#endif const struct ieee80211_ops rtl_ops = { .start = rtl_op_start, @@ -1438,13 +1294,7 @@ const struct ieee80211_ops rtl_ops = { .tx = rtl_op_tx, .add_interface = rtl_op_add_interface, .remove_interface = rtl_op_remove_interface, -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -/*<delete in kernel end>*/ .change_interface = rtl_op_change_interface, -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ .config = rtl_op_config, .configure_filter = rtl_op_configure_filter, .set_key = rtl_op_set_key, diff --git a/drivers/staging/rtl8821ae/debug.c b/drivers/staging/rtl8821ae/debug.c index 8a6c794bda4..8aefbf10a45 100644 --- a/drivers/staging/rtl8821ae/debug.c +++ b/drivers/staging/rtl8821ae/debug.c @@ -30,12 +30,7 @@ #include "wifi.h" #include "cam.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) #define GET_INODE_DATA(__node) PDE_DATA(__node) -#else -#define GET_INODE_DATA(__node) PDE(__node)->data -#endif - void rtl_dbgp_flag_init(struct ieee80211_hw *hw) { diff --git a/drivers/staging/rtl8821ae/efuse.c b/drivers/staging/rtl8821ae/efuse.c index 250aae1ce63..206012cf360 100644 --- a/drivers/staging/rtl8821ae/efuse.c +++ b/drivers/staging/rtl8821ae/efuse.c @@ -29,9 +29,7 @@ #include "wifi.h" #include "efuse.h" #include "btcoexist/halbt_precomp.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) #include <linux/export.h> -#endif static const u8 MAX_PGPKT_SIZE = 9; static const u8 PGPKT_DATA_SIZE = 8; diff --git a/drivers/staging/rtl8821ae/pci.c b/drivers/staging/rtl8821ae/pci.c index a562aa60d59..e194ffe58ac 100644 --- a/drivers/staging/rtl8821ae/pci.c +++ b/drivers/staging/rtl8821ae/pci.c @@ -33,9 +33,7 @@ #include "base.h" #include "ps.h" #include "efuse.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) #include <linux/export.h> -#endif static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = { INTEL_VENDOR_ID, @@ -364,47 +362,6 @@ static bool rtl_pci_get_amd_l1_patch(struct ieee80211_hw *hw) return status; } -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) -static u8 _rtl_pci_get_pciehdr_offset(struct ieee80211_hw *hw) -{ - u8 capability_offset; - u8 num4bytes = 0x34/4; - struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); - u32 pcicfg_addr_port = (pcipriv->ndis_adapter.pcibridge_busnum << 16)| - (pcipriv->ndis_adapter.pcibridge_devnum << 11)| - (pcipriv->ndis_adapter.pcibridge_funcnum << 8)| - (1 << 31); - - rtl_pci_raw_write_port_ulong(PCI_CONF_ADDRESS , pcicfg_addr_port - + (num4bytes << 2)); - rtl_pci_raw_read_port_uchar(PCI_CONF_DATA, &capability_offset); - while (capability_offset != 0) { - struct rtl_pci_capabilities_header capability_hdr; - - num4bytes = capability_offset / 4; - /* Read the header of the capability at this offset. - * If the retrieved capability is not the power management - * capability that we are looking for, follow the link to - * the next capability and continue looping. - */ - rtl_pci_raw_write_port_ulong(PCI_CONF_ADDRESS , - pcicfg_addr_port + - (num4bytes << 2)); - rtl_pci_raw_read_port_ushort(PCI_CONF_DATA, - (u16*)&capability_hdr); - /* Found the PCI express capability. */ - if (capability_hdr.capability_id == - PCI_CAPABILITY_ID_PCI_EXPRESS) - break; - else - capability_offset = capability_hdr.next; - } - return capability_offset; -} -#endif -/*<delete in kernel end>*/ - bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw, struct rtl_priv **buddy_priv) { @@ -610,14 +567,7 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw) _rtl_pci_update_earlymode_info(hw, skb, &tcb_desc, tid); -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - rtlpriv->intf_ops->adapter_tx(hw, skb, &tcb_desc); -#else -/*<delete in kernel end>*/ rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc); -#endif -/*<delete in kernel end>*/ } } } @@ -1201,19 +1151,9 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) if (rtlpriv->use_new_trx_flow) pbuffer_desc = &ring->buffer_desc[0]; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc, - (u8 *)pbuffer_desc, info, pskb, - BEACON_QUEUE, &tcb_desc); -#else -/*<delete in kernel end>*/ rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc, (u8 *)pbuffer_desc, info, NULL, pskb, BEACON_QUEUE, &tcb_desc); -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ __skb_queue_tail(&ring->queue, pskb); @@ -1616,26 +1556,11 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) return 0; } -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) -static bool rtl_pci_tx_chk_waitq_insert(struct ieee80211_hw *hw, - struct sk_buff *skb) -#else -/*<delete in kernel end>*/ static bool rtl_pci_tx_chk_waitq_insert(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct sk_buff *skb) -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ { struct rtl_priv *rtlpriv = rtl_priv(hw); -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_sta *sta = info->control.sta; -#endif -/*<delete in kernel end>*/ struct rtl_sta_info *sta_entry = NULL; u8 tid = rtl_get_tid(skb); u16 fc = rtl_get_fc(skb); @@ -1671,28 +1596,14 @@ static bool rtl_pci_tx_chk_waitq_insert(struct ieee80211_hw *hw, return true; } -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) -int rtl_pci_tx(struct ieee80211_hw *hw, struct sk_buff *skb, - struct rtl_tcb_desc *ptcb_desc) -#else -/*<delete in kernel end>*/ static int rtl_pci_tx(struct ieee80211_hw *hw, struct ieee80211_sta *sta, struct sk_buff *skb, struct rtl_tcb_desc *ptcb_desc) -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ { struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_sta_info *sta_entry = NULL; struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - struct ieee80211_sta *sta = info->control.sta; -#endif -/*<delete in kernel end>*/ struct rtl8192_tx_ring *ring; struct rtl_tx_desc *pdesc; struct rtl_tx_buffer_desc *ptx_bd_desc = NULL; @@ -1777,19 +1688,9 @@ static int rtl_pci_tx(struct ieee80211_hw *hw, if (ieee80211_is_data(fc)) rtlpriv->cfg->ops->led_control(hw, LED_CTL_TX); -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc, - (u8 *)ptx_bd_desc, info, skb, - hw_queue, ptcb_desc); -#else -/*<delete in kernel end>*/ rtlpriv->cfg->ops->fill_tx_desc(hw, hdr, (u8 *) pdesc, (u8 *)ptx_bd_desc, info, sta, skb, hw_queue, ptcb_desc); -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ __skb_queue_tail(&ring->queue, skb); if (rtlpriv->use_new_trx_flow) { @@ -1819,11 +1720,7 @@ static int rtl_pci_tx(struct ieee80211_hw *hw, return 0; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) static void rtl_pci_flush(struct ieee80211_hw *hw, u32 queues, bool drop) -#else -static void rtl_pci_flush(struct ieee80211_hw *hw, bool drop) -#endif { struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); @@ -1838,12 +1735,10 @@ static void rtl_pci_flush(struct ieee80211_hw *hw, bool drop) for (queue_id = RTL_PCI_MAX_TX_QUEUE_COUNT - 1; queue_id >= 0;) { u32 queue_len; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) if (((queues >> queue_id) & 0x1) == 0) { queue_id--; continue; } -#endif ring = &pcipriv->dev.tx_ring[queue_id]; queue_len = skb_queue_len(&ring->queue); if (queue_len == 0 || queue_id == BEACON_QUEUE || @@ -2122,17 +2017,8 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev, (pcipriv->ndis_adapter.pcibridge_busnum << 16) | (pcipriv->ndis_adapter.pcibridge_devnum << 11) | (pcipriv->ndis_adapter.pcibridge_funcnum << 8) | (1 << 31); -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) -/*<delete in kernel end>*/ pcipriv->ndis_adapter.pcibridge_pciehdr_offset = pci_pcie_cap(bridge_pdev); -/*<delete in kernel start>*/ -#else - pcipriv->ndis_adapter.pcibridge_pciehdr_offset = - _rtl_pci_get_pciehdr_offset(hw); -#endif -/*<delete in kernel end>*/ pcipriv->ndis_adapter.num4bytes = (pcipriv->ndis_adapter.pcibridge_pciehdr_offset + 0x10) / 4; @@ -2230,14 +2116,8 @@ static int rtl_pci_intr_mode_decide(struct ieee80211_hw *hw) * hw pointer in rtl_pci_get_hw_pointer */ struct ieee80211_hw *hw_export = NULL; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) int rtl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) - -#else -int __devinit rtl_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id) -#endif { struct ieee80211_hw *hw = NULL; @@ -2313,16 +2193,16 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev, /*shared mem start */ rtlpriv->io.pci_mem_start = - (unsigned long)pci_iomap(pdev, + pci_iomap(pdev, rtlpriv->cfg->bar_id, pmem_len); - if (rtlpriv->io.pci_mem_start == 0) { + if (rtlpriv->io.pci_mem_start == NULL) { RT_ASSERT(false, ("Can't map PCI mem\n")); goto fail2; } RT_TRACE(COMP_INIT, DBG_DMESG, ("mem mapped space: start: 0x%08lx len:%08lx " - "flags:%08lx, after map:0x%08lx\n", + "flags:%08lx, after map:0x%p\n", pmem_start, pmem_len, pmem_flags, rtlpriv->io.pci_mem_start)); @@ -2415,8 +2295,8 @@ fail3: rtl_deinit_core(hw); ieee80211_free_hw(hw); - if (rtlpriv->io.pci_mem_start != 0) - pci_iounmap(pdev, (void *)rtlpriv->io.pci_mem_start); + if (rtlpriv->io.pci_mem_start != NULL) + pci_iounmap(pdev, rtlpriv->io.pci_mem_start); fail2: pci_release_regions(pdev); @@ -2478,8 +2358,8 @@ void rtl_pci_disconnect(struct pci_dev *pdev) pci_disable_msi(rtlpci->pdev); list_del(&rtlpriv->list); - if (rtlpriv->io.pci_mem_start != 0) { - pci_iounmap(pdev, (void *)rtlpriv->io.pci_mem_start); + if (rtlpriv->io.pci_mem_start != NULL) { + pci_iounmap(pdev, rtlpriv->io.pci_mem_start); pci_release_regions(pdev); } diff --git a/drivers/staging/rtl8821ae/pci.h b/drivers/staging/rtl8821ae/pci.h index 06eaa521e0e..3f16ec90296 100644 --- a/drivers/staging/rtl8821ae/pci.h +++ b/drivers/staging/rtl8821ae/pci.h @@ -282,13 +282,8 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw); extern struct rtl_intf_ops rtl_pci_ops; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) int rtl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id); -#else -int __devinit rtl_pci_probe(struct pci_dev *pdev, - const struct pci_device_id *id); -#endif void rtl_pci_disconnect(struct pci_dev *pdev); int rtl_pci_suspend(struct device *dev); int rtl_pci_resume(struct device *dev); diff --git a/drivers/staging/rtl8821ae/ps.c b/drivers/staging/rtl8821ae/ps.c index 7876442417f..5a9bbf025e2 100644 --- a/drivers/staging/rtl8821ae/ps.c +++ b/drivers/staging/rtl8821ae/ps.c @@ -30,9 +30,7 @@ #include "wifi.h" #include "base.h" #include "ps.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) #include <linux/export.h> -#endif #include "btcoexist/rtl_btc.h" bool rtl_ps_enable_nic(struct ieee80211_hw *hw) @@ -542,17 +540,8 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len) tim_len = tim[1]; tim_ie = (struct ieee80211_tim_ie *) &tim[2]; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) -/*<delete in kernel end>*/ if (!WARN_ON_ONCE(!hw->conf.ps_dtim_period)) rtlpriv->psc.dtim_counter = tim_ie->dtim_count; -/*<delete in kernel start>*/ -#else - if (!WARN_ON_ONCE(!mac->vif->bss_conf.dtim_period)) - rtlpriv->psc.dtim_counter = tim_ie->dtim_count; -#endif -/*<delete in kernel end>*/ /* Check whenever the PHY can be turned off again. */ @@ -656,9 +645,6 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) * time to sleep_intv = rtlpriv->psc.dtim_counter or * MAX_SW_LPS_SLEEP_INTV(default set to 5) */ -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) -/*<delete in kernel end>*/ if (rtlpriv->psc.dtim_counter == 0) { if (hw->conf.ps_dtim_period == 1) sleep_intv = hw->conf.ps_dtim_period * 2; @@ -667,18 +653,6 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) } else { sleep_intv = rtlpriv->psc.dtim_counter; } -/*<delete in kernel start>*/ -#else - if (rtlpriv->psc.dtim_counter == 0) { - if (mac->vif->bss_conf.dtim_period == 1) - sleep_intv = mac->vif->bss_conf.dtim_period * 2; - else - sleep_intv = mac->vif->bss_conf.dtim_period; - } else { - sleep_intv = rtlpriv->psc.dtim_counter; - } -#endif -/*<delete in kernel end>*/ if (sleep_intv > MAX_SW_LPS_SLEEP_INTV) sleep_intv = MAX_SW_LPS_SLEEP_INTV; diff --git a/drivers/staging/rtl8821ae/rc.c b/drivers/staging/rtl8821ae/rc.c index 0cc32c60dde..0b4f3218508 100644 --- a/drivers/staging/rtl8821ae/rc.c +++ b/drivers/staging/rtl8821ae/rc.c @@ -210,16 +210,8 @@ static void rtl_tx_status(void *ppriv, tid)) { sta_entry->tids[tid].agg.agg_state = RTL_AGG_PROGRESS; - /*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) - /*<delete in kernel end>*/ ieee80211_start_tx_ba_session(sta, tid, 5000); - /*<delete in kernel start>*/ -#else - ieee80211_start_tx_ba_session(sta, tid); -#endif - /*<delete in kernel end>*/ } } } @@ -232,15 +224,6 @@ static void rtl_rate_init(void *ppriv, struct ieee80211_sta *sta, void *priv_sta) { } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) -static void rtl_rate_update(void *ppriv, - struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - u32 changed, - enum nl80211_channel_type oper_chan_type) -{ -} -#else static void rtl_rate_update(void *ppriv, struct ieee80211_supported_band *sband, struct cfg80211_chan_def *chandef, @@ -248,7 +231,6 @@ static void rtl_rate_update(void *ppriv, u32 changed) { } -#endif static void *rtl_rate_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -286,7 +268,7 @@ static void rtl_rate_free_sta(void *rtlpriv, } static struct rate_control_ops rtl_rate_ops = { - .name = "rtl_rc", + .name = "rtl_rc_21ae", .alloc = rtl_rate_alloc, .free = rtl_rate_free, .alloc_sta = rtl_rate_alloc_sta, diff --git a/drivers/staging/rtl8821ae/regd.c b/drivers/staging/rtl8821ae/regd.c index 0a4b3984b7e..2efa5f31822 100644 --- a/drivers/staging/rtl8821ae/regd.c +++ b/drivers/staging/rtl8821ae/regd.c @@ -158,11 +158,6 @@ static void _rtl_reg_apply_beaconing_flags(struct wiphy *wiphy, const struct ieee80211_reg_rule *reg_rule; struct ieee80211_channel *ch; unsigned int i; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) - u32 bandwidth = 0; - int r; -#endif - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { if (!wiphy->bands[band]) @@ -176,16 +171,9 @@ static void _rtl_reg_apply_beaconing_flags(struct wiphy *wiphy, (ch->flags & IEEE80211_CHAN_RADAR)) continue; if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) reg_rule = freq_reg_info(wiphy, ch->center_freq); if (IS_ERR(reg_rule)) continue; -#else - r = freq_reg_info(wiphy, ch->center_freq, - bandwidth, ®_rule); - if (r) - continue; -#endif /* *If 11d had a rule for this channel ensure @@ -219,10 +207,6 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy, struct ieee80211_supported_band *sband; struct ieee80211_channel *ch; const struct ieee80211_reg_rule *reg_rule; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) - u32 bandwidth = 0; - int r; -#endif if (!wiphy->bands[IEEE80211_BAND_2GHZ]) return; @@ -250,26 +234,16 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy, */ ch = &sband->channels[11]; /* CH 12 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) reg_rule = freq_reg_info(wiphy, ch->center_freq); if (!IS_ERR(reg_rule)) { -#else - r = freq_reg_info(wiphy, ch->center_freq, bandwidth, ®_rule); - if (!r) { -#endif if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; } ch = &sband->channels[12]; /* CH 13 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) reg_rule = freq_reg_info(wiphy, ch->center_freq); if (!IS_ERR(reg_rule)) { -#else - r = freq_reg_info(wiphy, ch->center_freq, bandwidth, ®_rule); - if (!r) { -#endif if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN)) if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; @@ -389,19 +363,11 @@ static const struct ieee80211_regdomain *_rtl_regdomain_select( } } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg, struct wiphy *wiphy, void (*reg_notifier) (struct wiphy * wiphy, struct regulatory_request * request)) -#else -static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg, - struct wiphy *wiphy, - int (*reg_notifier) (struct wiphy * wiphy, - struct regulatory_request * - request)) -#endif { const struct ieee80211_regdomain *regd; @@ -429,15 +395,9 @@ static struct country_code_to_enum_rd *_rtl_regd_find_country(u16 countrycode) return NULL; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) int rtl_regd_init(struct ieee80211_hw *hw, void (*reg_notifier) (struct wiphy *wiphy, struct regulatory_request *request)) -#else -int rtl_regd_init(struct ieee80211_hw *hw, - int (*reg_notifier) (struct wiphy *wiphy, - struct regulatory_request *request)) -#endif { struct rtl_priv *rtlpriv = rtl_priv(hw); struct wiphy *wiphy = hw->wiphy; @@ -480,7 +440,6 @@ int rtl_regd_init(struct ieee80211_hw *hw, return 0; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) { struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); @@ -490,14 +449,3 @@ void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd); } -#else -int rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) -{ - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); - struct rtl_priv *rtlpriv = rtl_priv(hw); - - RT_TRACE(COMP_REGD, DBG_LOUD, ("\n")); - - return _rtl_reg_notifier_apply(wiphy, request, &rtlpriv->regd); -} -#endif diff --git a/drivers/staging/rtl8821ae/regd.h b/drivers/staging/rtl8821ae/regd.h index dceb3f18200..1cfcb97b0ab 100644 --- a/drivers/staging/rtl8821ae/regd.h +++ b/drivers/staging/rtl8821ae/regd.h @@ -60,16 +60,8 @@ enum country_code_type_t { COUNTRY_CODE_MAX }; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) int rtl_regd_init(struct ieee80211_hw *hw, void (*reg_notifier) (struct wiphy *wiphy, struct regulatory_request *request)); void rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); -#else -int rtl_regd_init(struct ieee80211_hw *hw, - int (*reg_notifier) (struct wiphy *wiphy, - struct regulatory_request *request)); -int rtl_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request); -#endif - #endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hw.h b/drivers/staging/rtl8821ae/rtl8821ae/hw.h index 4fb6bf0d1da..256e514f424 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/hw.h +++ b/drivers/staging/rtl8821ae/rtl8821ae/hw.h @@ -11,10 +11,6 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * * The full GNU General Public License is included in this distribution in the * file called LICENSE. * @@ -34,42 +30,43 @@ void rtl8821ae_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); void rtl8821ae_read_eeprom_info(struct ieee80211_hw *hw); void rtl8821ae_interrupt_recognized(struct ieee80211_hw *hw, - u32 *p_inta, u32 *p_intb); + u32 *p_inta, u32 *p_intb); int rtl8821ae_hw_init(struct ieee80211_hw *hw); void rtl8821ae_card_disable(struct ieee80211_hw *hw); void rtl8821ae_enable_interrupt(struct ieee80211_hw *hw); void rtl8821ae_disable_interrupt(struct ieee80211_hw *hw); -int rtl8821ae_set_network_type(struct ieee80211_hw *hw, enum nl80211_iftype type); +int rtl8821ae_set_network_type(struct ieee80211_hw *hw, + enum nl80211_iftype type); void rtl8821ae_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); void rtl8821ae_set_qos(struct ieee80211_hw *hw, int aci); void rtl8821ae_set_beacon_related_registers(struct ieee80211_hw *hw); void rtl8821ae_set_beacon_interval(struct ieee80211_hw *hw); void rtl8821ae_update_interrupt_mask(struct ieee80211_hw *hw, - u32 add_msr, u32 rm_msr); + u32 add_msr, u32 rm_msr); void rtl8821ae_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val); void rtl8821ae_update_hal_rate_tbl(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u8 rssi_level); + struct ieee80211_sta *sta, + u8 rssi_level); void rtl8821ae_update_channel_access_setting(struct ieee80211_hw *hw); bool rtl8821ae_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 *valid); void rtl8821ae_enable_hw_security_config(struct ieee80211_hw *hw); void rtl8821ae_set_key(struct ieee80211_hw *hw, u32 key_index, - u8 *p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); + u8 *p_macaddr, bool is_group, u8 enc_algo, + bool is_wepkey, bool clear_all); void rtl8821ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8* hwinfo); + bool autoload_fail, + u8 *hwinfo); void rtl8812ae_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw, - bool autoload_fail, - u8* hwinfo); -void rtl8821ae_bt_reg_init(struct ieee80211_hw* hw); -void rtl8821ae_bt_hw_init(struct ieee80211_hw* hw); + bool autoload_fail, + u8 *hwinfo); +void rtl8821ae_bt_reg_init(struct ieee80211_hw *hw); +void rtl8821ae_bt_hw_init(struct ieee80211_hw *hw); void rtl8821ae_suspend(struct ieee80211_hw *hw); void rtl8821ae_resume(struct ieee80211_hw *hw); void rtl8821ae_allow_all_destaddr(struct ieee80211_hw *hw, - bool allow_all_da, - bool write_into_reg); + bool allow_all_da, + bool write_into_reg); void _rtl8821ae_stop_tx_beacon(struct ieee80211_hw *hw); void _rtl8821ae_resume_tx_beacon(struct ieee80211_hw *hw); #endif diff --git a/drivers/staging/rtl8821ae/rtl8821ae/sw.c b/drivers/staging/rtl8821ae/rtl8821ae/sw.c index a8d17556977..26212755f88 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/sw.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/sw.c @@ -45,7 +45,7 @@ #include "hal_btc.h" #include "../btcoexist/rtl_btc.h" -void rtl8821ae_init_aspm_vars(struct ieee80211_hw *hw) +static void rtl8821ae_init_aspm_vars(struct ieee80211_hw *hw) { struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); @@ -225,7 +225,7 @@ void rtl8821ae_deinit_sw_vars(struct ieee80211_hw *hw) //printk("<=========rtl8821ae_deinit_sw_vars().\n"); } -u32 rtl8812ae_rx_command_packet_handler( +static u32 rtl8812ae_rx_command_packet_handler( struct ieee80211_hw *hw, struct rtl_stats status, struct sk_buff *skb @@ -260,7 +260,7 @@ bool rtl8821ae_get_btc_status(void) return true; } -struct rtl_hal_ops rtl8821ae_hal_ops = { +static struct rtl_hal_ops rtl8821ae_hal_ops = { .init_sw_vars = rtl8821ae_init_sw_vars, .deinit_sw_vars = rtl8821ae_deinit_sw_vars, .read_eeprom_info = rtl8821ae_read_eeprom_info, @@ -311,14 +311,14 @@ struct rtl_hal_ops rtl8821ae_hal_ops = { .rx_command_packet_handler = rtl8812ae_rx_command_packet_handler, }; -struct rtl_mod_params rtl8821ae_mod_params = { +static struct rtl_mod_params rtl8821ae_mod_params = { .sw_crypto = false, .b_inactiveps = false,//true, .b_swctrl_lps = false, .b_fwctrl_lps = false, //true, }; -struct rtl_hal_cfg rtl8821ae_hal_cfg = { +static struct rtl_hal_cfg rtl8821ae_hal_cfg = { .bar_id = 2, .write_readback = true, .name = "rtl8821ae_pci", @@ -415,19 +415,11 @@ struct rtl_hal_cfg rtl8821ae_hal_cfg = { .maps[RTL_RC_HT_RATEMCS15] = DESC_RATEMCS15, }; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) static struct pci_device_id rtl8821ae_pci_ids[] = { {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8812, rtl8821ae_hal_cfg)}, {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8821, rtl8821ae_hal_cfg)}, {}, }; -#else -static struct pci_device_id rtl8821ae_pci_ids[] __devinitdata = { - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8812, rtl8821ae_hal_cfg)}, - {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8821, rtl8821ae_hal_cfg)}, - {}, -}; -#endif MODULE_DEVICE_TABLE(pci, rtl8821ae_pci_ids); @@ -445,14 +437,7 @@ MODULE_PARM_DESC(swenc, "using hardware crypto (default 0 [hardware])\n"); MODULE_PARM_DESC(ips, "using no link power save (default 1 is open)\n"); MODULE_PARM_DESC(fwlps, "using linked fw control power save (default 1 is open)\n"); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) -static const SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -compat_pci_suspend(rtl_pci_suspend) -compat_pci_resume(rtl_pci_resume) -#endif +static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume); static struct pci_driver rtl8821ae_driver = { .name = KBUILD_MODNAME, @@ -460,13 +445,7 @@ static struct pci_driver rtl8821ae_driver = { .probe = rtl_pci_probe, .remove = rtl_pci_disconnect, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) .driver.pm = &rtlwifi_pm_ops, -#elif defined(CONFIG_PM) - .suspend = rtl_pci_suspend_compat, - .resume = rtl_pci_resume_compat, -#endif - }; diff --git a/drivers/staging/rtl8821ae/rtl8821ae/trx.c b/drivers/staging/rtl8821ae/rtl8821ae/trx.c index f40a93c0d2b..b4943e8b7f8 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/trx.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/trx.c @@ -77,11 +77,7 @@ static int _rtl8821ae_rate_mapping(struct ieee80211_hw *hw, int rate_idx; if (false == isht) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) if (IEEE80211_BAND_2GHZ == hw->conf.chandef.chan->band) { -#else - if (IEEE80211_BAND_2GHZ == hw->conf.channel->band) { -#endif switch (desc_rate) { case DESC_RATE1M: rate_idx = 0; @@ -579,13 +575,8 @@ bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw, if (status->wake_match) RT_TRACE(COMP_RXDESC,DBG_LOUD, ("GGGGGGGGGGGGGet Wakeup Packet!! WakeMatch=%d\n",status->wake_match )); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) rx_status->freq = hw->conf.chandef.chan->center_freq; rx_status->band = hw->conf.chandef.chan->band; -#else - rx_status->freq = hw->conf.channel->center_freq; - rx_status->band = hw->conf.channel->band; -#endif hdr = (struct ieee80211_hdr *)(skb->data + status->rx_drvinfo_size + status->rx_bufshift); @@ -650,33 +641,17 @@ bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw, return true; } -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) -void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, u8 *txbd, - struct ieee80211_tx_info *info, struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) -#else -/*<delete in kernel end>*/ void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, u8 *pdesc_tx, u8 *txbd, struct ieee80211_tx_info *info, struct ieee80211_sta *sta, struct sk_buff *skb, u8 hw_queue, struct rtl_tcb_desc *ptcb_desc) -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ { struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); struct rtl_hal *rtlhal = rtl_hal(rtlpriv); -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - struct ieee80211_sta *sta = info->control.sta; -#endif -/*<delete in kernel end>*/ u8 *pdesc = (u8 *) pdesc_tx; u16 seq_number; u16 fc = le16_to_cpu(hdr->frame_control); @@ -783,9 +758,6 @@ void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, } if (info->control.hw_key) { struct ieee80211_key_conf *keyconf = info->control.hw_key; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -/*<delete in kernel end>*/ switch (keyconf->cipher) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: @@ -800,23 +772,6 @@ void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, break; } -/*<delete in kernel start>*/ -#else - switch (keyconf->alg) { - case ALG_WEP: - case ALG_TKIP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x1); - break; - case ALG_CCMP: - SET_TX_DESC_SEC_TYPE(pdesc, 0x3); - break; - default: - SET_TX_DESC_SEC_TYPE(pdesc, 0x0); - break; - - } -#endif -/*<delete in kernel end>*/ } SET_TX_DESC_QUEUE_SEL(pdesc, fw_qsel); diff --git a/drivers/staging/rtl8821ae/rtl8821ae/trx.h b/drivers/staging/rtl8821ae/rtl8821ae/trx.h index da93e5c7ece..af017844d82 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/trx.h +++ b/drivers/staging/rtl8821ae/rtl8821ae/trx.h @@ -609,23 +609,12 @@ struct rx_desc_8821ae { } __packed; -/*<delete in kernel start>*/ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) -void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, - struct ieee80211_hdr *hdr, u8 *pdesc_tx, u8 *txbd, - struct ieee80211_tx_info *info, struct sk_buff *skb, - u8 hw_queue, struct rtl_tcb_desc *ptcb_desc); -#else -/*<delete in kernel end>*/ void rtl8821ae_tx_fill_desc(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr, u8 *pdesc_tx, u8 *txbd, struct ieee80211_tx_info *info, struct ieee80211_sta *sta, struct sk_buff *skb, u8 hw_queue, struct rtl_tcb_desc *ptcb_desc); -/*<delete in kernel start>*/ -#endif -/*<delete in kernel end>*/ bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *status, struct ieee80211_rx_status *rx_status, diff --git a/drivers/staging/rtl8821ae/stats.c b/drivers/staging/rtl8821ae/stats.c index a20c0f8f65e..4d383d11574 100644 --- a/drivers/staging/rtl8821ae/stats.c +++ b/drivers/staging/rtl8821ae/stats.c @@ -28,9 +28,7 @@ *****************************************************************************/ #include "wifi.h" #include "stats.h" -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) #include <linux/export.h> -#endif u8 rtl_query_rxpwrpercentage(char antpower) { diff --git a/drivers/staging/rtl8821ae/wifi.h b/drivers/staging/rtl8821ae/wifi.h index 17a9d9f8781..e8250dad613 100644 --- a/drivers/staging/rtl8821ae/wifi.h +++ b/drivers/staging/rtl8821ae/wifi.h @@ -1086,8 +1086,8 @@ struct rtl_io { struct device *dev; /*PCI MEM map */ - unsigned long pci_mem_end; /*shared mem end */ - unsigned long pci_mem_start; /*shared mem start */ + void __iomem *pci_mem_end; /*shared mem end */ + void __iomem *pci_mem_start; /*shared mem start */ /*PCI IO map */ unsigned long pci_base_addr; /*device I/O address */ |
