diff options
Diffstat (limited to 'drivers/staging/rtl8821ae')
40 files changed, 1030 insertions, 1971 deletions
diff --git a/drivers/staging/rtl8821ae/base.c b/drivers/staging/rtl8821ae/base.c index 18c936fbdf1..4a36da06c01 100644 --- a/drivers/staging/rtl8821ae/base.c +++ b/drivers/staging/rtl8821ae/base.c @@ -39,10 +39,10 @@ #include "pci.h" /* - *NOTICE!!!: This file will be very big, we hsould - *keep it clear under follwing roles: + *NOTICE!!!: This file will be very big, we should + *keep it clear under following roles: * - *This file include follwing part, so, if you add new + *This file include following part, so, if you add new *functions into this file, please check which part it *should includes. or check if you should add new part *for this file: @@ -64,73 +64,73 @@ * *********************************************************/ static struct ieee80211_channel rtl_channeltable_2g[] = { - {.center_freq = 2412,.hw_value = 1,}, - {.center_freq = 2417,.hw_value = 2,}, - {.center_freq = 2422,.hw_value = 3,}, - {.center_freq = 2427,.hw_value = 4,}, - {.center_freq = 2432,.hw_value = 5,}, - {.center_freq = 2437,.hw_value = 6,}, - {.center_freq = 2442,.hw_value = 7,}, - {.center_freq = 2447,.hw_value = 8,}, - {.center_freq = 2452,.hw_value = 9,}, - {.center_freq = 2457,.hw_value = 10,}, - {.center_freq = 2462,.hw_value = 11,}, - {.center_freq = 2467,.hw_value = 12,}, - {.center_freq = 2472,.hw_value = 13,}, - {.center_freq = 2484,.hw_value = 14,}, + {.center_freq = 2412, .hw_value = 1,}, + {.center_freq = 2417, .hw_value = 2,}, + {.center_freq = 2422, .hw_value = 3,}, + {.center_freq = 2427, .hw_value = 4,}, + {.center_freq = 2432, .hw_value = 5,}, + {.center_freq = 2437, .hw_value = 6,}, + {.center_freq = 2442, .hw_value = 7,}, + {.center_freq = 2447, .hw_value = 8,}, + {.center_freq = 2452, .hw_value = 9,}, + {.center_freq = 2457, .hw_value = 10,}, + {.center_freq = 2462, .hw_value = 11,}, + {.center_freq = 2467, .hw_value = 12,}, + {.center_freq = 2472, .hw_value = 13,}, + {.center_freq = 2484, .hw_value = 14,}, }; static struct ieee80211_channel rtl_channeltable_5g[] = { - {.center_freq = 5180,.hw_value = 36,}, - {.center_freq = 5200,.hw_value = 40,}, - {.center_freq = 5220,.hw_value = 44,}, - {.center_freq = 5240,.hw_value = 48,}, - {.center_freq = 5260,.hw_value = 52,}, - {.center_freq = 5280,.hw_value = 56,}, - {.center_freq = 5300,.hw_value = 60,}, - {.center_freq = 5320,.hw_value = 64,}, - {.center_freq = 5500,.hw_value = 100,}, - {.center_freq = 5520,.hw_value = 104,}, - {.center_freq = 5540,.hw_value = 108,}, - {.center_freq = 5560,.hw_value = 112,}, - {.center_freq = 5580,.hw_value = 116,}, - {.center_freq = 5600,.hw_value = 120,}, - {.center_freq = 5620,.hw_value = 124,}, - {.center_freq = 5640,.hw_value = 128,}, - {.center_freq = 5660,.hw_value = 132,}, - {.center_freq = 5680,.hw_value = 136,}, - {.center_freq = 5700,.hw_value = 140,}, - {.center_freq = 5745,.hw_value = 149,}, - {.center_freq = 5765,.hw_value = 153,}, - {.center_freq = 5785,.hw_value = 157,}, - {.center_freq = 5805,.hw_value = 161,}, - {.center_freq = 5825,.hw_value = 165,}, + {.center_freq = 5180, .hw_value = 36,}, + {.center_freq = 5200, .hw_value = 40,}, + {.center_freq = 5220, .hw_value = 44,}, + {.center_freq = 5240, .hw_value = 48,}, + {.center_freq = 5260, .hw_value = 52,}, + {.center_freq = 5280, .hw_value = 56,}, + {.center_freq = 5300, .hw_value = 60,}, + {.center_freq = 5320, .hw_value = 64,}, + {.center_freq = 5500, .hw_value = 100,}, + {.center_freq = 5520, .hw_value = 104,}, + {.center_freq = 5540, .hw_value = 108,}, + {.center_freq = 5560, .hw_value = 112,}, + {.center_freq = 5580, .hw_value = 116,}, + {.center_freq = 5600, .hw_value = 120,}, + {.center_freq = 5620, .hw_value = 124,}, + {.center_freq = 5640, .hw_value = 128,}, + {.center_freq = 5660, .hw_value = 132,}, + {.center_freq = 5680, .hw_value = 136,}, + {.center_freq = 5700, .hw_value = 140,}, + {.center_freq = 5745, .hw_value = 149,}, + {.center_freq = 5765, .hw_value = 153,}, + {.center_freq = 5785, .hw_value = 157,}, + {.center_freq = 5805, .hw_value = 161,}, + {.center_freq = 5825, .hw_value = 165,}, }; static struct ieee80211_rate rtl_ratetable_2g[] = { - {.bitrate = 10,.hw_value = 0x00,}, - {.bitrate = 20,.hw_value = 0x01,}, - {.bitrate = 55,.hw_value = 0x02,}, - {.bitrate = 110,.hw_value = 0x03,}, - {.bitrate = 60,.hw_value = 0x04,}, - {.bitrate = 90,.hw_value = 0x05,}, - {.bitrate = 120,.hw_value = 0x06,}, - {.bitrate = 180,.hw_value = 0x07,}, - {.bitrate = 240,.hw_value = 0x08,}, - {.bitrate = 360,.hw_value = 0x09,}, - {.bitrate = 480,.hw_value = 0x0a,}, - {.bitrate = 540,.hw_value = 0x0b,}, + {.bitrate = 10, .hw_value = 0x00,}, + {.bitrate = 20, .hw_value = 0x01,}, + {.bitrate = 55, .hw_value = 0x02,}, + {.bitrate = 110, .hw_value = 0x03,}, + {.bitrate = 60, .hw_value = 0x04,}, + {.bitrate = 90, .hw_value = 0x05,}, + {.bitrate = 120, .hw_value = 0x06,}, + {.bitrate = 180, .hw_value = 0x07,}, + {.bitrate = 240, .hw_value = 0x08,}, + {.bitrate = 360, .hw_value = 0x09,}, + {.bitrate = 480, .hw_value = 0x0a,}, + {.bitrate = 540, .hw_value = 0x0b,}, }; static struct ieee80211_rate rtl_ratetable_5g[] = { - {.bitrate = 60,.hw_value = 0x04,}, - {.bitrate = 90,.hw_value = 0x05,}, - {.bitrate = 120,.hw_value = 0x06,}, - {.bitrate = 180,.hw_value = 0x07,}, - {.bitrate = 240,.hw_value = 0x08,}, - {.bitrate = 360,.hw_value = 0x09,}, - {.bitrate = 480,.hw_value = 0x0a,}, - {.bitrate = 540,.hw_value = 0x0b,}, + {.bitrate = 60, .hw_value = 0x04,}, + {.bitrate = 90, .hw_value = 0x05,}, + {.bitrate = 120, .hw_value = 0x06,}, + {.bitrate = 180, .hw_value = 0x07,}, + {.bitrate = 240, .hw_value = 0x08,}, + {.bitrate = 360, .hw_value = 0x09,}, + {.bitrate = 480, .hw_value = 0x0a,}, + {.bitrate = 540, .hw_value = 0x0b,}, }; static const struct ieee80211_supported_band rtl_band_2ghz = { @@ -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 | @@ -332,11 +329,9 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw) /* swlps or hwlps has been set in diff chip in init_sw_vars */ if (rtlpriv->psc.b_swctrl_lps) hw->flags |= IEEE80211_HW_SUPPORTS_PS | - IEEE80211_HW_PS_NULLFUNC_STACK | - /* IEEE80211_HW_SUPPORTS_DYNAMIC_PS | */ + 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 @@ -662,30 +643,27 @@ static void _rtl_txrate_selectmode(struct ieee80211_hw *hw, if (rtlpriv->dm.b_useramask) { tcb_desc->ratr_index = ratr_index; - /* TODO we will differentiate adhoc and station futrue */ + /* TODO we will differentiate adhoc and station future */ if (mac->opmode == NL80211_IFTYPE_STATION || mac->opmode == NL80211_IFTYPE_MESH_POINT) { tcb_desc->mac_id = 0; - - if (mac->mode == WIRELESS_MODE_N_24G) { + if (mac->mode == WIRELESS_MODE_N_24G) tcb_desc->ratr_index = RATR_INX_WIRELESS_NGB; - } else if (mac->mode == WIRELESS_MODE_N_5G) { + else if (mac->mode == WIRELESS_MODE_N_5G) tcb_desc->ratr_index = RATR_INX_WIRELESS_NG; - } else if (mac->mode & WIRELESS_MODE_G) { + else if (mac->mode & WIRELESS_MODE_G) tcb_desc->ratr_index = RATR_INX_WIRELESS_GB; - } else if (mac->mode & WIRELESS_MODE_B) { + else if (mac->mode & WIRELESS_MODE_B) tcb_desc->ratr_index = RATR_INX_WIRELESS_B; - } else if (mac->mode & WIRELESS_MODE_A) { + else if (mac->mode & WIRELESS_MODE_A) tcb_desc->ratr_index = RATR_INX_WIRELESS_G; - } } else if (mac->opmode == NL80211_IFTYPE_AP || mac->opmode == NL80211_IFTYPE_ADHOC) { if (NULL != sta) { - if (sta->aid > 0) { + if (sta->aid > 0) tcb_desc->mac_id = sta->aid + 1; - } else { + else tcb_desc->mac_id = 1; - } } else { tcb_desc->mac_id = 0; } @@ -711,7 +689,7 @@ static void _rtl_query_bandwidth_mode(struct ieee80211_hw *hw, return; } else if (mac->opmode == NL80211_IFTYPE_STATION) { if (!mac->bw_40 || !(sta->ht_cap.ht_supported)) - return; + return; } if (tcb_desc->b_multicast || tcb_desc->b_broadcast) return; @@ -730,7 +708,7 @@ static u8 _rtl_get_highest_n_rate(struct ieee80211_hw *hw, struct rtl_phy *rtlphy = &(rtlpriv->phy); u8 hw_rate; - if ((get_rf_type(rtlphy) == RF_2T2R) && (sta->ht_cap.mcs.rx_mask[1]!=0)) + if ((get_rf_type(rtlphy) == RF_2T2R) && (sta->ht_cap.mcs.rx_mask[1] != 0)) hw_rate = rtlpriv->cfg->maps[RTL_RC_HT_RATEMCS15]; else hw_rate = rtlpriv->cfg->maps[RTL_RC_HT_RATEMCS7]; @@ -772,16 +750,16 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw, tcb_desc->disable_ratefallback = 1; } else { /* - *because hw will nerver use hw_rate + *because hw will never use hw_rate *when tcb_desc->use_driver_rate = false *so we never set highest N rate here, - *and N rate will all be controled by FW + *and N rate will all be controlled by FW *when tcb_desc->use_driver_rate = false */ if (sta && (sta->ht_cap.ht_supported)) { tcb_desc->hw_rate = _rtl_get_highest_n_rate(hw, sta); } else { - if(rtlmac->mode == WIRELESS_MODE_B) { + if (rtlmac->mode == WIRELESS_MODE_B) { tcb_desc->hw_rate = rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M]; } else { @@ -809,7 +787,7 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw, tcb_desc->b_packet_bw = false; } } -//EXPORT_SYMBOL(rtl_get_tcb_desc); +/* EXPORT_SYMBOL(rtl_get_tcb_desc); */ bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb) { @@ -862,8 +840,8 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) RT_TRACE((COMP_SEND | COMP_RECV), DBG_DMESG, ("%s ACT_ADDBAREQ From :%pM\n", is_tx ? "Tx" : "Rx", hdr->addr2)); - RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("req \n"), - skb->data, skb->len); + RT_PRINT_DATA(rtlpriv, COMP_INIT, DBG_DMESG, ("req\n"), + skb->data, skb->len); if (!is_tx) { struct ieee80211_sta *sta = NULL; struct rtl_sta_info *sta_entry = NULL; @@ -897,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; @@ -1184,7 +1157,7 @@ void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb) if (ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid)) return; - rtlpriv->link_info.bcn_rx_inperiod ++; + rtlpriv->link_info.bcn_rx_inperiod++; } void rtl_watchdog_wq_callback(void *data) @@ -1363,7 +1336,7 @@ void rtl_easy_concurrent_retrytimer_callback(unsigned long data) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *buddy_priv = rtlpriv->buddy_priv; - if(buddy_priv == NULL) + if (buddy_priv == NULL) return; rtlpriv->cfg->ops->dualmac_easy_concurrent(hw); @@ -1478,28 +1451,15 @@ 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; err_free: return 0; } -//EXPORT_SYMBOL(rtl_send_smps_action); +/* EXPORT_SYMBOL(rtl_send_smps_action); */ /* because mac80211 have issues when can receive del ba * so here we just make a fake del_ba if we receive a ba_req @@ -1528,8 +1488,8 @@ struct sk_buff *rtl_make_del_ba(struct ieee80211_hw *hw, IEEE80211_STYPE_ACTION); action_frame->u.action.category = WLAN_CATEGORY_BACK; action_frame->u.action.u.delba.action_code = WLAN_ACTION_DELBA; - params = (u16)(1 << 11); /* bit 11 initiator */ - params |= (u16)(tid << 12); /* bit 15:12 TID number */ + params = (u16)(1 << 11); /* bit 11 initiator */ + params |= (u16)(tid << 12); /* bit 15:12 TID number */ action_frame->u.action.u.delba.params = cpu_to_le16(params); action_frame->u.action.u.delba.reason_code = @@ -1652,9 +1612,8 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len) if (ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid)) return; - if (rtl_find_221_ie(hw, data, len)) { + if (rtl_find_221_ie(hw, data, len)) vendor = mac->vendor; - } if ((memcmp(mac->bssid, ap5_1, 3) == 0) || (memcmp(mac->bssid, ap5_2, 3) == 0) || @@ -1671,7 +1630,7 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len) (memcmp(mac->bssid, ap4_2, 3) == 0) || (memcmp(mac->bssid, ap4_3, 3) == 0) || vendor == PEER_RAL) { - RT_TRACE(COMP_MAC80211, DBG_LOUD, ("=>ral findn\n")); + RT_TRACE(COMP_MAC80211, DBG_LOUD, ("=>ral find\n")); vendor = PEER_RAL; } else if (memcmp(mac->bssid, ap6_1, 3) == 0 || vendor == PEER_CISCO) { @@ -1715,7 +1674,7 @@ static ssize_t rtl_store_debug_level(struct device *d, unsigned long val; int ret; - ret = strict_strtoul(buf, 0, &val); + ret = kstrtoul(buf, 0, &val); if (ret) { printk(KERN_DEBUG "%s is not in hex or decimal form.\n", buf); } else { @@ -1845,8 +1804,7 @@ struct rtl_global_var global_var = {}; int rtl_core_module_init(void) { if (rtl_rate_control_register()) - printk(KERN_DEBUG "rtl: Unable to register rtl_rc," - "use default RC !!\n"); + printk(KERN_DEBUG "rtl: Unable to register rtl_rc, use default RC !!\n"); /* add proc for debug */ rtl_proc_add_topdir(); @@ -1861,7 +1819,7 @@ int rtl_core_module_init(void) void rtl_core_module_exit(void) { /*RC*/ - rtl_rate_control_unregister(); + rtl_rate_control_unregister(); /* add proc for debug */ rtl_proc_remove_topdir(); diff --git a/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c b/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c index b30f17ae021..5a54bb10698 100644 --- a/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c +++ b/drivers/staging/rtl8821ae/btcoexist/HalBtc8812a1Ant.c @@ -1653,7 +1653,7 @@ halbtc8812a1ant_TdmaDurationAdjustForAcl( } else { - //accquire the BT TRx retry count from BT_Info byte2 + //acquire the BT TRx retry count from BT_Info byte2 retry_count = coex_sta->bt_retry_cnt; bt_info_ext = coex_sta->bt_info_ext; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retry_count = %d\n", retry_count)); diff --git a/drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.c b/drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.c index e619923ef0a..8e4293a3587 100644 --- a/drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.c +++ b/drivers/staging/rtl8821ae/btcoexist/habtc8723a1ant.c @@ -629,7 +629,7 @@ halbtc8723a1ant_TdmaDurationAdjust( } else { - //accquire the BT TRx retry count from BT_Info byte2 + //acquire the BT TRx retry count from BT_Info byte2 retryCount = pCoexSta->btRetryCnt; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], retryCount = %d\n", retryCount)); result = 0; diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.c index 973d0ea82cb..1b04530d46b 100644 --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.c +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e1ant.c @@ -1721,7 +1721,7 @@ halbtc8192e1ant_TdmaDurationAdjustForAcl( } else { - //accquire the BT TRx retry count from BT_Info byte2 + //acquire the BT TRx retry count from BT_Info byte2 retryCount = pCoexSta->btRetryCnt; btInfoExt = pCoexSta->btInfoExt; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retryCount = %d\n", retryCount)); diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c index 44ec78562e2..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,11 +1688,11 @@ 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 { - /* accquire the BT TRx retry count from BT_Info byte2 */ + /* acquire the BT TRx retry count from BT_Info byte2 */ retry_cnt = coex_sta->bt_retry_cnt; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, "[BTCoex], retry_cnt = %d\n", retry_cnt); @@ -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/halbtc8723a2ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8723a2ant.c index 180d6f12e7b..3f5c4fd2e73 100644 --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8723a2ant.c +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8723a2ant.c @@ -1687,7 +1687,7 @@ halbtc8723a2ant_TdmaDurationAdjust( } else { - //accquire the BT TRx retry count from BT_Info byte2 + //acquire the BT TRx retry count from BT_Info byte2 retryCount = pCoexSta->btRetryCnt; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retryCount = %d\n", retryCount)); BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], up=%d, dn=%d, m=%d, n=%d, WaitCount=%d\n", diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8723b1ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8723b1ant.c index 3414ba78cc4..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, @@ -1950,7 +1749,7 @@ void halbtc8723b1ant_tdma_duration_adjust_for_acl(struct btc_coexist *btcoexist, result = 0; wait_count = 0; } else { - /*accquire the BT TRx retry count from BT_Info byte2 */ + /*acquire the BT TRx retry count from BT_Info byte2 */ retry_count = coex_sta->bt_retry_cnt; bt_info_ext = coex_sta->bt_info_ext; result = 0; @@ -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 83b1b421833..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) { @@ -1830,7 +1845,7 @@ void halbtc8723b2ant_tdma_duration_adjust(struct btc_coexist *btcoexist, result = 0; wait_count = 0; } else { - /*accquire the BT TRx retry count from BT_Info byte2*/ + /*acquire the BT TRx retry count from BT_Info byte2*/ retryCount = coex_sta->bt_retry_cnt; BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, "[BTCoex], retryCount = %d\n", retryCount); @@ -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 9d9fa4d7575..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,8 +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) +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; @@ -620,25 +615,7 @@ void halbtc_set_macreg(void *bt_context, u32 reg_addr, u32 bit_mask, u32 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) -{ - 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_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 *****************************************************************/ @@ -732,17 +691,7 @@ bool exhalbtc_initlize_variables(struct rtl_priv *adapter) else btcoexist->binded = true; -#if ( defined(CONFIG_PCI_HCI)) - btcoexist->chip_interface = BTC_INTF_PCI; -#elif ( defined(CONFIG_USB_HCI)) - btcoexist->chip_interface = BTC_INTF_USB; -#elif ( defined(CONFIG_SDIO_HCI)) - btcoexist->chip_interface = BTC_INTF_SDIO; -#elif ( defined(CONFIG_GSPI_HCI)) - btcoexist->chip_interface = BTC_INTF_GSPI; -#else btcoexist->chip_interface = BTC_INTF_UNKNOWN; -#endif if (NULL == btcoexist->adapter) btcoexist->adapter = adapter; @@ -1087,7 +1036,7 @@ void exhalbtc_dbg_control(struct btc_coexist *btcoexist, btcoexist->statistics.cnt_dbg_ctrl++; } -void exhalbtc_stack_update_profile_info() +void exhalbtc_stack_update_profile_info(void) { } 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 40de6089039..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); @@ -373,7 +309,7 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed) /* sleep here is must, or we may recv the beacon and * cause mac80211 into wrong ps state, this will cause * power save nullfunc send fail, and further cause - * pkt loss, So sleep must quickly but not immediatly + * pkt loss, So sleep must quickly but not immediately * because that will cause nullfunc send by mac80211 * fail, and cause pkt loss, we have tested that 5mA * is worked very well */ @@ -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; @@ -1200,8 +1101,8 @@ static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, key_type = AESCMAC_ENCRYPTION; RT_TRACE(COMP_SEC, DBG_DMESG, ("alg:CMAC\n")); RT_TRACE(COMP_SEC, DBG_DMESG, - ("HW don't support CMAC encrypiton, " - "use software CMAC encrypiton\n")); + ("HW don't support CMAC encryption, " + "use software CMAC encryption\n")); err = -EOPNOTSUPP; goto out_unlock; default: @@ -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 encrypiton, " - "use software CMAC encrypiton\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) @@ -1411,26 +1275,18 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw) } /* this function is called by mac80211 to flush tx buffer - * before switch channle or power save, or tx buffer packet + * 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/core.h b/drivers/staging/rtl8821ae/core.h index 4b247db2861..f0c74e9239f 100644 --- a/drivers/staging/rtl8821ae/core.h +++ b/drivers/staging/rtl8821ae/core.h @@ -2,20 +2,20 @@ * * Copyright(c) 2009-2010 Realtek Corporation. * - * Tmis program is free software; you can redistribute it and/or modify it + * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * - * Tmis program is distributed in the hope that it will be useful, but WITHOUT + * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with - * tmis program; if not, write to the Free Software Foundation, Inc., + * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * Tme full GNU General Public License is included in this distribution in the + * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: diff --git a/drivers/staging/rtl8821ae/debug.c b/drivers/staging/rtl8821ae/debug.c index cb051223c68..8aefbf10a45 100644 --- a/drivers/staging/rtl8821ae/debug.c +++ b/drivers/staging/rtl8821ae/debug.c @@ -2,20 +2,20 @@ * * Copyright(c) 2009-2010 Realtek Corporation. * - * Tmis program is free software; you can redistribute it and/or modify it + * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * - * Tmis program is distributed in the hope that it will be useful, but WITHOUT + * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with - * tmis program; if not, write to the Free Software Foundation, Inc., + * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * Tme full GNU General Public License is included in this distribution in the + * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: @@ -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) { @@ -985,4 +980,4 @@ void rtl_proc_remove_topdir(void) { if (proc_topdir) remove_proc_entry("rtlwifi", init_net.proc_net); -}
\ No newline at end of file +} diff --git a/drivers/staging/rtl8821ae/debug.h b/drivers/staging/rtl8821ae/debug.h index 5eb6251b89d..6c0a553e98b 100644 --- a/drivers/staging/rtl8821ae/debug.h +++ b/drivers/staging/rtl8821ae/debug.h @@ -2,20 +2,20 @@ * * Copyright(c) 2009-2010 Realtek Corporation. * - * Tmis program is free software; you can redistribute it and/or modify it + * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * - * Tmis program is distributed in the hope that it will be useful, but WITHOUT + * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with - * tmis program; if not, write to the Free Software Foundation, Inc., + * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * Tme full GNU General Public License is included in this distribution in the + * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: @@ -44,7 +44,7 @@ #define DBG_EMERG 0 /* - *Abnormal, rare, or unexpeted cases. + *Abnormal, rare, or unexpected cases. *For example, Packet/IO Ctl canceled, *device suprisely unremoved and so on. */ @@ -54,7 +54,7 @@ *Normal case driver developer should *open, we can see link status like *assoc/AddBA/DHCP/adapter start and - *so on basic and useful infromations. + *so on basic and useful informations. */ #define DBG_DMESG 3 diff --git a/drivers/staging/rtl8821ae/efuse.c b/drivers/staging/rtl8821ae/efuse.c index 74c19ecc95a..206012cf360 100644 --- a/drivers/staging/rtl8821ae/efuse.c +++ b/drivers/staging/rtl8821ae/efuse.c @@ -2,20 +2,20 @@ * * Copyright(c) 2009-2010 Realtek Corporation. * - * Tmis program is free software; you can redistribute it and/or modify it + * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * - * Tmis program is distributed in the hope that it will be useful, but WITHOUT + * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with - * tmis program; if not, write to the Free Software Foundation, Inc., + * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * - * Tme full GNU General Public License is included in this distribution in the + * The full GNU General Public License is included in this distribution in the * file called LICENSE. * * Contact Information: @@ -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; @@ -149,7 +147,7 @@ u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address) return 0xFF; } -//EXPORT_SYMBOL(efuse_read_1byte); +/* EXPORT_SYMBOL(efuse_read_1byte); */ void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value) { @@ -517,7 +515,7 @@ void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw) rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE]); } -//EXPORT_SYMBOL(rtl_efuse_shadow_map_update); +/* EXPORT_SYMBOL(rtl_efuse_shadow_map_update); */ void efuse_force_write_vendor_Id(struct ieee80211_hw *hw) { @@ -628,7 +626,7 @@ int efuse_one_byte_read(struct ieee80211_hw *hw, u16 addr, u8 *data) } return bresult; } -//EXPORT_SYMBOL(efuse_one_byte_read); +/* EXPORT_SYMBOL(efuse_one_byte_read); */ static int efuse_one_byte_write(struct ieee80211_hw *hw, u16 addr, u8 data) { @@ -1120,16 +1118,16 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 bwrite, u8 pwrstate) { rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_ACCESS], 0x69); - // 1.2V Power: From VDDON with Power Cut(0x0000h[15]), defualt valid + /* 1.2V Power: From VDDON with Power Cut(0x0000h[15]), default valid */ tmpV16 = rtl_read_word(rtlpriv, rtlpriv->cfg->maps[SYS_ISO_CTRL]); printk("SYS_ISO_CTRL=%04x.\n",tmpV16); if( ! (tmpV16 & PWC_EV12V ) ){ tmpV16 |= PWC_EV12V ; - //PlatformEFIOWrite2Byte(pAdapter,REG_SYS_ISO_CTRL,tmpV16); + /* PlatformEFIOWrite2Byte(pAdapter,REG_SYS_ISO_CTRL,tmpV16); */ } - // Reset: 0x0000h[28], default valid + /* Reset: 0x0000h[28], default valid */ tmpV16 = rtl_read_word(rtlpriv, rtlpriv->cfg->maps[SYS_FUNC_EN]); printk("SYS_FUNC_EN=%04x.\n",tmpV16); if( !(tmpV16 & FEN_ELDR) ){ @@ -1137,7 +1135,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 bwrite, u8 pwrstate) rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[SYS_FUNC_EN], tmpV16); } - // Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock from ANA, default valid + /* Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock from ANA, default valid */ tmpV16 = rtl_read_word(rtlpriv, rtlpriv->cfg->maps[SYS_CLK] ); printk("SYS_CLK=%04x.\n",tmpV16); if( (!(tmpV16 & LOADER_CLK_EN) ) ||(!(tmpV16 & ANA8M) ) ) @@ -1148,7 +1146,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 bwrite, u8 pwrstate) if(bwrite == true) { - // Enable LDO 2.5V before read/write action + /* Enable LDO 2.5V before read/write action */ tempval = rtl_read_word(rtlpriv, rtlpriv->cfg->maps[EFUSE_TEST] + 3); printk("EFUSE_TEST=%04x.\n",tmpV16); tempval &= ~(BIT(3) | BIT(4) |BIT(5) | BIT(6)); @@ -1161,7 +1159,7 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 bwrite, u8 pwrstate) { rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_ACCESS], 0x00); if(bwrite == true){ - // Disable LDO 2.5V after read/write action + /* Disable LDO 2.5V after read/write action */ tempval = rtl_read_word(rtlpriv, rtlpriv->cfg->maps[EFUSE_TEST] + 3); rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[EFUSE_TEST] + 3, (tempval & 0x7F)); } diff --git a/drivers/staging/rtl8821ae/pci.c b/drivers/staging/rtl8821ae/pci.c index cfa651edd23..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) { @@ -418,7 +375,7 @@ bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw, list_for_each_entry(temp_priv, &rtlpriv->glb_var->glb_priv_list, list) { if (temp_priv) { - temp_pcipriv = + temp_pcipriv = (struct rtl_pci_priv *)temp_priv->priv; RT_TRACE(COMP_INIT, DBG_LOUD, (("pcipriv->ndis_adapter.funcnumber %x \n"), @@ -526,8 +483,8 @@ static void _rtl_pci_io_handler_init(struct device *dev, } static bool _rtl_pci_update_earlymode_info(struct ieee80211_hw *hw, - struct sk_buff *skb, - struct rtl_tcb_desc *tcb_desc, + struct sk_buff *skb, + struct rtl_tcb_desc *tcb_desc, u8 tid) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -535,7 +492,7 @@ static bool _rtl_pci_update_earlymode_info(struct ieee80211_hw *hw, struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); u8 additionlen = FCS_LEN; struct sk_buff *next_skb; - + /* here open is 4, wep/tkip is 8, aes is 12*/ if (info->control.hw_key) additionlen += info->control.hw_key->icv_len; @@ -544,7 +501,7 @@ static bool _rtl_pci_update_earlymode_info(struct ieee80211_hw *hw, tcb_desc->empkt_num = 0; spin_lock_bh(&rtlpriv->locks.waitq_lock); skb_queue_walk(&rtlpriv->mac80211.skb_waitq[tid], next_skb) { - struct ieee80211_tx_info *next_info = + struct ieee80211_tx_info *next_info = IEEE80211_SKB_CB(next_skb); if (next_info->flags & IEEE80211_TX_CTL_AMPDU) { tcb_desc->empkt_len[tcb_desc->empkt_num] = @@ -554,7 +511,7 @@ static bool _rtl_pci_update_earlymode_info(struct ieee80211_hw *hw, break; } - if (skb_queue_is_last(&rtlpriv->mac80211.skb_waitq[tid], + if (skb_queue_is_last(&rtlpriv->mac80211.skb_waitq[tid], next_skb)) break; @@ -575,26 +532,26 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw) struct sk_buff *skb = NULL; struct ieee80211_tx_info *info = NULL; int tid; /* should be int */ - + if (!rtlpriv->rtlhal.b_earlymode_enable) - return; + return; if (rtlpriv->dm.supp_phymode_switch && (rtlpriv->easy_concurrent_ctl.bswitch_in_process || - (rtlpriv->buddy_priv && + (rtlpriv->buddy_priv && rtlpriv->buddy_priv->easy_concurrent_ctl.bswitch_in_process))) return; - /* we juse use em for BE/BK/VI/VO */ + /* we just use em for BE/BK/VI/VO */ for (tid = 7; tid >= 0; tid--) { u8 hw_queue = ac_to_hwq[rtl_tid_to_ac(hw, tid)]; struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; - while (!mac->act_scanning && + while (!mac->act_scanning && rtlpriv->psc.rfpwr_state == ERFON) { struct rtl_tcb_desc tcb_desc; - memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); + memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); spin_lock_bh(&rtlpriv->locks.waitq_lock); if (!skb_queue_empty(&mac->skb_waitq[tid]) && - (ring->entries - skb_queue_len(&ring->queue) > + (ring->entries - skb_queue_len(&ring->queue) > rtlhal->max_earlymode_num)) { skb = skb_dequeue(&mac->skb_waitq[tid]); } else { @@ -607,17 +564,10 @@ static void _rtl_pci_tx_chk_waitq(struct ieee80211_hw *hw) * multicast/broadcast/no_qos data */ info = IEEE80211_SKB_CB(skb); if (info->flags & IEEE80211_TX_CTL_AMPDU) - _rtl_pci_update_earlymode_info(hw, skb, + _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>*/ } } } @@ -635,7 +585,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio) u8 tid; u8 *entry; - + if (rtlpriv->use_new_trx_flow) entry = (u8 *)(&ring->buffer_desc[ring->idx]); else @@ -643,11 +593,11 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio) if (!rtlpriv->cfg->ops->is_tx_desc_closed(hw, prio, ring->idx)) return; - + ring->idx = (ring->idx + 1) % ring->entries; - + skb = __skb_dequeue(&ring->queue); - + pci_unmap_single(rtlpci->pdev, le32_to_cpu(rtlpriv->cfg->ops-> get_desc((u8 *) entry, true, @@ -672,7 +622,7 @@ static void _rtl_pci_tx_isr(struct ieee80211_hw *hw, int prio) } /* for sw LPS, just after NULL skb send out, we can - * sure AP kown we are sleeped, our we should not let + * sure AP known we are slept, our we should not let * rf to sleep*/ fc = rtl_get_fc(skb); if (ieee80211_is_nullfunc(fc)) { @@ -740,7 +690,7 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw, u8 tmp_one = 1; struct sk_buff *skb; - skb = dev_alloc_skb(rtlpci->rxbuffersize); + skb = dev_alloc_skb(rtlpci->rxbuffersize); if (!skb) return 0; rtlpci->rx_ring[rxring_idx].rx_buf[desc_idx] = skb; @@ -754,25 +704,25 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw, if (pci_dma_mapping_error(rtlpci->pdev, bufferaddress)) return 0; if (rtlpriv->use_new_trx_flow) { - rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, + rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, HW_DESC_RX_PREPARE, (u8 *) & bufferaddress); - } else { - rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, + } else { + rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, HW_DESC_RXBUFF_ADDR, (u8 *) & bufferaddress); - rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, + rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, HW_DESC_RXPKT_LEN, (u8 *) & rtlpci->rxbuffersize); - rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, + rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, HW_DESC_RXOWN, (u8 *) & tmp_one); } - + return 1; } -/* inorder to receive 8K AMSDU we have set skb to +/* In order to receive 8K AMSDU we have set skb to * 9100bytes in init rx ring, but if this packet is * not a AMSDU, this so big packet will be sent to * TCP/IP directly, this cause big packet ping fail @@ -783,7 +733,7 @@ static int _rtl_pci_init_one_rxdesc(struct ieee80211_hw *hw, /* but some platform will fail when alloc skb sometimes. * in this condition, we will send the old skb to * mac80211 directly, this will not cause any other - * issues, but only be losted by TCP/IP */ + * issues, but only be lost by TCP/IP */ static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_rx_status rx_status) { @@ -792,7 +742,7 @@ static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw, } else { struct sk_buff *uskb = NULL; u8 *pdata; - + uskb = dev_alloc_skb(skb->len + 128); if (likely(uskb)) { memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, @@ -804,7 +754,7 @@ static void _rtl_pci_rx_to_mac80211(struct ieee80211_hw *hw, ieee80211_rx_irqsafe(hw, uskb); } else { ieee80211_rx_irqsafe(hw, skb); - } + } } } @@ -814,11 +764,11 @@ static void _rtl_pci_hs_interrupt(struct ieee80211_hw *hw) struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[MAC_HSISR], - rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[MAC_HSISR]) | + rtl_write_byte(rtlpriv, rtlpriv->cfg->maps[MAC_HSISR], + rtl_read_byte(rtlpriv, rtlpriv->cfg->maps[MAC_HSISR]) | rtlpci->sys_irq_mask); - + } static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) { @@ -839,7 +789,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) .noise = -98, .rate = 0, }; - + /*RX NORMAL PKT */ while (count--) { struct ieee80211_hdr *hdr; @@ -852,65 +802,65 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) /*rx pkt */ struct sk_buff *skb = rtlpci->rx_ring[rxring_idx].rx_buf[ rtlpci->rx_ring[rxring_idx].idx]; - + if (rtlpriv->use_new_trx_flow) { - rx_remained_cnt = + rx_remained_cnt = rtlpriv->cfg->ops->rx_desc_buff_remained_cnt(hw, hw_queue); - if (rx_remained_cnt < 1) + if (rx_remained_cnt < 1) return; - + } else { /* rx descriptor */ pdesc = &rtlpci->rx_ring[rxring_idx].desc[ rtlpci->rx_ring[rxring_idx].idx]; - + own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, - false, + false, HW_DESC_OWN); if (own) /* wait data to be filled by hardware */ return; } - + /* Get here means: data is filled already*/ /* AAAAAAttention !!! * We can NOT access 'skb' before 'pci_unmap_single' */ pci_unmap_single(rtlpci->pdev, *((dma_addr_t *) skb->cb), rtlpci->rxbuffersize, PCI_DMA_FROMDEVICE); - + if (rtlpriv->use_new_trx_flow) { buffer_desc = &rtlpci->rx_ring[rxring_idx].buffer_desc[ rtlpci->rx_ring[rxring_idx].idx]; /*means rx wifi info*/ pdesc = (struct rtl_rx_desc *)skb->data; } - + rtlpriv->cfg->ops->query_rx_desc(hw, &status, &rx_status, (u8 *) pdesc, skb); - + if (rtlpriv->use_new_trx_flow) - rtlpriv->cfg->ops->rx_check_dma_ok(hw, - (u8 *)buffer_desc, + rtlpriv->cfg->ops->rx_check_dma_ok(hw, + (u8 *)buffer_desc, hw_queue); - - len = rtlpriv->cfg->ops->get_desc((u8 *)pdesc, false, + + len = rtlpriv->cfg->ops->get_desc((u8 *)pdesc, false, HW_DESC_RXPKT_LEN); - + if (skb->end - skb->tail > len) { skb_put(skb, len); - if (rtlpriv->use_new_trx_flow) - skb_reserve(skb, status.rx_drvinfo_size + + if (rtlpriv->use_new_trx_flow) + skb_reserve(skb, status.rx_drvinfo_size + status.rx_bufshift + 24); else - skb_reserve(skb, status.rx_drvinfo_size + + skb_reserve(skb, status.rx_drvinfo_size + status.rx_bufshift); } else { - printk("skb->end - skb->tail = %d, len is %d\n", + printk("skb->end - skb->tail = %d, len is %d\n", skb->end - skb->tail, len); break; } - + rtlpriv->cfg->ops->rx_command_packet_handler(hw, status, skb); /* @@ -922,9 +872,9 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) hdr = rtl_get_hdr(skb); fc = rtl_get_fc(skb); - + if (!status.b_crc && !status.b_hwerror) { - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, + memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); if (is_broadcast_ether_addr(hdr->addr1)) { @@ -947,13 +897,13 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) /* static bcn for roaming */ rtl_beacon_statistic(hw, skb); - rtl_p2p_info(hw, (void*)skb->data, skb->len); + rtl_p2p_info(hw, (void*)skb->data, skb->len); /* for sw lps */ rtl_swlps_beacon(hw, (void*)skb->data, skb->len); rtl_recognize_peer(hw, (void*)skb->data, skb->len); if ((rtlpriv->mac80211.opmode == NL80211_IFTYPE_AP) && (rtlpriv->rtlhal.current_bandtype == BAND_ON_2_4G)&& - (ieee80211_is_beacon(fc) || + (ieee80211_is_beacon(fc) || ieee80211_is_probe_resp(fc))) { dev_kfree_skb_any(skb); } else { @@ -964,13 +914,13 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) } if (rtlpriv->use_new_trx_flow) { rtlpci->rx_ring[hw_queue].next_rx_rp += 1; - rtlpci->rx_ring[hw_queue].next_rx_rp %= + rtlpci->rx_ring[hw_queue].next_rx_rp %= RTL_PCI_MAX_RX_COUNT; rx_remained_cnt--; if (1/*rx_remained_cnt == 0*/) { - rtl_write_word(rtlpriv, 0x3B4, + rtl_write_word(rtlpriv, 0x3B4, rtlpci->rx_ring[hw_queue].next_rx_rp); } } @@ -981,22 +931,22 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) } if (rtlpriv->use_new_trx_flow) { - _rtl_pci_init_one_rxdesc(hw, (u8 *)buffer_desc, + _rtl_pci_init_one_rxdesc(hw, (u8 *)buffer_desc, rxring_idx, - rtlpci->rx_ring[rxring_idx].idx); + rtlpci->rx_ring[rxring_idx].idx); } else { _rtl_pci_init_one_rxdesc(hw, (u8 *)pdesc, rxring_idx, - rtlpci->rx_ring[rxring_idx].idx); + rtlpci->rx_ring[rxring_idx].idx); - if (rtlpci->rx_ring[rxring_idx].idx == + if (rtlpci->rx_ring[rxring_idx].idx == rtlpci->rxringcount - 1) - rtlpriv->cfg->ops->set_desc(hw, (u8 *) pdesc, - false, + rtlpriv->cfg->ops->set_desc(hw, (u8 *) pdesc, + false, HW_DESC_RXERO, (u8 *) & tmp_one); } - rtlpci->rx_ring[rxring_idx].idx = - (rtlpci->rx_ring[rxring_idx].idx + 1) % + rtlpci->rx_ring[rxring_idx].idx = + (rtlpci->rx_ring[rxring_idx].idx + 1) % rtlpci->rxringcount; } } @@ -1011,7 +961,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) u32 inta = 0; u32 intb = 0; - + if (rtlpci->irq_enabled == 0) return IRQ_HANDLED; @@ -1020,7 +970,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[MAC_HIMR], 0x0); - + rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[MAC_HIMRE], 0x0); @@ -1029,7 +979,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) rtlpriv->cfg->ops->interrupt_recognized(hw, &inta, &intb); - /*Shared IRQ or HW disappared */ + /*Shared IRQ or HW disappeared */ if (!inta || inta == 0xffff) goto done; /*<1> beacon related */ @@ -1127,7 +1077,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) /*<4> fw related*/ if (rtlhal->hw_type == HARDWARE_TYPE_RTL8723AE) { if (inta & rtlpriv->cfg->maps[RTL_IMR_C2HCMD]) { - RT_TRACE(COMP_INTR, DBG_TRACE, + RT_TRACE(COMP_INTR, DBG_TRACE, ("firmware interrupt!\n")); queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.fwevt_wq, 0); @@ -1142,12 +1092,12 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) if (rtlhal->hw_type == HARDWARE_TYPE_RTL8188EE || rtlhal->hw_type == HARDWARE_TYPE_RTL8723BE) { if (unlikely(inta & rtlpriv->cfg->maps[RTL_IMR_HSISR_IND])) { - RT_TRACE(COMP_INTR, DBG_TRACE, + RT_TRACE(COMP_INTR, DBG_TRACE, ("hsisr interrupt!\n")); _rtl_pci_hs_interrupt(hw); } } - + if(rtlpriv->rtlhal.b_earlymode_enable) tasklet_schedule(&rtlpriv->works.irq_tasklet); @@ -1157,7 +1107,7 @@ static irqreturn_t _rtl_pci_interrupt(int irq, void *dev_id) rtl_write_dword(rtlpriv, rtlpriv->cfg->maps[MAC_HIMRE], rtlpci->irq_mask[1]); spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); - + return IRQ_HANDLED; done: @@ -1200,20 +1150,10 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) pdesc = &ring->desc[0]; 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, + (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); @@ -1235,7 +1175,7 @@ static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) desc_num = TX_DESC_NUM_92E; else desc_num = RT_TXDESC_NUM; - + for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) { rtlpci->txringcount[i] = desc_num; } @@ -1309,12 +1249,12 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, /* alloc tx buffer desc for new trx flow*/ if (rtlpriv->use_new_trx_flow) { buffer_desc = pci_alloc_consistent(rtlpci->pdev, - sizeof(*buffer_desc) * entries, + sizeof(*buffer_desc) * entries, &buffer_desc_dma); if (!buffer_desc || (unsigned long)buffer_desc & 0xFF) { RT_TRACE(COMP_ERR, DBG_EMERG, - ("Cannot allocate TX ring (prio = %d)\n", + ("Cannot allocate TX ring (prio = %d)\n", prio)); return -ENOMEM; } @@ -1322,13 +1262,13 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, memset(buffer_desc, 0, sizeof(*buffer_desc) * entries); rtlpci->tx_ring[prio].buffer_desc = buffer_desc; rtlpci->tx_ring[prio].buffer_desc_dma = buffer_desc_dma; - + rtlpci->tx_ring[prio].cur_tx_rp = 0; rtlpci->tx_ring[prio].cur_tx_wp = 0; rtlpci->tx_ring[prio].avl_desc = entries; } - + /* alloc dma for this ring */ desc = pci_alloc_consistent(rtlpci->pdev, sizeof(*desc) * entries, &desc_dma); @@ -1342,7 +1282,7 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, memset(desc, 0, sizeof(*desc) * entries); rtlpci->tx_ring[prio].desc = desc; rtlpci->tx_ring[prio].dma = desc_dma; - + rtlpci->tx_ring[prio].idx = 0; rtlpci->tx_ring[prio].entries = entries; skb_queue_head_init(&rtlpci->tx_ring[prio].queue); @@ -1357,7 +1297,7 @@ static int _rtl_pci_init_tx_ring(struct ieee80211_hw *hw, sizeof(*desc)); rtlpriv->cfg->ops->set_desc(hw, (u8 *) & (desc[i]), - true, + true, HW_DESC_TX_NEXTDESC_ADDR, (u8 *) & nextdescaddress); } @@ -1371,15 +1311,15 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx) struct rtl_priv *rtlpriv = rtl_priv(hw); int i; - + if (rtlpriv->use_new_trx_flow) { struct rtl_rx_buffer_desc *entry = NULL; /* alloc dma for this ring */ - rtlpci->rx_ring[rxring_idx].buffer_desc = + rtlpci->rx_ring[rxring_idx].buffer_desc = pci_alloc_consistent(rtlpci->pdev, sizeof(*rtlpci->rx_ring[rxring_idx]. - buffer_desc) * - rtlpci->rxringcount, + buffer_desc) * + rtlpci->rxringcount, &rtlpci->rx_ring[rxring_idx].dma); if (!rtlpci->rx_ring[rxring_idx].buffer_desc || (unsigned long)rtlpci->rx_ring[rxring_idx].buffer_desc & 0xFF) { @@ -1393,9 +1333,9 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx) /* init every desc in this ring */ rtlpci->rx_ring[rxring_idx].idx = 0; - for (i = 0; i < rtlpci->rxringcount; i++) { + for (i = 0; i < rtlpci->rxringcount; i++) { entry = &rtlpci->rx_ring[rxring_idx].buffer_desc[i]; - if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)entry, + if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)entry, rxring_idx, i)) return -ENOMEM; } @@ -1403,14 +1343,14 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx) struct rtl_rx_desc *entry = NULL; u8 tmp_one = 1; /* alloc dma for this ring */ - rtlpci->rx_ring[rxring_idx].desc = + rtlpci->rx_ring[rxring_idx].desc = pci_alloc_consistent(rtlpci->pdev, sizeof(*rtlpci->rx_ring[rxring_idx]. - desc) * rtlpci->rxringcount, + desc) * rtlpci->rxringcount, &rtlpci->rx_ring[rxring_idx].dma); if (!rtlpci->rx_ring[rxring_idx].desc || (unsigned long)rtlpci->rx_ring[rxring_idx].desc & 0xFF) { - RT_TRACE(COMP_ERR, DBG_EMERG, + RT_TRACE(COMP_ERR, DBG_EMERG, ("Cannot allocate RX ring\n")); return -ENOMEM; } @@ -1421,9 +1361,9 @@ static int _rtl_pci_init_rx_ring(struct ieee80211_hw *hw, int rxring_idx) /* init every desc in this ring */ rtlpci->rx_ring[rxring_idx].idx = 0; - for (i = 0; i < rtlpci->rxringcount; i++) { + for (i = 0; i < rtlpci->rxringcount; i++) { entry = &rtlpci->rx_ring[rxring_idx].desc[i]; - if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)entry, + if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)entry, rxring_idx, i)) return -ENOMEM; } @@ -1467,7 +1407,7 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, sizeof(*ring->buffer_desc) * ring->entries, ring->buffer_desc, ring->buffer_desc_dma); ring->buffer_desc = NULL; - } + } } static void _rtl_pci_free_rx_ring(struct ieee80211_hw *hw, int rxring_idx) @@ -1532,7 +1472,7 @@ err_free_rings: _rtl_pci_free_rx_ring(hw, rxring_idx); for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) - if (rtlpci->tx_ring[i].desc || + if (rtlpci->tx_ring[i].desc || rtlpci->tx_ring[i].buffer_desc) _rtl_pci_free_tx_ring(hw, i); @@ -1567,16 +1507,16 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) /* force the rx_ring[RX_MPDU_QUEUE/ * RX_CMD_QUEUE].idx to the first one */ /*new trx flow, do nothing*/ - if ((rtlpriv->use_new_trx_flow == false) && + if ((rtlpriv->use_new_trx_flow == false) && rtlpci->rx_ring[rxring_idx].desc) { struct rtl_rx_desc *entry = NULL; for (i = 0; i < rtlpci->rxringcount; i++) { - entry = &rtlpci->rx_ring[rxring_idx].desc[i]; - rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, + entry = &rtlpci->rx_ring[rxring_idx].desc[i]; + rtlpriv->cfg->ops->set_desc(hw, (u8 *) entry, false, - HW_DESC_RXOWN, - (u8 *) & tmp_one); + HW_DESC_RXOWN, + (u8 *) & tmp_one); } } rtlpci->rx_ring[rxring_idx].idx = 0; } @@ -1585,13 +1525,13 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw) * and force the tx idx to the first one */ spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); for (i = 0; i < RTL_PCI_MAX_TX_QUEUE_COUNT; i++) { - if (rtlpci->tx_ring[i].desc || + if (rtlpci->tx_ring[i].desc || rtlpci->tx_ring[i].buffer_desc) { struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[i]; while (skb_queue_len(&ring->queue)) { u8 *entry; - struct sk_buff *skb = + struct sk_buff *skb = __skb_dequeue(&ring->queue); if (rtlpriv->use_new_trx_flow) entry = (u8 *)(&ring->buffer_desc @@ -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; @@ -1741,10 +1652,10 @@ static int rtl_pci_tx(struct ieee80211_hw *hw, } pdesc = &ring->desc[idx]; - + if (rtlpriv->use_new_trx_flow) { ptx_bd_desc = &ring->buffer_desc[idx]; - } else { + } else { own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, true, HW_DESC_OWN); @@ -1755,17 +1666,17 @@ static int rtl_pci_tx(struct ieee80211_hw *hw, hw_queue, ring->idx, idx, skb_queue_len(&ring->queue))); - spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, + spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); return skb->len; } } - + if (ieee80211_is_data_qos(fc)) { tid = rtl_get_tid(skb); if (sta) { sta_entry = (struct rtl_sta_info *)sta->drv_priv; - seq_number = (le16_to_cpu(hdr->seq_ctrl) & + seq_number = (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4; seq_number += 1; @@ -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, + 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); @@ -1832,18 +1729,16 @@ static void rtl_pci_flush(struct ieee80211_hw *hw, bool drop) u16 i = 0; int queue_id; struct rtl8192_tx_ring *ring; - + if (mac->skip_scan) return; - + 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 || @@ -1936,7 +1831,7 @@ void rtl_pci_stop(struct ieee80211_hw *hw) u8 RFInProgressTimeOut = 0; /* - *should before disable interrrupt&adapter + *should before disable interrupt&adapter *and will do it immediately. */ set_hal_stop(rtlhal); @@ -2081,13 +1976,13 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev, rtlhal->interfaceindex = 0; } } - + /* 92ee use new trx flow */ if (rtlhal->hw_type == HARDWARE_TYPE_RTL8192EE) rtlpriv->use_new_trx_flow = true; else rtlpriv->use_new_trx_flow = false; - + /*find bus info */ pcipriv->ndis_adapter.busnumber = pdev->bus->number; pcipriv->ndis_adapter.devnumber = PCI_SLOT(pdev->devfn); @@ -2095,7 +1990,7 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev, /*find bridge info */ pcipriv->ndis_adapter.pcibridge_vendor = PCI_BRIDGE_VENDOR_UNKNOWN; - /* some ARM have no bridge_pdev and will crash here + /* some ARM have no bridge_pdev and will crash here * so we should check if bridge_pdev is NULL */ if (bridge_pdev) { pcipriv->ndis_adapter.pcibridge_vendorid = bridge_pdev->vendor; @@ -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; @@ -2187,7 +2073,7 @@ static int rtl_pci_intr_mode_msi(struct ieee80211_hw *hw) } rtlpci->using_msi = true; - + RT_TRACE(COMP_INIT|COMP_INTR, DBG_DMESG, ("MSI Interrupt Mode!\n")); return 0; } @@ -2198,7 +2084,7 @@ static int rtl_pci_intr_mode_legacy(struct ieee80211_hw *hw) struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); int ret; - + ret = request_irq(rtlpci->pdev->irq, &_rtl_pci_interrupt, IRQF_SHARED, KBUILD_MODNAME, hw); if (ret < 0) { @@ -2206,7 +2092,7 @@ static int rtl_pci_intr_mode_legacy(struct ieee80211_hw *hw) } rtlpci->using_msi = false; - RT_TRACE(COMP_INIT|COMP_INTR, DBG_DMESG, + RT_TRACE(COMP_INIT|COMP_INTR, DBG_DMESG, ("Pin-based Interrupt Mode!\n")); return 0; } @@ -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; @@ -2293,7 +2173,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev, /* *init dbgp flags before all *other functions, because we will - *use it in other funtions like + *use it in other functions like *RT_TRACE/RT_PRINT/RTL_PRINT_DATA *you can not use these macro *before this @@ -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)); @@ -2377,7 +2257,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev, } else { rtlpriv->mac80211.mac80211_registered = 1; } - /* the wiphy must have been registed to + /* the wiphy must have been registed to * cfg80211 prior to regulatory_hint */ if (regulatory_hint(hw->wiphy, rtlpriv->regd.alpha2)) { RT_TRACE(COMP_ERR, DBG_WARNING, ("regulatory_hint fail\n")); @@ -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); @@ -2428,13 +2308,13 @@ fail1: return -ENODEV; } -//EXPORT_SYMBOL(rtl_pci_probe); +/* EXPORT_SYMBOL(rtl_pci_probe); */ struct ieee80211_hw *rtl_pci_get_hw_pointer(void) { return hw_export; } -//EXPORT_SYMBOL(rtl_pci_get_hw_pointer); +/* EXPORT_SYMBOL(rtl_pci_get_hw_pointer); */ void rtl_pci_disconnect(struct pci_dev *pdev) { @@ -2450,7 +2330,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) /* add for prov */ rtl_proc_remove_one(hw); - + /*ieee80211_unregister_hw will call ops_stop */ if (rtlmac->mac80211_registered == 1) { @@ -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); } @@ -2491,7 +2371,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) ieee80211_free_hw(hw); } -//EXPORT_SYMBOL(rtl_pci_disconnect); +/* EXPORT_SYMBOL(rtl_pci_disconnect); */ /*************************************** kernel pci power state define: @@ -2519,7 +2399,7 @@ int rtl_pci_suspend(struct device *dev) return 0; } -//EXPORT_SYMBOL(rtl_pci_suspend); +/* EXPORT_SYMBOL(rtl_pci_suspend); */ int rtl_pci_resume(struct device *dev) { @@ -2529,10 +2409,10 @@ int rtl_pci_resume(struct device *dev) rtlpriv->cfg->ops->hw_resume(hw); rtl_init_rfkill(hw); - + return 0; } -//EXPORT_SYMBOL(rtl_pci_resume); +/* EXPORT_SYMBOL(rtl_pci_resume); */ struct rtl_intf_ops rtl_pci_ops = { .read_efuse_byte = read_efuse_byte, diff --git a/drivers/staging/rtl8821ae/pci.h b/drivers/staging/rtl8821ae/pci.h index 9f206550a65..3f16ec90296 100644 --- a/drivers/staging/rtl8821ae/pci.h +++ b/drivers/staging/rtl8821ae/pci.h @@ -148,11 +148,11 @@ struct rtl_pci_capabilities_header { * RX wifi info == RX descriptor in old flow */ struct rtl_tx_buffer_desc { #if (RTL8192EE_SEG_NUM == 2) - u32 dword[2*(DMA_IS_64BIT + 1)*8]; //seg = 8 + u32 dword[2*(DMA_IS_64BIT + 1)*8]; /* seg = 8 */ #elif (RTL8192EE_SEG_NUM == 1) - u32 dword[2*(DMA_IS_64BIT + 1)*4]; //seg = 4 + u32 dword[2*(DMA_IS_64BIT + 1)*4]; /* seg = 4 */ #elif (RTL8192EE_SEG_NUM == 0) - u32 dword[2*(DMA_IS_64BIT + 1)*2]; //seg = 2 + u32 dword[2*(DMA_IS_64BIT + 1)*2]; /* seg = 2 */ #endif } __packed; @@ -187,7 +187,7 @@ struct rtl8192_tx_ring { }; struct rtl8192_rx_ring { - struct rtl_rx_desc *desc;/*for old trx flow, not uesd in new trx*/ + struct rtl_rx_desc *desc;/*for old trx flow, not used in new trx*/ /*dma matches either 'desc' or 'buffer_desc'*/ dma_addr_t dma; unsigned int idx; @@ -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 f12ffa83c58..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) @@ -257,7 +255,7 @@ void rtl_ips_nic_off_wq_callback(void *data) *Do not enter IPS in the following conditions: *(1) RF is already OFF or Sleep *(2) b_swrf_processing (indicates the IPS is still under going) - *(3) Connectted (only disconnected can trigger IPS) + *(3) Connected (only disconnected can trigger IPS) *(4) IBSS (send Beacon) *(5) AP mode (send Beacon) *(6) monitor mode (rcv packet) @@ -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 d387f13ea7d..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,8 +268,7 @@ static void rtl_rate_free_sta(void *rtlpriv, } static struct rate_control_ops rtl_rate_ops = { - .module = NULL, - .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 d89f15cb808..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; @@ -243,33 +227,23 @@ static void _rtl_reg_apply_active_scan_flags(struct wiphy *wiphy, } /* - *If a country IE has been recieved check its rule for this + *If a country IE has been received check its rule for this *channel first before enabling active scan. The passive scan *would have been enforced by the initial processing of our *custom regulatory domain. */ 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; @@ -455,7 +415,7 @@ int rtl_regd_init(struct ieee80211_hw *hw, if (rtlpriv->regd.country_code >= COUNTRY_CODE_MAX) { RT_TRACE(COMP_REGD, DBG_DMESG, - (KERN_DEBUG "rtl: EEPROM indicates invalid contry code" + (KERN_DEBUG "rtl: EEPROM indicates invalid country code" "world wide 13 should be used\n")); rtlpriv->regd.country_code = COUNTRY_CODE_WORLD_WIDE_13; @@ -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 abc60ab8165..1cfcb97b0ab 100644 --- a/drivers/staging/rtl8821ae/regd.h +++ b/drivers/staging/rtl8821ae/regd.h @@ -30,8 +30,8 @@ #ifndef __RTL_REGD_H__ #define __RTL_REGD_H__ -#define IEEE80211_CHAN_NO_IBSS 1<<2 -#define IEEE80211_CHAN_PASSIVE_SCAN 1<<1 +#define IEEE80211_CHAN_NO_IBSS (1 << 2) +#define IEEE80211_CHAN_PASSIVE_SCAN (1 << 1) #define WIPHY_FLAG_CUSTOM_REGULATORY BIT(0) #define WIPHY_FLAG_STRICT_REGULATORY BIT(1) #define WIPHY_FLAG_DISABLE_BEACON_HINTS BIT(2) @@ -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/dm.c b/drivers/staging/rtl8821ae/rtl8821ae/dm.c index 8634206b892..e0efcd281df 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/dm.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/dm.c @@ -731,7 +731,7 @@ void rtl8821ae_dm_find_minimum_rssi(struct ieee80211_hw *hw) rtl_dm_dig->min_undecorated_pwdb_for_dm = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; RT_TRACE(COMP_BB_POWERSAVING, DBG_LOUD, - ("AP Ext Port or disconnet PWDB = 0x%x \n", + ("AP Ext Port or disconnect PWDB = 0x%x \n", rtl_dm_dig->min_undecorated_pwdb_for_dm)); } RT_TRACE(COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n", @@ -925,7 +925,7 @@ static void rtl8821ae_dm_dig(struct ieee80211_hw *hw) if (rtlpriv->falsealm_cnt.cnt_all > 10000) { RT_TRACE(COMP_DIG, DBG_LOUD, - ("rtl8821ae_dm_dig(): Abnornally false alarm case. \n")); + ("rtl8821ae_dm_dig(): Abnormally false alarm case. \n")); if (dm_digtable.large_fa_hit != 3) dm_digtable.large_fa_hit++; @@ -1087,7 +1087,7 @@ static void rtl8821ae_dm_false_alarm_counter_statistics(struct ieee80211_hw *hw) else falsealm_cnt->cnt_all = falsealm_cnt->cnt_ofdm_fail; - /*reset OFDM FA coutner*/ + /*reset OFDM FA counter*/ rtl_set_bbreg(hw, ODM_REG_OFDM_FA_RST_11AC, BIT(17), 1); rtl_set_bbreg(hw, ODM_REG_OFDM_FA_RST_11AC, BIT(17), 0); /* reset CCK FA counter*/ @@ -1316,7 +1316,7 @@ u8 rtl8812ae_hw_rate_to_mrate( /*----------------------------------------------------------------------------- * Function: odm_TxPwrTrackSetPwr88E() * - * Overview: 88E change all channel tx power accordign to flag. + * Overview: 88E change all channel tx power according to flag. * OFDM & CCK are all different. * * Input: NONE @@ -1537,7 +1537,7 @@ void rtl8812ae_dm_txpwr_track_set_pwr(struct ieee80211_hw *hw, rtldm->modify_txagc_flag_path_b = false; RT_TRACE(COMP_POWER_TRACKING, DBG_LOUD, - ("******Path_B pDM_Odm->Modify_TxAGC_Flag = FALSE \n")); + ("******Path_B dm_Odm->Modify_TxAGC_Flag = FALSE \n")); } } } @@ -1654,7 +1654,7 @@ void rtl8812ae_dm_txpower_tracking_callback_thermalmeter if (delta > 0 && rtldm->txpower_track_control) { - /*"delta" here is used to record the absolute value of differrence.*/ + /*"delta" here is used to record the absolute value of difference.*/ delta = thermal_value > rtlefuse->eeprom_thermalmeter ? \ (thermal_value - rtlefuse->eeprom_thermalmeter) : \ (rtlefuse->eeprom_thermalmeter - thermal_value); @@ -1976,7 +1976,7 @@ void rtl8821ae_phy_lccalibrate( /*----------------------------------------------------------------------------- * Function: odm_TxPwrTrackSetPwr88E() * - * Overview: 88E change all channel tx power accordign to flag. + * Overview: 88E change all channel tx power according to flag. * OFDM & CCK are all different. * * Input: NONE @@ -2159,7 +2159,7 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter u8 *delta_swing_table_idx_tup_b; u8 *delta_swing_table_idx_tdown_b; - /*2. Initilization ( 7 steps in total )*/ + /*2. Initialization ( 7 steps in total )*/ rtl8821ae_get_delta_swing_table(hw, (u8**)&delta_swing_table_idx_tup_a, (u8**)&delta_swing_table_idx_tdown_a, (u8**)&delta_swing_table_idx_tup_b, @@ -2244,7 +2244,7 @@ void rtl8821ae_dm_txpower_tracking_callback_thermalmeter if (delta > 0 && rtldm->txpower_track_control) { - /*"delta" here is used to record the absolute value of differrence.*/ + /*"delta" here is used to record the absolute value of difference.*/ delta = thermal_value > rtlefuse->eeprom_thermalmeter ? \ (thermal_value - rtlefuse->eeprom_thermalmeter) : \ (rtlefuse->eeprom_thermalmeter - thermal_value); @@ -2613,11 +2613,11 @@ static void rtl8821ae_dm_check_edca_turbo(struct ieee80211_hw *hw) RT_TRACE(COMP_TURBO, DBG_LOUD, ("rtl8821ae_dm_check_edca_turbo=====>")); RT_TRACE(COMP_TURBO, DBG_LOUD, - ("Orginial BE PARAM: 0x%x\n", + ("Original BE PARAM: 0x%x\n", rtl_read_dword(rtlpriv, DM_REG_EDCA_BE_11N))); /*=============================== - list paramter for different platform + list parameter for different platform ===============================*/ b_last_is_cur_rdl_state = rtlpriv->dm.bis_cur_rdlstate; pb_is_cur_rdl_state = &( rtlpriv->dm.bis_cur_rdlstate); @@ -2963,7 +2963,7 @@ void rtl8821ae_dm_dynamic_atc_switch(struct ieee80211_hw *hw) "Crystal cap = 0x%x, Crystal cap offset = %d\n", rtldm->crystal_cap, adjust_xtal)); - /*3.Adjudt Crystal Cap.*/ + /*3.Adjust Crystal Cap.*/ if (adjust_xtal != 0){ rtldm->is_freeze = 0; rtldm->crystal_cap += adjust_xtal; diff --git a/drivers/staging/rtl8821ae/rtl8821ae/fw.c b/drivers/staging/rtl8821ae/rtl8821ae/fw.c index 4083cab926a..46eb4125d18 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/fw.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/fw.c @@ -164,7 +164,7 @@ static int _rtl8821ae_fw_free_to_go(struct ieee80211_hw *hw) if (counter >= FW_8821AE_POLLING_TIMEOUT_COUNT) { RT_TRACE(COMP_ERR, DBG_LOUD, - ("chksum report faill ! REG_MCUFWDL:0x%08x .\n", + ("chksum report fail ! REG_MCUFWDL:0x%08x .\n", value32)); goto exit; } @@ -368,7 +368,7 @@ static void _rtl8821ae_fill_h2c_command(struct ieee80211_hw *hw, wait_h2c_limmit--; if (wait_h2c_limmit == 0) { RT_TRACE(COMP_CMD, DBG_LOUD, - ("Wating too long for FW read " + ("Waiting too long for FW read " "clear HMEBox(%d)!\n", boxnum)); break; } @@ -378,7 +378,7 @@ static void _rtl8821ae_fill_h2c_command(struct ieee80211_hw *hw, isfw_read = _rtl8821ae_check_fw_read_last_h2c(hw, boxnum); u1b_tmp = rtl_read_byte(rtlpriv, 0x130); RT_TRACE(COMP_CMD, DBG_LOUD, - ("Wating for FW read clear HMEBox(%d)!!! " + ("Waiting for FW read clear HMEBox(%d)!!! " "0x130 = %2x\n", boxnum, u1b_tmp)); } } @@ -1179,7 +1179,7 @@ void rtl8821ae_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) ("Set RSVD page location to Fw FAIL!!!!!!.\n")); } -/*Shoud check FW support p2p or not.*/ +/*Should check FW support p2p or not.*/ void rtl8821ae_set_p2p_ctw_period_cmd(struct ieee80211_hw *hw, u8 ctwindow) { u8 u1_ctwindow_period[1] ={ ctwindow}; diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h b/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h index 799cc6f95cc..b365f82f481 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h +++ b/drivers/staging/rtl8821ae/rtl8821ae/hal_bt_coexist.h @@ -142,7 +142,7 @@ void rtl8821ae_dm_bt_hw_coex_all_off(struct ieee80211_hw *hw); long rtl8821ae_dm_bt_get_rx_ss(struct ieee80211_hw *hw); void rtl8821ae_dm_bt_balance(struct ieee80211_hw *hw, bool b_balance_on, u8 ms0, u8 ms1); -void rtl8821ae_dm_bt_agc_table(struct ieee80211_hw *hw, u8 tyep); +void rtl8821ae_dm_bt_agc_table(struct ieee80211_hw *hw, u8 type); void rtl8821ae_dm_bt_bb_back_off_level(struct ieee80211_hw *hw, u8 type); u8 rtl8821ae_dm_bt_check_coex_rssi_state(struct ieee80211_hw *hw, u8 level_num, u8 rssi_thresh, u8 rssi_thresh1); diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c b/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c index 79386ee142f..7b1d113505f 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/hal_btc.c @@ -157,7 +157,7 @@ bool rtl8821ae_dm_bt_is_same_coexist_state(struct ieee80211_hw *hw) &&(rtlpcipriv->btcoexist.previous_state_h == rtlpcipriv->btcoexist.current_state_h)) { RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, - ("[DM][BT], Coexist state do not chang!!\n")); + ("[DM][BT], Coexist state do not change!!\n")); return true; } else { RT_TRACE(COMP_BT_COEXIST, DBG_DMESG, @@ -902,7 +902,7 @@ void rtl8821ae_dm_bt_set_bt_dm(struct ieee80211_hw *hw, struct btdm_8821ae *p_bt /* * Note: - * We should add delay for making sure sw DacSwing can be set sucessfully. + * We should add delay for making sure sw DacSwing can be set successfully. * because of that rtl8821ae_dm_bt_set_fw_2_ant_hid() and rtl8821ae_dm_bt_set_fw_tdma_ctrl() * will overwrite the reg 0x880. */ @@ -2025,7 +2025,7 @@ void rtl_8821ae_c2h_command_handle(struct ieee80211_hw *hw) rtl_write_byte(rtlpriv, 0x1AF, 0x00); return; } - ptmp_buf = (u8 *) kmalloc(c2h_event.cmd_len, GFP_KERNEL); + ptmp_buf = kmalloc(c2h_event.cmd_len, GFP_KERNEL); if(ptmp_buf == NULL) { RT_TRACE(COMP_FW, DBG_TRACE, ("malloc cmd buf failed\n")); return; diff --git a/drivers/staging/rtl8821ae/rtl8821ae/hw.c b/drivers/staging/rtl8821ae/rtl8821ae/hw.c index 5ed7a114c56..1b8583b689d 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/hw.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/hw.c @@ -147,6 +147,7 @@ static void _rtl8821ae_set_fw_clock_on(struct ieee80211_hw *hw, } else { rtlhal->bfw_clk_change_in_progress = false; spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); + break; } } @@ -1016,7 +1017,7 @@ static void _rtl8821ae_hw_configure(struct ieee80211_hw *hw) /* ARFB table 12 for 11ac 24G 1SS */ rtl_write_dword(rtlpriv, REG_ARFR3, 0x00000015); rtl_write_dword(rtlpriv, REG_ARFR3 + 4, 0xffcff000); - /* 0x420[7] = 0 , enable retry AMPDU in new AMPD not singal MPDU. */ + /* 0x420[7] = 0 , enable retry AMPDU in new AMPD not signal MPDU. */ rtl_write_word(rtlpriv, REG_FWHW_TXQ_CTRL, 0x1F00); rtl_write_byte(rtlpriv, REG_AMPDU_MAX_TIME, 0x70); @@ -1406,7 +1407,7 @@ int rtl8821ae_hw_init(struct ieee80211_hw *hw) rtl8821ae_phy_mac_config(hw); /* because last function modify RCR, so we update * rcr var here, or TP will unstable for receive_config - * is wrong, RX RCR_ACRC32 will cause TP unstabel & Rx + * is wrong, RX RCR_ACRC32 will cause TP unstable & Rx * RCR_APP_ICV will cause mac80211 unassoc for cisco 1252 rtlpci->receive_config = rtl_read_dword(rtlpriv, REG_RCR); rtlpci->receive_config &= ~(RCR_ACRC32 | RCR_AICV); @@ -1562,7 +1563,7 @@ static enum version_8821ae _rtl8821ae_read_chip_version(struct ieee80211_hw *hw) break; default: RT_TRACE(COMP_INIT, DBG_LOUD, - ("Chip Version ID: Unknow (0x%X).\n", version)); + ("Chip Version ID: Unknown (0x%X).\n", version)); break; } @@ -1622,7 +1623,7 @@ static int _rtl8821ae_set_media_status(struct ieee80211_hw *hw, rtl_write_byte(rtlpriv, (MSR), bt_msr); rtlpriv->cfg->ops->led_control(hw, ledaction); - if ((bt_msr & 0xfc) == MSR_AP) + if ((bt_msr & ~0xfc) == MSR_AP) rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x00); else rtl_write_byte(rtlpriv, REG_BCNTCFG + 1, 0x66); @@ -2371,7 +2372,7 @@ static void _rtl8812ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ if (rtlefuse->eeprom_channelplan == 0xff) rtlefuse->eeprom_channelplan = 0x7F; - /* set channel paln to world wide 13 */ + /* set channel plan to world wide 13 */ //rtlefuse->channel_plan = (u8) rtlefuse->eeprom_channelplan; /*parse xtal*/ @@ -2534,7 +2535,7 @@ static void _rtl8821ae_read_adapter_info(struct ieee80211_hw *hw, bool b_pseudo_ if (rtlefuse->eeprom_channelplan == 0xff) rtlefuse->eeprom_channelplan = 0x7F; - /* set channel paln to world wide 13 */ + /* set channel plan to world wide 13 */ //rtlefuse->channel_plan = (u8) rtlefuse->eeprom_channelplan; /*parse xtal*/ 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/phy.c b/drivers/staging/rtl8821ae/rtl8821ae/phy.c index d02fca38a2b..1dd33016b4b 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/phy.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/phy.c @@ -86,7 +86,7 @@ void rtl8812ae_fixspur( /* 0x8AC[11:10] = 2'b10*/ - /* <20120914, Kordan> A workarould to resolve + /* <20120914, Kordan> A workaround to resolve 2480Mhz spur by setting ADC clock as 160M. (Asked by Binson)*/ if (band_width == HT_CHANNEL_WIDTH_20 && (channel == 13 || channel == 14)) { @@ -107,7 +107,7 @@ void rtl8812ae_fixspur( } else if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { - /* <20120914, Kordan> A workarould to resolve + /* <20120914, Kordan> A workaround to resolve 2480Mhz spur by setting ADC clock as 160M. (Asked by Binson)*/ if (band_width == HT_CHANNEL_WIDTH_20 && (channel == 13 || channel == 14)) @@ -441,8 +441,8 @@ u32 phy_get_tx_bb_swing_8812A( struct rtl_dm *rtldm = rtl_dm(rtlpriv); struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); - char bb_swing_2g = (char) (-1 * 0xFF); - char bb_swing_5g = (char) (-1 * 0xFF); + char bb_swing_2g = (char) ((-1 * 0xFF) & 0xFF); + char bb_swing_5g = (char) ((-1 * 0xFF) & 0xFF); u32 out = 0x200; const char auto_temp = -1; diff --git a/drivers/staging/rtl8821ae/rtl8821ae/phy.h b/drivers/staging/rtl8821ae/rtl8821ae/phy.h index a932d8c9d45..a80bf739940 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/phy.h +++ b/drivers/staging/rtl8821ae/rtl8821ae/phy.h @@ -30,7 +30,7 @@ #ifndef __RTL8821AE_PHY_H__ #define __RTL8821AE_PHY_H__ -/*It must always set to 4, otherwise read efuse table secquence will be wrong.*/ +/*It must always set to 4, otherwise read efuse table sequence will be wrong.*/ #define MAX_TX_COUNT 4 #define TX_1S 0 #define TX_2S 1 diff --git a/drivers/staging/rtl8821ae/rtl8821ae/pwrseq.h b/drivers/staging/rtl8821ae/rtl8821ae/pwrseq.h index 8b39c042fa9..480a6bb6d76 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/pwrseq.h +++ b/drivers/staging/rtl8821ae/rtl8821ae/pwrseq.h @@ -81,7 +81,7 @@ {0x0047, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* 0x47[7:0] = 00 gpio mode */ \ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* suspend option all off */ \ {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, BIT7},/*0x14[7] = 1 turn on ZCD */ \ - {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, BIT0},/* 0x15[0] =1 trun on ZCD */ \ + {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, BIT0},/* 0x15[0] =1 turn on ZCD */ \ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, BIT4},/*0x23[4] = 1 hpon LDO sleep mode */ \ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x02, 0},/*0x8[1] = 0 ANA clk =500k */ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, BIT3}, /*0x04[11] = 2b'11 enable WL suspend for PCIe*/ @@ -91,7 +91,7 @@ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT3, 0}, /*0x04[11] = 2b'01enable WL suspend*/ \ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, 0},/*0x23[4] = 0 hpon LDO sleep mode leave */ \ - {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/* 0x15[0] =0 trun off ZCD */ \ + {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/* 0x15[0] =0 turn off ZCD */ \ {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, 0},/*0x14[7] = 0 turn off ZCD */ \ {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio0~7 input mode */ \ {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio11 input mode, gpio10~8 input mode */ @@ -110,7 +110,7 @@ {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0xff},/* gpio0~7 output mode */ \ {0x0047, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0},/* 0x47[7:0] = 00 gpio mode */ \ {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, BIT7},/*0x14[7] = 1 turn on ZCD */ \ - {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, BIT0},/* 0x15[0] =1 trun on ZCD */ \ + {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, BIT0},/* 0x15[0] =1 turn on ZCD */ \ {0x0012, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/*0x12[0] = 0 force PFM mode */ \ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, BIT4},/*0x23[4] = 1 hpon LDO sleep mode */ \ {0x0008, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x02, 0},/*0x8[1] = 0 ANA clk =500k */ \ @@ -124,7 +124,7 @@ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0012, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, BIT0, BIT0},/*0x12[0] = 1 force PWM mode */ \ {0x0014, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x80, 0},/*0x14[7] = 0 turn off ZCD */ \ - {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/* 0x15[0] =0 trun off ZCD */ \ + {0x0015, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x01, 0},/* 0x15[0] =0 turn off ZCD */ \ {0x0023, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0x10, 0},/*0x23[4] = 0 hpon LDO leave sleep mode */ \ {0x0046, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio0~7 input mode */ \ {0x0043, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK,PWR_BASEADDR_MAC,PWR_CMD_WRITE, 0xFF, 0x00},/* gpio11 input mode, gpio10~8 input mode */ \ @@ -204,7 +204,7 @@ extern struct wlan_pwr_cfg rtl8812_leave_lps_flow[RTL8812_TRANS_LPS_TO_ACT_STEP 4: LPS--Low Power State 5: SUS--Suspend - The transision from different states are defined below + The transition from different states are defined below TRANS_CARDEMU_TO_ACT TRANS_ACT_TO_CARDEMU TRANS_CARDEMU_TO_SUS diff --git a/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c b/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c index 710bc015251..ff188718777 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/pwrseqcmd.c @@ -82,7 +82,7 @@ bool rtl_hal_pwrseqcmdparsing (struct rtl_priv* rtlpriv, u8 cut_version, value = value | (GET_PWR_CFG_VALUE(pwr_cfg_cmd) & GET_PWR_CFG_MASK(pwr_cfg_cmd)); - /*Write the value back to sytem register*/ + /*Write the value back to system register*/ rtl_write_byte(rtlpriv, offset, value); } break; diff --git a/drivers/staging/rtl8821ae/rtl8821ae/reg.h b/drivers/staging/rtl8821ae/rtl8821ae/reg.h index 09c5f00d260..beffb4243b1 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/reg.h +++ b/drivers/staging/rtl8821ae/rtl8821ae/reg.h @@ -596,13 +596,13 @@ #define IMR_BCNDMAINT3 BIT(23) /* Beacon DMA Interrupt 3 */ #define IMR_BCNDMAINT2 BIT(22) /* Beacon DMA Interrupt 2 */ #define IMR_BCNDMAINT1 BIT(21) /* Beacon DMA Interrupt 1 */ -#define IMR_BCNDOK7 BIT(20) /* Beacon Queue DMA OK Interrup 7 */ -#define IMR_BCNDOK6 BIT(19) /* Beacon Queue DMA OK Interrup 6 */ -#define IMR_BCNDOK5 BIT(18) /* Beacon Queue DMA OK Interrup 5 */ -#define IMR_BCNDOK4 BIT(17) /* Beacon Queue DMA OK Interrup 4 */ -#define IMR_BCNDOK3 BIT(16) /* Beacon Queue DMA OK Interrup 3 */ -#define IMR_BCNDOK2 BIT(15) /* Beacon Queue DMA OK Interrup 2 */ -#define IMR_BCNDOK1 BIT(14) /* Beacon Queue DMA OK Interrup 1 */ +#define IMR_BCNDOK7 BIT(20) /* Beacon Queue DMA OK Interrupt 7 */ +#define IMR_BCNDOK6 BIT(19) /* Beacon Queue DMA OK Interrupt 6 */ +#define IMR_BCNDOK5 BIT(18) /* Beacon Queue DMA OK Interrupt 5 */ +#define IMR_BCNDOK4 BIT(17) /* Beacon Queue DMA OK Interrupt 4 */ +#define IMR_BCNDOK3 BIT(16) /* Beacon Queue DMA OK Interrupt 3 */ +#define IMR_BCNDOK2 BIT(15) /* Beacon Queue DMA OK Interrupt 2 */ +#define IMR_BCNDOK1 BIT(14) /* Beacon Queue DMA OK Interrupt 1 */ #define IMR_ATIMEND_E BIT(13) /* ATIM Window End Extension for Win7 */ #define IMR_TXERR BIT(11) /* Tx Error Flag Interrupt Status, write 1 clear. */ #define IMR_RXERR BIT(10) /* Rx Error Flag INT Status, Write 1 clear */ @@ -613,7 +613,7 @@ #define HWSET_MAX_SIZE 512 #define EFUSE_MAX_SECTION 64 #define EFUSE_REAL_CONTENT_LEN 256 -#define EFUSE_OOB_PROTECT_BYTES 18 /* PG data exclude header, dummy 7 bytes frome CP test and reserved 1byte.*/ +#define EFUSE_OOB_PROTECT_BYTES 18 /* PG data exclude header, dummy 7 bytes from CP test and reserved 1byte.*/ #define EEPROM_DEFAULT_TSSI 0x0 @@ -1511,7 +1511,7 @@ #define ROFDM0_TXCOEFF5 0xcb4 #define ROFDM0_TXCOEFF6 0xcb8 -/*Path_A RFE cotrol */ +/*Path_A RFE control */ #define RA_RFE_CTRL_8812 0xcb8 /*Path_B RFE control*/ #define RB_RFE_CTRL_8812 0xeb8 @@ -2336,19 +2336,19 @@ #define WOL_REASON_DEAUTH BIT(3) #define WOL_REASON_FW_DISCONNECT BIT(4) -#define RA_RFE_PINMUX 0xcb0 /* Path_A RFE cotrol pinmux*/ +#define RA_RFE_PINMUX 0xcb0 /* Path_A RFE control pinmux*/ #define RB_RFE_PINMUX 0xeb0 /* Path_B RFE control pinmux*/ #define RA_RFE_INV 0xcb4 #define RB_RFE_INV 0xeb4 /* RXIQC */ -#define RA_RXIQC_AB 0xc10 /*RxIQ imblance matrix coeff. A & B*/ -#define RA_RXIQC_CD 0xc14 /*RxIQ imblance matrix coeff. C & D*/ +#define RA_RXIQC_AB 0xc10 /*RxIQ imbalance matrix coeff. A & B*/ +#define RA_RXIQC_CD 0xc14 /*RxIQ imbalance matrix coeff. C & D*/ #define RA_TXSCALE 0xc1c /* Pah_A TX scaling factor*/ #define RB_TXSCALE 0xe1c /* Path_B TX scaling factor*/ -#define RB_RXIQC_AB 0xe10 /*RxIQ imblance matrix coeff. A & B*/ -#define RB_RXIQC_CD 0xe14 /*RxIQ imblance matrix coeff. C & D*/ +#define RB_RXIQC_AB 0xe10 /*RxIQ imbalance matrix coeff. A & B*/ +#define RB_RXIQC_CD 0xe14 /*RxIQ imbalance matrix coeff. C & D*/ #define RXIQC_AC 0x02ff /*bit mask for IQC matrix element A & C*/ #define RXIQC_BD 0x02ff0000 /*bit mask for IQC matrix element A & C*/ diff --git a/drivers/staging/rtl8821ae/rtl8821ae/sw.c b/drivers/staging/rtl8821ae/rtl8821ae/sw.c index 85a3474fc09..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)); @@ -57,9 +57,9 @@ void rtl8821ae_init_aspm_vars(struct ieee80211_hw *hw) * 0 - Disable ASPM, * 1 - Enable ASPM without Clock Req, * 2 - Enable ASPM with Clock Req, - * 3 - Alwyas Enable ASPM with Clock Req, + * 3 - Always Enable ASPM with Clock Req, * 4 - Always Enable ASPM without Clock Req. - * set defult to RTL8192CE:3 RTL8192E:2 + * set default to RTL8192CE:3 RTL8192E:2 * */ rtlpci->const_pci_aspm = 3; @@ -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 75ae4387fe1..b4943e8b7f8 100644 --- a/drivers/staging/rtl8821ae/rtl8821ae/trx.c +++ b/drivers/staging/rtl8821ae/rtl8821ae/trx.c @@ -37,8 +37,8 @@ #include "trx.h" #include "led.h" #include "dm.h" -#include "phy.h" -u8 _rtl8821ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) + +static u8 _rtl8821ae_map_hwqueue_to_fwqueue(struct sk_buff *skb, u8 hw_queue) { u16 fc = rtl_get_fc(skb); @@ -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; @@ -244,7 +240,7 @@ static void _rtl8821ae_query_rxphystatus(struct ieee80211_hw *hw, cck_agc_rpt = cck_buf->cck_agc_rpt; /* (1)Hardware does not provide RSSI for CCK */ - /* (2)PWDB, Average PWDB cacluated by + /* (2)PWDB, Average PWDB calculated by * hardware (for rate adaptive) */ if (ppsc->rfpwr_state == ERFON) cck_highpwr = (u8) rtl_get_bbreg(hw, RFPGA0_XA_HSSIPARAMETER2, @@ -363,7 +359,7 @@ static void _rtl8821ae_query_rxphystatus(struct ieee80211_hw *hw, pstatus->rx_mimo_signalstrength[i] = (u8) rssi; } - /* (2)PWDB, Average PWDB cacluated by + /* (2)PWDB, Average PWDB calculated by * hardware (for rate adaptive) */ rx_pwr_all = ((p_drvinfo->pwdb_all >> 1) & 0x7f) - 110; @@ -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); @@ -603,7 +594,7 @@ bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw, /* hw will set status->decrypted true, if it finds the * frame is open data frame or mgmt frame. */ - /* So hw will not decryption robust managment frame + /* So hw will not decryption robust management frame * for IEEE80211w but still set status->decrypted * true, so here we should set it back to undecrypted * for IEEE80211w frame, and mac80211 sw will help @@ -616,7 +607,7 @@ bool rtl8821ae_rx_query_desc(struct ieee80211_hw *hw, return false; } - if ((ieee80211_is_robust_mgmt_frame(hdr)) && + if ((_ieee80211_is_robust_mgmt_frame(hdr)) && (ieee80211_has_protected(hdr->frame_control))) rx_status->flag &= ~RX_FLAG_DECRYPTED; else @@ -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 76bef93ad70..e8250dad613 100644 --- a/drivers/staging/rtl8821ae/wifi.h +++ b/drivers/staging/rtl8821ae/wifi.h @@ -40,10 +40,10 @@ #define RF_CHANGE_BY_INIT 0 -#define RF_CHANGE_BY_IPS BIT(28) -#define RF_CHANGE_BY_PS BIT(29) -#define RF_CHANGE_BY_HW BIT(30) -#define RF_CHANGE_BY_SW BIT(31) +#define RF_CHANGE_BY_IPS BIT(28) +#define RF_CHANGE_BY_PS BIT(29) +#define RF_CHANGE_BY_HW BIT(30) +#define RF_CHANGE_BY_SW BIT(31) #define IQK_ADDA_REG_NUM 16 #define IQK_MAC_REG_NUM 4 @@ -69,35 +69,35 @@ #define QBSS_LOAD_SIZE 5 #define MAX_WMMELE_LENGTH 64 -#define TOTAL_CAM_ENTRY 32 +#define TOTAL_CAM_ENTRY 32 /*slot time for 11g. */ #define RTL_SLOT_TIME_9 9 #define RTL_SLOT_TIME_20 20 /*related with tcp/ip. */ -/*if_ehther.h*/ -#define ETH_P_PAE 0x888E /*Port Access Entity +/*if_ether.h*/ +#define ETH_P_PAE 0x888E /*Port Access Entity *(IEEE 802.1X) */ -#define ETH_P_IP 0x0800 /*Internet Protocol packet */ -#define ETH_P_ARP 0x0806 /*Address Resolution packet */ -#define SNAP_SIZE 6 +#define ETH_P_IP 0x0800 /*Internet Protocol packet */ +#define ETH_P_ARP 0x0806 /*Address Resolution packet */ +#define SNAP_SIZE 6 #define PROTOC_TYPE_SIZE 2 /*related with 802.11 frame*/ -#define MAC80211_3ADDR_LEN 24 -#define MAC80211_4ADDR_LEN 30 +#define MAC80211_3ADDR_LEN 24 +#define MAC80211_4ADDR_LEN 30 #define CHANNEL_MAX_NUMBER (14 + 24 + 21) /* 14 is the max * channel number */ #define CHANNEL_MAX_NUMBER_2G 14 -#define CHANNEL_MAX_NUMBER_5G 54 /* Please refer to +#define CHANNEL_MAX_NUMBER_5G 54 /* Please refer to *"phy_GetChnlGroup8812A" and * "Hal_ReadTxPowerInfo8812A"*/ #define CHANNEL_MAX_NUMBER_5G_80M 7 #define CHANNEL_GROUP_MAX (3 + 9) /* ch1~3, ch4~9, ch10~14 * total three groups */ -#define MAX_PG_GROUP 13 +#define MAX_PG_GROUP 13 #define CHANNEL_GROUP_MAX_2G 3 #define CHANNEL_GROUP_IDX_5GL 3 #define CHANNEL_GROUP_IDX_5GM 6 @@ -112,14 +112,14 @@ #define MAX_NUM_RATES 264 /*for 88E use*/ -/*It must always set to 4, otherwise read efuse table secquence will be wrong.*/ +/*It must always set to 4, otherwise read efuse table sequence will be wrong.*/ #define MAX_TX_COUNT 4 #define MAX_RF_PATH 4 #define MAX_CHNL_GROUP_24G 6 #define MAX_CHNL_GROUP_5G 14 /* BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON. */ -#define MAX_TX_QUEUE 9 +#define MAX_TX_QUEUE 9 #define TX_PWR_BY_RATE_NUM_BAND 2 #define TX_PWR_BY_RATE_NUM_RF 4 @@ -127,11 +127,11 @@ #define MAX_BASE_NUM_IN_PHY_REG_PG_24G 6 #define MAX_BASE_NUM_IN_PHY_REG_PG_5G 5 -#define DELTA_SWINGIDX_SIZE 30 -#define BAND_NUM 3 +#define DELTA_SWINGIDX_SIZE 30 +#define BAND_NUM 3 /*Now, it's just for 8192ee *not OK yet, keep it 0*/ -#define DMA_IS_64BIT 0 +#define DMA_IS_64BIT 0 #define RTL8192EE_SEG_NUM 1 /* 0:2 seg, 1: 4 seg, 2: 8 seg */ struct txpower_info_2g { @@ -219,7 +219,7 @@ enum hardware_type { }; enum scan_operation_backup_opt { - SCAN_OPT_BACKUP_BAND0=0, + SCAN_OPT_BACKUP_BAND0 = 0, SCAN_OPT_BACKUP_BAND1, SCAN_OPT_RESTORE, SCAN_OPT_MAX @@ -435,7 +435,7 @@ enum ht_channel_width { HT_CHANNEL_WIDTH_80 = 2, }; -/* Ref: 802.11i sepc D10.0 7.3.2.25.1 +/* Ref: 802.11i spec D10.0 7.3.2.25.1 Cipher Suites Encryption Algorithms */ enum rt_enc_alg { NO_ENCRYPTION = 0, @@ -499,14 +499,14 @@ enum rtl_var_map { RTL_IMR_BCNDMAINT3, /*Beacon DMA Interrupt 3 */ RTL_IMR_BCNDMAINT2, /*Beacon DMA Interrupt 2 */ RTL_IMR_BCNDMAINT1, /*Beacon DMA Interrupt 1 */ - RTL_IMR_BCNDOK8, /*Beacon Queue DMA OK Interrup 8 */ - RTL_IMR_BCNDOK7, /*Beacon Queue DMA OK Interrup 7 */ - RTL_IMR_BCNDOK6, /*Beacon Queue DMA OK Interrup 6 */ - RTL_IMR_BCNDOK5, /*Beacon Queue DMA OK Interrup 5 */ - RTL_IMR_BCNDOK4, /*Beacon Queue DMA OK Interrup 4 */ - RTL_IMR_BCNDOK3, /*Beacon Queue DMA OK Interrup 3 */ - RTL_IMR_BCNDOK2, /*Beacon Queue DMA OK Interrup 2 */ - RTL_IMR_BCNDOK1, /*Beacon Queue DMA OK Interrup 1 */ + RTL_IMR_BCNDOK8, /*Beacon Queue DMA OK Interrupt 8 */ + RTL_IMR_BCNDOK7, /*Beacon Queue DMA OK Interrupt 7 */ + RTL_IMR_BCNDOK6, /*Beacon Queue DMA OK Interrupt 6 */ + RTL_IMR_BCNDOK5, /*Beacon Queue DMA OK Interrupt 5 */ + RTL_IMR_BCNDOK4, /*Beacon Queue DMA OK Interrupt 4 */ + RTL_IMR_BCNDOK3, /*Beacon Queue DMA OK Interrupt 3 */ + RTL_IMR_BCNDOK2, /*Beacon Queue DMA OK Interrupt 2 */ + RTL_IMR_BCNDOK1, /*Beacon Queue DMA OK Interrupt 1 */ RTL_IMR_TIMEOUT2, /*Timeout interrupt 2 */ RTL_IMR_TIMEOUT1, /*Timeout interrupt 1 */ RTL_IMR_TXFOVW, /*Transmit FIFO Overflow */ @@ -515,10 +515,10 @@ enum rtl_var_map { RTL_IMR_RXFOVW, /*Receive FIFO Overflow */ RTL_IMR_RDU, /*Receive Descriptor Unavailable */ RTL_IMR_ATIMEND, /*For 92C,ATIM Window End Interrupt */ - RTL_IMR_BDOK, /*Beacon Queue DMA OK Interrup */ + RTL_IMR_BDOK, /*Beacon Queue DMA OK Interrupt */ RTL_IMR_HIGHDOK, /*High Queue DMA OK Interrupt */ RTL_IMR_COMDOK, /*Command Queue DMA OK Interrupt*/ - RTL_IMR_TBDOK, /*Transmit Beacon OK interrup */ + RTL_IMR_TBDOK, /*Transmit Beacon OK interrupt */ RTL_IMR_MGNTDOK, /*Management Queue DMA OK Interrupt */ RTL_IMR_TBDER, /*For 92C,Transmit Beacon Error Interrupt */ RTL_IMR_BKDOK, /*AC_BK DMA OK Interrupt */ @@ -645,9 +645,9 @@ enum wireless_mode { }; enum ratr_table_mode { - RATR_INX_WIRELESS_NGB = 0, // BGN 40 Mhz 2SS 1SS - RATR_INX_WIRELESS_NG = 1, // GN or N - RATR_INX_WIRELESS_NB = 2, // BGN 20 Mhz 2SS 1SS or BN + RATR_INX_WIRELESS_NGB = 0, /* BGN 40 Mhz 2SS 1SS */ + RATR_INX_WIRELESS_NG = 1, /* GN or N */ + RATR_INX_WIRELESS_NB = 2, /* BGN 20 Mhz 2SS 1SS or BN */ RATR_INX_WIRELESS_N = 3, RATR_INX_WIRELESS_GB = 4, RATR_INX_WIRELESS_G = 5, @@ -759,7 +759,7 @@ struct rtl_tid_data { struct rtl_ht_agg agg; }; -struct rssi_sta{ +struct rssi_sta { long undecorated_smoothed_pwdb; }; @@ -899,7 +899,7 @@ struct regd_pair_mapping { u16 reg_2ghz_ctl; }; -struct dynamic_primary_cca{ +struct dynamic_primary_cca { u8 pricca_flag; u8 intf_flag; u8 intf_type; @@ -939,14 +939,14 @@ enum p2p_ps_state { P2P_PS_ENABLE = 1, P2P_PS_SCAN = 2, P2P_PS_SCAN_DONE = 3, - P2P_PS_ALLSTASLEEP = 4, // for P2P GO + P2P_PS_ALLSTASLEEP = 4, /* for P2P GO */ }; enum p2p_ps_mode { P2P_PS_NONE = 0, P2P_PS_CTWINDOW = 1, P2P_PS_NOA = 2, - P2P_PS_MIX = 3, // CTWindow and NoA + P2P_PS_MIX = 3, /* CTWindow and NoA */ }; struct rtl_p2p_ps_info { @@ -969,7 +969,7 @@ struct rtl_p2p_ps_info { u32 noa_start_time[P2P_MAX_NOA_NUM]; }; - struct p2p_ps_offload_t { +struct p2p_ps_offload_t { u8 Offload_En:1; u8 role:1; /* 1: Owner, 0: Client */ u8 CTWindow_En:1; @@ -981,7 +981,7 @@ struct rtl_p2p_ps_info { }; #define IQK_MATRIX_REG_NUM 8 -#define IQK_MATRIX_SETTINGS_NUM (14+24+21) // Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G +#define IQK_MATRIX_SETTINGS_NUM (14+24+21) /* Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G */ struct iqk_matrix_regs { bool b_iqk_done; long value[1][IQK_MATRIX_REG_NUM]; @@ -1074,31 +1074,31 @@ struct rtl_phy { enum rt_polarity_ctl polarity_ctl; }; -#define RTL_AGG_STOP 0 +#define RTL_AGG_STOP 0 #define RTL_AGG_PROGRESS 1 -#define RTL_AGG_START 2 +#define RTL_AGG_START 2 #define RTL_AGG_OPERATIONAL 3 -#define RTL_RX_AGG_START 1 -#define RTL_RX_AGG_STOP 0 +#define RTL_RX_AGG_START 1 +#define RTL_RX_AGG_STOP 0 struct rtl_priv; 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 */ - void (*write8_async) (struct rtl_priv * rtlpriv, u32 addr, u8 val); - void (*write16_async) (struct rtl_priv * rtlpriv, u32 addr, u16 val); - void (*write32_async) (struct rtl_priv * rtlpriv, u32 addr, u32 val); + void (*write8_async)(struct rtl_priv *rtlpriv, u32 addr, u8 val); + void (*write16_async)(struct rtl_priv *rtlpriv, u32 addr, u16 val); + void (*write32_async)(struct rtl_priv *rtlpriv, u32 addr, u32 val); - u8(*read8_sync) (struct rtl_priv * rtlpriv, u32 addr); - u16(*read16_sync) (struct rtl_priv * rtlpriv, u32 addr); - u32(*read32_sync) (struct rtl_priv * rtlpriv, u32 addr); + u8 (*read8_sync)(struct rtl_priv *rtlpriv, u32 addr); + u16 (*read16_sync)(struct rtl_priv *rtlpriv, u32 addr); + u32 (*read32_sync)(struct rtl_priv *rtlpriv, u32 addr); }; @@ -1256,7 +1256,7 @@ struct rtl_security { bool use_defaultkey; /*Encryption Algorithm for Unicast Packet */ enum rt_enc_alg pairwise_enc_algorithm; - /*Encryption Algorithm for Brocast/Multicast */ + /*Encryption Algorithm for Broadcast/Multicast */ enum rt_enc_alg group_enc_algorithm; /*Cam Entry Bitmap */ u32 hwsec_cam_bitmap; @@ -1317,9 +1317,9 @@ struct rtl_pstbl { }; -#define ASSOCIATE_ENTRY_NUM 32+1 +#define ASSOCIATE_ENTRY_NUM (32+1) -struct fast_ant_trainning{ +struct fast_ant_trainning { u8 bssid[6]; u8 antsel_rx_keep_0; u8 antsel_rx_keep_1; @@ -1427,19 +1427,19 @@ struct rtl_dm { char bb_swing_diff_5g; u8 delta_swing_table_idx_24gccka_p[DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_24gccka_n[DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_24gcckb_p[DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_24gccka_n[DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_24gcckb_p[DELTA_SWINGIDX_SIZE]; u8 delta_swing_table_idx_24gcckb_n[DELTA_SWINGIDX_SIZE]; u8 delta_swing_table_idx_24ga_p[DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_24ga_n[DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_24gb_p[DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_24gb_n[DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_5ga_p[BAND_NUM][DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_5ga_n[BAND_NUM][DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_5gb_p[BAND_NUM][DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_5gb_n[BAND_NUM][DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_24ga_p_8188e[DELTA_SWINGIDX_SIZE]; - u8 delta_swing_table_idx_24ga_n_8188e[DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_24ga_n[DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_24gb_p[DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_24gb_n[DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_5ga_p[BAND_NUM][DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_5ga_n[BAND_NUM][DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_5gb_p[BAND_NUM][DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_5gb_n[BAND_NUM][DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_24ga_p_8188e[DELTA_SWINGIDX_SIZE]; + u8 delta_swing_table_idx_24ga_n_8188e[DELTA_SWINGIDX_SIZE]; /* DMSP */ @@ -1451,7 +1451,7 @@ struct rtl_dm { struct fast_ant_trainning fat_table; u8 resp_tx_path; - u8 path_sel; + u8 path_sel; u32 patha_sum; u32 pathb_sum; u32 patha_cnt; @@ -1671,7 +1671,6 @@ struct rtl_stats { u8 rx_mimo_evm_dbm[4]; u16 cfo_short[4]; /* per-path's Cfo_short */ u16 cfo_tail[4]; - u8 rx_pwr[4]; /* per-path's pwdb */ u8 rx_snr[4]; /* per-path's SNR */ u8 bandwidth; @@ -1692,7 +1691,7 @@ struct rtl_stats { }; struct rt_link_detect { - /* count for raoming */ + /* count for roaming */ u32 bcn_rx_inperiod; u32 roam_times; @@ -1756,48 +1755,48 @@ struct proxim { void *proximity_priv; int (*proxim_rx)(struct ieee80211_hw *hw, struct rtl_stats *status, struct sk_buff *skb); - u8 (*proxim_get_var)(struct ieee80211_hw *hw, u8 type); + u8 (*proxim_get_var)(struct ieee80211_hw *hw, u8 type); }; struct rtl_hal_ops { - int (*init_sw_vars) (struct ieee80211_hw * hw); - void (*deinit_sw_vars) (struct ieee80211_hw * hw); - void (*read_eeprom_info) (struct ieee80211_hw * hw); - void (*interrupt_recognized) (struct ieee80211_hw * hw, - u32 * p_inta, u32 * p_intb); - int (*hw_init) (struct ieee80211_hw * hw); - void (*hw_disable) (struct ieee80211_hw * hw); - void (*hw_suspend) (struct ieee80211_hw * hw); - void (*hw_resume) (struct ieee80211_hw * hw); - void (*enable_interrupt) (struct ieee80211_hw * hw); - void (*disable_interrupt) (struct ieee80211_hw * hw); - int (*set_network_type) (struct ieee80211_hw * hw, - enum nl80211_iftype type); + int (*init_sw_vars)(struct ieee80211_hw *hw); + void (*deinit_sw_vars)(struct ieee80211_hw *hw); + void (*read_eeprom_info)(struct ieee80211_hw *hw); + void (*interrupt_recognized)(struct ieee80211_hw *hw, + u32 *p_inta, u32 *p_intb); + int (*hw_init)(struct ieee80211_hw *hw); + void (*hw_disable)(struct ieee80211_hw *hw); + void (*hw_suspend)(struct ieee80211_hw *hw); + void (*hw_resume)(struct ieee80211_hw *hw); + void (*enable_interrupt)(struct ieee80211_hw *hw); + void (*disable_interrupt)(struct ieee80211_hw *hw); + int (*set_network_type)(struct ieee80211_hw *hw, + enum nl80211_iftype type); void (*set_chk_bssid)(struct ieee80211_hw *hw, bool check_bssid); - void (*set_bw_mode) (struct ieee80211_hw * hw, - enum nl80211_channel_type ch_type); - u8(*switch_channel) (struct ieee80211_hw * hw); - void (*set_qos) (struct ieee80211_hw * hw, int aci); - void (*set_bcn_reg) (struct ieee80211_hw * hw); - void (*set_bcn_intv) (struct ieee80211_hw * hw); - void (*update_interrupt_mask) (struct ieee80211_hw * hw, - u32 add_msr, u32 rm_msr); - void (*get_hw_reg) (struct ieee80211_hw * hw, u8 variable, u8 * val); - void (*set_hw_reg) (struct ieee80211_hw * hw, u8 variable, u8 * val); - void (*update_rate_tbl) (struct ieee80211_hw * hw, - struct ieee80211_sta *sta, u8 rssi_level); - void (*pre_fill_tx_bd_desc) (struct ieee80211_hw *hw, u8 *tx_bd_desc, - u8 *desc, u8 queue_index, - struct sk_buff *skb, dma_addr_t addr); - u16 (*rx_desc_buff_remained_cnt) (struct ieee80211_hw *hw, - u8 queue_index); - void (*rx_check_dma_ok) (struct ieee80211_hw *hw, u8 *header_desc, - u8 queue_index); - void (*fill_tx_desc) (struct ieee80211_hw * hw, - struct ieee80211_hdr * hdr, - u8 * pdesc_tx, u8 * pbd_desc, - struct ieee80211_tx_info * info, + void (*set_bw_mode)(struct ieee80211_hw *hw, + enum nl80211_channel_type ch_type); + u8 (*switch_channel)(struct ieee80211_hw *hw); + void (*set_qos)(struct ieee80211_hw *hw, int aci); + void (*set_bcn_reg)(struct ieee80211_hw *hw); + void (*set_bcn_intv)(struct ieee80211_hw *hw); + void (*update_interrupt_mask)(struct ieee80211_hw *hw, + u32 add_msr, u32 rm_msr); + void (*get_hw_reg)(struct ieee80211_hw *hw, u8 variable, u8 *val); + void (*set_hw_reg)(struct ieee80211_hw *hw, u8 variable, u8 *val); + void (*update_rate_tbl)(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, u8 rssi_level); + void (*pre_fill_tx_bd_desc)(struct ieee80211_hw *hw, u8 *tx_bd_desc, + u8 *desc, u8 queue_index, + struct sk_buff *skb, dma_addr_t addr); + u16 (*rx_desc_buff_remained_cnt)(struct ieee80211_hw *hw, + u8 queue_index); + void (*rx_check_dma_ok)(struct ieee80211_hw *hw, u8 *header_desc, + u8 queue_index); + void (*fill_tx_desc)(struct ieee80211_hw *hw, + struct ieee80211_hdr *hdr, + u8 *pdesc_tx, u8 *pbd_desc, + struct ieee80211_tx_info *info, /*<delete in kernel start>*/ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)) /*<delete in kernel end>*/ @@ -1805,74 +1804,77 @@ struct rtl_hal_ops { /*<delete in kernel start>*/ #endif /*<delete in kernel end>*/ - struct sk_buff * skb, u8 hw_queue, + struct sk_buff *skb, u8 hw_queue, struct rtl_tcb_desc *ptcb_desc); - void (*fill_tx_cmddesc) (struct ieee80211_hw * hw, u8 * pdesc, - bool b_firstseg, bool b_lastseg, - struct sk_buff * skb); - bool(*query_rx_desc) (struct ieee80211_hw * hw, - struct rtl_stats * status, - struct ieee80211_rx_status * rx_status, - u8 * pdesc, struct sk_buff * skb); - void (*set_channel_access) (struct ieee80211_hw * hw); - bool(*radio_onoff_checking) (struct ieee80211_hw * hw, u8 * valid); - void (*dm_watchdog) (struct ieee80211_hw * hw); - void (*scan_operation_backup) (struct ieee80211_hw * hw, u8 operation); - bool(*set_rf_power_state) (struct ieee80211_hw * hw, - enum rf_pwrstate rfpwr_state); - void (*led_control) (struct ieee80211_hw * hw, - enum led_ctl_mode ledaction); - void (*set_desc) (struct ieee80211_hw *hw, u8 * pdesc, bool istx, - u8 desc_name, u8 * val); - u32(*get_desc) (u8 * pdesc, bool istx, u8 desc_name); - bool (*is_tx_desc_closed) (struct ieee80211_hw *hw, - u8 hw_queue, u16 index); - void (*tx_polling) (struct ieee80211_hw * hw, u8 hw_queue); - void (*enable_hw_sec) (struct ieee80211_hw * hw); - void (*set_key) (struct ieee80211_hw * hw, u32 key_index, - u8 * p_macaddr, bool is_group, u8 enc_algo, - bool is_wepkey, bool clear_all); - void (*init_sw_leds) (struct ieee80211_hw * hw); - u32(*get_bbreg) (struct ieee80211_hw * hw, u32 regaddr, u32 bitmask); - void (*set_bbreg) (struct ieee80211_hw * hw, u32 regaddr, u32 bitmask, - u32 data); - u32(*get_rfreg) (struct ieee80211_hw * hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask); - void (*set_rfreg) (struct ieee80211_hw * hw, enum radio_path rfpath, - u32 regaddr, u32 bitmask, u32 data); + void (*fill_tx_cmddesc)(struct ieee80211_hw *hw, u8 *pdesc, + bool b_firstseg, bool b_lastseg, + struct sk_buff *skb); + bool (*query_rx_desc)(struct ieee80211_hw *hw, + struct rtl_stats *status, + struct ieee80211_rx_status *rx_status, + u8 *pdesc, struct sk_buff *skb); + void (*set_channel_access)(struct ieee80211_hw *hw); + bool (*radio_onoff_checking)(struct ieee80211_hw *hw, u8 *valid); + void (*dm_watchdog)(struct ieee80211_hw *hw); + void (*scan_operation_backup)(struct ieee80211_hw *hw, u8 operation); + bool (*set_rf_power_state)(struct ieee80211_hw *hw, + enum rf_pwrstate rfpwr_state); + void (*led_control)(struct ieee80211_hw *hw, + enum led_ctl_mode ledaction); + void (*set_desc)(struct ieee80211_hw *hw, u8 *pdesc, bool istx, + u8 desc_name, u8 *val); + u32 (*get_desc)(u8 *pdesc, bool istx, u8 desc_name); + bool (*is_tx_desc_closed)(struct ieee80211_hw *hw, + u8 hw_queue, u16 index); + void (*tx_polling)(struct ieee80211_hw *hw, u8 hw_queue); + void (*enable_hw_sec)(struct ieee80211_hw *hw); + void (*set_key)(struct ieee80211_hw *hw, u32 key_index, + u8 *p_macaddr, bool is_group, u8 enc_algo, + bool is_wepkey, bool clear_all); + void (*init_sw_leds)(struct ieee80211_hw *hw); + u32 (*get_bbreg)(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask); + void (*set_bbreg)(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask, + u32 data); + u32 (*get_rfreg)(struct ieee80211_hw *hw, enum radio_path rfpath, + u32 regaddr, u32 bitmask); + void (*set_rfreg)(struct ieee80211_hw *hw, enum radio_path rfpath, + u32 regaddr, u32 bitmask, u32 data); void (*allow_all_destaddr)(struct ieee80211_hw *hw, - bool allow_all_da, bool write_into_reg); - void (*linked_set_reg) (struct ieee80211_hw * hw); - void (*check_switch_to_dmdp) (struct ieee80211_hw * hw); - void (*dualmac_easy_concurrent) (struct ieee80211_hw *hw); - void (*dualmac_switch_to_dmdp) (struct ieee80211_hw *hw); - void (*c2h_command_handle) (struct ieee80211_hw *hw); - void (*bt_wifi_media_status_notify) (struct ieee80211_hw *hw, bool mstate); - void (*bt_turn_off_bt_coexist_before_enter_lps) (struct ieee80211_hw *hw); - void (*fill_h2c_cmd) (struct ieee80211_hw *hw, u8 element_id, - u32 cmd_len, u8 *p_cmdbuffer); - bool (*get_btc_status) (void); - u32 (*rx_command_packet_handler)(struct ieee80211_hw *hw, struct rtl_stats status, struct sk_buff *skb); + bool allow_all_da, bool write_into_reg); + void (*linked_set_reg)(struct ieee80211_hw *hw); + void (*check_switch_to_dmdp)(struct ieee80211_hw *hw); + void (*dualmac_easy_concurrent)(struct ieee80211_hw *hw); + void (*dualmac_switch_to_dmdp)(struct ieee80211_hw *hw); + void (*c2h_command_handle)(struct ieee80211_hw *hw); + void (*bt_wifi_media_status_notify)(struct ieee80211_hw *hw, + bool mstate); + void (*bt_turn_off_bt_coexist_before_enter_lps)(struct ieee80211_hw *hw); + void (*fill_h2c_cmd)(struct ieee80211_hw *hw, u8 element_id, + u32 cmd_len, u8 *p_cmdbuffer); + bool (*get_btc_status)(void); + u32 (*rx_command_packet_handler)(struct ieee80211_hw *hw, + struct rtl_stats status, + struct sk_buff *skb); }; struct rtl_intf_ops { /*com */ void (*read_efuse_byte)(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); - int (*adapter_start) (struct ieee80211_hw * hw); - void (*adapter_stop) (struct ieee80211_hw * hw); + int (*adapter_start)(struct ieee80211_hw *hw); + void (*adapter_stop)(struct ieee80211_hw *hw); bool (*check_buddy_priv)(struct ieee80211_hw *hw, - struct rtl_priv **buddy_priv); + struct rtl_priv **buddy_priv); /*<delete in kernel start>*/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - int (*adapter_tx) (struct ieee80211_hw * hw, struct sk_buff * skb, - struct rtl_tcb_desc *ptcb_desc); + int (*adapter_tx)(struct ieee80211_hw *hw, struct sk_buff *skb, + struct rtl_tcb_desc *ptcb_desc); #else /*<delete in kernel end>*/ - int (*adapter_tx) (struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb, - struct rtl_tcb_desc *ptcb_desc); + int (*adapter_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>*/ @@ -1881,22 +1883,22 @@ struct rtl_intf_ops { #else void (*flush)(struct ieee80211_hw *hw, bool drop); #endif - int (*reset_trx_ring) (struct ieee80211_hw * hw); + int (*reset_trx_ring)(struct ieee80211_hw *hw); /*<delete in kernel start>*/ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)) - bool (*waitq_insert) (struct ieee80211_hw *hw, struct sk_buff *skb); + bool (*waitq_insert)(struct ieee80211_hw *hw, struct sk_buff *skb); #else /*<delete in kernel end>*/ - bool (*waitq_insert) (struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - struct sk_buff *skb); + bool (*waitq_insert)(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, + struct sk_buff *skb); /*<delete in kernel start>*/ #endif /*<delete in kernel end>*/ /*pci */ - void (*disable_aspm) (struct ieee80211_hw * hw); - void (*enable_aspm) (struct ieee80211_hw * hw); + void (*disable_aspm)(struct ieee80211_hw *hw); + void (*enable_aspm)(struct ieee80211_hw *hw); /*usb */ }; @@ -2027,21 +2029,21 @@ struct rtl_btc_info { }; struct rtl_btc_ops { - void (*btc_init_variables) (struct rtl_priv *rtlpriv); - void (*btc_init_hal_vars) (struct rtl_priv *rtlpriv); - void (*btc_init_hw_config) (struct rtl_priv *rtlpriv); - void (*btc_ips_notify) (struct rtl_priv *rtlpriv, u8 type); - void (*btc_scan_notify) (struct rtl_priv *rtlpriv, u8 scantype); - void (*btc_connect_notify) (struct rtl_priv *rtlpriv, u8 action); - void (*btc_mediastatus_notify) (struct rtl_priv *rtlpriv, - enum rt_media_status mstatus); - void (*btc_periodical) (struct rtl_priv *rtlpriv); - void (*btc_halt_notify) (void); - void (*btc_btinfo_notify) (struct rtl_priv *rtlpriv, - u8 * tmp_buf, u8 length); - bool (*btc_is_limited_dig) (struct rtl_priv *rtlpriv); - bool (*btc_is_disable_edca_turbo) (struct rtl_priv *rtlpriv); - bool (*btc_is_bt_disabled) (struct rtl_priv *rtlpriv); + void (*btc_init_variables)(struct rtl_priv *rtlpriv); + void (*btc_init_hal_vars)(struct rtl_priv *rtlpriv); + void (*btc_init_hw_config)(struct rtl_priv *rtlpriv); + void (*btc_ips_notify)(struct rtl_priv *rtlpriv, u8 type); + void (*btc_scan_notify)(struct rtl_priv *rtlpriv, u8 scantype); + void (*btc_connect_notify)(struct rtl_priv *rtlpriv, u8 action); + void (*btc_mediastatus_notify)(struct rtl_priv *rtlpriv, + enum rt_media_status mstatus); + void (*btc_periodical)(struct rtl_priv *rtlpriv); + void (*btc_halt_notify)(void); + void (*btc_btinfo_notify)(struct rtl_priv *rtlpriv, + u8 *tmp_buf, u8 length); + bool (*btc_is_limited_dig)(struct rtl_priv *rtlpriv); + bool (*btc_is_disable_edca_turbo)(struct rtl_priv *rtlpriv); + bool (*btc_is_bt_disabled)(struct rtl_priv *rtlpriv); }; struct rtl_bt_coexist { @@ -2087,7 +2089,7 @@ struct rtl_priv { /* *hal_cfg : for diff cards - *intf_ops : for diff interrface usb/pcie + *intf_ops : for diff interface usb/pcie */ struct rtl_hal_cfg *cfg; struct rtl_intf_ops *intf_ops; @@ -2105,7 +2107,7 @@ struct rtl_priv { /*for bt coexist use*/ struct rtl_bt_coexist btcoexist; - /* seperate 92ee from other ICs, + /* separate 92ee from other ICs, * 92ee use new trx flow. */ bool use_new_trx_flow; /*This must be the last item so @@ -2120,57 +2122,57 @@ struct rtl_priv { #define rtl_hal(rtlpriv) (&((rtlpriv)->rtlhal)) #define rtl_efuse(rtlpriv) (&((rtlpriv)->efuse)) #define rtl_psc(rtlpriv) (&((rtlpriv)->psc)) -#define rtl_sec(rtlpriv) (&((rtlpriv)->sec)) -#define rtl_dm(rtlpriv) (&((rtlpriv)->dm)) +#define rtl_sec(rtlpriv) (&((rtlpriv)->sec)) +#define rtl_dm(rtlpriv) (&((rtlpriv)->dm)) /*************************************** Bluetooth Co-existance Related ****************************************/ enum bt_ant_num { - ANT_X2 = 0, - ANT_X1 = 1, + ANT_X2 = 0, + ANT_X1 = 1, }; enum bt_co_type { - BT_2WIRE = 0, - BT_ISSC_3WIRE = 1, - BT_ACCEL = 2, - BT_CSR_BC4 = 3, - BT_CSR_BC8 = 4, - BT_RTL8756 = 5, - BT_RTL8723A = 6, - BT_RTL8821A = 7, - BT_RTL8723B = 8, - BT_RTL8192E = 9, - BT_RTL8812A = 11, -}; - -enum bt_total_ant_num{ + BT_2WIRE = 0, + BT_ISSC_3WIRE = 1, + BT_ACCEL = 2, + BT_CSR_BC4 = 3, + BT_CSR_BC8 = 4, + BT_RTL8756 = 5, + BT_RTL8723A = 6, + BT_RTL8821A = 7, + BT_RTL8723B = 8, + BT_RTL8192E = 9, + BT_RTL8812A = 11, +}; + +enum bt_total_ant_num { ANT_TOTAL_X2 = 0, ANT_TOTAL_X1 = 1 }; enum bt_cur_state { - BT_OFF = 0, - BT_ON = 1, + BT_OFF = 0, + BT_ON = 1, }; enum bt_service_type { - BT_SCO = 0, - BT_A2DP = 1, - BT_HID = 2, - BT_HID_IDLE = 3, - BT_SCAN = 4, - BT_IDLE = 5, - BT_OTHER_ACTION = 6, - BT_BUSY = 7, - BT_OTHERBUSY = 8, - BT_PAN = 9, + BT_SCO = 0, + BT_A2DP = 1, + BT_HID = 2, + BT_HID_IDLE = 3, + BT_SCAN = 4, + BT_IDLE = 5, + BT_OTHER_ACTION = 6, + BT_BUSY = 7, + BT_OTHERBUSY = 8, + BT_PAN = 9, }; enum bt_radio_shared { - BT_RADIO_SHARED = 0, - BT_RADIO_INDIVIDUAL = 1, + BT_RADIO_SHARED = 0, + BT_RADIO_INDIVIDUAL = 1, }; struct bt_coexist_info { @@ -2255,11 +2257,11 @@ struct bt_coexist_info { /* Write data to memory */ #define WRITEEF1BYTE(_ptr, _val) \ - (*((u8 *)(_ptr)))=EF1BYTE(_val) + ((*((u8 *)(_ptr))) = EF1BYTE(_val)) #define WRITEEF2BYTE(_ptr, _val) \ - (*((u16 *)(_ptr)))=EF2BYTE(_val) + ((*((u16 *)(_ptr))) = EF2BYTE(_val)) #define WRITEEF4BYTE(_ptr, _val) \ - (*((u32 *)(_ptr)))=EF4BYTE(_val) + ((*((u32 *)(_ptr))) = EF4BYTE(_val)) /*Example: BIT_LEN_MASK_32(0) => 0x00000000 @@ -2298,17 +2300,17 @@ Translate subfield (continuous bits in little-endian) of 4-byte value to host byte ordering.*/ #define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ ( \ - ( LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset) ) & \ + (LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset)) & \ BIT_LEN_MASK_32(__bitlen) \ ) #define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \ ( \ - ( LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset) ) & \ + (LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \ BIT_LEN_MASK_16(__bitlen) \ ) #define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \ ( \ - ( LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset) ) & \ + (LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \ BIT_LEN_MASK_8(__bitlen) \ ) @@ -2318,17 +2320,17 @@ and return the result in 4-byte value in host byte ordering.*/ #define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ ( \ LE_P4BYTE_TO_HOST_4BYTE(__pstart) & \ - ( ~BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) ) \ + (~BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen)) \ ) #define LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) \ ( \ LE_P2BYTE_TO_HOST_2BYTE(__pstart) & \ - ( ~BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) ) \ + (~BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen)) \ ) #define LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) \ ( \ LE_P1BYTE_TO_HOST_1BYTE(__pstart) & \ - ( ~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen) ) \ + (~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \ ) /*Description: @@ -2337,19 +2339,19 @@ Set subfield of little-endian 4-byte value to specified value. */ *((u32 *)(__pstart)) = EF4BYTE \ ( \ LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \ - ( (((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset) )\ + ((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset))\ ); #define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \ *((u16 *)(__pstart)) = EF2BYTE \ ( \ LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \ - ( (((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset) )\ + ((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset))\ ); #define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \ *((u8 *)(__pstart)) = EF1BYTE \ ( \ LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) | \ - ( (((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset) ) \ + ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \ ); #define N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \ @@ -2359,18 +2361,18 @@ Set subfield of little-endian 4-byte value to specified value. */ mem access macro define end ****************************************/ -#define byte(x,n) ((x >> (8 * n)) & 0xff) +#define byte(x, n) ((x >> (8 * n)) & 0xff) #define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC) -#define RTL_WATCH_DOG_TIME 2000 +#define RTL_WATCH_DOG_TIME 2000 #define MSECS(t) msecs_to_jiffies(t) -#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS) -#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) -#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) -#define WLAN_FC_MORE_DATA(fc) ((fc) & IEEE80211_FCTL_MOREDATA) -#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) -#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) -#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) +#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS) +#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) +#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) +#define WLAN_FC_MORE_DATA(fc) ((fc) & IEEE80211_FCTL_MOREDATA) +#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) +#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) +#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) #define RT_RF_OFF_LEVL_ASPM BIT(0) /*PCI ASPM */ #define RT_RF_OFF_LEVL_CLK_REQ BIT(1) /*PCI clock request */ @@ -2383,7 +2385,7 @@ Set subfield of little-endian 4-byte value to specified value. */ #define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT(6) /* no matter RFOFF or SLEEP we set PS_ASPM_LEVL*/ #define RT_PS_LEVEL_ASPM BIT(7) -/*When LPS is on, disable 2R if no packet is received or transmittd.*/ +/*When LPS is on, disable 2R if no packet is received or transmitted.*/ #define RT_RF_LPS_DISALBE_2R BIT(30) #define RT_RF_LPS_LEVEL_ASPM BIT(31) /*LPS with ASPM */ #define RT_IN_PS_LEVEL(ppsc, _ps_flg) \ @@ -2397,13 +2399,13 @@ Set subfield of little-endian 4-byte value to specified value. */ container_of(container_of(x, struct delayed_work, work), y, z) #define FILL_OCTET_STRING(_os,_octet,_len) \ - (_os).octet=(u8*)(_octet); \ - (_os).length=(_len); + (_os).octet = (u8 *)(_octet); \ + (_os).length = (_len); #define CP_MACADDR(des,src) \ - ((des)[0]=(src)[0],(des)[1]=(src)[1],\ - (des)[2]=(src)[2],(des)[3]=(src)[3],\ - (des)[4]=(src)[4],(des)[5]=(src)[5]) + ((des)[0] = (src)[0],(des)[1] = (src)[1],\ + (des)[2] = (src)[2],(des)[3] = (src)[3],\ + (des)[4] = (src)[4],(des)[5] = (src)[5]) static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) { |
