diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-15 18:06:13 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-15 18:06:13 -0800 |
commit | dab363f938a53ddaee60bfecc1aebdbb3d3af5f0 (patch) | |
tree | ccdb11a6e6191ba71fbc7716714c47b79172070d /drivers/staging/rtl8723au | |
parent | a68db9cb858d10820add66682ad4d412f9914288 (diff) | |
parent | 17d2c6439be65777245914be354c5a97c76ad246 (diff) |
Merge tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH:
"Here's the big staging tree pull request for 3.19-rc1.
We continued to delete more lines than were added, always a good
thing, but not at a huge rate this release, only about 70k lines
removed overall mostly from removing the horrid bcm driver.
Lots of normal staging driver cleanups and fixes all over the place,
well over a thousand of them, the shortlog shows all the horrid
details.
The "contentious" thing here is the movement of the Android binder
code out of staging into the "real" part of the kernel. This is code
that has been stable for a few years now and is working as-is in the
tens of millions of devices with no issues. Yes, the code is horrid,
and the userspace api leaves a lot to be desired, but it's not going
to change due to legacy issues that we have no control over. Because
so many devices and companies rely on this, and the code is stable,
might as well promote it out of staging.
This was all discussed at the Linux Plumbers conference, and everyone
participating agreed that this was the best way forward.
There is work happening to replace the binder code with something new
that is happening right now, but I don't expect to see the results of
that work for another year at the earliest. If that ever happens, and
Android switches over to it, I'll gladly remove this version.
As for maintainers, I'll be glad to maintain this code, I've been
doing it for the past few years with no problems. I'll send a
MAINTAINERS entry for it before 3.19-final is out, still need to talk
to the Google developers about if they are willing to help with it or
not, last I checked they were, which was good.
All of these patches have been in linux-next for a while with no
reported issues"
* tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1382 commits)
Staging: slicoss: Fix long line issues in slicoss.c
staging: rtl8712: remove unnecessary else after return
staging: comedi: change some printk calls to pr_err
staging: rtl8723au: hal: Removed the extra semicolon
lustre: Deletion of unnecessary checks before three function calls
staging: lustre: fix sparse warnings: static function declaration
staging: lustre: fixed sparse warnings related to static declarations
staging: unisys: remove duplicate header
staging: unisys: remove unneeded structure
staging: ft1000 : replace __attribute ((__packed__) with __packed
drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c"
Drivers:staging:rtl8192e: Fixed checkpatch warning
Drivers:staging:clocking-wizard: Added a newline
staging: clocking-wizard: check for a valid clk_name pointer
staging: rtl8723au: Hal_InitPGData() avoid unnecessary typecasts
staging: rtl8723au: _DisableAnalog(): Avoid zero-init variables unnecessarily
staging: rtl8723au: Remove unnecessary wrapper _ResetDigitalProcedure1()
staging: rtl8723au: _ResetDigitalProcedure1_92C() reduce code obfuscation
staging: rtl8723au: Remove unnecessary wrapper _DisableRFAFEAndResetBB()
staging: rtl8723au: _DisableRFAFEAndResetBB8192C(): Reduce code obfuscation
...
Diffstat (limited to 'drivers/staging/rtl8723au')
49 files changed, 733 insertions, 3966 deletions
diff --git a/drivers/staging/rtl8723au/Makefile b/drivers/staging/rtl8723au/Makefile index a9aae2163639..3e8989018a88 100644 --- a/drivers/staging/rtl8723au/Makefile +++ b/drivers/staging/rtl8723au/Makefile @@ -2,7 +2,6 @@ r8723au-y := \ core/rtw_cmd.o \ core/rtw_efuse.o \ core/rtw_ieee80211.o \ - core/rtw_led.o \ core/rtw_mlme.o \ core/rtw_mlme_ext.o \ core/rtw_pwrctrl.o \ @@ -33,8 +32,6 @@ r8723au-y := \ hal/rtl8723a_rf6052.o \ hal/rtl8723a_rxdesc.o \ hal/rtl8723a_sreset.o \ - hal/rtl8723a_xmit.o \ - hal/rtl8723au_led.o \ hal/rtl8723au_recv.o \ hal/rtl8723au_xmit.o \ hal/usb_halinit.o \ diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c index 6b4092f05da5..e394d12c36b0 100644 --- a/drivers/staging/rtl8723au/core/rtw_ap.c +++ b/drivers/staging/rtl8723au/core/rtw_ap.c @@ -231,12 +231,10 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) psta->expire_to--; } - if (psta->expire_to <= 0) - { + if (psta->expire_to <= 0) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - if (padapter->registrypriv.wifi_spec == 1) - { + if (padapter->registrypriv.wifi_spec == 1) { psta->expire_to = pstapriv->expire_to; continue; } @@ -308,15 +306,12 @@ void expire_timeout_chk23a(struct rtw_adapter *padapter) ret = issue_nulldata23a(padapter, psta->hwaddr, 0, 3, 50); psta->keep_alive_trycnt++; - if (ret == _SUCCESS) - { + if (ret == _SUCCESS) { DBG_8723A("asoc check, sta(" MAC_FMT ") is alive\n", MAC_ARG(psta->hwaddr)); psta->expire_to = pstapriv->expire_to; psta->keep_alive_trycnt = 0; continue; - } - else if (psta->keep_alive_trycnt <= 3) - { + } else if (psta->keep_alive_trycnt <= 3) { DBG_8723A("ack check for asoc expire, keep_alive_trycnt =%d\n", psta->keep_alive_trycnt); psta->expire_to = 1; continue; @@ -363,8 +358,7 @@ void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_l return; /* b/g mode ra_bitmap */ - for (i = 0; i < sizeof(psta->bssrateset); i++) - { + for (i = 0; i < sizeof(psta->bssrateset); i++) { if (psta->bssrateset[i]) tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value23a(psta->bssrateset[i]&0x7f); } @@ -406,8 +400,7 @@ void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_l raid = networktype_to_raid23a(sta_band); init_rate = get_highest_rate_idx23a(tx_ra_bitmap&0x0fffffff)&0x3f; - if (psta->aid < NUM_STA) - { + if (psta->aid < NUM_STA) { u8 arg = 0; arg = psta->mac_id&0x1f; @@ -436,11 +429,8 @@ void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_l psta->raid = raid; psta->init_rate = init_rate; - } - else - { + } else DBG_8723A("station aid %d exceed the max number\n", psta->aid); - } } static void update_bmc_sta(struct rtw_adapter *padapter) @@ -453,8 +443,7 @@ static void update_bmc_sta(struct rtw_adapter *padapter) struct wlan_bssid_ex *pcur_network = &pmlmepriv->cur_network.network; struct sta_info *psta = rtw_get_bcmc_stainfo23a(padapter); - if (psta) - { + if (psta) { psta->aid = 0;/* default set to 0 */ psta->mac_id = psta->aid + 1; @@ -474,8 +463,7 @@ static void update_bmc_sta(struct rtw_adapter *padapter) psta->bssratelen = supportRateNum; /* b/g mode ra_bitmap */ - for (i = 0; i < supportRateNum; i++) - { + for (i = 0; i < supportRateNum; i++) { if (psta->bssrateset[i]) tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value23a(psta->bssrateset[i]&0x7f); } @@ -522,11 +510,8 @@ static void update_bmc_sta(struct rtw_adapter *padapter) psta->state = _FW_LINKED; spin_unlock_bh(&psta->lock); - } - else - { + } else DBG_8723A("add_RATid23a_bmc_sta error!\n"); - } } /* notes: */ @@ -561,8 +546,7 @@ void update_sta_info23a_apmode23a(struct rtw_adapter *padapter, struct sta_info /* ERP */ VCS_update23a(padapter, psta); /* HT related cap */ - if (phtpriv_sta->ht_option) - { + if (phtpriv_sta->ht_option) { /* check if sta supports rx ampdu */ phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable; @@ -580,9 +564,7 @@ void update_sta_info23a_apmode23a(struct rtw_adapter *padapter, struct sta_info psta->qos_option = true; - } - else - { + } else { phtpriv_sta->ampdu_enable = false; phtpriv_sta->sgi = false; @@ -654,7 +636,7 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf) bcn_interval = (u16)pnetwork->beacon_interval; cur_channel = pnetwork->DSConfig; - cur_bwmode = HT_CHANNEL_WIDTH_20;; + cur_bwmode = HT_CHANNEL_WIDTH_20; cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; /* check if there is wps ie, */ @@ -1122,7 +1104,6 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) struct sta_priv *pstapriv = &padapter->stapriv; struct wlan_acl_pool *pacl_list = &pstapriv->acl_list; struct rtw_queue *pacl_node_q = &pacl_list->acl_node_q; - int ret = 0; DBG_8723A("%s(acl_num =%d) = %pM\n", __func__, pacl_list->num, addr); @@ -1148,7 +1129,7 @@ int rtw_acl_remove_sta23a(struct rtw_adapter *padapter, u8 *addr) DBG_8723A("%s, acl_num =%d\n", __func__, pacl_list->num); - return ret; + return 0; } static void update_bcn_fixed_ie(struct rtw_adapter *padapter) @@ -1217,8 +1198,6 @@ static void update_bcn_wmm_ie(struct rtw_adapter *padapter) static void update_bcn_wps_ie(struct rtw_adapter *padapter) { DBG_8723A("%s\n", __func__); - - return; } static void update_bcn_p2p_ie(struct rtw_adapter *padapter) @@ -1261,8 +1240,7 @@ void update_beacon23a(struct rtw_adapter *padapter, u8 ie_id, u8 *oui, u8 tx) spin_lock_bh(&pmlmepriv->bcn_update_lock); - switch (ie_id) - { + switch (ie_id) { case 0xFF: /* 8: TimeStamp, 2: Beacon Interval 2:Capability */ update_bcn_fixed_ie(padapter); @@ -1389,8 +1367,7 @@ static int rtw_ht_operation_update(struct rtw_adapter *padapter) void associated_clients_update23a(struct rtw_adapter *padapter, u8 updated) { /* update associated stations cap. */ - if (updated == true) - { + if (updated == true) { struct list_head *phead, *plist, *ptmp; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; @@ -1416,34 +1393,27 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - if (!(psta->flags & WLAN_STA_SHORT_PREAMBLE)) - { - if (!psta->no_short_preamble_set) - { + if (!(psta->flags & WLAN_STA_SHORT_PREAMBLE)) { + if (!psta->no_short_preamble_set) { psta->no_short_preamble_set = 1; pmlmepriv->num_sta_no_short_preamble++; if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_preamble == 1)) - { + (pmlmepriv->num_sta_no_short_preamble == 1)) { beacon_updated = true; update_beacon23a(padapter, 0xFF, NULL, true); } } - } - else - { - if (psta->no_short_preamble_set) - { + } else { + if (psta->no_short_preamble_set) { psta->no_short_preamble_set = 0; pmlmepriv->num_sta_no_short_preamble--; if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_preamble == 0)) - { + (pmlmepriv->num_sta_no_short_preamble == 0)) { beacon_updated = true; update_beacon23a(padapter, 0xFF, NULL, true); } @@ -1451,32 +1421,25 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info } } - if (psta->flags & WLAN_STA_NONERP) - { - if (!psta->nonerp_set) - { + if (psta->flags & WLAN_STA_NONERP) { + if (!psta->nonerp_set) { psta->nonerp_set = 1; pmlmepriv->num_sta_non_erp++; - if (pmlmepriv->num_sta_non_erp == 1) - { + if (pmlmepriv->num_sta_non_erp == 1) { beacon_updated = true; update_beacon23a(padapter, WLAN_EID_ERP_INFO, NULL, true); } } - } - else - { - if (psta->nonerp_set) - { + } else { + if (psta->nonerp_set) { psta->nonerp_set = 0; pmlmepriv->num_sta_non_erp--; - if (pmlmepriv->num_sta_non_erp == 0) - { + if (pmlmepriv->num_sta_non_erp == 0) { beacon_updated = true; update_beacon23a(padapter, WLAN_EID_ERP_INFO, NULL, true); } @@ -1484,42 +1447,34 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info } - if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)) - { - if (!psta->no_short_slot_time_set) - { + if (!(psta->capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)) { + if (!psta->no_short_slot_time_set) { psta->no_short_slot_time_set = 1; pmlmepriv->num_sta_no_short_slot_time++; if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_slot_time == 1)) - { + (pmlmepriv->num_sta_no_short_slot_time == 1)) { beacon_updated = true; update_beacon23a(padapter, 0xFF, NULL, true); } } - } - else - { - if (psta->no_short_slot_time_set) - { + } else { + if (psta->no_short_slot_time_set) { psta->no_short_slot_time_set = 0; pmlmepriv->num_sta_no_short_slot_time--; if ((pmlmeext->cur_wireless_mode > WIRELESS_11B) && - (pmlmepriv->num_sta_no_short_slot_time == 0)) - { + (pmlmepriv->num_sta_no_short_slot_time == 0)) { beacon_updated = true; update_beacon23a(padapter, 0xFF, NULL, true); } } } - if (psta->flags & WLAN_STA_HT) - { + if (psta->flags & WLAN_STA_HT) { u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); DBG_8723A("HT: STA " MAC_FMT " HT Capabilities " @@ -1552,9 +1507,7 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info pmlmepriv->num_sta_ht_20mhz); } - } - else - { + } else { if (!psta->no_ht_set) { psta->no_ht_set = 1; pmlmepriv->num_sta_no_ht++; @@ -1567,8 +1520,7 @@ void bss_cap_update_on_sta_join23a(struct rtw_adapter *padapter, struct sta_info } } - if (rtw_ht_operation_update(padapter) > 0) - { + if (rtw_ht_operation_update(padapter) > 0) { update_beacon23a(padapter, WLAN_EID_HT_CAPABILITY, NULL, false); update_beacon23a(padapter, WLAN_EID_HT_OPERATION, NULL, true); } @@ -1592,8 +1544,7 @@ u8 bss_cap_update_on_sta_leave23a(struct rtw_adapter *padapter, struct sta_info psta->no_short_preamble_set = 0; pmlmepriv->num_sta_no_short_preamble--; if (pmlmeext->cur_wireless_mode > WIRELESS_11B - && pmlmepriv->num_sta_no_short_preamble == 0) - { + && pmlmepriv->num_sta_no_short_preamble == 0) { beacon_updated = true; update_beacon23a(padapter, 0xFF, NULL, true); } @@ -1602,8 +1553,7 @@ u8 bss_cap_update_on_sta_leave23a(struct rtw_adapter *padapter, struct sta_info if (psta->nonerp_set) { psta->nonerp_set = 0; pmlmepriv->num_sta_non_erp--; - if (pmlmepriv->num_sta_non_erp == 0) - { + if (pmlmepriv->num_sta_non_erp == 0) { beacon_updated = true; update_beacon23a(padapter, WLAN_EID_ERP_INFO, NULL, true); @@ -1614,8 +1564,7 @@ u8 bss_cap_update_on_sta_leave23a(struct rtw_adapter *padapter, struct sta_info psta->no_short_slot_time_set = 0; pmlmepriv->num_sta_no_short_slot_time--; if (pmlmeext->cur_wireless_mode > WIRELESS_11B - && pmlmepriv->num_sta_no_short_slot_time == 0) - { + && pmlmepriv->num_sta_no_short_slot_time == 0) { beacon_updated = true; update_beacon23a(padapter, 0xFF, NULL, true); } @@ -1636,8 +1585,7 @@ u8 bss_cap_update_on_sta_leave23a(struct rtw_adapter *padapter, struct sta_info pmlmepriv->num_sta_ht_20mhz--; } - if (rtw_ht_operation_update(padapter) > 0) - { + if (rtw_ht_operation_update(padapter) > 0) { update_beacon23a(padapter, WLAN_EID_HT_CAPABILITY, NULL, false); update_beacon23a(padapter, WLAN_EID_HT_OPERATION, NULL, true); } @@ -1657,8 +1605,7 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti if (!psta) return beacon_updated; - if (active == true) - { + if (active) { /* tear down Rx AMPDU */ send_delba23a(padapter, 0, psta->hwaddr);/* recipient */ @@ -1698,7 +1645,6 @@ u8 ap_free_sta23a(struct rtw_adapter *padapter, struct sta_info *psta, bool acti int rtw_ap_inform_ch_switch23a (struct rtw_adapter *padapter, u8 new_ch, u8 ch_offset) { struct list_head *phead, *plist; - int ret = 0; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -1706,7 +1652,7 @@ int rtw_ap_inform_ch_switch23a (struct rtw_adapter *padapter, u8 new_ch, u8 ch_o u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; if ((pmlmeinfo->state&0x03) != MSR_AP) - return ret; + return 0; DBG_8723A("%s(%s): with ch:%u, offset:%u\n", __func__, padapter->pnetdev->name, new_ch, ch_offset); @@ -1724,13 +1670,12 @@ int rtw_ap_inform_ch_switch23a (struct rtw_adapter *padapter, u8 new_ch, u8 ch_o issue_action_spct_ch_switch23a (padapter, bc_addr, new_ch, ch_offset); - return ret; + return 0; } int rtw_sta_flush23a(struct rtw_adapter *padapter) { struct list_head *phead, *plist, *ptmp; - int ret = 0; struct sta_info *psta; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -1743,7 +1688,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter) DBG_8723A("%s(%s)\n", __func__, padapter->pnetdev->name); if ((pmlmeinfo->state&0x03) != MSR_AP) - return ret; + return 0; spin_lock_bh(&pstapriv->asoc_list_lock); phead = &pstapriv->asoc_list; @@ -1769,7 +1714,7 @@ int rtw_sta_flush23a(struct rtw_adapter *padapter) associated_clients_update23a(padapter, true); - return ret; + return 0; } /* called > TSR LEVEL for USB or SDIO Interface*/ @@ -1788,13 +1733,10 @@ void sta_info_update23a(struct rtw_adapter *padapter, struct sta_info *psta) psta->qos_option = 0; /* update 802.11n ht cap. */ - if (WLAN_STA_HT&flags) - { + if (WLAN_STA_HT&flags) { psta->htpriv.ht_option = true; psta->qos_option = 1; - } - else - { + } else { psta->htpriv.ht_option = false; } @@ -1807,8 +1749,7 @@ void sta_info_update23a(struct rtw_adapter *padapter, struct sta_info *psta) /* called >= TSR LEVEL for USB or SDIO Interface*/ void ap_sta_info_defer_update23a(struct rtw_adapter *padapter, struct sta_info *psta) { - if (psta->state & _FW_LINKED) - { + if (psta->state & _FW_LINKED) { /* add ratid */ add_RATid23a(padapter, psta, 0);/* DM_RATR_STA_INIT */ } @@ -1819,7 +1760,7 @@ void rtw_ap_restore_network(struct rtw_adapter *padapter) { struct mlme_priv *mlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - struct sta_priv * pstapriv = &padapter->stapriv; + struct sta_priv *pstapriv = &padapter->stapriv; struct sta_info *psta; struct security_priv *psecuritypriv = &padapter->securitypriv; struct list_head *phead, *plist, *ptmp; diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c b/drivers/staging/rtl8723au/core/rtw_cmd.c index 4eaa50297b95..60e0ded8ae02 100644 --- a/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -36,25 +36,25 @@ static struct cmd_hdl wlancmds[] = { GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct wlan_bssid_ex), join_cmd_hdl23a) /*14*/ - GEN_MLME_EXT_HANDLER(sizeof (struct disconnect_parm), disconnect_hdl23a) - GEN_MLME_EXT_HANDLER(sizeof (struct wlan_bssid_ex), createbss_hdl23a) - GEN_MLME_EXT_HANDLER(sizeof (struct setopmode_parm), setopmode_hdl23a) - GEN_MLME_EXT_HANDLER(sizeof (struct sitesurvey_parm), sitesurvey_cmd_hdl23a) /*18*/ - GEN_MLME_EXT_HANDLER(sizeof (struct setauth_parm), setauth_hdl23a) - GEN_MLME_EXT_HANDLER(sizeof (struct setkey_parm), setkey_hdl23a) /*20*/ - GEN_MLME_EXT_HANDLER(sizeof (struct set_stakey_parm), set_stakey_hdl23a) - GEN_MLME_EXT_HANDLER(sizeof (struct set_assocsta_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct del_assocsta_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct setstapwrstate_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct setbasicrate_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct getbasicrate_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct setdatarate_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct getdatarate_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct setphyinfo_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct getphyinfo_parm), NULL) /*30*/ - GEN_MLME_EXT_HANDLER(sizeof (struct setphy_parm), NULL) - GEN_MLME_EXT_HANDLER(sizeof (struct getphy_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), join_cmd_hdl23a) /*14*/ + GEN_MLME_EXT_HANDLER(sizeof(struct disconnect_parm), disconnect_hdl23a) + GEN_MLME_EXT_HANDLER(sizeof(struct wlan_bssid_ex), createbss_hdl23a) + GEN_MLME_EXT_HANDLER(sizeof(struct setopmode_parm), setopmode_hdl23a) + GEN_MLME_EXT_HANDLER(sizeof(struct sitesurvey_parm), sitesurvey_cmd_hdl23a) /*18*/ + GEN_MLME_EXT_HANDLER(sizeof(struct setauth_parm), setauth_hdl23a) + GEN_MLME_EXT_HANDLER(sizeof(struct setkey_parm), setkey_hdl23a) /*20*/ + GEN_MLME_EXT_HANDLER(sizeof(struct set_stakey_parm), set_stakey_hdl23a) + GEN_MLME_EXT_HANDLER(sizeof(struct set_assocsta_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct del_assocsta_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct setstapwrstate_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct setbasicrate_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct getbasicrate_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct setdatarate_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct getdatarate_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct setphyinfo_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct getphyinfo_parm), NULL) /*30*/ + GEN_MLME_EXT_HANDLER(sizeof(struct setphy_parm), NULL) + GEN_MLME_EXT_HANDLER(sizeof(struct getphy_parm), NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) GEN_MLME_EXT_HANDLER(0, NULL) @@ -359,6 +359,7 @@ int rtw_sitesurvey_cmd23a(struct rtw_adapter *padapter, /* prepare ssid list */ if (ssid) { int i; + for (i = 0; i < ssid_num && i < RTW_SSID_SCAN_AMOUNT; i++) { if (ssid[i].ssid_len) { memcpy(&psurveyPara->ssid[i], &ssid[i], @@ -371,6 +372,7 @@ int rtw_sitesurvey_cmd23a(struct rtw_adapter *padapter, /* prepare channel list */ if (ch) { int i; + for (i = 0; i < ch_num && i < RTW_CHANNEL_SCAN_AMOUNT; i++) { if (ch[i].hw_value && !(ch[i].flags & IEEE80211_CHAN_DISABLED)) { @@ -389,8 +391,6 @@ int rtw_sitesurvey_cmd23a(struct rtw_adapter *padapter, mod_timer(&pmlmepriv->scan_to_timer, jiffies + msecs_to_jiffies(SCANNING_TIMEOUT)); - rtw_led_control(padapter, LED_CTL_SITE_SURVEY); - pmlmepriv->scan_interval = SCAN_INTERVAL;/* 30*2 sec = 60sec */ } else _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); @@ -415,8 +415,6 @@ int rtw_createbss_cmd23a(struct rtw_adapter *padapter) pdev_network = &padapter->registrypriv.dev_network; - rtw_led_control(padapter, LED_CTL_START_TO_LINK); - if (pmlmepriv->assoc_ssid.ssid_len == 0) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for Any SSid:%s\n", @@ -465,8 +463,6 @@ int rtw_joinbss_cmd23a(struct rtw_adapter *padapter, ifmode = pnetwork->network.ifmode; - rtw_led_control(padapter, LED_CTL_START_TO_LINK); - if (pmlmepriv->assoc_ssid.ssid_len == 0) { RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any SSid\n")); @@ -599,7 +595,7 @@ exit: return res; } -int rtw_disassoc_cmd23a(struct rtw_adapter*padapter, u32 deauth_timeout_ms, +int rtw_disassoc_cmd23a(struct rtw_adapter *padapter, u32 deauth_timeout_ms, bool enqueue) { struct cmd_obj *cmdobj = NULL; @@ -719,6 +715,7 @@ int rtw_setstakey_cmd23a(struct rtw_adapter *padapter, u8 *psta, u8 unicast_key) memcpy(&psetstakey_para->key, &sta->dot118021x_UncstKey, 16); } else { int idx = psecuritypriv->dot118021XGrpKeyid; + memcpy(&psetstakey_para->key, &psecuritypriv->dot118021XGrpKey[idx].skey, 16); } @@ -786,7 +783,7 @@ exit: return res; } -int rtw_addbareq_cmd23a(struct rtw_adapter*padapter, u8 tid, u8 *addr) +int rtw_addbareq_cmd23a(struct rtw_adapter *padapter, u8 tid, u8 *addr) { struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_obj *ph2c; @@ -822,7 +819,7 @@ exit: return res; } -int rtw_dynamic_chk_wk_cmd23a(struct rtw_adapter*padapter) +int rtw_dynamic_chk_wk_cmd23a(struct rtw_adapter *padapter) { struct cmd_obj *ph2c; struct drvextra_cmd_parm *pdrvextra_cmd_parm; @@ -859,7 +856,7 @@ exit: * This is only ever called from on_action_spct23a_ch_switch () which isn't * called from anywhere itself */ -int rtw_set_ch_cmd23a(struct rtw_adapter*padapter, u8 ch, u8 bw, u8 ch_offset, +int rtw_set_ch_cmd23a(struct rtw_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 enqueue) { struct cmd_obj *pcmdobj; @@ -919,34 +916,34 @@ static void traffic_status_watchdog(struct rtw_adapter *padapter) u8 bHigherBusyTxTraffic = false; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; int BusyThreshold = 100; + struct rt_link_detect *ldi = &pmlmepriv->LinkDetectInfo; + /* */ /* Determine if our traffic is busy now */ /* */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { if (rtl8723a_BT_coexist(padapter)) BusyThreshold = 50; - else if (pmlmepriv->LinkDetectInfo.bBusyTraffic) + else if (ldi->bBusyTraffic) BusyThreshold = 75; /* if we raise bBusyTraffic in last watchdog, using lower threshold. */ - if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold || - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold) { + if (ldi->NumRxOkInPeriod > BusyThreshold || + ldi->NumTxOkInPeriod > BusyThreshold) { bBusyTraffic = true; - if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) + if (ldi->NumRxOkInPeriod > ldi->NumTxOkInPeriod) bRxBusyTraffic = true; else bTxBusyTraffic = true; } /* Higher Tx/Rx data. */ - if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 || - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000) { + if (ldi->NumRxOkInPeriod > 4000 || + ldi->NumTxOkInPeriod > 4000) { bHigherBusyTraffic = true; - if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) + if (ldi->NumRxOkInPeriod > ldi->NumTxOkInPeriod) bHigherBusyRxTraffic = true; else bHigherBusyTxTraffic = true; @@ -955,9 +952,9 @@ static void traffic_status_watchdog(struct rtw_adapter *padapter) if (!rtl8723a_BT_coexist(padapter) || !rtl8723a_BT_using_antenna_1(padapter)) { /* check traffic for powersaving. */ - if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8) || - pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod >2) + if (((ldi->NumRxUnicastOkInPeriod + + ldi->NumTxOkInPeriod) > 8) || + ldi->NumRxUnicastOkInPeriod > 2) bEnterPS = false; else bEnterPS = true; @@ -971,15 +968,15 @@ static void traffic_status_watchdog(struct rtw_adapter *padapter) } else LPS_Leave23a(padapter); - pmlmepriv->LinkDetectInfo.NumRxOkInPeriod = 0; - pmlmepriv->LinkDetectInfo.NumTxOkInPeriod = 0; - pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod = 0; - pmlmepriv->LinkDetectInfo.bBusyTraffic = bBusyTraffic; - pmlmepriv->LinkDetectInfo.bTxBusyTraffic = bTxBusyTraffic; - pmlmepriv->LinkDetectInfo.bRxBusyTraffic = bRxBusyTraffic; - pmlmepriv->LinkDetectInfo.bHigherBusyTraffic = bHigherBusyTraffic; - pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic = bHigherBusyRxTraffic; - pmlmepriv->LinkDetectInfo.bHigherBusyTxTraffic = bHigherBusyTxTraffic; + ldi->NumRxOkInPeriod = 0; + ldi->NumTxOkInPeriod = 0; + ldi->NumRxUnicastOkInPeriod = 0; + ldi->bBusyTraffic = bBusyTraffic; + ldi->bTxBusyTraffic = bTxBusyTraffic; + ldi->bRxBusyTraffic = bRxBusyTraffic; + ldi->bHigherBusyTraffic = bHigherBusyTraffic; + ldi->bHigherBusyRxTraffic = bHigherBusyRxTraffic; + ldi->bHigherBusyTxTraffic = bHigherBusyTxTraffic; } static void dynamic_chk_wk_hdl(struct rtw_adapter *padapter, u8 *pbuf, int sz) @@ -1017,46 +1014,45 @@ static void lps_ctrl_wk_hdl(struct rtw_adapter *padapter, u8 lps_ctrl_type) check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) return; - switch (lps_ctrl_type) - { - case LPS_CTRL_SCAN: - rtl8723a_BT_wifiscan_notify(padapter, true); - if (!rtl8723a_BT_using_antenna_1(padapter)) { - if (check_fwstate(pmlmepriv, _FW_LINKED)) - LPS_Leave23a(padapter); + switch (lps_ctrl_type) { + case LPS_CTRL_SCAN: + rtl8723a_BT_wifiscan_notify(padapter, true); + if (!rtl8723a_BT_using_antenna_1(padapter)) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) + LPS_Leave23a(padapter); } - break; - case LPS_CTRL_JOINBSS: + break; + case LPS_CTRL_JOINBSS: + LPS_Leave23a(padapter); + break; + case LPS_CTRL_CONNECT: + mstatus = 1;/* connect */ + /* Reset LPS Setting */ + padapter->pwrctrlpriv.LpsIdleCount = 0; + rtl8723a_set_FwJoinBssReport_cmd(padapter, 1); + rtl8723a_BT_mediastatus_notify(padapter, mstatus); + break; + case LPS_CTRL_DISCONNECT: + mstatus = 0;/* disconnect */ + rtl8723a_BT_mediastatus_notify(padapter, mstatus); + if (!rtl8723a_BT_using_antenna_1(padapter)) LPS_Leave23a(padapter); - break; - case LPS_CTRL_CONNECT: - mstatus = 1;/* connect */ - /* Reset LPS Setting */ - padapter->pwrctrlpriv.LpsIdleCount = 0; - rtl8723a_set_FwJoinBssReport_cmd(padapter, 1); - rtl8723a_BT_mediastatus_notify(padapter, mstatus); - break; - case LPS_CTRL_DISCONNECT: - mstatus = 0;/* disconnect */ - rtl8723a_BT_mediastatus_notify(padapter, mstatus); - if (!rtl8723a_BT_using_antenna_1(padapter)) - LPS_Leave23a(padapter); - rtl8723a_set_FwJoinBssReport_cmd(padapter, 0); - break; - case LPS_CTRL_SPECIAL_PACKET: - pwrpriv->DelayLPSLastTimeStamp = jiffies; - rtl8723a_BT_specialpacket_notify(padapter); - if (!rtl8723a_BT_using_antenna_1(padapter)) - LPS_Leave23a(padapter); - break; - case LPS_CTRL_LEAVE: - rtl8723a_BT_lps_leave(padapter); - if (!rtl8723a_BT_using_antenna_1(padapter)) - LPS_Leave23a(padapter); - break; + rtl8723a_set_FwJoinBssReport_cmd(padapter, 0); + break; + case LPS_CTRL_SPECIAL_PACKET: + pwrpriv->DelayLPSLastTimeStamp = jiffies; + rtl8723a_BT_specialpacket_notify(padapter); + if (!rtl8723a_BT_using_antenna_1(padapter)) + LPS_Leave23a(padapter); + break; + case LPS_CTRL_LEAVE: + rtl8723a_BT_lps_leave(padapter); + if (!rtl8723a_BT_using_antenna_1(padapter)) + LPS_Leave23a(padapter); + break; - default: - break; + default: + break; } } @@ -1098,7 +1094,7 @@ exit: return res; } -int rtw_ps_cmd23a(struct rtw_adapter*padapter) +int rtw_ps_cmd23a(struct rtw_adapter *padapter) { struct cmd_obj *ppscmd; struct drvextra_cmd_parm *pdrvextra_cmd_parm; @@ -1147,12 +1143,12 @@ static void rtw_chk_hi_queue_hdl(struct rtw_adapter *padapter) val = rtl8723a_chk_hi_queue_empty(padapter); - while (val == false) { + while (!val) { msleep(100); cnt++; - if (cnt>10) + if (cnt > 10) break; val = rtl8723a_chk_hi_queue_empty(padapter); @@ -1168,7 +1164,7 @@ static void rtw_chk_hi_queue_hdl(struct rtw_adapter *padapter) } } -int rtw_chk_hi_queue_cmd23a(struct rtw_adapter*padapter) +int rtw_chk_hi_queue_cmd23a(struct rtw_adapter *padapter) { struct cmd_obj *ph2c; struct drvextra_cmd_parm *pdrvextra_cmd_parm; @@ -1305,8 +1301,7 @@ int rtw_drvextra_cmd_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf) pdrvextra_cmd = (struct drvextra_cmd_parm *)pbuf; - switch (pdrvextra_cmd->ec_id) - { + switch (pdrvextra_cmd->ec_id) { case DYNAMIC_CHK_WK_CID: dynamic_chk_wk_hdl(padapter, pdrvextra_cmd->pbuf, pdrvextra_cmd->type_size); diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c index 9f6ce7d071cd..81960e788f89 100644 --- a/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -117,12 +117,7 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType) u8 Efuse_CalculateWordCnts23a(u8 word_en) { - u8 word_cnts = 0; - if (!(word_en & BIT(0))) word_cnts++; /* 0 : write enable */ - if (!(word_en & BIT(1))) word_cnts++; - if (!(word_en & BIT(2))) word_cnts++; - if (!(word_en & BIT(3))) word_cnts++; - return word_cnts; + return hweight8((~word_en) & 0xf); } /* */ @@ -181,7 +176,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, switch (type) { case TYPE_EFUSE_MAX_SECTION: - pMax_section = (u8 *) pOut; + pMax_section = pOut; if (efuseType == EFUSE_WIFI) *pMax_section = EFUSE_MAX_SECTION_8723A; @@ -190,7 +185,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, break; case TYPE_EFUSE_REAL_CONTENT_LEN: - pu2Tmp = (u16 *) pOut; + pu2Tmp = pOut; if (efuseType == EFUSE_WIFI) *pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723A; @@ -199,7 +194,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, break; case TYPE_AVAILABLE_EFUSE_BYTES_BANK: - pu2Tmp = (u16 *) pOut; + pu2Tmp = pOut; if (efuseType == EFUSE_WIFI) *pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723A - @@ -210,7 +205,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, break; case TYPE_AVAILABLE_EFUSE_BYTES_TOTAL: - pu2Tmp = (u16 *) pOut; + pu2Tmp = pOut; if (efuseType == EFUSE_WIFI) *pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723A - @@ -221,7 +216,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, break; case TYPE_EFUSE_MAP_LEN: - pu2Tmp = (u16 *) pOut; + pu2Tmp = pOut; if (efuseType == EFUSE_WIFI) *pu2Tmp = EFUSE_MAP_LEN_8723A; @@ -230,7 +225,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, break; case TYPE_EFUSE_PROTECT_BYTES_BANK: - pu1Tmp = (u8 *) pOut; + pu1Tmp = pOut; if (efuseType == EFUSE_WIFI) *pu1Tmp = EFUSE_OOB_PROTECT_BYTES; @@ -239,7 +234,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, break; case TYPE_EFUSE_CONTENT_LEN_BANK: - pu2Tmp = (u16 *) pOut; + pu2Tmp = pOut; if (efuseType == EFUSE_WIFI) *pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723A; @@ -248,7 +243,7 @@ EFUSE_GetEfuseDefinition23a(struct rtw_adapter *pAdapter, u8 efuseType, break; default: - pu1Tmp = (u8 *) pOut; + pu1Tmp = pOut; *pu1Tmp = 0; break; } diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c index 6274cb397c92..bbbcfc8257da 100644 --- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c @@ -69,6 +69,7 @@ int rtw_get_bit_value_from_ieee_value23a(u8 val) {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108, 0}; int i = 0; + while (dot11_rate_table[i] != 0) { if (dot11_rate_table[i] == val) return BIT(i); @@ -301,8 +302,7 @@ void rtw_set_supported_rate23a(u8 *SupportedRates, uint mode) memset(SupportedRates, 0, NDIS_802_11_LENGTH_RATES_EX); - switch (mode) - { + switch (mode) { case WIRELESS_11B: memcpy(SupportedRates, WIFI_CCKRATES, IEEE80211_CCK_RATE_LEN); break; diff --git a/drivers/staging/rtl8723au/core/rtw_led.c b/drivers/staging/rtl8723au/core/rtw_led.c deleted file mode 100644 index 989cda29a57e..000000000000 --- a/drivers/staging/rtl8723au/core/rtw_led.c +++ /dev/null @@ -1,1893 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - ******************************************************************************/ - -#include <drv_types.h> -#include <rtl8723a_led.h> - -/* */ -/* Description: */ -/* Callback function of LED BlinkTimer, */ -/* it just schedules to corresponding BlinkWorkItem/led_blink_hdl23a */ -/* */ -static void BlinkTimerCallback(unsigned long data) -{ - struct led_8723a *pLed = (struct led_8723a *)data; - struct rtw_adapter *padapter = pLed->padapter; - - /* DBG_8723A("%s\n", __func__); */ - - if ((padapter->bSurpriseRemoved == true) || (padapter->bDriverStopped == true)) - { - /* DBG_8723A("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __func__, padapter->bSurpriseRemoved, padapter->bDriverStopped); */ - return; - } - schedule_work(&pLed->BlinkWorkItem); -} - -/* */ -/* Description: */ -/* Callback function of LED BlinkWorkItem. */ -/* We dispatch acture LED blink action according to LedStrategy. */ -/* */ -void BlinkWorkItemCallback23a(struct work_struct *work) -{ - struct led_8723a *pLed = container_of(work, struct led_8723a, BlinkWorkItem); - BlinkHandler23a(pLed); -} - -/* */ -/* Description: */ -/* Reset status of led_8723a object. */ -/* */ -void ResetLedStatus23a(struct led_8723a * pLed) { - - pLed->CurrLedState = RTW_LED_OFF; /* Current LED state. */ - pLed->bLedOn = false; /* true if LED is ON, false if LED is OFF. */ - - pLed->bLedBlinkInProgress = false; /* true if it is blinking, false o.w.. */ - pLed->bLedWPSBlinkInProgress = false; - - pLed->BlinkTimes = 0; /* Number of times to toggle led state for blinking. */ - pLed->BlinkingLedState = LED_UNKNOWN; /* Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. */ - - pLed->bLedNoLinkBlinkInProgress = false; - pLed->bLedLinkBlinkInProgress = false; - pLed->bLedStartToLinkBlinkInProgress = false; - pLed->bLedScanBlinkInProgress = false; -} - - /* */ -/* Description: */ -/* Initialize an led_8723a object. */ -/* */ -void -InitLed871x23a(struct rtw_adapter *padapter, struct led_8723a *pLed, enum led_pin_8723a LedPin) -{ - pLed->padapter = padapter; - pLed->LedPin = LedPin; - - ResetLedStatus23a(pLed); - - setup_timer(&pLed->BlinkTimer, BlinkTimerCallback, (unsigned long)pLed); - - INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback23a); -} - -/* */ -/* Description: */ -/* DeInitialize an led_8723a object. */ -/* */ -void -DeInitLed871x23a(struct led_8723a *pLed) -{ - cancel_work_sync(&pLed->BlinkWorkItem); - del_timer_sync(&pLed->BlinkTimer); - ResetLedStatus23a(pLed); -} - -/* Description: */ -/* Implementation of LED blinking behavior. */ -/* It toggle off LED and schedule corresponding timer if necessary. */ - -static void SwLedBlink(struct led_8723a *pLed) -{ - struct rtw_adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 bStopBlinking = false; - - /* Change LED according to BlinkingLedState specified. */ - if (pLed->BlinkingLedState == RTW_LED_ON) { - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } else { - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - /* Determine if we shall change LED state again. */ - pLed->BlinkTimes--; - switch (pLed->CurrLedState) { - - case LED_BLINK_NORMAL: - if (pLed->BlinkTimes == 0) - bStopBlinking = true; - break; - case LED_BLINK_StartToBlink: - if (check_fwstate(pmlmepriv, _FW_LINKED) && - check_fwstate(pmlmepriv, WIFI_STATION_STATE)) - bStopBlinking = true; - if (check_fwstate(pmlmepriv, _FW_LINKED) && - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || - check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))) - bStopBlinking = true; - else if (pLed->BlinkTimes == 0) - bStopBlinking = true; - break; - case LED_BLINK_WPS: - if (pLed->BlinkTimes == 0) - bStopBlinking = true; - break; - default: - bStopBlinking = true; - break; - } - - if (bStopBlinking) { - if ((check_fwstate(pmlmepriv, _FW_LINKED)) && !pLed->bLedOn) - SwLedOn23a(padapter, pLed); - else if ((check_fwstate(pmlmepriv, _FW_LINKED)) && pLed->bLedOn) - SwLedOff23a(padapter, pLed); - - pLed->BlinkTimes = 0; - pLed->bLedBlinkInProgress = false; - } else { - /* Assign LED state to toggle. */ - if (pLed->BlinkingLedState == RTW_LED_ON) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - - /* Schedule a timer to toggle LED state. */ - switch (pLed->CurrLedState) { - case LED_BLINK_NORMAL: - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); - break; - case LED_BLINK_SLOWLY: - case LED_BLINK_StartToBlink: - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); - break; - case LED_BLINK_WPS: - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_LONG_INTERVAL)); - break; - default: - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); - break; - } - } -} - -static void SwLedBlink1(struct led_8723a *pLed) -{ - struct rtw_adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - unsigned long delay = 0; - u8 bStopBlinking = false; - - /* Change LED according to BlinkingLedState specified. */ - if (pLed->BlinkingLedState == RTW_LED_ON) { - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, - ("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } else { - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, - ("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) { - SwLedOff23a(padapter, pLed); - ResetLedStatus23a(pLed); - return; - } - switch (pLed->CurrLedState) { - case LED_BLINK_SLOWLY: - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NO_LINK_INTERVAL_ALPHA; - break; - case LED_BLINK_NORMAL: - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_LINK_INTERVAL_ALPHA; - break; - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) - bStopBlinking = true; - if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - pLed->bLedLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_NORMAL; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_LINK_INTERVAL_ALPHA; - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } else { - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NO_LINK_INTERVAL_ALPHA; - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedScanBlinkInProgress = false; - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - } - break; - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) - bStopBlinking = true; - if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED)) { - pLed->bLedLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_NORMAL; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_LINK_INTERVAL_ALPHA; - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } else { - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NO_LINK_INTERVAL_ALPHA; - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->BlinkTimes = 0; - pLed->bLedBlinkInProgress = false; - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_FASTER_INTERVAL_ALPHA; - } - break; - case LED_BLINK_WPS: - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - break; - case LED_BLINK_WPS_STOP: /* WPS success */ - if (pLed->BlinkingLedState == RTW_LED_ON) - bStopBlinking = false; - else - bStopBlinking = true; - if (bStopBlinking) { - pLed->bLedLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_NORMAL; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_LINK_INTERVAL_ALPHA; - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - - pLed->bLedWPSBlinkInProgress = false; - } else { - pLed->BlinkingLedState = RTW_LED_OFF; - delay = LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA; - } - break; - default: - break; - } - if (delay) - mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(delay)); -} - -static void SwLedBlink2(struct led_8723a *pLed) -{ - struct rtw_adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 bStopBlinking = false; - - /* Change LED according to BlinkingLedState specified. */ - if (pLed->BlinkingLedState == RTW_LED_ON) { - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, - ("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } else { - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, - ("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - switch (pLed->CurrLedState) { - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) - bStopBlinking = true; - if (bStopBlinking) { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) { - SwLedOff23a(padapter, pLed); - } else if (check_fwstate(pmlmepriv, _FW_LINKED)) { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, - ("stop scan blink CurrLedState %d\n", - pLed->CurrLedState)); - } else { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, - ("stop scan blink CurrLedState %d\n", - pLed->CurrLedState)); - } - pLed->bLedScanBlinkInProgress = false; - } else { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) { - SwLedOff23a(padapter, pLed); - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, - jiffies + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); - } - } - break; - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) - bStopBlinking = true; - if (bStopBlinking) { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) { - SwLedOff23a(padapter, pLed); - } else if (check_fwstate(pmlmepriv, _FW_LINKED)) { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, - ("stop CurrLedState %d\n", pLed->CurrLedState)); - - } else { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, - ("stop CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedBlinkInProgress = false; - } else { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) { - SwLedOff23a(padapter, pLed); - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, - jiffies + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); - } - } - break; - default: - break; - } -} - -static void SwLedBlink3(struct led_8723a *pLed) -{ - struct rtw_adapter *padapter = pLed->padapter; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - u8 bStopBlinking = false; - - /* Change LED according to BlinkingLedState specified. */ - if (pLed->BlinkingLedState == RTW_LED_ON) - { - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } - else - { - if (pLed->CurrLedState != LED_BLINK_WPS_STOP) - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - switch (pLed->CurrLedState) - { - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) - { - bStopBlinking = true; - } - - if (bStopBlinking) - { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) - { - SwLedOff23a(padapter, pLed); - } - else if (check_fwstate(pmlmepriv, _FW_LINKED)) { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if (!pLed->bLedOn) - SwLedOn23a(padapter, pLed); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } else { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if (pLed->bLedOn) - SwLedOff23a(padapter, pLed); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedScanBlinkInProgress = false; - } - else - { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) - { - SwLedOff23a(padapter, pLed); - } - else - { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, - jiffies + msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); - } - } - break; - - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) - { - bStopBlinking = true; - } - if (bStopBlinking) - { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) - { - SwLedOff23a(padapter, pLed); - } else if (check_fwstate(pmlmepriv, - _FW_LINKED)) { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - - if (!pLed->bLedOn) - SwLedOn23a(padapter, pLed); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } else { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - - if (pLed->bLedOn) - SwLedOff23a(padapter, pLed); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedBlinkInProgress = false; - } - else - { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) - { - SwLedOff23a(padapter, pLed); - } - else - { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, - jiffies + msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); - } - } - break; - - case LED_BLINK_WPS: - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); - break; - - case LED_BLINK_WPS_STOP: /* WPS success */ - if (pLed->BlinkingLedState == RTW_LED_ON) - { - pLed->BlinkingLedState = RTW_LED_OFF; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA)); - bStopBlinking = false; - } else { - bStopBlinking = true; - } - - if (bStopBlinking) - { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) - { - SwLedOff23a(padapter, pLed); - } - else - { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } - pLed->bLedWPSBlinkInProgress = false; - } - break; - - default: - break; - } -} - -static void SwLedBlink4(struct led_8723a *pLed) -{ - struct rtw_adapter *padapter = pLed->padapter; - struct led_priv *ledpriv = &padapter->ledpriv; - struct led_8723a *pLed1 = &ledpriv->SwLed1; - u8 bStopBlinking = false; - unsigned long delay = 0; - - /* Change LED according to BlinkingLedState specified. */ - if (pLed->BlinkingLedState == RTW_LED_ON) - { - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } else { - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - if (!pLed1->bLedWPSBlinkInProgress && pLed1->BlinkingLedState == LED_UNKNOWN) - { - pLed1->BlinkingLedState = RTW_LED_OFF; - pLed1->CurrLedState = RTW_LED_OFF; - SwLedOff23a(padapter, pLed1); - } - - switch (pLed->CurrLedState) - { - case LED_BLINK_SLOWLY: - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NO_LINK_INTERVAL_ALPHA; - break; - - case LED_BLINK_StartToBlink: - if (pLed->bLedOn) { - pLed->BlinkingLedState = RTW_LED_OFF; - delay = LED_BLINK_SLOWLY_INTERVAL; - } else { - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NORMAL_INTERVAL; - } - break; - - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) { - bStopBlinking = false; - } - - if (bStopBlinking) { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) { - SwLedOff23a(padapter, pLed); - } else { - pLed->bLedNoLinkBlinkInProgress = false; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NO_LINK_INTERVAL_ALPHA; - } - pLed->bLedScanBlinkInProgress = false; - } else { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) { - SwLedOff23a(padapter, pLed); - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - } - } - break; - - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) { - bStopBlinking = true; - } - if (bStopBlinking) { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) { - SwLedOff23a(padapter, pLed); - } else { - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NO_LINK_INTERVAL_ALPHA; - } - pLed->bLedBlinkInProgress = false; - } else { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) { - SwLedOff23a(padapter, pLed); - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_FASTER_INTERVAL_ALPHA; - } - } - break; - - case LED_BLINK_WPS: - if (pLed->bLedOn) { - pLed->BlinkingLedState = RTW_LED_OFF; - delay = LED_BLINK_SLOWLY_INTERVAL; - } else { - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NORMAL_INTERVAL; - } - break; - - case LED_BLINK_WPS_STOP: /* WPS authentication fail */ - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - - delay = LED_BLINK_NORMAL_INTERVAL; - break; - - case LED_BLINK_WPS_STOP_OVERLAP: /* WPS session overlap */ - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) { - if (pLed->bLedOn) { - pLed->BlinkTimes = 1; - } else { - bStopBlinking = true; - } - } - - if (bStopBlinking) { - pLed->BlinkTimes = 10; - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_LINK_INTERVAL_ALPHA; - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - - delay = LED_BLINK_NORMAL_INTERVAL; - } - break; - - default: - break; - } - if (delay) - mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(delay)); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("SwLedBlink4 CurrLedState %d\n", pLed->CurrLedState)); -} - -static void SwLedBlink5(struct led_8723a *pLed) -{ - struct rtw_adapter *padapter = pLed->padapter; - u8 bStopBlinking = false; - unsigned long delay = 0; - - /* Change LED according to BlinkingLedState specified. */ - if (pLed->BlinkingLedState == RTW_LED_ON) { - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } else { - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - - switch (pLed->CurrLedState) - { - case LED_BLINK_SCAN: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) { - bStopBlinking = true; - } - - if (bStopBlinking) { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if (pLed->bLedOn) - SwLedOff23a(padapter, pLed); - } else { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if (!pLed->bLedOn) - delay = LED_BLINK_FASTER_INTERVAL_ALPHA; - } - - pLed->bLedScanBlinkInProgress = false; - } else { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) { - SwLedOff23a(padapter, pLed); - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - } - } - break; - - case LED_BLINK_TXRX: - pLed->BlinkTimes--; - if (pLed->BlinkTimes == 0) { - bStopBlinking = true; - } - - if (bStopBlinking) { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if (pLed->bLedOn) - SwLedOff23a(padapter, pLed); - } else { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if (!pLed->bLedOn) - delay = LED_BLINK_FASTER_INTERVAL_ALPHA; - } - - pLed->bLedBlinkInProgress = false; - } else { - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) { - SwLedOff23a(padapter, pLed); - } else { - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_FASTER_INTERVAL_ALPHA; - } - } - break; - - default: - break; - } - - if (delay) - mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(delay)); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState)); -} - -static void SwLedBlink6(struct led_8723a *pLed) -{ - struct rtw_adapter *padapter = pLed->padapter; - - /* Change LED according to BlinkingLedState specified. */ - if (pLed->BlinkingLedState == RTW_LED_ON) { - SwLedOn23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn on\n", pLed->BlinkTimes)); - } else { - SwLedOff23a(padapter, pLed); - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn off\n", pLed->BlinkTimes)); - } - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("<==== blink6\n")); -} - -/* ALPHA, added by chiyoko, 20090106 */ -static void -SwLedControlMode1(struct rtw_adapter *padapter, enum led_ctl_mode LedAction) -{ - struct led_priv *ledpriv = &padapter->ledpriv; - struct led_8723a *pLed = &ledpriv->SwLed0; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - long delay = -1; - - switch (LedAction) - { - case LED_CTL_POWER_ON: - case LED_CTL_START_TO_LINK: - case LED_CTL_NO_LINK: - if (pLed->bLedNoLinkBlinkInProgress == false) { - if (pLed->CurrLedState == LED_BLINK_SCAN || - IS_LED_WPS_BLINKING(pLed)) { - return; - } - if (pLed->bLedLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NO_LINK_INTERVAL_ALPHA; - } - break; - - case LED_CTL_LINK: - if (pLed->bLedLinkBlinkInProgress == false) { - if (pLed->CurrLedState == LED_BLINK_SCAN || - IS_LED_WPS_BLINKING(pLed)) { - return; - } - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - pLed->bLedLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_NORMAL; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_LINK_INTERVAL_ALPHA; - } - break; - - case LED_CTL_SITE_SURVEY: - if (pmlmepriv->LinkDetectInfo.bBusyTraffic && - check_fwstate(pmlmepriv, _FW_LINKED)) - ; - else if (pLed->bLedScanBlinkInProgress == false) { - if (IS_LED_WPS_BLINKING(pLed)) - return; - - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - pLed->bLedScanBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { - if (pLed->CurrLedState == LED_BLINK_SCAN || - IS_LED_WPS_BLINKING(pLed)) { - return; - } - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedLinkBlinkInProgress = false; - } - pLed->bLedBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_FASTER_INTERVAL_ALPHA; - } - break; - - case LED_CTL_START_WPS: /* wait until xinpin finish */ - case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - pLed->bLedWPSBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_WPS; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - } - break; - - case LED_CTL_STOP_WPS: - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - } else { - pLed->bLedWPSBlinkInProgress = true; - } - - pLed->CurrLedState = LED_BLINK_WPS_STOP; - if (pLed->bLedOn) { - pLed->BlinkingLedState = RTW_LED_OFF; - delay = LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA; - } else { - pLed->BlinkingLedState = RTW_LED_ON; - delay = 0; - } - break; - - case LED_CTL_STOP_WPS_FAIL: - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_NO_LINK_INTERVAL_ALPHA; - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if (pLed->bLedNoLinkBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedLinkBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - - SwLedOff23a(padapter, pLed); - break; - - default: - break; - - } - - if (delay != -1) - mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(delay)); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Led %d\n", pLed->CurrLedState)); -} - - /* Arcadyan/Sitecom , added by chiyoko, 20090216 */ -static void -SwLedControlMode2(struct rtw_adapter *padapter, enum led_ctl_mode LedAction) -{ - struct led_priv *ledpriv = &padapter->ledpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct led_8723a *pLed = &ledpriv->SwLed0; - long delay = -1; - - switch (LedAction) { - case LED_CTL_SITE_SURVEY: - if (pmlmepriv->LinkDetectInfo.bBusyTraffic) - ; - else if (pLed->bLedScanBlinkInProgress == false) { - if (IS_LED_WPS_BLINKING(pLed)) - return; - - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - pLed->bLedScanBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - } - break; - case LED_CTL_TX: - case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false && - check_fwstate(pmlmepriv, _FW_LINKED)) { - if (pLed->CurrLedState == LED_BLINK_SCAN || - IS_LED_WPS_BLINKING(pLed)) { - return; - } - - pLed->bLedBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_FASTER_INTERVAL_ALPHA; - } - break; - case LED_CTL_LINK: - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if (pLed->bLedBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - - delay = 0; - break; - case LED_CTL_START_WPS: /* wait until xinpin finish */ - case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - pLed->bLedWPSBlinkInProgress = true; - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - delay = 0; - } - break; - case LED_CTL_STOP_WPS: - pLed->bLedWPSBlinkInProgress = false; - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) { - SwLedOff23a(padapter, pLed); - } else { - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - delay = 0; - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } - break; - case LED_CTL_STOP_WPS_FAIL: - pLed->bLedWPSBlinkInProgress = false; - if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) { - SwLedOff23a(padapter, pLed); - } else { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - delay = 0; - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); - } - break; - case LED_CTL_START_TO_LINK: - case LED_CTL_NO_LINK: - if (!IS_LED_BLINKING(pLed)) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - delay = 0; - } - break; - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if (pLed->bLedBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - - delay = 0; - break; - default: - break; - - } - - if (delay != -1) - mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(delay)); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); -} - - /* COREGA, added by chiyoko, 20090316 */ -static void -SwLedControlMode3(struct rtw_adapter *padapter, enum led_ctl_mode LedAction) -{ - struct led_priv *ledpriv = &padapter->ledpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct led_8723a *pLed = &ledpriv->SwLed0; - long delay = -1; - - switch (LedAction) - { - case LED_CTL_SITE_SURVEY: - if (pmlmepriv->LinkDetectInfo.bBusyTraffic) - ; - else if (pLed->bLedScanBlinkInProgress == false) { - if (IS_LED_WPS_BLINKING(pLed)) - return; - - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - pLed->bLedScanBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false && - check_fwstate(pmlmepriv, _FW_LINKED)) { - if (pLed->CurrLedState == LED_BLINK_SCAN || - IS_LED_WPS_BLINKING(pLed)) { - return; - } - - pLed->bLedBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_FASTER_INTERVAL_ALPHA; - } - break; - - case LED_CTL_LINK: - if (IS_LED_WPS_BLINKING(pLed)) - return; - - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - if (pLed->bLedBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - - delay = 0; - break; - - case LED_CTL_START_WPS: /* wait until xinpin finish */ - case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - pLed->bLedWPSBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_WPS; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - delay = LED_BLINK_SCAN_INTERVAL_ALPHA; - } - break; - - case LED_CTL_STOP_WPS: - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } else { - pLed->bLedWPSBlinkInProgress = true; - } - - pLed->CurrLedState = LED_BLINK_WPS_STOP; - if (pLed->bLedOn) { - pLed->BlinkingLedState = RTW_LED_OFF; - delay = LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA; - } else { - pLed->BlinkingLedState = RTW_LED_ON; - delay = 0; - } - - break; - - case LED_CTL_STOP_WPS_FAIL: - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - delay = 0; - break; - - case LED_CTL_START_TO_LINK: - case LED_CTL_NO_LINK: - if (!IS_LED_BLINKING(pLed)) - { - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - delay = 0; - } - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - if (pLed->bLedBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - - delay = 0; - break; - - default: - break; - - } - - if (delay != -1) - mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(delay)); - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState)); -} - - /* Edimax-Belkin, added by chiyoko, 20090413 */ -static void -SwLedControlMode4(struct rtw_adapter *padapter, enum led_ctl_mode LedAction) -{ - struct led_priv *ledpriv = &padapter->ledpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct led_8723a *pLed = &ledpriv->SwLed0; - struct led_8723a *pLed1 = &ledpriv->SwLed1; - - switch (LedAction) - { - case LED_CTL_START_TO_LINK: - if (pLed1->bLedWPSBlinkInProgress) { - pLed1->bLedWPSBlinkInProgress = false; - del_timer_sync(&pLed1->BlinkTimer); - - pLed1->BlinkingLedState = RTW_LED_OFF; - pLed1->CurrLedState = RTW_LED_OFF; - - if (pLed1->bLedOn) - mod_timer(&pLed->BlinkTimer, jiffies); - } - - if (pLed->bLedStartToLinkBlinkInProgress == false) { - if (pLed->CurrLedState == LED_BLINK_SCAN || - IS_LED_WPS_BLINKING(pLed)) { - return; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - - pLed->bLedStartToLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_StartToBlink; - if (pLed->bLedOn) { - pLed->BlinkingLedState = RTW_LED_OFF; - mod_timer(&pLed->BlinkTimer, - jiffies + msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); - } else { - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, - jiffies + msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); - } - } - break; - - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - /* LED1 settings */ - if (LedAction == LED_CTL_LINK) { - if (pLed1->bLedWPSBlinkInProgress) { - pLed1->bLedWPSBlinkInProgress = false; - del_timer_sync(&pLed1->BlinkTimer); - - pLed1->BlinkingLedState = RTW_LED_OFF; - pLed1->CurrLedState = RTW_LED_OFF; - - if (pLed1->bLedOn) - mod_timer(&pLed->BlinkTimer, jiffies); - } - } - - if (pLed->bLedNoLinkBlinkInProgress == false) { - if (pLed->CurrLedState == LED_BLINK_SCAN || - IS_LED_WPS_BLINKING(pLed)) { - return; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); - } - break; - - case LED_CTL_SITE_SURVEY: - if (pmlmepriv->LinkDetectInfo.bBusyTraffic && - check_fwstate(pmlmepriv, _FW_LINKED)) - ; - else if (pLed->bLedScanBlinkInProgress == false) { - if (IS_LED_WPS_BLINKING(pLed)) - return; - - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - pLed->bLedScanBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { - if (pLed->CurrLedState == LED_BLINK_SCAN || - IS_LED_WPS_BLINKING(pLed)) { - return; - } - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - pLed->bLedBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); - } - break; - - case LED_CTL_START_WPS: /* wait until xinpin finish */ - case LED_CTL_START_WPS_BOTTON: - if (pLed1->bLedWPSBlinkInProgress) { - pLed1->bLedWPSBlinkInProgress = false; - del_timer_sync(&pLed1->BlinkTimer); - - pLed1->BlinkingLedState = RTW_LED_OFF; - pLed1->CurrLedState = RTW_LED_OFF; - - if (pLed1->bLedOn) - mod_timer(&pLed->BlinkTimer, jiffies); - } - - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedNoLinkBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress == true) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - pLed->bLedWPSBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_WPS; - if (pLed->bLedOn) - { - pLed->BlinkingLedState = RTW_LED_OFF; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_SLOWLY_INTERVAL)); - } else { - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); - } - } - break; - - case LED_CTL_STOP_WPS: /* WPS connect success */ - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); - break; - - case LED_CTL_STOP_WPS_FAIL: /* WPS authentication fail */ - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); - - /* LED1 settings */ - if (pLed1->bLedWPSBlinkInProgress) - del_timer_sync(&pLed1->BlinkTimer); - else - pLed1->bLedWPSBlinkInProgress = true; - - pLed1->CurrLedState = LED_BLINK_WPS_STOP; - if (pLed1->bLedOn) - pLed1->BlinkingLedState = RTW_LED_OFF; - else - pLed1->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); - - break; - - case LED_CTL_STOP_WPS_FAIL_OVERLAP: /* WPS session overlap */ - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - - pLed->bLedNoLinkBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SLOWLY; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); - - /* LED1 settings */ - if (pLed1->bLedWPSBlinkInProgress) - del_timer_sync(&pLed1->BlinkTimer); - else - pLed1->bLedWPSBlinkInProgress = true; - - pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP; - pLed1->BlinkTimes = 10; - if (pLed1->bLedOn) - pLed1->BlinkingLedState = RTW_LED_OFF; - else - pLed1->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_NORMAL_INTERVAL)); - - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - - if (pLed->bLedNoLinkBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedNoLinkBlinkInProgress = false; - } - if (pLed->bLedLinkBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedLinkBlinkInProgress = false; - } - if (pLed->bLedBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - if (pLed->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedWPSBlinkInProgress = false; - } - if (pLed->bLedScanBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedScanBlinkInProgress = false; - } - if (pLed->bLedStartToLinkBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedStartToLinkBlinkInProgress = false; - } - - if (pLed1->bLedWPSBlinkInProgress) { - del_timer_sync(&pLed1->BlinkTimer); - pLed1->bLedWPSBlinkInProgress = false; - } - - pLed1->BlinkingLedState = LED_UNKNOWN; - SwLedOff23a(padapter, pLed); - SwLedOff23a(padapter, pLed1); - break; - - default: - break; - - } - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Led %d\n", pLed->CurrLedState)); -} - - /* Sercomm-Belkin, added by chiyoko, 20090415 */ -static void -SwLedControlMode5(struct rtw_adapter *padapter, enum led_ctl_mode LedAction) -{ - struct led_priv *ledpriv = &padapter->ledpriv; - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct led_8723a *pLed = &ledpriv->SwLed0; - - switch (LedAction) - { - case LED_CTL_POWER_ON: - case LED_CTL_NO_LINK: - case LED_CTL_LINK: /* solid blue */ - pLed->CurrLedState = RTW_LED_ON; - pLed->BlinkingLedState = RTW_LED_ON; - - mod_timer(&pLed->BlinkTimer, jiffies); - break; - - case LED_CTL_SITE_SURVEY: - if (pmlmepriv->LinkDetectInfo.bBusyTraffic && - check_fwstate(pmlmepriv, _FW_LINKED)) - ; - else if (pLed->bLedScanBlinkInProgress == false) - { - if (pLed->bLedBlinkInProgress == true) - { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - pLed->bLedScanBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_SCAN; - pLed->BlinkTimes = 24; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA)); - } - break; - - case LED_CTL_TX: - case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { - if (pLed->CurrLedState == LED_BLINK_SCAN) { - return; - } - pLed->bLedBlinkInProgress = true; - pLed->CurrLedState = LED_BLINK_TXRX; - pLed->BlinkTimes = 2; - if (pLed->bLedOn) - pLed->BlinkingLedState = RTW_LED_OFF; - else - pLed->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed->BlinkTimer, jiffies + - msecs_to_jiffies(LED_BLINK_FASTER_INTERVAL_ALPHA)); - } - break; - - case LED_CTL_POWER_OFF: - pLed->CurrLedState = RTW_LED_OFF; - pLed->BlinkingLedState = RTW_LED_OFF; - - if (pLed->bLedBlinkInProgress) { - del_timer_sync(&pLed->BlinkTimer); - pLed->bLedBlinkInProgress = false; - } - - SwLedOff23a(padapter, pLed); - break; - - default: - break; - - } - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Led %d\n", pLed->CurrLedState)); -} - - /* WNC-Corega, added by chiyoko, 20090902 */ -static void SwLedControlMode6(struct rtw_adapter *padapter, - enum led_ctl_mode LedAction) -{ - struct led_priv *ledpriv = &padapter->ledpriv; - struct led_8723a *pLed0 = &ledpriv->SwLed0; - - switch (LedAction) { - case LED_CTL_POWER_ON: - case LED_CTL_LINK: - case LED_CTL_NO_LINK: - del_timer_sync(&pLed0->BlinkTimer); - pLed0->CurrLedState = RTW_LED_ON; - pLed0->BlinkingLedState = RTW_LED_ON; - mod_timer(&pLed0->BlinkTimer, jiffies); - break; - case LED_CTL_POWER_OFF: - SwLedOff23a(padapter, pLed0); - break; - default: - break; - } - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("ledcontrol 6 Led %d\n", pLed0->CurrLedState)); -} - -/* */ -/* Description: */ -/* Handler function of LED Blinking. */ -/* We dispatch acture LED blink action according to LedStrategy. */ -/* */ -void BlinkHandler23a(struct led_8723a *pLed) -{ - struct rtw_adapter *padapter = pLed->padapter; - struct led_priv *ledpriv = &padapter->ledpriv; - - /* DBG_8723A("%s (%s:%d)\n", __func__, current->comm, current->pid); */ - - if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped)) - return; - - switch (ledpriv->LedStrategy) { - case SW_LED_MODE0: - SwLedBlink(pLed); - break; - case SW_LED_MODE1: - SwLedBlink1(pLed); - break; - case SW_LED_MODE2: - SwLedBlink2(pLed); - break; - case SW_LED_MODE3: - SwLedBlink3(pLed); - break; - case SW_LED_MODE4: - SwLedBlink4(pLed); - break; - case SW_LED_MODE5: - SwLedBlink5(pLed); - break; - case SW_LED_MODE6: - SwLedBlink6(pLed); - break; - default: - break; - } -} - -void -LedControl871x23a(struct rtw_adapter *padapter, enum led_ctl_mode LedAction) { - struct led_priv *ledpriv = &padapter->ledpriv; - - if ((padapter->bSurpriseRemoved == true) || - (padapter->bDriverStopped == true) || - (padapter->hw_init_completed == false)) { - return; - } - - if (ledpriv->bRegUseLed == false) - return; - - /* if (!priv->up) */ - /* return; */ - - /* if (priv->bInHctTest) */ - /* return; */ - - if ((padapter->pwrctrlpriv.rf_pwrstate != rf_on && - padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) && - (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX || - LedAction == LED_CTL_SITE_SURVEY || - LedAction == LED_CTL_LINK || - LedAction == LED_CTL_NO_LINK || - LedAction == LED_CTL_POWER_ON)) { - return; - } - - switch (ledpriv->LedStrategy) { - case SW_LED_MODE0: - break; - case SW_LED_MODE1: - SwLedControlMode1(padapter, LedAction); - break; - case SW_LED_MODE2: - SwLedControlMode2(padapter, LedAction); - break; - case SW_LED_MODE3: - SwLedControlMode3(padapter, LedAction); - break; - case SW_LED_MODE4: - SwLedControlMode4(padapter, LedAction); - break; - case SW_LED_MODE5: - SwLedControlMode5(padapter, LedAction); - break; - case SW_LED_MODE6: - SwLedControlMode6(padapter, LedAction); - break; - default: - break; - } - - RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("LedStrategy:%d, LedAction %d\n", ledpriv->LedStrategy, LedAction)); -} diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c index 1f6006439bbb..7299ef0a2e54 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -50,7 +50,6 @@ static void rtw_init_mlme_timer(struct rtw_adapter *padapter) int rtw_init_mlme_priv23a(struct rtw_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - int res = _SUCCESS; pmlmepriv->nic_hdl = padapter; @@ -68,7 +67,7 @@ int rtw_init_mlme_priv23a(struct rtw_adapter *padapter) rtw_clear_scan_deny(padapter); rtw_init_mlme_timer(padapter); - return res; + return _SUCCESS; } #ifdef CONFIG_8723AU_AP_MODE @@ -110,7 +109,6 @@ struct wlan_network *rtw_alloc_network(struct mlme_priv *pmlmepriv, gfp_t gfp) pnetwork->network_type = 0; pnetwork->fixed = false; pnetwork->last_scanned = jiffies; - pnetwork->aid = 0; pnetwork->join_res = 0; } @@ -218,8 +216,6 @@ void rtw_generate_random_ibss23a(u8 *pibss) pibss[3] = curtime & 0xff;/* p[0]; */ pibss[4] = (curtime >> 8) & 0xff;/* p[1]; */ pibss[5] = (curtime >> 16) & 0xff;/* p[2]; */ - - return; } void rtw_set_roaming(struct rtw_adapter *adapter, u8 to_roaming) @@ -356,12 +352,12 @@ rtw_get_oldest_wlan_network23a(struct rtw_queue *scanned_queue) void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, struct rtw_adapter *padapter, bool update_ie) { - u8 ss_ori = dst->PhyInfo.SignalStrength; - u8 sq_ori = dst->PhyInfo.SignalQuality; + u8 ss_ori = dst->SignalStrength; + u8 sq_ori = dst->SignalQuality; long rssi_ori = dst->Rssi; - u8 ss_smp = src->PhyInfo.SignalStrength; - u8 sq_smp = src->PhyInfo.SignalQuality; + u8 ss_smp = src->SignalStrength; + u8 sq_smp = src->SignalQuality; long rssi_smp = src->Rssi; u8 ss_final; @@ -389,16 +385,16 @@ void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, rssi_final = rssi_ori; } else { if (sq_smp != 101) { /* from the right channel */ - ss_final = ((u32)src->PhyInfo.SignalStrength + - (u32)dst->PhyInfo.SignalStrength * 4) / 5; - sq_final = ((u32)src->PhyInfo.SignalQuality + - (u32)dst->PhyInfo.SignalQuality * 4) / 5; + ss_final = ((u32)src->SignalStrength + + (u32)dst->SignalStrength * 4) / 5; + sq_final = ((u32)src->SignalQuality + + (u32)dst->SignalQuality * 4) / 5; rssi_final = src->Rssi+dst->Rssi * 4 / 5; } else { /* bss info not receiving from the right channel, use the original RX signal infos */ - ss_final = dst->PhyInfo.SignalStrength; - sq_final = dst->PhyInfo.SignalQuality; + ss_final = dst->SignalStrength; + sq_final = dst->SignalQuality; rssi_final = dst->Rssi; } @@ -407,14 +403,13 @@ void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src, if (update_ie) memcpy(dst, src, get_wlan_bssid_ex_sz(src)); - dst->PhyInfo.SignalStrength = ss_final; - dst->PhyInfo.SignalQuality = sq_final; + dst->SignalStrength = ss_final; + dst->SignalQuality = sq_final; dst->Rssi = rssi_final; DBG_8723A("%s %s(%pM), SignalStrength:%u, SignalQuality:%u, " "RawRSSI:%ld\n", __func__, dst->Ssid.ssid, dst->MacAddress, - dst->PhyInfo.SignalStrength, - dst->PhyInfo.SignalQuality, dst->Rssi); + dst->SignalStrength, dst->SignalQuality, dst->Rssi); } static void update_current_network(struct rtw_adapter *adapter, @@ -487,12 +482,11 @@ static void rtw_update_scanned_network(struct rtw_adapter *adapter, pnetwork->last_scanned = jiffies; pnetwork->network_type = 0; - pnetwork->aid = 0; pnetwork->join_res = 0; /* bss info not receiving from the right channel */ - if (pnetwork->network.PhyInfo.SignalQuality == 101) - pnetwork->network.PhyInfo.SignalQuality = 0; + if (pnetwork->network.SignalQuality == 101) + pnetwork->network.SignalQuality = 0; } else { /* * we have an entry and we are going to update it. But @@ -579,8 +573,6 @@ void rtw_atimdone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf) { RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("receive atimdone_evet\n")); - - return; } void rtw_survey_event_cb23a(struct rtw_adapter *adapter, const u8 *pbuf) @@ -650,8 +642,6 @@ exit: kfree(survey->bss); survey->bss = NULL; - - return; } void @@ -825,8 +815,6 @@ void rtw_indicate_connect23a(struct rtw_adapter *padapter) if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) { set_fwstate(pmlmepriv, _FW_LINKED); - rtw_led_control(padapter, LED_CTL_LINK); - rtw_cfg80211_indicate_connect(padapter); netif_carrier_on(padapter->pnetdev); @@ -871,10 +859,7 @@ void rtw_indicate_disconnect23a(struct rtw_adapter *padapter) _clr_fwstate_(pmlmepriv, _FW_LINKED); - rtw_led_control(padapter, LED_CTL_NO_LINK); - rtw_clear_scan_deny(padapter); - } rtw_lps_ctrl_wk_cmd23a(padapter, LPS_CTRL_DISCONNECT, 1); @@ -1028,22 +1013,18 @@ rtw_joinbss_update_network23a(struct rtw_adapter *padapter, cur_network->network.beacon_interval = ptarget_wlan->network.beacon_interval; cur_network->network.tsf = ptarget_wlan->network.tsf; - cur_network->aid = pnetwork->join_res; rtw_set_signal_stat_timer(&padapter->recvpriv); padapter->recvpriv.signal_strength = - ptarget_wlan->network.PhyInfo.SignalStrength; - padapter->recvpriv.signal_qual = - ptarget_wlan->network.PhyInfo.SignalQuality; + ptarget_wlan->network.SignalStrength; + padapter->recvpriv.signal_qual = ptarget_wlan->network.SignalQuality; /* * the ptarget_wlan->network.Rssi is raw data, we use - * ptarget_wlan->network.PhyInfo.SignalStrength instead (has scaled) + * ptarget_wlan->network.SignalStrength instead (has scaled) */ - padapter->recvpriv.rssi = translate_percentage_to_dbm( - ptarget_wlan->network.PhyInfo.SignalStrength); - DBG_8723A("%s signal_strength:%3u, rssi:%3d, signal_qual:%3u\n", + DBG_8723A("%s signal_strength:%3u, signal_qual:%3u\n", __func__, padapter->recvpriv.signal_strength, - padapter->recvpriv.rssi, padapter->recvpriv.signal_qual); + padapter->recvpriv.signal_qual); rtw_set_signal_stat_timer(&padapter->recvpriv); /* update fw_state will clr _FW_UNDER_LINKING here indirectly */ @@ -1132,7 +1113,7 @@ void rtw_joinbss_event_prehandle23a(struct rtw_adapter *adapter, u8 *pbuf) if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) { /* s1. find ptarget_wlan */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { - if (the_same_macaddr == true) { + if (the_same_macaddr) { ptarget_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); } else { pcur_wlan = rtw_find_network23a(&pmlmepriv->scanned_queue, cur_network->network.MacAddress); @@ -1515,18 +1496,21 @@ out: inline bool rtw_is_scan_deny(struct rtw_adapter *adapter) { struct mlme_priv *mlmepriv = &adapter->mlmepriv; + return (atomic_read(&mlmepriv->set_scan_deny) != 0) ? true : false; } void rtw_clear_scan_deny(struct rtw_adapter *adapter) { struct mlme_priv *mlmepriv = &adapter->mlmepriv; + atomic_set(&mlmepriv->set_scan_deny, 0); } void rtw_set_scan_deny_timer_hdl(unsigned long data) { struct rtw_adapter *adapter = (struct rtw_adapter *)data; + rtw_clear_scan_deny(adapter); } @@ -1540,7 +1524,8 @@ void rtw_set_scan_deny(struct rtw_adapter *adapter, u32 ms) } #if defined(IEEE80211_SCAN_RESULT_EXPIRE) -#define RTW_SCAN_RESULT_EXPIRE IEEE80211_SCAN_RESULT_EXPIRE/HZ*1000 -1000 /* 3000 -1000 */ +#define RTW_SCAN_RESULT_EXPIRE \ + ((IEEE80211_SCAN_RESULT_EXPIRE / (HZ*1000)) - 1000) /* 3000 -1000 */ #else #define RTW_SCAN_RESULT_EXPIRE 2000 #endif @@ -1766,7 +1751,7 @@ exit: return ret; } -int rtw_set_auth23a(struct rtw_adapter * adapter, +int rtw_set_auth23a(struct rtw_adapter *adapter, struct security_priv *psecuritypriv) { struct cmd_obj *pcmd; @@ -2151,6 +2136,7 @@ bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie, if (p && p[1] > 0) { u32 rx_packet_offset, max_recvbuf_sz; + if (pmlmepriv->qos_option == 0) { out_len = *pout_len; pframe = rtw_set_ie23a(out_ie + out_len, @@ -2165,9 +2151,9 @@ bool rtw_restructure_ht_ie23a(struct rtw_adapter *padapter, u8 *in_ie, memset(&ht_capie, 0, sizeof(struct ieee80211_ht_cap)); - ht_capie.cap_info = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | + ht_capie.cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_TX_STBC | IEEE80211_HT_CAP_DSSSCCK40; + IEEE80211_HT_CAP_TX_STBC | IEEE80211_HT_CAP_DSSSCCK40); GetHalDefVar8192CUsb(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset); diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 3eb77de17e3a..0e0f73c86e53 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -331,6 +331,7 @@ rtw_update_TSF(struct mlme_ext_priv *pmlmeext, struct ieee80211_mgmt *mgmt) int rtw_ch_set_search_ch23a(struct rt_channel_info *ch_set, const u32 ch) { int i; + for (i = 0; ch_set[i]. ChannelNum != 0; i++) { if (ch == ch_set[i].ChannelNum) break; @@ -566,7 +567,6 @@ static u8 init_channel_set(struct rtw_adapter *padapter, u8 cplan, int init_mlme_ext_priv23a(struct rtw_adapter *padapter) { - int res = _SUCCESS; struct registry_priv *pregistrypriv = &padapter->registrypriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -593,7 +593,7 @@ int init_mlme_ext_priv23a(struct rtw_adapter *padapter) pmlmeext->mlmeext_init = true; pmlmeext->active_keep_alive_check = true; - return res; + return _SUCCESS; } void free_mlme_ext_priv23a (struct mlme_ext_priv *pmlmeext) @@ -680,8 +680,7 @@ void mgt_dispatcher23a(struct rtw_adapter *padapter, } #ifdef CONFIG_8723AU_AP_MODE - switch (stype) - { + switch (stype) { case IEEE80211_STYPE_AUTH: if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) ptable->func = &OnAuth23a; @@ -1572,6 +1571,7 @@ OnAssocReq23a(struct rtw_adapter *padapter, struct recv_frame *precv_frame) pstat->uapsd_bk = 0; if (pmlmepriv->qos_option) { const u8 *end = pos + left; + p = pos; for (;;) { @@ -2335,12 +2335,9 @@ static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) __func__, hidden_ssid_mode, ssid_ie, ssid_len_ori); */ if (ssid_ie && ssid_len_ori > 0) { - switch (hidden_ssid_mode) - { + switch (hidden_ssid_mode) { case 1: next_ie = ssid_ie + 2 + ssid_len_ori; - remain_len = 0; - remain_len = ies_len -(next_ie-ies); ssid_ie[1] = 0; @@ -2599,7 +2596,9 @@ static void issue_probersp(struct rtw_adapter *padapter, unsigned char *da, if (ssid_ie && cur_network->Ssid.ssid_len) { uint remainder_ielen; u8 *remainder_ie; + remainder_ie = ssid_ie + 2; + remainder_ielen = pframe - remainder_ie; DBG_8723A_LEVEL(_drv_warning_, "%s(%s): " @@ -2862,6 +2861,7 @@ static void issue_auth(struct rtw_adapter *padapter, struct sta_info *psta, if (psta) { /* for AP mode */ #ifdef CONFIG_8723AU_AP_MODE unsigned short val16; + ether_addr_copy(mgmt->da, psta->hwaddr); ether_addr_copy(mgmt->sa, myid(&padapter->eeprompriv)); ether_addr_copy(mgmt->bssid, myid(&padapter->eeprompriv)); @@ -3306,6 +3306,7 @@ static void issue_assocreq(struct rtw_adapter *padapter) !memcmp(p + 2, WMM_OUI23A, 4) || !memcmp(p + 2, WPS_OUI23A, 4)) { u8 plen = p[1]; + if (!padapter->registrypriv.wifi_spec) { /* Commented by Kurt 20110629 */ /* In some older APs, WPS handshake */ @@ -3997,7 +3998,7 @@ int send_beacon23a(struct rtw_adapter *padapter) yield(); bxmitok = rtl8723a_get_bcn_valid(padapter); poll++; - } while ((poll % 10) != 0 && bxmitok == false && + } while ((poll % 10) != 0 && !bxmitok && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); @@ -4070,6 +4071,7 @@ static void rtw_site_survey(struct rtw_adapter *padapter) if (ScanType == SCAN_ACTIVE) /* obey the channel plan setting... */ { int i; + for (i = 0;i<RTW_SSID_SCAN_AMOUNT;i++) { if (pmlmeext->sitesurvey_res.ssid[i].ssid_len) { /* todo: to issue two probe req??? */ @@ -4197,9 +4199,9 @@ static struct wlan_bssid_ex *collect_bss_info(struct rtw_adapter *padapter, /* get the signal strength */ /* in dBM.raw data */ bssid->Rssi = precv_frame->attrib.phy_info.RecvSignalPower; - bssid->PhyInfo.SignalQuality = + bssid->SignalQuality = precv_frame->attrib.phy_info.SignalQuality;/* in percentage */ - bssid->PhyInfo.SignalStrength = + bssid->SignalStrength = precv_frame->attrib.phy_info.SignalStrength;/* in percentage */ /* checking SSID */ @@ -4293,6 +4295,7 @@ static struct wlan_bssid_ex *collect_bss_info(struct rtw_adapter *padapter, bssid->IELength); if (p && p[1] > 0) { struct ieee80211_ht_cap *pHT_caps; + pHT_caps = (struct ieee80211_ht_cap *)(p + 2); if (pHT_caps->cap_info & @@ -4305,7 +4308,7 @@ static struct wlan_bssid_ex *collect_bss_info(struct rtw_adapter *padapter, /* mark bss info receiving from nearby channel as SignalQuality 101 */ if (bssid->DSConfig != rtw_get_oper_ch23a(padapter)) - bssid->PhyInfo.SignalQuality = 101; + bssid->SignalQuality = 101; return bssid; fail: @@ -4319,6 +4322,7 @@ static void start_create_ibss(struct rtw_adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network; + pmlmeext->cur_channel = (u8)pnetwork->DSConfig; pmlmeinfo->bcn_interval = pnetwork->beacon_interval; @@ -4354,9 +4358,7 @@ static void start_create_ibss(struct rtw_adapter *padapter) report_join_res23a(padapter, 1); pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS; } - } - else - { + } else { DBG_8723A("%s: invalid cap:%x\n", __func__, caps); return; } @@ -4414,9 +4416,7 @@ static void start_clnt_join(struct rtw_adapter *padapter) pmlmeinfo->state = MSR_ADHOC; report_join_res23a(padapter, 1); - } - else - { + } else { /* DBG_8723A("marc: invalid cap:%x\n", caps); */ return; } @@ -4480,16 +4480,12 @@ int receive_disconnect23a(struct rtw_adapter *padapter, DBG_8723A("%s\n", __func__); - if ((pmlmeinfo->state&0x03) == MSR_INFRA) - { - if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) - { + if ((pmlmeinfo->state&0x03) == MSR_INFRA) { + if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { pmlmeinfo->state = MSR_NOLINK; report_del_sta_event23a(padapter, MacAddr, reason); - } - else if (pmlmeinfo->state & WIFI_FW_LINKING_STATE) - { + } else if (pmlmeinfo->state & WIFI_FW_LINKING_STATE) { pmlmeinfo->state = MSR_NOLINK; report_join_res23a(padapter, -2); } @@ -4866,7 +4862,7 @@ void report_join_res23a(struct rtw_adapter *padapter, int res) pjoinbss_evt = (struct joinbss_event*)(pevtcmd + sizeof(struct C2HEvent_Header)); memcpy((unsigned char *)&pjoinbss_evt->network.network, &pmlmeinfo->network, sizeof(struct wlan_bssid_ex)); - pjoinbss_evt->network.join_res = pjoinbss_evt->network.aid = res; + pjoinbss_evt->network.join_res = res; DBG_8723A("report_join_res23a(%d)\n", res); @@ -4995,8 +4991,7 @@ void update_sta_info23a(struct rtw_adapter *padapter, struct sta_info *psta) VCS_update23a(padapter, psta); /* HT */ - if (pmlmepriv->htpriv.ht_option) - { + if (pmlmepriv->htpriv.ht_option) { psta->htpriv.ht_option = true; psta->htpriv.ampdu_enable = pmlmepriv->htpriv.ampdu_enable; @@ -5006,9 +5001,7 @@ void update_sta_info23a(struct rtw_adapter *padapter, struct sta_info *psta) psta->qos_option = true; - } - else - { + } else { psta->htpriv.ht_option = false; psta->htpriv.ampdu_enable = false; @@ -5050,12 +5043,10 @@ void mlmeext_joinbss_event_callback23a(struct rtw_adapter *padapter, goto exit_mlmeext_joinbss_event_callback23a; } - if ((pmlmeinfo->state&0x03) == MSR_ADHOC) - { + if ((pmlmeinfo->state&0x03) == MSR_ADHOC) { /* for bc/mc */ psta_bmc = rtw_get_bcmc_stainfo23a(padapter); - if (psta_bmc) - { + if (psta_bmc) { pmlmeinfo->FW_sta_info[psta_bmc->mac_id].psta = psta_bmc; update_bmc_sta_support_rate23a(padapter, psta_bmc->mac_id); Update_RA_Entry23a(padapter, psta_bmc); @@ -5086,8 +5077,7 @@ void mlmeext_joinbss_event_callback23a(struct rtw_adapter *padapter, set_channel_bwmode23a(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); psta = rtw_get_stainfo23a(pstapriv, cur_network->MacAddress); - if (psta) /* only for infra. mode */ - { + if (psta) { /* only for infra. mode */ pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta; /* DBG_8723A("set_sta_rate23a\n"); */ @@ -5123,8 +5113,7 @@ void mlmeext_sta_add_event_callback23a(struct rtw_adapter *padapter, if ((pmlmeinfo->state & 0x03) == MSR_ADHOC) { /* adhoc master or sta_count>1 */ - if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) - { + if (pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) { /* nothing to do */ } else { /* adhoc client */ /* correcting TSF */ diff --git a/drivers/staging/rtl8723au/core/rtw_pwrctrl.c b/drivers/staging/rtl8723au/core/rtw_pwrctrl.c index 1b2af7381d82..e2d51afe522c 100644 --- a/drivers/staging/rtl8723au/core/rtw_pwrctrl.c +++ b/drivers/staging/rtl8723au/core/rtw_pwrctrl.c @@ -159,7 +159,7 @@ void rtw_ps_processor23a(struct rtw_adapter *padapter) if (pwrpriv->ips_mode_req == IPS_NONE) goto exit; - if (rtw_pwr_unassociated_idle(padapter) == false) + if (!rtw_pwr_unassociated_idle(padapter)) goto exit; if (pwrpriv->rf_pwrstate == rf_on && @@ -172,12 +172,12 @@ void rtw_ps_processor23a(struct rtw_adapter *padapter) exit: rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); pwrpriv->ps_processing = false; - return; } static void pwr_state_check_handler(unsigned long data) { struct rtw_adapter *padapter = (struct rtw_adapter *)data; + rtw_ps_cmd23a(padapter); } @@ -338,8 +338,7 @@ s32 LPS_RF_ON_check23a(struct rtw_adapter *padapter, u32 delay_ms) start_time = jiffies; end_time = start_time + msecs_to_jiffies(delay_ms); - while (1) - { + while (1) { bAwake = rtl8723a_get_fwlps_rf_on(padapter); if (bAwake == true) break; @@ -470,6 +469,7 @@ void rtw_free_pwrctrl_priv(struct rtw_adapter *adapter) inline void rtw_set_ips_deny23a(struct rtw_adapter *padapter, u32 ms) { struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; + pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ms); } diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 5bc7734d9a72..559dddee2648 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -215,6 +215,7 @@ u32 rtw_free_uc_swdec_pending_queue23a(struct rtw_adapter *adapter) { u32 cnt = 0; struct recv_frame *pending_frame; + while ((pending_frame = rtw_alloc_recvframe23a(&adapter->recvpriv.uc_swdec_pending_queue))) { rtw_free_recvframe23a(pending_frame); DBG_8723A("%s: dequeue uc_swdec_pending_queue\n", __func__); @@ -239,6 +240,7 @@ int rtw_enqueue_recvbuf23a_to_head(struct recv_buf *precvbuf, struct rtw_queue * int rtw_enqueue_recvbuf23a(struct recv_buf *precvbuf, struct rtw_queue *queue) { unsigned long irqL; + spin_lock_irqsave(&queue->lock, irqL); list_del_init(&precvbuf->list); @@ -364,6 +366,7 @@ int recvframe_chkmic(struct rtw_adapter *adapter, if (bmic_err == true) { int i; + RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("\n *(pframemic-8)-*(pframemic-1) =" "0x%02x:0x%02x:0x%02x:0x%02x:0x%02x:" @@ -483,6 +486,7 @@ struct recv_frame *decryptor(struct rtw_adapter *padapter, if (prxattrib->encrypt > 0) { u8 *iv = precv_frame->pkt->data + prxattrib->hdrlen; + prxattrib->key_index = (((iv[3]) >> 6) & 0x3); if (prxattrib->key_index > WEP_KEYS) { @@ -564,59 +568,27 @@ static struct recv_frame *portctrl(struct rtw_adapter *adapter, ("########portctrl:adapter->securitypriv.dot11AuthAlgrthm =" "%d\n", adapter->securitypriv.dot11AuthAlgrthm)); + prtnframe = precv_frame; + if (auth_alg == dot11AuthAlgrthm_8021X) { /* get ether_type */ ptr = pfhdr->pkt->data + pfhdr->attrib.hdrlen; ether_type = (ptr[6] << 8) | ptr[7]; - if ((psta != NULL) && (psta->ieee8021x_blocked)) { + if (psta && psta->ieee8021x_blocked) { /* blocked */ /* only accept EAPOL frame */ RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("########portctrl:psta->ieee8021x_blocked ==" "1\n")); - if (ether_type == eapol_type) { - prtnframe = precv_frame; - } else { + if (ether_type != eapol_type) { /* free this frame */ rtw_free_recvframe23a(precv_frame); prtnframe = NULL; } - } else { - /* allowed */ - /* check decryption status, and decrypt the frame if needed */ - RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("########portctrl:psta->ieee8021x_blocked ==" - "0\n")); - RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("portctrl:precv_frame->hdr.attrib.privacy =" - "%x\n", precv_frame->attrib.privacy)); - - if (pattrib->bdecrypted == 0) { - RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("portctrl:prxstat->decrypted =%x\n", - pattrib->bdecrypted)); - } - - prtnframe = precv_frame; - /* check is the EAPOL frame or not (Rekey) */ - if (ether_type == eapol_type) { - RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_, - ("########portctrl:ether_type == " - "0x888e\n")); - /* check Rekey */ - - prtnframe = precv_frame; - } else { - RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, - ("########portctrl:ether_type = 0x%04x" - "\n", ether_type)); - } } - } else { - prtnframe = precv_frame; } return prtnframe; @@ -1066,6 +1038,7 @@ int sta2ap_data_frame(struct rtw_adapter *adapter, } } else { u8 *myhwaddr = myid(&adapter->eeprompriv); + if (!ether_addr_equal(pattrib->ra, myhwaddr)) { ret = RTW_RX_HANDLED; goto exit; @@ -1405,8 +1378,7 @@ static int validate_recv_data_frame(struct rtw_adapter *adapter, RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n pattrib->encrypt =%d\n", pattrib->encrypt)); - switch (pattrib->encrypt) - { + switch (pattrib->encrypt) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: pattrib->iv_len = IEEE80211_WEP_IV_LEN; @@ -1505,8 +1477,7 @@ static int validate_recv_frame(struct rtw_adapter *adapter, if (unlikely(bDumpRxPkt == 1)) dump_rx_pkt(skb, type, bDumpRxPkt); - switch (type) - { + switch (type) { case IEEE80211_FTYPE_MGMT: retval = validate_recv_mgnt_frame(adapter, precv_frame); if (retval == _FAIL) { @@ -1524,7 +1495,6 @@ static int validate_recv_frame(struct rtw_adapter *adapter, retval = _FAIL; /* only data frame return _SUCCESS */ break; case IEEE80211_FTYPE_DATA: - rtw_led_control(adapter, LED_CTL_RX); pattrib->qos = (subtype & IEEE80211_STYPE_QOS_DATA) ? 1 : 0; retval = validate_recv_data_frame(adapter, precv_frame); if (retval == _FAIL) { @@ -1551,8 +1521,6 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe) u16 eth_type, len, hdrlen; u8 bsnaphdr; u8 *psnap; - - int ret = _SUCCESS; struct rtw_adapter *adapter = precvframe->adapter; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -1613,7 +1581,7 @@ static int wlanhdr_to_ethhdr (struct recv_frame *precvframe) } - return ret; + return _SUCCESS; } /* perform defrag */ @@ -1691,7 +1659,7 @@ struct recv_frame *recvframe_defrag(struct rtw_adapter *adapter, skb_put(skb, pnfhdr->pkt->len); prframe->attrib.icv_len = pnfhdr->attrib.icv_len; - }; + } /* free the defrag_q queue and return the prframe */ rtw_free_recvframe23a_queue(defrag_q); @@ -2177,8 +2145,7 @@ int process_recv_indicatepkts(struct rtw_adapter *padapter, return retval; } } - } else /* B/G mode */ - { + } else { /* B/G mode */ retval = wlanhdr_to_ethhdr(prframe); if (retval != _SUCCESS) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, @@ -2238,8 +2205,6 @@ static int recv_func_posthandle(struct rtw_adapter *padapter, struct recv_priv *precvpriv = &padapter->recvpriv; /* DATA FRAME */ - rtw_led_control(padapter, LED_CTL_RX); - prframe = decryptor(padapter, prframe); if (prframe == NULL) { RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, @@ -2349,66 +2314,52 @@ void rtw_signal_stat_timer_hdl23a(unsigned long data) u8 _alpha = 3; /* this value is based on converging_constant = 5000 */ /* and sampling_interval = 1000 */ - if (adapter->recvpriv.is_signal_dbg) { - /* update the user specific value, signal_strength_dbg, */ - /* to signal_strength, rssi */ - adapter->recvpriv.signal_strength = - adapter->recvpriv.signal_strength_dbg; - adapter->recvpriv.rssi = - (s8)translate_percentage_to_dbm((u8)adapter->recvpriv.signal_strength_dbg); - } else { - if (recvpriv->signal_strength_data.update_req == 0) { - /* update_req is clear, means we got rx */ - avg_signal_strength = - recvpriv->signal_strength_data.avg_val; - num_signal_strength = - recvpriv->signal_strength_data.total_num; - /* after avg_vals are acquired, we can re-stat */ - /* the signal values */ - recvpriv->signal_strength_data.update_req = 1; - } + if (recvpriv->signal_strength_data.update_req == 0) { + /* update_req is clear, means we got rx */ + avg_signal_strength = recvpriv->signal_strength_data.avg_val; + num_signal_strength = recvpriv->signal_strength_data.total_num; + /* after avg_vals are acquired, we can re-stat */ + /* the signal values */ + recvpriv->signal_strength_data.update_req = 1; + } + + if (recvpriv->signal_qual_data.update_req == 0) { + /* update_req is clear, means we got rx */ + avg_signal_qual = recvpriv->signal_qual_data.avg_val; + num_signal_qual = recvpriv->signal_qual_data.total_num; + /* after avg_vals are acquired, we can re-stat */ + /*the signal values */ + recvpriv->signal_qual_data.update_req = 1; + } + + /* update value of signal_strength, rssi, signal_qual */ + if (!check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY)) { + tmp_s = (avg_signal_strength + (_alpha - 1) * + recvpriv->signal_strength); + if (tmp_s %_alpha) + tmp_s = tmp_s / _alpha + 1; + else + tmp_s = tmp_s / _alpha; + if (tmp_s > 100) + tmp_s = 100; - if (recvpriv->signal_qual_data.update_req == 0) { - /* update_req is clear, means we got rx */ - avg_signal_qual = recvpriv->signal_qual_data.avg_val; - num_signal_qual = recvpriv->signal_qual_data.total_num; - /* after avg_vals are acquired, we can re-stat */ - /*the signal values */ - recvpriv->signal_qual_data.update_req = 1; - } + tmp_q = avg_signal_qual + (_alpha - 1) * recvpriv->signal_qual; + if (tmp_q %_alpha) + tmp_q = tmp_q / _alpha + 1; + else + tmp_q = tmp_q / _alpha; + if (tmp_q > 100) + tmp_q = 100; - /* update value of signal_strength, rssi, signal_qual */ - if (!check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY)) { - tmp_s = (avg_signal_strength + (_alpha - 1) * - recvpriv->signal_strength); - if (tmp_s %_alpha) - tmp_s = tmp_s / _alpha + 1; - else - tmp_s = tmp_s / _alpha; - if (tmp_s > 100) - tmp_s = 100; - - tmp_q = (avg_signal_qual + (_alpha - 1) * - recvpriv->signal_qual); - if (tmp_q %_alpha) - tmp_q = tmp_q / _alpha + 1; - else - tmp_q = tmp_q / _alpha; - if (tmp_q > 100) - tmp_q = 100; - - recvpriv->signal_strength = tmp_s; - recvpriv->rssi = (s8)translate_percentage_to_dbm(tmp_s); - recvpriv->signal_qual = tmp_q; - - DBG_8723A("%s signal_strength:%3u, rssi:%3d, " - "signal_qual:%3u, num_signal_strength:%u, " - "num_signal_qual:%u\n", - __func__, recvpriv->signal_strength, - recvpriv->rssi, recvpriv->signal_qual, - num_signal_strength, num_signal_qual - ); - } + recvpriv->signal_strength = tmp_s; + recvpriv->signal_qual = tmp_q; + + DBG_8723A("%s signal_strength:%3u, signal_qual:%3u, " + "num_signal_strength:%u, num_signal_qual:%u\n", + __func__, recvpriv->signal_strength, + recvpriv->signal_qual, num_signal_strength, + num_signal_qual); } + rtw_set_signal_stat_timer(recvpriv); } diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 76371ae69377..715a47414bdd 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -23,19 +23,18 @@ #define CRC32_POLY 0x04c11db7 -struct arc4context -{ +struct arc4context { u32 x; u32 y; u8 state[256]; }; -static void arcfour_init(struct arc4context *parc4ctx, u8 * key, u32 key_len) +static void arcfour_init(struct arc4context *parc4ctx, u8 *key, u32 key_len) { u32 t, u; u32 keyindex; u32 stateindex; - u8 * state; + u8 *state; u32 counter; state = parc4ctx->state; @@ -45,8 +44,7 @@ static void arcfour_init(struct arc4context *parc4ctx, u8 * key, u32 key_len) state[counter] = (u8)counter; keyindex = 0; stateindex = 0; - for (counter = 0; counter < 256; counter++) - { + for (counter = 0; counter < 256; counter++) { t = state[counter]; stateindex = (stateindex + key[keyindex] + t) & 0xff; u = state[stateindex]; @@ -62,7 +60,7 @@ static u32 arcfour_byte( struct arc4context *parc4ctx) u32 x; u32 y; u32 sx, sy; - u8 * state; + u8 *state; state = parc4ctx->state; x = (parc4ctx->x + 1) & 0xff; @@ -78,8 +76,8 @@ static u32 arcfour_byte( struct arc4context *parc4ctx) } static void arcfour_encrypt( struct arc4context *parc4ctx, - u8 * dest, - u8 * src, + u8 *dest, + u8 *src, u32 len) { u32 i; @@ -114,8 +112,7 @@ static void crc32_init(void) c = 0x12340000; - for (i = 0; i < 256; ++i) - { + for (i = 0; i < 256; ++i) { k = crc32_reverseBit((u8)i); for (c = ((u32)k) << 24, j = 8; j > 0; --j) { c = c & 0x80000000 ? (c << 1) ^ CRC32_POLY : (c << 1); @@ -221,7 +218,7 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, u8 keyindex; struct rx_pkt_attrib *prxattrib = &precvframe->attrib; struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sk_buff * skb = precvframe->pkt; + struct sk_buff *skb = precvframe->pkt; pframe = skb->data; @@ -260,33 +257,29 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, crc[1], payload[length - 3], crc[0], payload[length - 4])); } - - return; } /* 3 ===== TKIP related ===== */ -static u32 secmicgetuint32(u8 * p) +static u32 secmicgetuint32(u8 *p) /* Convert from Byte[] to u32 in a portable way */ { s32 i; u32 res = 0; - for (i = 0; i<4; i++) - { + for (i = 0; i<4; i++) { res |= ((u32)(*p++)) << (8*i); } return res; } -static void secmicputuint32(u8 * p, u32 val) +static void secmicputuint32(u8 *p, u32 val) /* Convert from long to Byte[] in a portable way */ { long i; - for (i = 0; i<4; i++) - { + for (i = 0; i<4; i++) { *p++ = (u8) (val & 0xff); val >>= 8; } @@ -304,7 +297,7 @@ static void secmicclear(struct mic_data *pmicdata) } -void rtw_secmicsetkey23a(struct mic_data *pmicdata, u8 * key) +void rtw_secmicsetkey23a(struct mic_data *pmicdata, u8 *key) { /* Set the key */ @@ -322,8 +315,7 @@ void rtw_secmicappend23abyte23a(struct mic_data *pmicdata, u8 b) pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM); pmicdata->nBytesInM++; /* Process the word if it is full. */ - if (pmicdata->nBytesInM >= 4) - { + if (pmicdata->nBytesInM >= 4) { pmicdata->L ^= pmicdata->M; pmicdata->R ^= ROL32(pmicdata->L, 17); pmicdata->L += pmicdata->R; @@ -340,19 +332,18 @@ void rtw_secmicappend23abyte23a(struct mic_data *pmicdata, u8 b) } -void rtw_secmicappend23a(struct mic_data *pmicdata, u8 * src, u32 nbytes) +void rtw_secmicappend23a(struct mic_data *pmicdata, u8 *src, u32 nbytes) { /* This is simple */ - while(nbytes > 0) - { + while(nbytes > 0) { rtw_secmicappend23abyte23a(pmicdata, *src++); nbytes--; } } -void rtw_secgetmic23a(struct mic_data *pmicdata, u8 * dst) +void rtw_secgetmic23a(struct mic_data *pmicdata, u8 *dst) { /* Append the minimum padding */ @@ -362,8 +353,7 @@ void rtw_secgetmic23a(struct mic_data *pmicdata, u8 * dst) rtw_secmicappend23abyte23a(pmicdata, 0); rtw_secmicappend23abyte23a(pmicdata, 0); /* and then zeroes until the length is a multiple of 4 */ - while(pmicdata->nBytesInM != 0) - { + while(pmicdata->nBytesInM != 0) { rtw_secmicappend23abyte23a(pmicdata, 0); } /* The appendByte function has already computed the result. */ @@ -374,7 +364,8 @@ void rtw_secgetmic23a(struct mic_data *pmicdata, u8 * dst) } -void rtw_seccalctkipmic23a(u8 * key, u8 *header, u8 *data, u32 data_len, u8 *mic_code, u8 pri) +void rtw_seccalctkipmic23a(u8 *key, u8 *header, u8 *data, u32 data_len, + u8 *mic_code, u8 pri) { struct mic_data micdata; @@ -531,8 +522,8 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) /* Now compute an unbalanced Feistel cipher with 80-bit block */ /* size on the 80-bit block P1K[], using the 128-bit key TK[] */ - for (i = 0; i < PHASE1_LOOP_CNT ;i++) - { /* Each add operation here is mod 2**16 */ + for (i = 0; i < PHASE1_LOOP_CNT ;i++) { + /* Each add operation here is mod 2**16 */ p1k[0] += _S_(p1k[4] ^ TK16((i&1)+0)); p1k[1] += _S_(p1k[0] ^ TK16((i&1)+2)); p1k[2] += _S_(p1k[1] ^ TK16((i&1)+4)); @@ -602,8 +593,7 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16) rc4key[3] = Lo8((PPK[5] ^ TK16(0)) >> 1); /* Copy 96 bits of PPK[0..5] to RC4KEY[4..15] (little-endian) */ - for (i = 0;i<6;i++) - { + for (i = 0;i<6;i++) { rc4key[4+2*i] = Lo8(PPK[i]); rc4key[5+2*i] = Hi8(PPK[i]); } @@ -649,8 +639,7 @@ int rtw_tkip_encrypt23a(struct rtw_adapter *padapter, if (stainfo!= NULL) { - if (!(stainfo->state &_FW_LINKED)) - { + if (!(stainfo->state &_FW_LINKED)) { DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state); return _FAIL; } @@ -728,7 +717,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, struct sta_info *stainfo; struct rx_pkt_attrib *prxattrib = &precvframe->attrib; struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sk_buff * skb = precvframe->pkt; + struct sk_buff *skb = precvframe->pkt; int res = _SUCCESS; pframe = skb->data; @@ -887,8 +876,7 @@ static void byte_sub(u8 *in, u8 *out) { int i; - for (i = 0; i< 16; i++) - { + for (i = 0; i< 16; i++) { out[i] = sbox(in[i]); } @@ -928,8 +916,7 @@ static void mix_column(u8 *in, u8 *out) u8 temp[4]; u8 tempb[4]; - for (i = 0 ; i<4; i++) - { + for (i = 0 ; i<4; i++) { if ((in[i] & 0x80) == 0x80) add1b[i] = 0x1b; else @@ -951,11 +938,9 @@ static void mix_column(u8 *in, u8 *out) andf7[2] = in[2] & 0x7f; andf7[3] = in[3] & 0x7f; - for (i = 3; i>0; i--) /* logical shift left 1 bit */ - { + for (i = 3; i>0; i--) { /* logical shift left 1 bit */ andf7[i] = andf7[i] << 1; - if ((andf7[i-1] & 0x80) == 0x80) - { + if ((andf7[i-1] & 0x80) == 0x80) { andf7[i] = (andf7[i] | 0x01); } } @@ -988,21 +973,15 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext) for (i = 0; i<16; i++) round_key[i] = key[i]; - for (round = 0; round < 11; round++) - { - if (round == 0) - { + for (round = 0; round < 11; round++) { + if (round == 0) { xor_128(round_key, data, ciphertext); next_key(round_key, round); - } - else if (round == 10) - { + } else if (round == 10) { byte_sub(ciphertext, intermediatea); shift_row(intermediatea, intermediateb); xor_128(intermediateb, round_key, ciphertext); - } - else /* 1 - 9 */ - { + } else { /* 1 - 9 */ byte_sub(ciphertext, intermediatea); shift_row(intermediatea, intermediateb); mix_column(&intermediateb[0], &intermediatea[0]); @@ -1088,20 +1067,17 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, mic_header2[6] = 0x00; mic_header2[7] = 0x00; /* mpdu[23]; */ - if (!qc_exists && a4_exists) - { + if (!qc_exists && a4_exists) { for (i = 0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ } - if (qc_exists && !a4_exists) - { + if (qc_exists && !a4_exists) { mic_header2[8] = mpdu[24] & 0x0f; /* mute bits 15 - 4 */ mic_header2[9] = mpdu[25] & 0x00; } - if (qc_exists && a4_exists) - { + if (qc_exists && a4_exists) { for (i = 0;i<6;i++) mic_header2[8+i] = mpdu[24+i]; /* A4 */ mic_header2[14] = mpdu[30] & 0x0f; diff --git a/drivers/staging/rtl8723au/core/rtw_sreset.c b/drivers/staging/rtl8723au/core/rtw_sreset.c index 58ed980795a6..29a29d92a6ac 100644 --- a/drivers/staging/rtl8723au/core/rtw_sreset.c +++ b/drivers/staging/rtl8723au/core/rtw_sreset.c @@ -107,7 +107,7 @@ static void sreset_restore_network_station(struct rtw_adapter *padapter) mlmeext_joinbss_event_callback23a(padapter, 1); /* restore Sequence No. */ - rtl8723au_write8(padapter, 0x4dc, padapter->xmitpriv.nqos_ssn); + rtl8723au_write8(padapter, REG_NQOS_SEQ, padapter->xmitpriv.nqos_ssn); sreset_restore_security_station(padapter); } diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c index 09c44a55d4a6..69d9e0f17fd8 100644 --- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c @@ -608,8 +608,6 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter) DBG_8723A("wmm_para_seq(%d): %d\n", i, pxmitpriv->wmm_para_seq[i]); } - - return; } static void bwmode_update_check(struct rtw_adapter *padapter, const u8 *p) @@ -750,7 +748,6 @@ void HT_caps_handler23a(struct rtw_adapter *padapter, const u8 *p) else cap->mcs.rx_mask[i] &= MCS_rate_2R23A[i]; } - return; } void HT_info_handler23a(struct rtw_adapter *padapter, const u8 *p) @@ -771,7 +768,6 @@ void HT_info_handler23a(struct rtw_adapter *padapter, const u8 *p) pmlmeinfo->HT_info_enable = 1; memcpy(&pmlmeinfo->HT_info, p + 2, p[1]); - return; } void HTOnAssocRsp23a(struct rtw_adapter *padapter) @@ -833,7 +829,7 @@ void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta) psta->cts2self = 0; break; case 1: /* on */ - if (pregpriv->vcs_type == 1) { /* 1:RTS/CTS 2:CTS to self */ + if (pregpriv->vcs_type == RTS_CTS) { psta->rtsen = 1; psta->cts2self = 0; } else { @@ -844,7 +840,7 @@ void VCS_update23a(struct rtw_adapter *padapter, struct sta_info *psta) case 2: /* auto */ default: if (pmlmeinfo->ERP_enable && pmlmeinfo->ERP_IE & BIT(1)) { - if (pregpriv->vcs_type == 1) { + if (pregpriv->vcs_type == RTS_CTS) { psta->rtsen = 1; psta->cts2self = 0; } else { @@ -870,7 +866,7 @@ int rtw_check_bcn_info23a(struct rtw_adapter *Adapter, int pie_len, ssid_len, privacy; const u8 *p, *ssid; - if (is_client_associated_to_ap23a(Adapter) == false) + if (!is_client_associated_to_ap23a(Adapter)) return _SUCCESS; if (unlikely(!ieee80211_is_beacon(mgmt->frame_control))) { @@ -1080,7 +1076,7 @@ bool is_ap_in_tkip23a(struct rtw_adapter *padapter) return false; } -bool should_forbid_n_rate23a(struct rtw_adapter * padapter) +bool should_forbid_n_rate23a(struct rtw_adapter *padapter) { u32 i; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1153,6 +1149,7 @@ bool is_ap_in_wep23a(struct rtw_adapter *padapter) static int wifirate2_ratetbl_inx23a(unsigned char rate) { int inx = 0; + rate = rate & 0x7f; switch (rate) { @@ -1311,6 +1308,7 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len) u8 epigram_vendor_flag; u8 ralink_vendor_flag; const u8 *p; + epigram_vendor_flag = 0; ralink_vendor_flag = 0; @@ -1324,7 +1322,6 @@ unsigned char check_assoc_AP23a(u8 *pframe, uint len) DBG_8723A("link to Artheros AP\n"); return HT_IOT_PEER_ATHEROS; } else if (!memcmp(p + 2, BROADCOM_OUI1, 3) || - !memcmp(p + 2, BROADCOM_OUI2, 3) || !memcmp(p + 2, BROADCOM_OUI2, 3)) { DBG_8723A("link to Broadcom AP\n"); return HT_IOT_PEER_BROADCOM; diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c index 7a8038156cea..7a5e6bf0d1ae 100644 --- a/drivers/staging/rtl8723au/core/rtw_xmit.c +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c @@ -22,9 +22,6 @@ #include <usb_ops.h> #include <rtl8723a_xmit.h> -static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 }; -static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 }; - static void _init_txservq(struct tx_servq *ptxservq) { @@ -180,16 +177,8 @@ int _rtw_init_xmit_priv23a(struct xmit_priv *pxmitpriv, for (i = 0; i < 4; i ++) pxmitpriv->wmm_para_seq[i] = i; - pxmitpriv->txirp_cnt = 1; - sema_init(&pxmitpriv->tx_retevt, 0); - /* per AC pending irp */ - pxmitpriv->beq_cnt = 0; - pxmitpriv->bkq_cnt = 0; - pxmitpriv->viq_cnt = 0; - pxmitpriv->voq_cnt = 0; - pxmitpriv->ack_tx = false; mutex_init(&pxmitpriv->ack_tx_mutex); rtw_sctx_init23a(&pxmitpriv->ack_tx_ops, 0); @@ -315,6 +304,7 @@ static void update_attrib_vcs_info(struct rtw_adapter *padapter, struct xmit_fra /* check HT op mode */ if (pattrib->ht_en) { u8 HTOpMode = pmlmeinfo->HT_protection; + if ((pmlmeext->cur_bwmode && (HTOpMode == 2 || HTOpMode == 3)) || (!pmlmeext->cur_bwmode && HTOpMode == 3)) { pattrib->vcs_mode = RTS_CTS; @@ -464,6 +454,7 @@ static int update_attrib(struct rtw_adapter *padapter, if (pattrib->pktlen > 282 + 24) { if (pattrib->ether_type == ETH_P_IP) {/* IP header */ u8 *pframe = skb->data; + pframe += ETH_HLEN; if ((pframe[21] == 68 && pframe[23] == 67) || @@ -1048,21 +1039,23 @@ s32 rtw_txframes_sta_ac_pending23a(struct rtw_adapter *padapter, return ptxservq->qcnt; } -/* - * Calculate wlan 802.11 packet MAX size from pkt_attrib - * This function doesn't consider fragment case +/* Logical Link Control(LLC) SubNetwork Attachment Point(SNAP) header + * IEEE LLC/SNAP header contains 8 octets + * First 3 octets comprise the LLC portion + * SNAP portion, 5 octets, is divided into two fields: + * Organizationally Unique Identifier(OUI), 3 octets, + * type, defined by that organization, 2 octets. */ -u32 rtw_calculate_wlan_pkt_size_by_attribue23a(struct pkt_attrib *pattrib) +static int rtw_put_snap(u8 *data, u16 h_proto) { - u32 len = 0; - - len = pattrib->hdrlen + pattrib->iv_len; /* WLAN Header and IV */ - len += SNAP_SIZE + sizeof(u16); /* LLC */ - len += pattrib->pktlen; - if (pattrib->encrypt == WLAN_CIPHER_SUITE_TKIP) len += 8; /* MIC */ - len += ((pattrib->bswenc) ? pattrib->icv_len : 0); /* ICV */ + if (h_proto == ETH_P_IPX || h_proto == ETH_P_AARP) + ether_addr_copy(data, bridge_tunnel_header); + else + ether_addr_copy(data, rfc1042_header); - return len; + data += ETH_ALEN; + put_unaligned_be16(h_proto, data); + return ETH_ALEN + sizeof(u16); } /* @@ -1188,7 +1181,7 @@ int rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *skb, mpdu_len -= pattrib->iv_len; } if (frg_inx == 0) { - llc_sz = rtw_put_snap23a(pframe, pattrib->ether_type); + llc_sz = rtw_put_snap(pframe, pattrib->ether_type); pframe += llc_sz; mpdu_len -= llc_sz; } @@ -1258,34 +1251,6 @@ exit: return res; } -/* Logical Link Control(LLC) SubNetwork Attachment Point(SNAP) header - * IEEE LLC/SNAP header contains 8 octets - * First 3 octets comprise the LLC portion - * SNAP portion, 5 octets, is divided into two fields: - * Organizationally Unique Identifier(OUI), 3 octets, - * type, defined by that organization, 2 octets. - */ -s32 rtw_put_snap23a(u8 *data, u16 h_proto) -{ - struct ieee80211_snap_hdr *snap; - u8 *oui; - - snap = (struct ieee80211_snap_hdr *)data; - snap->dsap = 0xaa; - snap->ssap = 0xaa; - snap->ctrl = 0x03; - - if (h_proto == 0x8137 || h_proto == 0x80f3) - oui = P802_1H_OUI; - else - oui = RFC1042_OUI; - snap->oui[0] = oui[0]; - snap->oui[1] = oui[1]; - snap->oui[2] = oui[2]; - *(u16 *)(data + SNAP_SIZE) = htons(h_proto); - return SNAP_SIZE + sizeof(u16); -} - void rtw_update_protection23a(struct rtw_adapter *padapter, u8 *ie, uint ie_len) { struct xmit_priv *pxmitpriv = &padapter->xmitpriv; @@ -1293,7 +1258,7 @@ void rtw_update_protection23a(struct rtw_adapter *padapter, u8 *ie, uint ie_len) uint protection; const u8 *p; - switch (pxmitpriv->vcs_setting) { + switch (pregistrypriv->vrtl_carrier_sense) { case DISABLE_VCS: pxmitpriv->vcs = NONE_VCS; break; @@ -1326,7 +1291,7 @@ void rtw_count_tx_stats23a(struct rtw_adapter *padapter, struct xmit_frame *pxmi struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - if ((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) { + if (pxmitframe->frame_tag == DATA_FRAMETAG) { pxmitpriv->tx_bytes += sz; pmlmepriv->LinkDetectInfo.NumTxOkInPeriod++; @@ -1893,18 +1858,6 @@ u32 rtw_get_ff_hwaddr23a(struct xmit_frame *pxmitframe) return addr; } -static void do_queue_select(struct rtw_adapter *padapter, struct pkt_attrib *pattrib) -{ - u8 qsel; - - qsel = pattrib->priority; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("### do_queue_select priority =%d , qsel = %d\n", - pattrib->priority, qsel)); - - pattrib->qsel = qsel; -} - /* * The main transmit(tx) entry * @@ -1936,9 +1889,7 @@ int rtw_xmit23a(struct rtw_adapter *padapter, struct sk_buff *skb) } pxmitframe->pkt = skb; - rtw_led_control(padapter, LED_CTL_TX); - - do_queue_select(padapter, &pxmitframe->attrib); + pxmitframe->attrib.qsel = pxmitframe->attrib.priority; #ifdef CONFIG_8723AU_AP_MODE spin_lock_bh(&pxmitpriv->lock); @@ -2411,11 +2362,6 @@ void rtw23a_sctx_done_err(struct submit_ctx **sctx, int status) } } -void rtw_sctx_done23a(struct submit_ctx **sctx) -{ - rtw23a_sctx_done_err(sctx, RTW_SCTX_DONE_SUCCESS); -} - int rtw_ack_tx_wait23a(struct xmit_priv *pxmitpriv, u32 timeout_ms) { struct submit_ctx *pack_tx_ops = &pxmitpriv->ack_tx_ops; diff --git a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c index 4b41bc4ce1e6..179a1ba03029 100644 --- a/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c +++ b/drivers/staging/rtl8723au/hal/HalDMOutSrc8723A_CE.c @@ -612,7 +612,7 @@ static void _PHY_PathADDAOn(struct rtw_adapter *pAdapter, u32 *ADDAReg, bool isP u32 i; pathOn = isPathAOn ? 0x04db25a4 : 0x0b1b25a4; - if (false == is2T) { + if (!is2T) { pathOn = 0x0bdb25a0; PHY_SetBBReg(pAdapter, ADDAReg[0], bMaskDWord, 0x0b1b25a0); } else { diff --git a/drivers/staging/rtl8723au/hal/hal_com.c b/drivers/staging/rtl8723au/hal/hal_com.c index bf919f6e4128..bf4cae20bd12 100644 --- a/drivers/staging/rtl8723au/hal/hal_com.c +++ b/drivers/staging/rtl8723au/hal/hal_com.c @@ -463,7 +463,7 @@ void rtl8723a_set_ampdu_factor(struct rtw_adapter *padapter, u8 FactorToSet) MaxAggNum = 0xF; if (FactorToSet <= 3) { - FactorToSet = (1 << (FactorToSet + 2)); + FactorToSet = 1 << (FactorToSet + 2); if (FactorToSet > MaxAggNum) FactorToSet = MaxAggNum; @@ -727,7 +727,7 @@ void rtl8723a_fifo_cleanup(struct rtw_adapter *padapter) rtl8723au_write8(padapter, REG_TXPAUSE, 0xff); /* keep sn */ - padapter->xmitpriv.nqos_ssn = rtl8723au_read16(padapter, REG_NQOS_SEQ); + padapter->xmitpriv.nqos_ssn = rtl8723au_read8(padapter, REG_NQOS_SEQ); if (pwrpriv->bkeepfwalive != true) { u32 v32; diff --git a/drivers/staging/rtl8723au/hal/odm_HWConfig.c b/drivers/staging/rtl8723au/hal/odm_HWConfig.c index 29d844d66cae..fb3cc872f205 100644 --- a/drivers/staging/rtl8723au/hal/odm_HWConfig.c +++ b/drivers/staging/rtl8723au/hal/odm_HWConfig.c @@ -391,20 +391,11 @@ static void odm_Process_RSSIForDM(struct dm_odm_t *pDM_Odm, } } -/* Endianness before calling this API */ -static void ODM_PhyStatusQuery23a_92CSeries(struct dm_odm_t *pDM_Odm, - struct phy_info *pPhyInfo, - u8 *pPhyStatus, - struct odm_packet_info *pPktinfo) +void ODM_PhyStatusQuery23a(struct dm_odm_t *pDM_Odm, struct phy_info *pPhyInfo, + u8 *pPhyStatus, struct odm_packet_info *pPktinfo) { odm_RxPhyStatus92CSeries_Parsing(pDM_Odm, pPhyInfo, pPhyStatus, pPktinfo); odm_Process_RSSIForDM(pDM_Odm, pPhyInfo, pPktinfo); } - -void ODM_PhyStatusQuery23a(struct dm_odm_t *pDM_Odm, struct phy_info *pPhyInfo, - u8 *pPhyStatus, struct odm_packet_info *pPktinfo) -{ - ODM_PhyStatusQuery23a_92CSeries(pDM_Odm, pPhyInfo, pPhyStatus, pPktinfo); -} diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c index 9054a987f06b..86a83975f4f0 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c @@ -340,7 +340,7 @@ static u8 bthci_GetAssocInfo(struct rtw_adapter *padapter, u8 EntryNum) tempBuf, TotalLen-BaseMemoryShift); pAmpAsoc = (struct amp_assoc_structure *)tempBuf; - pAmpAsoc->Length = le16_to_cpu(pAmpAsoc->Length); + le16_to_cpus(&pAmpAsoc->Length); BaseMemoryShift += 3 + pAmpAsoc->Length; RTPRINT(FIOCTL, IOCTL_BT_HCICMD, ("TypeID = 0x%x, ", pAmpAsoc->TypeID)); @@ -1759,18 +1759,6 @@ static enum hci_status bthci_CmdReadConnectionAcceptTimeout(struct rtw_adapter * return status; } -/* 7.3.3 */ -static enum hci_status -bthci_CmdSetEventFilter( - struct rtw_adapter *padapter, - struct packet_irp_hcicmd_data *pHciCmd - ) -{ - enum hci_status status = HCI_STATUS_SUCCESS; - - return status; -} - /* 7.3.14 */ static enum hci_status bthci_CmdWriteConnectionAcceptTimeout( @@ -2982,19 +2970,12 @@ bthci_CmdReadLinkQuality( return status; } -static enum hci_status bthci_CmdReadRSSI(struct rtw_adapter *padapter) -{ - enum hci_status status = HCI_STATUS_SUCCESS; - return status; -} - static enum hci_status bthci_CmdCreateLogicalLink( struct rtw_adapter *padapter, struct packet_irp_hcicmd_data *pHciCmd ) { - enum hci_status status = HCI_STATUS_SUCCESS; struct bt_30info *pBTInfo = GET_BT_INFO(padapter); struct bt_dgb *pBtDbg = &pBTInfo->BtDbg; @@ -3003,7 +2984,7 @@ bthci_CmdCreateLogicalLink( bthci_BuildLogicalLink(padapter, pHciCmd, HCI_CREATE_LOGICAL_LINK); - return status; + return HCI_STATUS_SUCCESS; } static enum hci_status @@ -3012,7 +2993,6 @@ bthci_CmdAcceptLogicalLink( struct packet_irp_hcicmd_data *pHciCmd ) { - enum hci_status status = HCI_STATUS_SUCCESS; struct bt_30info *pBTInfo = GET_BT_INFO(padapter); struct bt_dgb *pBtDbg = &pBTInfo->BtDbg; @@ -3021,7 +3001,7 @@ bthci_CmdAcceptLogicalLink( bthci_BuildLogicalLink(padapter, pHciCmd, HCI_ACCEPT_LOGICAL_LINK); - return status; + return HCI_STATUS_SUCCESS; } static enum hci_status @@ -4138,15 +4118,6 @@ bthci_CmdHostBufferSize(struct rtw_adapter *padapter, } static enum hci_status -bthci_CmdHostNumberOfCompletedPackets(struct rtw_adapter *padapter, - struct packet_irp_hcicmd_data *pHciCmd) -{ - enum hci_status status = HCI_STATUS_SUCCESS; - - return status; -} - -static enum hci_status bthci_UnknownCMD(struct rtw_adapter *padapter, struct packet_irp_hcicmd_data *pHciCmd) { enum hci_status status = HCI_STATUS_UNKNOW_HCI_CMD; @@ -4219,7 +4190,6 @@ bthci_HandleOGFSetEventMaskCMD(struct rtw_adapter *padapter, break; case HCI_SET_EVENT_FILTER: RTPRINT(FIOCTL, IOCTL_BT_HCICMD, ("HCI_SET_EVENT_FILTER\n")); - status = bthci_CmdSetEventFilter(padapter, pHciCmd); break; case HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT: RTPRINT(FIOCTL, IOCTL_BT_HCICMD, ("HCI_WRITE_CONNECTION_ACCEPT_TIMEOUT\n")); @@ -4235,7 +4205,6 @@ bthci_HandleOGFSetEventMaskCMD(struct rtw_adapter *padapter, break; case HCI_HOST_NUMBER_OF_COMPLETED_PACKETS: RTPRINT(FIOCTL, IOCTL_BT_HCICMD, ("HCI_HOST_NUMBER_OF_COMPLETED_PACKETS\n")); - status = bthci_CmdHostNumberOfCompletedPackets(padapter, pHciCmd); break; case HCI_READ_LINK_SUPERVISION_TIMEOUT: RTPRINT(FIOCTL, IOCTL_BT_HCICMD, ("HCI_READ_LINK_SUPERVISION_TIMEOUT\n")); @@ -4323,7 +4292,6 @@ bthci_HandleOGFStatusParameters(struct rtw_adapter *padapter, break; case HCI_READ_RSSI: RTPRINT(FIOCTL, IOCTL_BT_HCICMD, ("HCI_READ_RSSI\n")); - status = bthci_CmdReadRSSI(padapter); break; case HCI_READ_LOCAL_AMP_INFO: RTPRINT(FIOCTL, IOCTL_BT_HCICMD, ("HCI_READ_LOCAL_AMP_INFO\n")); @@ -10671,7 +10639,7 @@ void BTDM_BBBackOffLevel(struct rtw_adapter *padapter, u8 type) void BTDM_FWCoexAllOff(struct rtw_adapter *padapter) { - struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);; + struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); RTPRINT(FBT, BT_TRACE, ("BTDM_FWCoexAllOff()\n")); if (pHalData->bt_coexist.bFWCoexistAllOff) @@ -10685,7 +10653,7 @@ void BTDM_FWCoexAllOff(struct rtw_adapter *padapter) void BTDM_SWCoexAllOff(struct rtw_adapter *padapter) { - struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);; + struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); RTPRINT(FBT, BT_TRACE, ("BTDM_SWCoexAllOff()\n")); if (pHalData->bt_coexist.bSWCoexistAllOff) @@ -10698,7 +10666,7 @@ void BTDM_SWCoexAllOff(struct rtw_adapter *padapter) void BTDM_HWCoexAllOff(struct rtw_adapter *padapter) { - struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter);; + struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); RTPRINT(FBT, BT_TRACE, ("BTDM_HWCoexAllOff()\n")); if (pHalData->bt_coexist.bHWCoexistAllOff) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c index 271c33d6ca5a..7b56411cc3c8 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c @@ -115,19 +115,16 @@ exit: int rtl8723a_set_rssi_cmd(struct rtw_adapter *padapter, u8 *param) { - int res = _SUCCESS; - *((u32 *)param) = cpu_to_le32(*((u32 *)param)); FillH2CCmd(padapter, RSSI_SETTING_EID, 3, param); - return res; + return _SUCCESS; } int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg) { u8 buf[5]; - int res = _SUCCESS; memset(buf, 0, 5); mask = cpu_to_le32(mask); @@ -136,7 +133,7 @@ int rtl8723a_set_raid_cmd(struct rtw_adapter *padapter, u32 mask, u8 arg) FillH2CCmd(padapter, MACID_CONFIG_EID, 5, buf); - return res; + return _SUCCESS; } /* bitmap[0:27] = tx_rate_bitmap */ diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index 8523908d5e5f..a5eadd4e2580 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -47,29 +47,19 @@ static void _FWDownloadEnable(struct rtw_adapter *padapter, bool enable) } } -static int _BlockWrite(struct rtw_adapter *padapter, void *buffer, u32 buffSize) -{ - int ret; - - if (buffSize > MAX_PAGE_SIZE) - return _FAIL; - - ret = rtl8723au_writeN(padapter, FW_8723A_START_ADDRESS, - buffSize, buffer); - - return ret; -} - static int _PageWrite(struct rtw_adapter *padapter, u32 page, void *buffer, u32 size) { u8 value8; u8 u8Page = (u8) (page & 0x07); + if (size > MAX_PAGE_SIZE) + return _FAIL; + value8 = (rtl8723au_read8(padapter, REG_MCUFWDL + 2) & 0xF8) | u8Page; rtl8723au_write8(padapter, REG_MCUFWDL + 2, value8); - return _BlockWrite(padapter, buffer, size); + return rtl8723au_writeN(padapter, FW_8723A_START_ADDRESS, size, buffer); } static int _WriteFW(struct rtw_adapter *padapter, void *buffer, u32 size) @@ -743,84 +733,6 @@ u16 rtl8723a_EfuseGetCurrentSize_BT(struct rtw_adapter *padapter) return retU2; } -bool -rtl8723a_EfusePgPacketRead(struct rtw_adapter *padapter, u8 offset, u8 *data) -{ - u8 efuse_data, word_cnts = 0; - u16 efuse_addr = 0; - u8 hoffset = 0, hworden = 0; - u8 i; - u8 max_section = 0; - s32 ret; - - if (data == NULL) - return false; - - EFUSE_GetEfuseDefinition23a(padapter, EFUSE_WIFI, TYPE_EFUSE_MAX_SECTION, - &max_section); - if (offset > max_section) { - DBG_8723A("%s: Packet offset(%d) is illegal(>%d)!\n", - __func__, offset, max_section); - return false; - } - - memset(data, 0xFF, PGPKT_DATA_SIZE); - ret = true; - - /* */ - /* <Roger_TODO> Efuse has been pre-programmed dummy 5Bytes at the - end of Efuse by CP. */ - /* Skip dummy parts to prevent unexpected data read from Efuse. */ - /* By pass right now. 2009.02.19. */ - /* */ - while (AVAILABLE_EFUSE_ADDR(efuse_addr)) { - if (efuse_OneByteRead23a(padapter, efuse_addr++, &efuse_data) == - _FAIL) { - ret = false; - break; - } - - if (efuse_data == 0xFF) - break; - - if (EXT_HEADER(efuse_data)) { - hoffset = GET_HDR_OFFSET_2_0(efuse_data); - efuse_OneByteRead23a(padapter, efuse_addr++, &efuse_data); - if (ALL_WORDS_DISABLED(efuse_data)) { - DBG_8723A("%s: Error!! All words disabled!\n", - __func__); - continue; - } - - hoffset |= ((efuse_data & 0xF0) >> 1); - hworden = efuse_data & 0x0F; - } else { - hoffset = (efuse_data >> 4) & 0x0F; - hworden = efuse_data & 0x0F; - } - - if (hoffset == offset) { - for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { - /* Check word enable condition in the section */ - if (!(hworden & (0x01 << i))) { - ReadEFuseByte23a(padapter, efuse_addr++, - &efuse_data); - data[i * 2] = efuse_data; - - ReadEFuseByte23a(padapter, efuse_addr++, - &efuse_data); - data[(i * 2) + 1] = efuse_data; - } - } - } else { - word_cnts = Efuse_CalculateWordCnts23a(hworden); - efuse_addr += word_cnts * 2; - } - } - - return ret; -} - void rtl8723a_read_chip_version(struct rtw_adapter *padapter) { u32 value32; @@ -1126,6 +1038,21 @@ exit: return ret; } +void handle_txrpt_ccx_8723a(struct rtw_adapter *adapter, void *buf) +{ + struct txrpt_ccx_8723a *txrpt_ccx = buf; + struct submit_ctx *pack_tx_ops = &adapter->xmitpriv.ack_tx_ops; + + if (txrpt_ccx->int_ccx && adapter->xmitpriv.ack_tx) { + if (txrpt_ccx->pkt_ok) + rtw23a_sctx_done_err(&pack_tx_ops, + RTW_SCTX_DONE_SUCCESS); + else + rtw23a_sctx_done_err(&pack_tx_ops, + RTW_SCTX_DONE_CCX_PKT_FAIL); + } +} + void rtl8723a_InitAntenna_Selection(struct rtw_adapter *padapter) { u8 val; @@ -1326,18 +1253,17 @@ c. APSD_CTRL 0x600[7:0] = 0x40 d. SYS_FUNC_EN 0x02[7:0] = 0x16 reset BB state machine e. SYS_FUNC_EN 0x02[7:0] = 0x14 reset BB state machine ***************************************/ - u8 eRFPath = 0, value8 = 0; + u8 value8; rtl8723au_write8(padapter, REG_TXPAUSE, 0xFF); - PHY_SetRFReg(padapter, (enum RF_RADIO_PATH) eRFPath, 0x0, bMaskByte0, 0x0); + PHY_SetRFReg(padapter, RF_PATH_A, 0x0, bMaskByte0, 0x0); - value8 |= APSDOFF; + value8 = APSDOFF; rtl8723au_write8(padapter, REG_APSD_CTRL, value8); /* 0x40 */ /* Set BB reset at first */ - value8 = 0; - value8 |= (FEN_USBD | FEN_USBA | FEN_BB_GLB_RSTn); + value8 = FEN_USBD | FEN_USBA | FEN_BB_GLB_RSTn; rtl8723au_write8(padapter, REG_SYS_FUNC_EN, value8); /* 0x16 */ /* Set global reset. */ @@ -1350,11 +1276,6 @@ e. SYS_FUNC_EN 0x02[7:0] = 0x14 reset BB state machine /* RT_TRACE(COMP_INIT, DBG_LOUD, ("======> RF off and reset BB.\n")); */ } -static void _DisableRFAFEAndResetBB(struct rtw_adapter *padapter) -{ - _DisableRFAFEAndResetBB8192C(padapter); -} - static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter, bool bWithoutHWSM) { @@ -1368,18 +1289,18 @@ static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter, i. SYS_FUNC_EN 0x02[10]= 1 enable MCU register, (8051 enable) ******************************/ - u16 valu16 = 0; + u16 valu16; rtl8723au_write8(padapter, REG_MCUFWDL, 0); valu16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN); /* reset MCU , 8051 */ rtl8723au_write16(padapter, REG_SYS_FUNC_EN, - valu16 & (~FEN_CPUEN)); + valu16 & ~FEN_CPUEN); valu16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN) & 0x0FFF; /* reset MAC */ rtl8723au_write16(padapter, REG_SYS_FUNC_EN, - valu16 | (FEN_HWPDN | FEN_ELDR)); + valu16 | FEN_HWPDN | FEN_ELDR); valu16 = rtl8723au_read16(padapter, REG_SYS_FUNC_EN); /* enable MCU , 8051 */ @@ -1387,43 +1308,41 @@ static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter, valu16 | FEN_CPUEN); } else { u8 retry_cnts = 0; + u8 val8; + + val8 = rtl8723au_read8(padapter, REG_MCUFWDL); /* 2010/08/12 MH For USB SS, we can not stop 8051 when we are trying to enter IPS/HW&SW radio off. For S3/S4/S5/Disable, we can stop 8051 because */ /* we will init FW when power on again. */ /* If we want to SS mode, we can not reset 8051. */ - if (rtl8723au_read8(padapter, REG_MCUFWDL) & BIT(1)) { + if ((val8 & BIT(1)) && padapter->bFWReady) { /* IF fw in RAM code, do reset */ - if (padapter->bFWReady) { - /* 2010/08/25 MH Accordign to RD alfred's - suggestion, we need to disable other */ - /* HRCV INT to influence 8051 reset. */ - rtl8723au_write8(padapter, REG_FWIMR, 0x20); - /* 2011/02/15 MH According to Alex's - suggestion, close mask to prevent - incorrect FW write operation. */ - rtl8723au_write8(padapter, REG_FTIMR, 0x00); - rtl8723au_write8(padapter, REG_FSIMR, 0x00); - - /* 8051 reset by self */ - rtl8723au_write8(padapter, REG_HMETFR + 3, - 0x20); - - while ((retry_cnts++ < 100) && - (FEN_CPUEN & - rtl8723au_read16(padapter, - REG_SYS_FUNC_EN))) { - udelay(50); /* us */ - } + /* 2010/08/25 MH Accordign to RD alfred's + suggestion, we need to disable other */ + /* HRCV INT to influence 8051 reset. */ + rtl8723au_write8(padapter, REG_FWIMR, 0x20); + /* 2011/02/15 MH According to Alex's + suggestion, close mask to prevent + incorrect FW write operation. */ + rtl8723au_write8(padapter, REG_FTIMR, 0x00); + rtl8723au_write8(padapter, REG_FSIMR, 0x00); + + /* 8051 reset by self */ + rtl8723au_write8(padapter, REG_HMETFR + 3, 0x20); + + while ((retry_cnts++ < 100) && + (rtl8723au_read16(padapter, REG_SYS_FUNC_EN) & + FEN_CPUEN)) { + udelay(50); /* us */ + } - if (retry_cnts >= 100) { - /* Reset MAC and Enable 8051 */ - rtl8723au_write8(padapter, - REG_SYS_FUNC_EN + 1, - 0x50); - mdelay(10); - } + if (retry_cnts >= 100) { + /* Reset MAC and Enable 8051 */ + rtl8723au_write8(padapter, + REG_SYS_FUNC_EN + 1, 0x50); + mdelay(10); } } /* Reset MAC and Enable 8051 */ @@ -1450,12 +1369,6 @@ static void _ResetDigitalProcedure1_92C(struct rtw_adapter *padapter, } } -static void _ResetDigitalProcedure1(struct rtw_adapter *padapter, - bool bWithoutHWSM) -{ - _ResetDigitalProcedure1_92C(padapter, bWithoutHWSM); -} - static void _ResetDigitalProcedure2(struct rtw_adapter *padapter) { /***************************** @@ -1472,8 +1385,8 @@ m. SYS_ISO_CTRL 0x01[7:0] = 0x83 isolated ELDR to PON static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM) { struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); - u16 value16 = 0; - u8 value8 = 0; + u16 value16; + u8 value8; if (bWithoutHWSM) { /***************************** @@ -1487,7 +1400,7 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM) /* rtl8723au_write8(padapter, REG_LDOV12D_CTRL, 0x54); */ value8 = rtl8723au_read8(padapter, REG_LDOV12D_CTRL); - value8 &= (~LDV12_EN); + value8 &= ~LDV12_EN; rtl8723au_write8(padapter, REG_LDOV12D_CTRL, value8); /* RT_TRACE(COMP_INIT, DBG_LOUD, (" REG_LDOV12D_CTRL Reg0x21:0x%02x.\n", value8)); */ @@ -1509,9 +1422,9 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM) use HW to shut down 8051 automatically. */ /* Becasue suspend operatione need the asistance of 8051 to wait for 3ms. */ - value16 |= (APDM_HOST | AFSM_HSUS | PFM_ALDN); + value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN; } else { - value16 |= (APDM_HOST | AFSM_HSUS | PFM_ALDN); + value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN; } rtl8723au_write16(padapter, REG_APS_FSMCO, value16); /* 0x4802 */ @@ -1522,16 +1435,14 @@ static void _DisableAnalog(struct rtw_adapter *padapter, bool bWithoutHWSM) /* HW Auto state machine */ int CardDisableHWSM(struct rtw_adapter *padapter, u8 resetMCU) { - int rtStatus = _SUCCESS; - if (padapter->bSurpriseRemoved) { - return rtStatus; + return _SUCCESS; } /* RF Off Sequence ==== */ - _DisableRFAFEAndResetBB(padapter); + _DisableRFAFEAndResetBB8192C(padapter); /* ==== Reset digital sequence ====== */ - _ResetDigitalProcedure1(padapter, false); + _ResetDigitalProcedure1_92C(padapter, false); /* ==== Pull GPIO PIN to balance level and LED control ====== */ _DisableGPIO(padapter); @@ -1542,25 +1453,21 @@ int CardDisableHWSM(struct rtw_adapter *padapter, u8 resetMCU) RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("======> Card disable finished.\n")); - return rtStatus; + return _SUCCESS; } /* without HW Auto state machine */ int CardDisableWithoutHWSM(struct rtw_adapter *padapter) { - int rtStatus = _SUCCESS; - - /* RT_TRACE(COMP_INIT, DBG_LOUD, - ("======> Card Disable Without HWSM .\n")); */ if (padapter->bSurpriseRemoved) { - return rtStatus; + return _SUCCESS; } /* RF Off Sequence ==== */ - _DisableRFAFEAndResetBB(padapter); + _DisableRFAFEAndResetBB8192C(padapter); /* ==== Reset digital sequence ====== */ - _ResetDigitalProcedure1(padapter, true); + _ResetDigitalProcedure1_92C(padapter, true); /* ==== Pull GPIO PIN to balance level and LED control ====== */ _DisableGPIO(padapter); @@ -1573,29 +1480,27 @@ int CardDisableWithoutHWSM(struct rtw_adapter *padapter) /* RT_TRACE(COMP_INIT, DBG_LOUD, ("<====== Card Disable Without HWSM .\n")); */ - return rtStatus; + return _SUCCESS; } void Hal_InitPGData(struct rtw_adapter *padapter, u8 *PROMContent) { struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); - if (false == pEEPROM->bautoload_fail_flag) { /* autoload OK. */ + if (!pEEPROM->bautoload_fail_flag) { /* autoload OK. */ if (!pEEPROM->EepromOrEfuse) { /* Read EFUSE real map to shadow. */ EFUSE_ShadowMapUpdate23a(padapter, EFUSE_WIFI); - memcpy((void *)PROMContent, - (void *)pEEPROM->efuse_eeprom_data, + memcpy(PROMContent, pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE); } - } else { /* autoload fail */ + } else { RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("AutoLoad Fail reported from CR9346!!\n")); -/* pHalData->AutoloadFailFlag = true; */ /* update to default value 0xFF */ - if (false == pEEPROM->EepromOrEfuse) + if (!pEEPROM->EepromOrEfuse) EFUSE_ShadowMapUpdate23a(padapter, EFUSE_WIFI); - memcpy((void *)PROMContent, (void *)pEEPROM->efuse_eeprom_data, + memcpy(PROMContent, pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE); } } @@ -1945,13 +1850,13 @@ Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter, /* */ /* ThermalMeter from EEPROM */ /* */ - if (AutoloadFail == false) + if (!AutoloadFail) pHalData->EEPROMThermalMeter = PROMContent[EEPROM_THERMAL_METER_8723A]; else pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; - if ((pHalData->EEPROMThermalMeter == 0xff) || (AutoloadFail == true)) { + if ((pHalData->EEPROMThermalMeter == 0xff) || AutoloadFail) { pHalData->bAPKThermalMeterIgnore = true; pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter; } @@ -1960,10 +1865,6 @@ Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter, pHalData->EEPROMThermalMeter); } -void Hal_InitChannelPlan23a(struct rtw_adapter *padapter) -{ -} - static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc) { u16 *usPtr = (u16 *) ptxdesc; @@ -1981,254 +1882,6 @@ static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc) ptxdesc->txdw7 |= cpu_to_le32(checksum & 0x0000ffff); } -static void fill_txdesc_sectype(struct pkt_attrib *pattrib, - struct txdesc_8723a *ptxdesc) -{ - if ((pattrib->encrypt > 0) && !pattrib->bswenc) { - switch (pattrib->encrypt) { - /* SEC_TYPE */ - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - ptxdesc->sectype = 1; - break; - - case WLAN_CIPHER_SUITE_CCMP: - ptxdesc->sectype = 3; - break; - - case 0: - default: - break; - } - } -} - -static void fill_txdesc_vcs(struct pkt_attrib *pattrib, - struct txdesc_8723a *ptxdesc) -{ - /* DBG_8723A("cvs_mode =%d\n", pattrib->vcs_mode); */ - - switch (pattrib->vcs_mode) { - case RTS_CTS: - ptxdesc->rtsen = 1; - break; - - case CTS_TO_SELF: - ptxdesc->cts2self = 1; - break; - - case NONE_VCS: - default: - break; - } - - if (pattrib->vcs_mode) { - ptxdesc->hw_rts_en = 1; /* ENABLE HW RTS */ - - /* Set RTS BW */ - if (pattrib->ht_en) { - if (pattrib->bwmode & HT_CHANNEL_WIDTH_40) - ptxdesc->rts_bw = 1; - - switch (pattrib->ch_offset) { - case HAL_PRIME_CHNL_OFFSET_DONT_CARE: - ptxdesc->rts_sc = 0; - break; - - case HAL_PRIME_CHNL_OFFSET_LOWER: - ptxdesc->rts_sc = 1; - break; - - case HAL_PRIME_CHNL_OFFSET_UPPER: - ptxdesc->rts_sc = 2; - break; - - default: - ptxdesc->rts_sc = 3; /* Duplicate */ - break; - } - } - } -} - -static void fill_txdesc_phy(struct pkt_attrib *pattrib, - struct txdesc_8723a *ptxdesc) -{ - if (pattrib->ht_en) { - if (pattrib->bwmode & HT_CHANNEL_WIDTH_40) - ptxdesc->data_bw = 1; - - switch (pattrib->ch_offset) { - case HAL_PRIME_CHNL_OFFSET_DONT_CARE: - ptxdesc->data_sc = 0; - break; - - case HAL_PRIME_CHNL_OFFSET_LOWER: - ptxdesc->data_sc = 1; - break; - - case HAL_PRIME_CHNL_OFFSET_UPPER: - ptxdesc->data_sc = 2; - break; - - default: - ptxdesc->data_sc = 3; /* Duplicate */ - break; - } - } -} - -static void rtl8723a_fill_default_txdesc(struct xmit_frame *pxmitframe, - u8 *pbuf) -{ - struct rtw_adapter *padapter; - struct hal_data_8723a *pHalData; - struct dm_priv *pdmpriv; - struct mlme_ext_priv *pmlmeext; - struct mlme_ext_info *pmlmeinfo; - struct pkt_attrib *pattrib; - struct txdesc_8723a *ptxdesc; - s32 bmcst; - - padapter = pxmitframe->padapter; - pHalData = GET_HAL_DATA(padapter); - pdmpriv = &pHalData->dmpriv; - pmlmeext = &padapter->mlmeextpriv; - pmlmeinfo = &pmlmeext->mlmext_info; - - pattrib = &pxmitframe->attrib; - bmcst = is_multicast_ether_addr(pattrib->ra); - - ptxdesc = (struct txdesc_8723a *)pbuf; - - if (pxmitframe->frame_tag == DATA_FRAMETAG) { - ptxdesc->macid = pattrib->mac_id; /* CAM_ID(MAC_ID) */ - - if (pattrib->ampdu_en == true) - ptxdesc->agg_en = 1; /* AGG EN */ - else - ptxdesc->bk = 1; /* AGG BK */ - - ptxdesc->qsel = pattrib->qsel; - ptxdesc->rate_id = pattrib->raid; - - fill_txdesc_sectype(pattrib, ptxdesc); - - ptxdesc->seq = pattrib->seqnum; - - if ((pattrib->ether_type != 0x888e) && - (pattrib->ether_type != 0x0806) && - (pattrib->dhcp_pkt != 1)) { - /* Non EAP & ARP & DHCP type data packet */ - - fill_txdesc_vcs(pattrib, ptxdesc); - fill_txdesc_phy(pattrib, ptxdesc); - - ptxdesc->rtsrate = 8; /* RTS Rate = 24M */ - ptxdesc->data_ratefb_lmt = 0x1F; - ptxdesc->rts_ratefb_lmt = 0xF; - - /* use REG_INIDATA_RATE_SEL value */ - ptxdesc->datarate = - pdmpriv->INIDATA_RATE[pattrib->mac_id]; - - } else { - /* EAP data packet and ARP packet. */ - /* Use the 1M data rate to send the EAP/ARP packet. */ - /* This will maybe make the handshake smooth. */ - - ptxdesc->bk = 1; /* AGG BK */ - ptxdesc->userate = 1; /* driver uses rate */ - if (pmlmeinfo->preamble_mode == PREAMBLE_SHORT) - ptxdesc->data_short = 1; - ptxdesc->datarate = MRateToHwRate23a(pmlmeext->tx_rate); - } - } else if (pxmitframe->frame_tag == MGNT_FRAMETAG) { -/* RT_TRACE(_module_hal_xmit_c_, _drv_notice_, - ("%s: MGNT_FRAMETAG\n", __func__)); */ - - ptxdesc->macid = pattrib->mac_id; /* CAM_ID(MAC_ID) */ - ptxdesc->qsel = pattrib->qsel; - ptxdesc->rate_id = pattrib->raid; /* Rate ID */ - ptxdesc->seq = pattrib->seqnum; - ptxdesc->userate = 1; /* driver uses rate, 1M */ - ptxdesc->rty_lmt_en = 1; /* retry limit enable */ - ptxdesc->data_rt_lmt = 6; /* retry limit = 6 */ - - /* CCX-TXRPT ack for xmit mgmt frames. */ - if (pxmitframe->ack_report) - ptxdesc->ccx = 1; - - ptxdesc->datarate = MRateToHwRate23a(pmlmeext->tx_rate); - } else if (pxmitframe->frame_tag == TXAGG_FRAMETAG) { - RT_TRACE(_module_hal_xmit_c_, _drv_warning_, - ("%s: TXAGG_FRAMETAG\n", __func__)); - } else { - RT_TRACE(_module_hal_xmit_c_, _drv_warning_, - ("%s: frame_tag = 0x%x\n", __func__, - pxmitframe->frame_tag)); - - ptxdesc->macid = 4; /* CAM_ID(MAC_ID) */ - ptxdesc->rate_id = 6; /* Rate ID */ - ptxdesc->seq = pattrib->seqnum; - ptxdesc->userate = 1; /* driver uses rate */ - ptxdesc->datarate = MRateToHwRate23a(pmlmeext->tx_rate); - } - - ptxdesc->pktlen = pattrib->last_txcmdsz; - ptxdesc->offset = TXDESC_SIZE + OFFSET_SZ; - if (bmcst) - ptxdesc->bmc = 1; - ptxdesc->ls = 1; - ptxdesc->fs = 1; - ptxdesc->own = 1; - - /* 2009.11.05. tynli_test. Suggested by SD4 Filen for FW LPS. */ - /* (1) The sequence number of each non-Qos frame / broadcast / - * multicast / mgnt frame should be controled by Hw because Fw - * will also send null data which we cannot control when Fw LPS enable. - * --> default enable non-Qos data sequense number. - 2010.06.23. by tynli. */ - /* (2) Enable HW SEQ control for beacon packet, - * because we use Hw beacon. */ - /* (3) Use HW Qos SEQ to control the seq num of Ext port - * non-Qos packets. */ - /* 2010.06.23. Added by tynli. */ - if (!pattrib->qos_en) { - /* Hw set sequence number */ - ptxdesc->hwseq_en = 1; /* HWSEQ_EN */ - ptxdesc->hwseq_sel = 0; /* HWSEQ_SEL */ - } -} - -/* - * Description: - * - * Parameters: - * pxmitframe xmitframe - * pbuf where to fill tx desc - */ -void rtl8723a_update_txdesc(struct xmit_frame *pxmitframe, u8 *pbuf) -{ - struct tx_desc *pdesc; - - pdesc = (struct tx_desc *)pbuf; - memset(pdesc, 0, sizeof(struct tx_desc)); - - rtl8723a_fill_default_txdesc(pxmitframe, pbuf); - - pdesc->txdw0 = cpu_to_le32(pdesc->txdw0); - pdesc->txdw1 = cpu_to_le32(pdesc->txdw1); - pdesc->txdw2 = cpu_to_le32(pdesc->txdw2); - pdesc->txdw3 = cpu_to_le32(pdesc->txdw3); - pdesc->txdw4 = cpu_to_le32(pdesc->txdw4); - pdesc->txdw5 = cpu_to_le32(pdesc->txdw5); - pdesc->txdw6 = cpu_to_le32(pdesc->txdw6); - pdesc->txdw7 = cpu_to_le32(pdesc->txdw7); - rtl8723a_cal_txdesc_chksum(pdesc); -} - /* * Description: In normal chip, we should send some packet to Hw which * will be used by Fw in FW LPS mode. The function is to fill the Tx diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c index 3d4d7ec27509..88e91cd8ebb9 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_phycfg.c @@ -418,7 +418,6 @@ PHY_SetRFReg(struct rtw_adapter *Adapter, enum RF_RADIO_PATH eRFPath, *---------------------------------------------------------------------------*/ int PHY_MACConfig8723A(struct rtw_adapter *Adapter) { - int rtStatus = _SUCCESS; struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); bool is92C = IS_92C_SERIAL(pHalData->VersionID); @@ -433,7 +432,7 @@ int PHY_MACConfig8723A(struct rtw_adapter *Adapter) if (is92C && (BOARD_USB_DONGLE == pHalData->BoardType)) rtl8723au_write8(Adapter, 0x40, 0x04); - return rtStatus; + return _SUCCESS; } /** diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c b/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c index 2dc0886e5f90..1aad4384471c 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_rf6052.c @@ -42,21 +42,6 @@ #include <rtl8723a_hal.h> #include <usb_ops_linux.h> -/*---------------------------Define Local Constant---------------------------*/ -/* Define local structure for debug!!!!! */ -struct rf_shadow_compare_map { - /* Shadow register value */ - u32 Value; - /* Compare or not flag */ - u8 Compare; - /* Record If it had ever modified unpredicted */ - u8 ErrorOrNot; - /* Recorver Flag */ - u8 Recorver; - /* */ - u8 Driver_Write; -}; - /*----------------------------------------------------------------------------- * Function: PHY_RF6052SetBandwidth() * @@ -71,20 +56,23 @@ struct rf_shadow_compare_map { * * Note: For RF type 0222D *---------------------------------------------------------------------------*/ -void rtl8723a_phy_rf6052set_bw( - struct rtw_adapter *Adapter, - enum ht_channel_width Bandwidth) /* 20M or 40M */ +void rtl8723a_phy_rf6052set_bw(struct rtw_adapter *Adapter, + enum ht_channel_width Bandwidth) /* 20M or 40M */ { - struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); + struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); switch (Bandwidth) { case HT_CHANNEL_WIDTH_20: - pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | 0x0400); - PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); + pHalData->RfRegChnlVal[0] = + (pHalData->RfRegChnlVal[0] & 0xfffff3ff) | 0x0400; + PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, + pHalData->RfRegChnlVal[0]); break; case HT_CHANNEL_WIDTH_40: - pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff)); - PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); + pHalData->RfRegChnlVal[0] = + (pHalData->RfRegChnlVal[0] & 0xfffff3ff); + PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, + pHalData->RfRegChnlVal[0]); break; default: break; @@ -108,7 +96,8 @@ void rtl8723a_phy_rf6052set_bw( * *---------------------------------------------------------------------------*/ -void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter, u8 *pPowerlevel) +void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter, + u8 *pPowerlevel) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; @@ -118,7 +107,8 @@ void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter, u8 *pPowerleve u8 idx1, idx2; u8 *ptr; - /* According to SD3 eechou's suggestion, we need to disable turbo scan for RU. */ + /* According to SD3 eechou's suggestion, we need to disable + turbo scan for RU. */ /* Otherwise, external PA will be broken if power index > 0x20. */ if (pHalData->EEPROMRegulatory != 0 || pHalData->ExternalPA) TurboScanOff = true; @@ -131,29 +121,37 @@ void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter, u8 *pPowerleve if (TurboScanOff) { for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) { - TxAGC[idx1] = - pPowerlevel[idx1] | (pPowerlevel[idx1]<<8) | - (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); - /* 2010/10/18 MH For external PA module. We need to limit power index to be less than 0x20. */ + TxAGC[idx1] = pPowerlevel[idx1] | + (pPowerlevel[idx1] << 8) | + (pPowerlevel[idx1] << 16) | + (pPowerlevel[idx1] << 24); + /* 2010/10/18 MH For external PA module. + We need to limit power index to be less + than 0x20. */ if (TxAGC[idx1] > 0x20 && pHalData->ExternalPA) TxAGC[idx1] = 0x20; } } } else { -/* 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. */ -/* Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. */ -/* In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. */ +/* 20100427 Joseph: Driver dynamic Tx power shall not affect Tx + * power. It shall be determined by power training mechanism. */ +/* Currently, we cannot fully disable driver dynamic tx power + * mechanism because it is referenced by BT coexist mechanism. */ +/* In the future, two mechanism shall be separated from each other + * and maintained independantly. Thanks for Lanhsin's reminder. */ if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) { TxAGC[RF_PATH_A] = 0x10101010; TxAGC[RF_PATH_B] = 0x10101010; - } else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) { + } else if (pdmpriv->DynamicTxHighPowerLvl == + TxHighPwrLevel_Level2) { TxAGC[RF_PATH_A] = 0x00000000; TxAGC[RF_PATH_B] = 0x00000000; } else { for (idx1 = RF_PATH_A; idx1 <= RF_PATH_B; idx1++) { - TxAGC[idx1] = - pPowerlevel[idx1] | (pPowerlevel[idx1]<<8) | - (pPowerlevel[idx1]<<16) | (pPowerlevel[idx1]<<24); + TxAGC[idx1] = pPowerlevel[idx1] | + (pPowerlevel[idx1] << 8) | + (pPowerlevel[idx1] << 16) | + (pPowerlevel[idx1] << 24); } if (pHalData->EEPROMRegulatory == 0) { @@ -178,29 +176,24 @@ void rtl823a_phy_rf6052setccktxpower(struct rtw_adapter *Adapter, u8 *pPowerleve } /* rf-A cck tx power */ - tmpval = TxAGC[RF_PATH_A]&0xff; + tmpval = TxAGC[RF_PATH_A] & 0xff; PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, tmpval); - tmpval = TxAGC[RF_PATH_A]>>8; + tmpval = TxAGC[RF_PATH_A] >> 8; PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, 0xffffff00, tmpval); /* rf-B cck tx power */ - tmpval = TxAGC[RF_PATH_B]>>24; + tmpval = TxAGC[RF_PATH_B] >> 24; PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte0, tmpval); - tmpval = TxAGC[RF_PATH_B]&0x00ffffff; + tmpval = TxAGC[RF_PATH_B] & 0x00ffffff; PHY_SetBBReg(Adapter, rTxAGC_B_CCK1_55_Mcs32, 0xffffff00, tmpval); } /* PHY_RF6052SetCckTxPower */ /* powerbase0 for OFDM rates */ /* powerbase1 for HT MCS rates */ -static void getPowerBase( - struct rtw_adapter *Adapter, - u8 *pPowerLevel, - u8 Channel, - u32 *OfdmBase, - u32 *MCSBase - ) +static void getPowerBase(struct rtw_adapter *Adapter, u8 *pPowerLevel, + u8 Channel, u32 *OfdmBase, u32 *MCSBase) { - struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); + struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); u32 powerBase0, powerBase1; u8 Legacy_pwrdiff = 0; s8 HT20_pwrdiff = 0; @@ -211,8 +204,9 @@ static void getPowerBase( Legacy_pwrdiff = pHalData->TxPwrLegacyHtDiff[i][Channel-1]; powerBase0 = powerlevel[i] + Legacy_pwrdiff; - powerBase0 = (powerBase0<<24) | (powerBase0<<16) | (powerBase0<<8) | powerBase0; - *(OfdmBase+i) = powerBase0; + powerBase0 = powerBase0 << 24 | powerBase0 << 16 | + powerBase0 << 8 | powerBase0; + *(OfdmBase + i) = powerBase0; } for (i = 0; i < 2; i++) { @@ -222,36 +216,35 @@ static void getPowerBase( powerlevel[i] += HT20_pwrdiff; } powerBase1 = powerlevel[i]; - powerBase1 = (powerBase1<<24) | (powerBase1<<16) | (powerBase1<<8) | powerBase1; - *(MCSBase+i) = powerBase1; + powerBase1 = powerBase1 << 24 | powerBase1 << 16 | + powerBase1 << 8 | powerBase1; + *(MCSBase + i) = powerBase1; } } -static void getTxPowerWriteValByRegulatory( - struct rtw_adapter *Adapter, - u8 Channel, - u8 index, - u32 *powerBase0, - u32 *powerBase1, - u32 *pOutWriteVal - ) +static void +getTxPowerWriteValByRegulatory(struct rtw_adapter *Adapter, u8 Channel, + u8 index, u32 *powerBase0, u32 *powerBase1, + u32 *pOutWriteVal) { - struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); + struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); struct dm_priv *pdmpriv = &pHalData->dmpriv; - u8 i, chnlGroup = 0, pwr_diff_limit[4]; - u32 writeVal, customer_limit, rf; + u8 i, chnlGroup = 0, pwr_diff_limit[4]; + u32 writeVal, customer_limit, rf; /* Index 0 & 1 = legacy OFDM, 2-5 = HT_MCS rate */ for (rf = 0; rf < 2; rf++) { switch (pHalData->EEPROMRegulatory) { case 0: /* Realtek better performance */ - /* increase power diff defined by Realtek for large power */ + /* increase power diff defined by Realtek for + * large power */ chnlGroup = 0; writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + ((index < 2) ? powerBase0[rf] : powerBase1[rf]); break; case 1: /* Realtek regulatory */ - /* increase power diff defined by Realtek for regulatory */ + /* increase power diff defined by Realtek for + * regulatory */ if (pHalData->pwrGroupCnt == 1) chnlGroup = 0; if (pHalData->pwrGroupCnt >= 3) { @@ -262,17 +255,20 @@ static void getTxPowerWriteValByRegulatory( else if (Channel > 9) chnlGroup = 2; - if (pHalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20) + if (pHalData->CurrentChannelBW == + HT_CHANNEL_WIDTH_20) chnlGroup++; else chnlGroup += 4; } writeVal = pHalData->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf?8:0)] + - ((index < 2) ? powerBase0[rf] : powerBase1[rf]); + ((index < 2) ? powerBase0[rf] : + powerBase1[rf]); break; case 2: /* Better regulatory */ - /* don't increase any power diff */ - writeVal = ((index < 2) ? powerBase0[rf] : powerBase1[rf]); + /* don't increase any power diff */ + writeVal = ((index < 2) ? powerBase0[rf] : + powerBase1[rf]); break; case 3: /* Customer defined power diff. */ chnlGroup = 0; @@ -299,28 +295,34 @@ static void getTxPowerWriteValByRegulatory( break; } -/* 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. It shall be determined by power training mechanism. */ -/* Currently, we cannot fully disable driver dynamic tx power mechanism because it is referenced by BT coexist mechanism. */ -/* In the future, two mechanism shall be separated from each other and maintained independantly. Thanks for Lanhsin's reminder. */ +/* 20100427 Joseph: Driver dynamic Tx power shall not affect Tx power. + It shall be determined by power training mechanism. */ +/* Currently, we cannot fully disable driver dynamic tx power mechanism + because it is referenced by BT coexist mechanism. */ +/* In the future, two mechanism shall be separated from each other and + maintained independantly. Thanks for Lanhsin's reminder. */ if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) writeVal = 0x14141414; - else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level2) + else if (pdmpriv->DynamicTxHighPowerLvl == + TxHighPwrLevel_Level2) writeVal = 0x00000000; - /* 20100628 Joseph: High power mode for BT-Coexist mechanism. */ - /* This mechanism is only applied when Driver-Highpower-Mechanism is OFF. */ + /* 20100628 Joseph: High power mode for BT-Coexist mechanism. */ + /* This mechanism is only applied when + Driver-Highpower-Mechanism is OFF. */ if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT1) writeVal = writeVal - 0x06060606; else if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_BT2) writeVal = writeVal; - *(pOutWriteVal+rf) = writeVal; + *(pOutWriteVal + rf) = writeVal; } } -static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index, u32 *pValue) +static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index, + u32 *pValue) { - struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); + struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); u16 RegOffset_A[6] = { rTxAGC_A_Rate18_06, rTxAGC_A_Rate54_24, rTxAGC_A_Mcs03_Mcs00, rTxAGC_A_Mcs07_Mcs04, @@ -338,12 +340,13 @@ static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index, u32 *pValue for (rf = 0; rf < 2; rf++) { writeVal = pValue[rf]; for (i = 0; i < 4; i++) { - pwr_val[i] = (u8)((writeVal & (0x7f<<(i*8)))>>(i*8)); - if (pwr_val[i] > RF6052_MAX_TX_PWR) + pwr_val[i] = (u8)((writeVal & + (0x7f << (i * 8))) >> (i * 8)); + if (pwr_val[i] > RF6052_MAX_TX_PWR) pwr_val[i] = RF6052_MAX_TX_PWR; } - writeVal = (pwr_val[3]<<24) | (pwr_val[2]<<16) | - (pwr_val[1]<<8) | pwr_val[0]; + writeVal = pwr_val[3] << 24 | pwr_val[2] << 16 | + pwr_val[1] << 8 | pwr_val[0]; if (rf == 0) RegOffset = RegOffset_A[index]; @@ -352,7 +355,8 @@ static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index, u32 *pValue PHY_SetBBReg(Adapter, RegOffset, bMaskDWord, writeVal); - /* 201005115 Joseph: Set Tx Power diff for Tx power training mechanism. */ + /* 201005115 Joseph: Set Tx Power diff for Tx power + training mechanism. */ if (((pHalData->rf_type == RF_2T2R) && (RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs15_Mcs12)) || @@ -360,15 +364,19 @@ static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index, u32 *pValue (RegOffset == rTxAGC_A_Mcs07_Mcs04 || RegOffset == rTxAGC_B_Mcs07_Mcs04))) { writeVal = pwr_val[3]; - if (RegOffset == rTxAGC_A_Mcs15_Mcs12 || RegOffset == rTxAGC_A_Mcs07_Mcs04) + if (RegOffset == rTxAGC_A_Mcs15_Mcs12 || + RegOffset == rTxAGC_A_Mcs07_Mcs04) RegOffset = 0xc90; - if (RegOffset == rTxAGC_B_Mcs15_Mcs12 || RegOffset == rTxAGC_B_Mcs07_Mcs04) + if (RegOffset == rTxAGC_B_Mcs15_Mcs12 || + RegOffset == rTxAGC_B_Mcs07_Mcs04) RegOffset = 0xc98; for (i = 0; i < 3; i++) { if (i != 2) - writeVal = (writeVal > 8) ? (writeVal-8) : 0; + writeVal = (writeVal > 8) ? + (writeVal - 8) : 0; else - writeVal = (writeVal > 6) ? (writeVal-6) : 0; + writeVal = (writeVal > 6) ? + (writeVal - 6) : 0; rtl8723au_write8(Adapter, RegOffset + i, (u8)writeVal); } @@ -379,8 +387,9 @@ static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index, u32 *pValue * Function: PHY_RF6052SetOFDMTxPower * * Overview: For legacy and HY OFDM, we must read EEPROM TX power index for - * different channel and read original value in TX power register area from - * 0xe00. We increase offset and original value to be correct tx pwr. + * different channel and read original value in TX power + * register area from 0xe00. We increase offset and + * original value to be correct tx pwr. * * Input: NONE * @@ -389,20 +398,23 @@ static void writeOFDMPowerReg(struct rtw_adapter *Adapter, u8 index, u32 *pValue * Return: NONE * * Revised History: - * When Who Remark - * 11/05/2008 MHC Simulate 8192 series method. - * 01/06/2009 MHC 1. Prevent Path B tx power overflow or underflow dure to - * A/B pwr difference or legacy/HT pwr diff. - * 2. We concern with path B legacy/HT OFDM difference. - * 01/22/2009 MHC Support new EPRO format from SD3. + * When Remark + * 11/05/2008 MHC Simulate 8192 series method. + * 01/06/2009 MHC 1. Prevent Path B tx power overflow or + * underflow dure to A/B pwr difference or + * legacy/HT pwr diff. + * 2. We concern with path B legacy/HT OFDM difference. + * 01/22/2009 MHC Support new EPRO format from SD3. * *---------------------------------------------------------------------------*/ -void rtl8723a_PHY_RF6052SetOFDMTxPower(struct rtw_adapter *Adapter, u8 *pPowerLevel, u8 Channel) +void rtl8723a_PHY_RF6052SetOFDMTxPower(struct rtw_adapter *Adapter, + u8 *pPowerLevel, u8 Channel) { u32 writeVal[2], powerBase0[2], powerBase1[2]; u8 index = 0; - getPowerBase(Adapter, pPowerLevel, Channel, &powerBase0[0], &powerBase1[0]); + getPowerBase(Adapter, pPowerLevel, Channel, + &powerBase0[0], &powerBase1[0]); for (index = 0; index < 6; index++) { getTxPowerWriteValByRegulatory(Adapter, Channel, index, @@ -416,7 +428,7 @@ static int phy_RF6052_Config_ParaFile(struct rtw_adapter *Adapter) { u32 u4RegValue = 0; u8 eRFPath; - struct bb_reg_define *pPhyReg; + struct bb_reg_define *pPhyReg; int rtStatus = _SUCCESS; struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); @@ -430,15 +442,17 @@ static int phy_RF6052_Config_ParaFile(struct rtw_adapter *Adapter) /*----Store original RFENV control type----*/ switch (eRFPath) { case RF_PATH_A: - u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); + u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, + bRFSI_RFENV); break; case RF_PATH_B: - u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16); + u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, + bRFSI_RFENV << 16); break; } /*----Set RF_ENV enable----*/ - PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1); + PHY_SetBBReg(Adapter, pPhyReg->rfintfe, bRFSI_RFENV << 16, 0x1); udelay(1);/* PlatformStallExecution(1); */ /*----Set RF_ENV output high----*/ @@ -446,10 +460,12 @@ static int phy_RF6052_Config_ParaFile(struct rtw_adapter *Adapter) udelay(1);/* PlatformStallExecution(1); */ /* Set bit number of Address and Data for RF register */ - PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, 0x0); /* Set 1 to 4 bits for 8255 */ + PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireAddressLength, + 0x0); /* Set 1 to 4 bits for 8255 */ udelay(1);/* PlatformStallExecution(1); */ - PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, 0x0); /* Set 0 to 12 bits for 8255 */ + PHY_SetBBReg(Adapter, pPhyReg->rfHSSIPara2, b3WireDataLength, + 0x0); /* Set 0 to 12 bits for 8255 */ udelay(1);/* PlatformStallExecution(1); */ /*----Initialize RF fom connfiguration file----*/ @@ -464,15 +480,16 @@ static int phy_RF6052_Config_ParaFile(struct rtw_adapter *Adapter) /*----Restore RFENV control type----*/; switch (eRFPath) { case RF_PATH_A: - PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); + PHY_SetBBReg(Adapter, pPhyReg->rfintfs, + bRFSI_RFENV, u4RegValue); break; case RF_PATH_B: - PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue); + PHY_SetBBReg(Adapter, pPhyReg->rfintfs, + bRFSI_RFENV << 16, u4RegValue); break; } if (rtStatus != _SUCCESS) { - /* RT_TRACE(COMP_FPGA, DBG_LOUD, ("phy_RF6052_Config_ParaFile():Radio[%d] Fail!!", eRFPath)); */ goto phy_RF6052_Config_ParaFile_Fail; } } diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_xmit.c b/drivers/staging/rtl8723au/hal/rtl8723a_xmit.c deleted file mode 100644 index 6ea2f9efef64..000000000000 --- a/drivers/staging/rtl8723au/hal/rtl8723a_xmit.c +++ /dev/null @@ -1,31 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - ******************************************************************************/ -#define _RTL8723A_XMIT_C_ - -#include <osdep_service.h> -#include <drv_types.h> -#include <rtl8723a_hal.h> - -void handle_txrpt_ccx_8723a(struct rtw_adapter *adapter, void *buf) -{ - struct txrpt_ccx_8723a *txrpt_ccx = buf; - - if (txrpt_ccx->int_ccx) { - if (txrpt_ccx->pkt_ok) - rtw_ack_tx_done23a(&adapter->xmitpriv, RTW_SCTX_DONE_SUCCESS); - else - rtw_ack_tx_done23a(&adapter->xmitpriv, RTW_SCTX_DONE_CCX_PKT_FAIL); - } -} diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_led.c b/drivers/staging/rtl8723au/hal/rtl8723au_led.c deleted file mode 100644 index b946636af9b3..000000000000 --- a/drivers/staging/rtl8723au/hal/rtl8723au_led.c +++ /dev/null @@ -1,124 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - ******************************************************************************/ - -#include "drv_types.h" -#include "rtl8723a_hal.h" -#include "rtl8723a_led.h" -#include "usb_ops_linux.h" - -/* */ -/* LED object. */ -/* */ - -/* */ -/* Prototype of protected function. */ -/* */ - -/* */ -/* LED_819xUsb routines. */ -/* */ - -/* Description: */ -/* Turn on LED according to LedPin specified. */ -void SwLedOn23a(struct rtw_adapter *padapter, struct led_8723a *pLed) -{ - u8 LedCfg = 0; - - if ((padapter->bSurpriseRemoved == true) || (padapter->bDriverStopped == true)) - return; - switch (pLed->LedPin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - /* SW control led0 on. */ - rtl8723au_write8(padapter, REG_LEDCFG0, - (LedCfg&0xf0)|BIT(5)|BIT(6)); - break; - case LED_PIN_LED1: - /* SW control led1 on. */ - rtl8723au_write8(padapter, REG_LEDCFG1, (LedCfg&0x00)|BIT(6)); - break; - case LED_PIN_LED2: - LedCfg = rtl8723au_read8(padapter, REG_LEDCFG2); - /* SW control led1 on. */ - rtl8723au_write8(padapter, REG_LEDCFG2, (LedCfg&0x80)|BIT(5)); - break; - default: - break; - } - pLed->bLedOn = true; -} - -/* Description: */ -/* Turn off LED according to LedPin specified. */ -void SwLedOff23a(struct rtw_adapter *padapter, struct led_8723a *pLed) -{ - u8 LedCfg = 0; - /* struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); */ - - if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped)) - goto exit; - - switch (pLed->LedPin) { - case LED_PIN_GPIO0: - break; - case LED_PIN_LED0: - /* SW control led0 on. */ - rtl8723au_write8(padapter, REG_LEDCFG0, - (LedCfg&0xf0)|BIT(5)|BIT(6)); - break; - case LED_PIN_LED1: - /* SW control led1 on. */ - rtl8723au_write8(padapter, REG_LEDCFG1, - (LedCfg&0x00)|BIT(5)|BIT(6)); - break; - case LED_PIN_LED2: - LedCfg = rtl8723au_read8(padapter, REG_LEDCFG2); - /* SW control led1 on. */ - rtl8723au_write8(padapter, REG_LEDCFG2, - (LedCfg&0x80)|BIT(3)|BIT(5)); - break; - default: - break; - } -exit: - pLed->bLedOn = false; -} - -/* Interface to manipulate LED objects. */ - -/* Description: */ -/* Initialize all LED_871x objects. */ -void -rtl8723au_InitSwLeds(struct rtw_adapter *padapter) -{ - struct led_priv *pledpriv = &padapter->ledpriv; - - pledpriv->LedControlHandler = LedControl871x23a; - /* 8723as-vau wifi used led2 */ - InitLed871x23a(padapter, &pledpriv->SwLed0, LED_PIN_LED2); - -/* InitLed871x23a(padapter,&pledpriv->SwLed1, LED_PIN_LED2); */ -} - -/* Description: */ -/* DeInitialize all LED_819xUsb objects. */ -void -rtl8723au_DeInitSwLeds(struct rtw_adapter *padapter) -{ - struct led_priv *ledpriv = &padapter->ledpriv; - - DeInitLed871x23a(&ledpriv->SwLed0); -} diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c b/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c index a67850fe6e5d..6070510bb470 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c +++ b/drivers/staging/rtl8723au/hal/rtl8723au_xmit.c @@ -21,18 +21,6 @@ /* include <rtl8192c_hal.h> */ #include <rtl8723a_hal.h> -static void do_queue_select(struct rtw_adapter *padapter, struct pkt_attrib *pattrib) -{ - u8 qsel; - - qsel = pattrib->priority; - RT_TRACE(_module_rtl871x_xmit_c_, _drv_info_, - ("### do_queue_select priority =%d , qsel = %d\n", - pattrib->priority, qsel)); - - pattrib->qsel = qsel; -} - static int urb_zero_packet_chk(struct rtw_adapter *padapter, int sz) { int blnSetTxDescOffset; @@ -163,7 +151,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag memset(ptxdesc, 0, sizeof(struct tx_desc)); - if ((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) { + if (pxmitframe->frame_tag == DATA_FRAMETAG) { /* offset 4 */ ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id&0x1f); @@ -215,7 +203,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate23a(pmlmeext->tx_rate)); } - } else if ((pxmitframe->frame_tag&0x0f) == MGNT_FRAMETAG) { + } else if (pxmitframe->frame_tag == MGNT_FRAMETAG) { /* offset 4 */ ptxdesc->txdw1 |= cpu_to_le32(pattrib->mac_id&0x1f); @@ -240,10 +228,11 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 bag ptxdesc->txdw5 |= cpu_to_le32(0x00180000);/* retry limit = 6 */ ptxdesc->txdw5 |= cpu_to_le32(MRateToHwRate23a(pmlmeext->tx_rate)); - } else if ((pxmitframe->frame_tag&0x0f) == TXAGG_FRAMETAG) { + } else if (pxmitframe->frame_tag == TXAGG_FRAMETAG) { DBG_8723A("pxmitframe->frame_tag == TXAGG_FRAMETAG\n"); } else { - DBG_8723A("pxmitframe->frame_tag = %d\n", pxmitframe->frame_tag); + DBG_8723A("pxmitframe->frame_tag = %d\n", + pxmitframe->frame_tag); /* offset 4 */ ptxdesc->txdw1 |= cpu_to_le32((4)&0x1f);/* CAM_ID(MAC_ID) */ @@ -306,10 +295,10 @@ static int rtw_dump_xframe(struct rtw_adapter *padapter, struct pkt_attrib *pattrib = &pxmitframe->attrib; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; - if ((pxmitframe->frame_tag == DATA_FRAMETAG) && - (pxmitframe->attrib.ether_type != 0x0806) && - (pxmitframe->attrib.ether_type != 0x888e) && - (pxmitframe->attrib.dhcp_pkt != 1)) + if (pxmitframe->frame_tag == DATA_FRAMETAG && + pxmitframe->attrib.ether_type != ETH_P_ARP && + pxmitframe->attrib.ether_type != ETH_P_PAE && + pxmitframe->attrib.dhcp_pkt != 1) rtw_issue_addbareq_cmd23a(padapter, pxmitframe); mem_addr = pxmitframe->buf_addr; @@ -392,7 +381,7 @@ bool rtl8723au_xmitframe_complete(struct rtw_adapter *padapter, pxmitbuf->priv_data = pxmitframe; - if ((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) { + if (pxmitframe->frame_tag == DATA_FRAMETAG) { if (pxmitframe->attrib.priority <= 15)/* TID0~15 */ res = rtw_xmitframe_coalesce23a(padapter, pxmitframe->pkt, pxmitframe); @@ -440,7 +429,7 @@ bool rtl8723au_hal_xmit(struct rtw_adapter *padapter, struct pkt_attrib *pattrib = &pxmitframe->attrib; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - do_queue_select(padapter, pattrib); + pattrib->qsel = pattrib->priority; spin_lock_bh(&pxmitpriv->lock); #ifdef CONFIG_8723AU_AP_MODE diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index a5de03d45aa9..febe5cedef8f 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -21,11 +21,13 @@ #include <HalPwrSeqCmd.h> #include <Hal8723PwrSeq.h> #include <rtl8723a_hal.h> -#include <rtl8723a_led.h> #include <linux/ieee80211.h> #include <usb_ops.h> +static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, + enum rt_rf_power_state eRFPowerState); + static void _ConfigChipOutEP(struct rtw_adapter *pAdapter, u8 NumOutPipe) { @@ -61,42 +63,28 @@ _ConfigChipOutEP(struct rtw_adapter *pAdapter, u8 NumOutPipe) (u32)NumOutPipe, (u32)pHalData->OutEpNumber)); */ } -static bool rtl8723au_set_queue_pipe_mapping(struct rtw_adapter *pAdapter, - u8 NumInPipe, u8 NumOutPipe) +bool rtl8723au_chip_configure(struct rtw_adapter *padapter) { - struct hal_data_8723a *pHalData = GET_HAL_DATA(pAdapter); - bool result = false; + struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); + u8 NumInPipe = pdvobjpriv->RtNumInPipes; + u8 NumOutPipe = pdvobjpriv->RtNumOutPipes; - _ConfigChipOutEP(pAdapter, NumOutPipe); + _ConfigChipOutEP(padapter, NumOutPipe); /* Normal chip with one IN and one OUT doesn't have interrupt IN EP. */ if (pHalData->OutEpNumber == 1) { if (NumInPipe != 1) - return result; + return false; } - result = Hal_MappingOutPipe23a(pAdapter, NumOutPipe); - - return result; -} - -void rtl8723au_chip_configure(struct rtw_adapter *padapter) -{ - struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); - struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); - - pHalData->interfaceIndex = pdvobjpriv->InterfaceNumber; - - rtl8723au_set_queue_pipe_mapping(padapter, - pdvobjpriv->RtNumInPipes, - pdvobjpriv->RtNumOutPipes); + return Hal_MappingOutPipe23a(padapter, NumOutPipe); } static int _InitPowerOn(struct rtw_adapter *padapter) { - int status = _SUCCESS; - u16 value16 = 0; - u8 value8 = 0; + u16 value16; + u8 value8; /* RSV_CTRL 0x1C[7:0] = 0x00 unlock ISO/CLK/Power control register */ @@ -123,7 +111,7 @@ static int _InitPowerOn(struct rtw_adapter *padapter) /* for Efuse PG, suggest by Jackie 2011.11.23 */ PHY_SetBBReg(padapter, REG_EFUSE_CTRL, BIT(28)|BIT(29)|BIT(30), 0x06); - return status; + return _SUCCESS; } /* Shall USB interface init this? */ @@ -313,7 +301,7 @@ static void _InitNormalChipThreeOutEpPriority(struct rtw_adapter *Adapter) _InitNormalChipRegPriority(Adapter, beQ, bkQ, viQ, voQ, mgtQ, hiQ); } -static void _InitNormalChipQueuePriority(struct rtw_adapter *Adapter) +static void _InitQueuePriority(struct rtw_adapter *Adapter) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); @@ -333,11 +321,6 @@ static void _InitNormalChipQueuePriority(struct rtw_adapter *Adapter) } } -static void _InitQueuePriority(struct rtw_adapter *Adapter) -{ - _InitNormalChipQueuePriority(Adapter); -} - static void _InitTransferPageSize(struct rtw_adapter *Adapter) { /* Tx page size is always 128. */ @@ -442,18 +425,6 @@ static void _InitEDCA(struct rtw_adapter *Adapter) rtl8723au_write32(Adapter, REG_EDCA_VO_PARAM, 0x002FA226); } -static void _InitHWLed(struct rtw_adapter *Adapter) -{ - struct led_priv *pledpriv = &Adapter->ledpriv; - - if (pledpriv->LedStrategy != HW_LED) - return; - -/* HW led control */ -/* to do .... */ -/* must consider cases of antenna diversity/ commbo card/solo card/mini card */ -} - static void _InitRDGSetting(struct rtw_adapter *Adapter) { rtl8723au_write8(Adapter, REG_RD_CTRL, 0xFF); @@ -480,7 +451,7 @@ static void _InitRFType(struct rtw_adapter *Adapter) pHalData->rf_chip = RF_6052; - if (is92CU == false) { + if (!is92CU) { pHalData->rf_type = RF_1T1R; DBG_8723A("Set RF Chip ID to RF_6052 and RF type to 1T1R.\n"); return; @@ -527,23 +498,22 @@ enum rt_rf_power_state RfOnOffDetect23a(struct rtw_adapter *pAdapter) return rfpowerstate; } -void _ps_open_RF23a(struct rtw_adapter *padapter); - int rtl8723au_hal_init(struct rtw_adapter *Adapter) { - u8 val8 = 0; - u32 boundary; - int status = _SUCCESS; struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); struct pwrctrl_priv *pwrctrlpriv = &Adapter->pwrctrlpriv; struct registry_priv *pregistrypriv = &Adapter->registrypriv; + u8 val8 = 0; + u32 boundary; + int status = _SUCCESS; + bool mac_on; unsigned long init_start_time = jiffies; Adapter->hw_init_completed = false; if (Adapter->pwrctrlpriv.bkeepfwalive) { - _ps_open_RF23a(Adapter); + phy_SsPwrSwitch92CU(Adapter, rf_on); if (pHalData->bIQKInitialized) { rtl8723a_phy_iq_calibrate(Adapter, true); @@ -566,9 +536,9 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) /* 0x100 value of first mac is 0xEA while 0x100 value of secondary is 0x00 */ if (val8 == 0xEA) { - pHalData->bMACFuncEnable = false; + mac_on = false; } else { - pHalData->bMACFuncEnable = true; + mac_on = true; RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("%s: MAC has already power on\n", __func__)); } @@ -587,7 +557,7 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) boundary = WMM_NORMAL_TX_PAGE_BOUNDARY; } - if (!pHalData->bMACFuncEnable) { + if (!mac_on) { status = InitLLTTable23a(Adapter, boundary); if (status == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, @@ -673,7 +643,7 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) pHalData->RfRegChnlVal[0] = PHY_QueryRFReg(Adapter, (enum RF_RADIO_PATH)0, RF_CHNLBW, bRFRegOffsetMask); pHalData->RfRegChnlVal[1] = PHY_QueryRFReg(Adapter, (enum RF_RADIO_PATH)1, RF_CHNLBW, bRFRegOffsetMask); - if (!pHalData->bMACFuncEnable) { + if (!mac_on) { _InitQueueReservedPage(Adapter); _InitTxBufferBoundary(Adapter); } @@ -694,8 +664,6 @@ int rtl8723au_hal_init(struct rtw_adapter *Adapter) _InitRetryFunction(Adapter); rtl8723a_InitBeaconParameters(Adapter); - _InitHWLed(Adapter); - _BBTurnOnBlock(Adapter); /* NicIFSetMacAddress(padapter, padapter->PermanentAddress); */ @@ -806,266 +774,108 @@ exit: } static void phy_SsPwrSwitch92CU(struct rtw_adapter *Adapter, - enum rt_rf_power_state eRFPowerState, - int bRegSSPwrLvl) + enum rt_rf_power_state eRFPowerState) { struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - u8 value8; - u8 bytetmp; + u8 sps0; + + sps0 = rtl8723au_read8(Adapter, REG_SPS0_CTRL); switch (eRFPowerState) { case rf_on: - if (bRegSSPwrLvl == 1) { - /* 1. Enable MAC Clock. Can not be enabled now. */ - /* WriteXBYTE(REG_SYS_CLKR+1, - ReadXBYTE(REG_SYS_CLKR+1) | BIT(3)); */ - - /* 2. Force PWM, Enable SPS18_LDO_Marco_Block */ - rtl8723au_write8(Adapter, REG_SPS0_CTRL, - rtl8723au_read8(Adapter, REG_SPS0_CTRL) | - BIT(0) | BIT(3)); - - /* 3. restore BB, AFE control register. */ - /* RF */ - if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, - 0x380038, 1); - else - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, - 0x38, 1); - PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, 0xf0, 1); - PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(1), 0); - - /* AFE */ - if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x63DB25A0); - else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x631B25A0); - - /* 4. issue 3-wire command that RF set to Rx idle - mode. This is used to re-write the RX idle mode. */ - /* We can only prvide a usual value instead and then - HW will modify the value by itself. */ - PHY_SetRFReg(Adapter, RF_PATH_A, 0, - bRFRegOffsetMask, 0x32D95); - if (pHalData->rf_type == RF_2T2R) { - PHY_SetRFReg(Adapter, RF_PATH_B, 0, - bRFRegOffsetMask, 0x32D95); - } - } else { /* Level 2 or others. */ - /* h. AFE_PLL_CTRL 0x28[7:0] = 0x80 - disable AFE PLL */ - rtl8723au_write8(Adapter, REG_AFE_PLL_CTRL, 0x81); - - /* i. AFE_XTAL_CTRL 0x24[15:0] = 0x880F - gated AFE DIG_CLOCK */ - rtl8723au_write16(Adapter, REG_AFE_XTAL_CTRL, 0x800F); - mdelay(1); - - /* 2. Force PWM, Enable SPS18_LDO_Marco_Block */ - rtl8723au_write8(Adapter, REG_SPS0_CTRL, - rtl8723au_read8(Adapter, REG_SPS0_CTRL) | - BIT(0) | BIT(3)); - - /* 3. restore BB, AFE control register. */ - /* RF */ - if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, - 0x380038, 1); - else - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, - 0x38, 1); - PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, 0xf0, 1); - PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(1), 0); - - /* AFE */ - if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, - bMaskDWord, 0x63DB25A0); - else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, - bMaskDWord, 0x631B25A0); - - /* 4. issue 3-wire command that RF set to Rx idle - mode. This is used to re-write the RX idle mode. */ - /* We can only prvide a usual value instead and - then HW will modify the value by itself. */ - PHY_SetRFReg(Adapter, RF_PATH_A, 0, + /* 1. Enable MAC Clock. Can not be enabled now. */ + /* WriteXBYTE(REG_SYS_CLKR+1, + ReadXBYTE(REG_SYS_CLKR+1) | BIT(3)); */ + + /* 2. Force PWM, Enable SPS18_LDO_Marco_Block */ + rtl8723au_write8(Adapter, REG_SPS0_CTRL, + sps0 | BIT(0) | BIT(3)); + + /* 3. restore BB, AFE control register. */ + /* RF */ + if (pHalData->rf_type == RF_2T2R) + PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, + 0x380038, 1); + else + PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, + 0x38, 1); + PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, 0xf0, 1); + PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(1), 0); + + /* AFE */ + if (pHalData->rf_type == RF_2T2R) + PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, + 0x63DB25A0); + else if (pHalData->rf_type == RF_1T1R) + PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, + 0x631B25A0); + + /* 4. issue 3-wire command that RF set to Rx idle + mode. This is used to re-write the RX idle mode. */ + /* We can only prvide a usual value instead and then + HW will modify the value by itself. */ + PHY_SetRFReg(Adapter, RF_PATH_A, 0, bRFRegOffsetMask, 0x32D95); + if (pHalData->rf_type == RF_2T2R) { + PHY_SetRFReg(Adapter, RF_PATH_B, 0, bRFRegOffsetMask, 0x32D95); - if (pHalData->rf_type == RF_2T2R) { - PHY_SetRFReg(Adapter, RF_PATH_B, 0, - bRFRegOffsetMask, 0x32D95); - } - - /* 5. gated MAC Clock */ - bytetmp = rtl8723au_read8(Adapter, REG_APSD_CTRL); - rtl8723au_write8(Adapter, REG_APSD_CTRL, - bytetmp & ~BIT(6)); - - mdelay(10); - - /* Set BB reset at first */ - /* 0x16 */ - rtl8723au_write8(Adapter, REG_SYS_FUNC_EN, 0x17); - - /* Enable TX */ - rtl8723au_write8(Adapter, REG_TXPAUSE, 0x0); } break; case rf_sleep: case rf_off: - value8 = rtl8723au_read8(Adapter, REG_SPS0_CTRL); if (IS_81xxC_VENDOR_UMC_B_CUT(pHalData->VersionID)) - value8 &= ~BIT(0); + sps0 &= ~BIT(0); else - value8 &= ~(BIT(0) | BIT(3)); - if (bRegSSPwrLvl == 1) { - RT_TRACE(_module_hal_init_c_, _drv_err_, ("SS LVL1\n")); - /* Disable RF and BB only for SelectSuspend. */ - - /* 1. Set BB/RF to shutdown. */ - /* (1) Reg878[5:3]= 0 RF rx_code for - preamble power saving */ - /* (2)Reg878[21:19]= 0 Turn off RF-B */ - /* (3) RegC04[7:4]= 0 Turn off all paths - for packet detection */ - /* (4) Reg800[1] = 1 enable preamble power - saving */ - Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF0] = - PHY_QueryBBReg(Adapter, rFPGA0_XAB_RFParameter, - bMaskDWord); - Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF1] = - PHY_QueryBBReg(Adapter, rOFDM0_TRxPathEnable, - bMaskDWord); - Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF2] = - PHY_QueryBBReg(Adapter, rFPGA0_RFMOD, - bMaskDWord); - if (pHalData->rf_type == RF_2T2R) { - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, - 0x380038, 0); - } else if (pHalData->rf_type == RF_1T1R) { - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, - 0x38, 0); - } - PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, 0xf0, 0); - PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(1), 1); - - /* 2 .AFE control register to power down. bit[30:22] */ - Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_AFE0] = - PHY_QueryBBReg(Adapter, rRx_Wait_CCA, - bMaskDWord); - if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x00DB25A0); - else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x001B25A0); - - /* 3. issue 3-wire command that RF set to power down.*/ - PHY_SetRFReg(Adapter, RF_PATH_A, 0, bRFRegOffsetMask, 0); - if (pHalData->rf_type == RF_2T2R) - PHY_SetRFReg(Adapter, RF_PATH_B, 0, - bRFRegOffsetMask, 0); - - /* 4. Force PFM , disable SPS18_LDO_Marco_Block */ - rtl8723au_write8(Adapter, REG_SPS0_CTRL, value8); - } else { /* Level 2 or others. */ - RT_TRACE(_module_hal_init_c_, _drv_err_, ("SS LVL2\n")); - { - u8 eRFPath = RF_PATH_A, value8 = 0; - rtl8723au_write8(Adapter, REG_TXPAUSE, 0xFF); - PHY_SetRFReg(Adapter, - (enum RF_RADIO_PATH)eRFPath, - 0x0, bMaskByte0, 0x0); - value8 |= APSDOFF; - /* 0x40 */ - rtl8723au_write8(Adapter, REG_APSD_CTRL, - value8); - - /* After switch APSD, we need to delay - for stability */ - mdelay(10); - - /* Set BB reset at first */ - value8 = 0; - value8 |= (FEN_USBD | FEN_USBA | - FEN_BB_GLB_RSTn); - /* 0x16 */ - rtl8723au_write8(Adapter, REG_SYS_FUNC_EN, - value8); - } - - /* Disable RF and BB only for SelectSuspend. */ - - /* 1. Set BB/RF to shutdown. */ - /* (1) Reg878[5:3]= 0 RF rx_code for - preamble power saving */ - /* (2)Reg878[21:19]= 0 Turn off RF-B */ - /* (3) RegC04[7:4]= 0 Turn off all paths for - packet detection */ - /* (4) Reg800[1] = 1 enable preamble power - saving */ - Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF0] = - PHY_QueryBBReg(Adapter, rFPGA0_XAB_RFParameter, - bMaskDWord); - Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF1] = - PHY_QueryBBReg(Adapter, rOFDM0_TRxPathEnable, - bMaskDWord); - Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF2] = - PHY_QueryBBReg(Adapter, rFPGA0_RFMOD, - bMaskDWord); - if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, - 0x380038, 0); - else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, - 0x38, 0); - PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, 0xf0, 0); - PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(1), 1); - - /* 2 .AFE control register to power down. bit[30:22] */ - Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_AFE0] = - PHY_QueryBBReg(Adapter, rRx_Wait_CCA, - bMaskDWord); - if (pHalData->rf_type == RF_2T2R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x00DB25A0); - else if (pHalData->rf_type == RF_1T1R) - PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, - 0x001B25A0); - - /* 3. issue 3-wire command that RF set to power down. */ - PHY_SetRFReg(Adapter, RF_PATH_A, 0, bRFRegOffsetMask, 0); - if (pHalData->rf_type == RF_2T2R) - PHY_SetRFReg(Adapter, RF_PATH_B, 0, - bRFRegOffsetMask, 0); - - /* 4. Force PFM , disable SPS18_LDO_Marco_Block */ - rtl8723au_write8(Adapter, REG_SPS0_CTRL, value8); - - /* 2010/10/13 MH/Isaachsu exchange sequence. */ - /* h. AFE_PLL_CTRL 0x28[7:0] = 0x80 - disable AFE PLL */ - rtl8723au_write8(Adapter, REG_AFE_PLL_CTRL, 0x80); - mdelay(1); - - /* i. AFE_XTAL_CTRL 0x24[15:0] = 0x880F - gated AFE DIG_CLOCK */ - rtl8723au_write16(Adapter, REG_AFE_XTAL_CTRL, 0xA80F); + sps0 &= ~(BIT(0) | BIT(3)); + + RT_TRACE(_module_hal_init_c_, _drv_err_, ("SS LVL1\n")); + /* Disable RF and BB only for SelectSuspend. */ + + /* 1. Set BB/RF to shutdown. */ + /* (1) Reg878[5:3]= 0 RF rx_code for + preamble power saving */ + /* (2)Reg878[21:19]= 0 Turn off RF-B */ + /* (3) RegC04[7:4]= 0 Turn off all paths + for packet detection */ + /* (4) Reg800[1] = 1 enable preamble power saving */ + Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF0] = + PHY_QueryBBReg(Adapter, rFPGA0_XAB_RFParameter, + bMaskDWord); + Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF1] = + PHY_QueryBBReg(Adapter, rOFDM0_TRxPathEnable, + bMaskDWord); + Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_RF2] = + PHY_QueryBBReg(Adapter, rFPGA0_RFMOD, bMaskDWord); + if (pHalData->rf_type == RF_2T2R) { + PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, + 0x380038, 0); + } else if (pHalData->rf_type == RF_1T1R) { + PHY_SetBBReg(Adapter, rFPGA0_XAB_RFParameter, 0x38, 0); } + PHY_SetBBReg(Adapter, rOFDM0_TRxPathEnable, 0xf0, 0); + PHY_SetBBReg(Adapter, rFPGA0_RFMOD, BIT(1), 1); + + /* 2 .AFE control register to power down. bit[30:22] */ + Adapter->pwrctrlpriv.PS_BBRegBackup[PSBBREG_AFE0] = + PHY_QueryBBReg(Adapter, rRx_Wait_CCA, bMaskDWord); + if (pHalData->rf_type == RF_2T2R) + PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, + 0x00DB25A0); + else if (pHalData->rf_type == RF_1T1R) + PHY_SetBBReg(Adapter, rRx_Wait_CCA, bMaskDWord, + 0x001B25A0); + + /* 3. issue 3-wire command that RF set to power down.*/ + PHY_SetRFReg(Adapter, RF_PATH_A, 0, bRFRegOffsetMask, 0); + if (pHalData->rf_type == RF_2T2R) + PHY_SetRFReg(Adapter, RF_PATH_B, 0, + bRFRegOffsetMask, 0); + + /* 4. Force PFM , disable SPS18_LDO_Marco_Block */ + rtl8723au_write8(Adapter, REG_SPS0_CTRL, sps0); break; default: break; } - -} /* phy_PowerSwitch92CU */ - -void _ps_open_RF23a(struct rtw_adapter *padapter) -{ - /* here call with bRegSSPwrLvl 1, bRegSSPwrLvl 2 needs to be verified */ - phy_SsPwrSwitch92CU(padapter, rf_on, 1); } static void CardDisableRTL8723U(struct rtw_adapter *Adapter) @@ -1142,8 +952,7 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) /* issue Rx irp to receive data */ precvbuf = (struct recv_buf *)precvpriv->precv_buf; for (i = 0; i < NR_RECVBUFF; i++) { - if (rtl8723au_read_port(Adapter, RECV_BULK_IN_ADDR, 0, - precvbuf) == _FAIL) { + if (rtl8723au_read_port(Adapter, 0, precvbuf) == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, ("usb_rx_init: usb_read_port error\n")); status = _FAIL; @@ -1151,9 +960,9 @@ int rtl8723au_inirp_init(struct rtw_adapter *Adapter) } precvbuf++; } - if (rtl8723au_read_interrupt(Adapter, RECV_INT_IN_ADDR) == _FAIL) { + if (rtl8723au_read_interrupt(Adapter) == _FAIL) { RT_TRACE(_module_hci_hal_init_c_, _drv_err_, - ("usb_rx_init: usb_read_interrupt error\n")); + ("%s: usb_read_interrupt error\n", __func__)); status = _FAIL; } pHalData->IntrMask[0] = rtl8723au_read32(Adapter, REG_USB_HIMR); @@ -1209,14 +1018,6 @@ static void _ReadBoardType(struct rtw_adapter *Adapter, u8 *PROMContent, pHalData->ExternalPA = 1; } -static void _ReadLEDSetting(struct rtw_adapter *Adapter, u8 *PROMContent, - bool AutoloadFail) -{ - struct led_priv *pledpriv = &Adapter->ledpriv; - - pledpriv->LedStrategy = HW_LED; -} - static void Hal_EfuseParseMACAddr_8723AU(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail) { @@ -1263,7 +1064,6 @@ static void readAdapterInfo(struct rtw_adapter *padapter) pEEPROM->bautoload_fail_flag); Hal_EfuseParseThermalMeter_8723A(padapter, hwinfo, pEEPROM->bautoload_fail_flag); - _ReadLEDSetting(padapter, hwinfo, pEEPROM->bautoload_fail_flag); /* _ReadRFSetting(Adapter, PROMContent, pEEPROM->bautoload_fail_flag); */ /* _ReadPSSetting(Adapter, PROMContent, pEEPROM->bautoload_fail_flag); */ Hal_EfuseParseAntennaDiversity(padapter, hwinfo, @@ -1276,10 +1076,6 @@ static void readAdapterInfo(struct rtw_adapter *padapter) pEEPROM->bautoload_fail_flag); Hal_EfuseParseXtal_8723A(padapter, hwinfo, pEEPROM->bautoload_fail_flag); - /* */ - /* The following part initialize some vars by PG info. */ - /* */ - Hal_InitChannelPlan23a(padapter); /* hal_CustomizedBehavior_8723U(Adapter); */ @@ -1311,13 +1107,6 @@ static void _ReadRFType(struct rtw_adapter *Adapter) pHalData->rf_chip = RF_6052; } -static void _ReadSilmComboMode(struct rtw_adapter *Adapter) -{ - struct hal_data_8723a *pHalData = GET_HAL_DATA(Adapter); - - pHalData->SlimComboDbg = false; /* Default is not debug mode. */ -} - /* */ /* Description: */ /* We should set Efuse cell selection to WiFi cell in default. */ @@ -1350,10 +1139,6 @@ void rtl8723a_read_adapter_info(struct rtw_adapter *Adapter) _ReadRFType(Adapter);/* rf_chip -> _InitRFType() */ _ReadPROMContent(Adapter); - /* 2010/10/25 MH THe function must be called after - borad_type & IC-Version recognize. */ - _ReadSilmComboMode(Adapter); - /* MSG_8723A("%s()(done), rf_chip = 0x%x, rf_type = 0x%x\n", __func__, pHalData->rf_chip, pHalData->rf_type); */ @@ -1417,17 +1202,17 @@ int GetHalDefVar8192CUsb(struct rtw_adapter *Adapter, void rtl8723a_update_ramask(struct rtw_adapter *padapter, u32 mac_id, u8 rssi_level) { - u8 init_rate = 0; - u8 networkType, raid; - u32 mask, rate_bitmap; - u8 shortGIrate = false; - int supportRateNum = 0; struct sta_info *psta; - struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); - struct dm_priv *pdmpriv = &pHalData->dmpriv; + struct FW_Sta_Info *fw_sta; + struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *cur_network = &pmlmeinfo->network; + u8 init_rate, networkType, raid; + u32 mask, rate_bitmap; + u8 shortGIrate = false; + int supportRateNum; if (mac_id >= NUM_STA) /* CAM_SIZE */ return; @@ -1456,8 +1241,8 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter, break; case 1:/* for broadcast/multicast */ - supportRateNum = rtw_get_rateset_len23a( - pmlmeinfo->FW_sta_info[mac_id].SupportedRates); + fw_sta = &pmlmeinfo->FW_sta_info[mac_id]; + supportRateNum = rtw_get_rateset_len23a(fw_sta->SupportedRates); if (pmlmeext->cur_wireless_mode & WIRELESS_11B) networkType = WIRELESS_11B; else @@ -1469,23 +1254,22 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter, break; default: /* for each sta in IBSS */ - supportRateNum = rtw_get_rateset_len23a( - pmlmeinfo->FW_sta_info[mac_id].SupportedRates); + fw_sta = &pmlmeinfo->FW_sta_info[mac_id]; + supportRateNum = rtw_get_rateset_len23a(fw_sta->SupportedRates); networkType = judge_network_type23a(padapter, - pmlmeinfo->FW_sta_info[mac_id].SupportedRates, - supportRateNum) & 0xf; + fw_sta->SupportedRates, + supportRateNum) & 0xf; /* pmlmeext->cur_wireless_mode = networkType; */ raid = networktype_to_raid23a(networkType); mask = update_supported_rate23a(cur_network->SupportedRates, - supportRateNum); + supportRateNum); /* todo: support HT in IBSS */ break; } /* mask &= 0x0fffffff; */ - rate_bitmap = 0x0fffffff; rate_bitmap = ODM_Get_Rate_Bitmap23a(pHalData, mac_id, mask, rssi_level); DBG_8723A("%s => mac_id:%d, networkType:0x%02x, " @@ -1493,15 +1277,14 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter, __func__, mac_id, networkType, mask, rssi_level, rate_bitmap); mask &= rate_bitmap; - mask |= ((raid<<28)&0xf0000000); + mask |= ((raid << 28) & 0xf0000000); - init_rate = get_highest_rate_idx23a(mask)&0x3f; + init_rate = get_highest_rate_idx23a(mask) & 0x3f; if (pHalData->fw_ractrl == true) { u8 arg = 0; - /* arg = (cam_idx-4)&0x1f;MACID */ - arg = mac_id&0x1f;/* MACID */ + arg = mac_id & 0x1f;/* MACID */ arg |= BIT(7); @@ -1516,7 +1299,7 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter, if (shortGIrate == true) init_rate |= BIT(6); - rtl8723au_write8(padapter, (REG_INIDATA_RATE_SEL+mac_id), + rtl8723au_write8(padapter, (REG_INIDATA_RATE_SEL + mac_id), init_rate); } diff --git a/drivers/staging/rtl8723au/hal/usb_ops_linux.c b/drivers/staging/rtl8723au/hal/usb_ops_linux.c index c1b04c13c392..a6d16adce107 100644 --- a/drivers/staging/rtl8723au/hal/usb_ops_linux.c +++ b/drivers/staging/rtl8723au/hal/usb_ops_linux.c @@ -317,7 +317,7 @@ urb_submit: } } -int rtl8723au_read_interrupt(struct rtw_adapter *adapter, u32 addr) +int rtl8723au_read_interrupt(struct rtw_adapter *adapter) { int err; unsigned int pipe; @@ -545,8 +545,7 @@ static void usb_read_port_complete(struct urb *purb) ("usb_read_port_complete: (purb->actual_" "length > MAX_RECVBUF_SZ) || (purb->actual_" "length < RXDESC_SIZE)\n")); - rtl8723au_read_port(padapter, RECV_BULK_IN_ADDR, 0, - precvbuf); + rtl8723au_read_port(padapter, 0, precvbuf); DBG_8723A("%s()-%d: RX Warning!\n", __func__, __LINE__); } else { @@ -561,8 +560,7 @@ static void usb_read_port_complete(struct urb *purb) tasklet_schedule(&precvpriv->recv_tasklet); precvbuf->pskb = NULL; - rtl8723au_read_port(padapter, RECV_BULK_IN_ADDR, 0, - precvbuf); + rtl8723au_read_port(padapter, 0, precvbuf); } } else { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, @@ -596,8 +594,7 @@ static void usb_read_port_complete(struct urb *purb) break; case -EPROTO: case -EOVERFLOW: - rtl8723au_read_port(padapter, RECV_BULK_IN_ADDR, 0, - precvbuf); + rtl8723au_read_port(padapter, 0, precvbuf); break; case -EINPROGRESS: DBG_8723A("ERROR: URB IS IN PROGRESS!\n"); @@ -608,18 +605,18 @@ static void usb_read_port_complete(struct urb *purb) } } -int rtl8723au_read_port(struct rtw_adapter *adapter, u32 addr, u32 cnt, +int rtl8723au_read_port(struct rtw_adapter *adapter, u32 cnt, struct recv_buf *precvbuf) { + struct urb *purb; + struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); + struct recv_priv *precvpriv = &adapter->recvpriv; + struct usb_device *pusbd = pdvobj->pusbdev; int err; unsigned int pipe; unsigned long tmpaddr; unsigned long alignment; int ret = _SUCCESS; - struct urb *purb; - struct dvobj_priv *pdvobj = adapter_to_dvobj(adapter); - struct recv_priv *precvpriv = &adapter->recvpriv; - struct usb_device *pusbd = pdvobj->pusbdev; if (adapter->bDriverStopped || adapter->bSurpriseRemoved) { RT_TRACE(_module_hci_ops_os_c_, _drv_err_, diff --git a/drivers/staging/rtl8723au/include/Hal8723UHWImg_CE.h b/drivers/staging/rtl8723au/include/Hal8723UHWImg_CE.h index bbeaab48057a..c834b3a738d7 100644 --- a/drivers/staging/rtl8723au/include/Hal8723UHWImg_CE.h +++ b/drivers/staging/rtl8723au/include/Hal8723UHWImg_CE.h @@ -19,7 +19,7 @@ extern u8 Rtl8723UFwUMCBCutImgArrayWithoutBT[Rtl8723UUMCBCutImgArrayWithoutBTLen extern const u8 Rtl8723SFwUMCBCutMPImgArray[Rtl8723SUMCBCutMPImgArrayLength]; #define Rtl8723EBTImgArrayLength 15276 -extern u8 Rtl8723EFwBTImgArray[Rtl8723EBTImgArrayLength] ; +extern u8 Rtl8723EFwBTImgArray[Rtl8723EBTImgArrayLength]; #define Rtl8723UPHY_REG_Array_PGLength 336 extern u32 Rtl8723UPHY_REG_Array_PG[Rtl8723UPHY_REG_Array_PGLength]; diff --git a/drivers/staging/rtl8723au/include/drv_types.h b/drivers/staging/rtl8723au/include/drv_types.h index 9870f87bdc70..e83463aeb9b1 100644 --- a/drivers/staging/rtl8723au/include/drv_types.h +++ b/drivers/staging/rtl8723au/include/drv_types.h @@ -51,7 +51,6 @@ enum _NIC_VERSION { #include <rtw_debug.h> #include <rtw_rf.h> #include <rtw_event.h> -#include <rtw_led.h> #include <rtw_mlme_ext.h> #include <rtw_ap.h> @@ -228,7 +227,6 @@ struct rtw_adapter { struct registry_priv registrypriv; struct pwrctrl_priv pwrctrlpriv; struct eeprom_priv eeprompriv; - struct led_priv ledpriv; u32 setband; diff --git a/drivers/staging/rtl8723au/include/odm_debug.h b/drivers/staging/rtl8723au/include/odm_debug.h index 4d935a33ccb3..83be5bab9e09 100644 --- a/drivers/staging/rtl8723au/include/odm_debug.h +++ b/drivers/staging/rtl8723au/include/odm_debug.h @@ -91,8 +91,7 @@ #define ODM_COMP_INIT BIT(31) /*------------------------Export Macro Definition---------------------------*/ - #define DbgPrint printk - #define RT_PRINTK(fmt, args...) DbgPrint("%s(): " fmt, __func__, ## args); + #define RT_PRINTK(fmt, args...) printk("%s(): " fmt, __func__, ## args); #ifndef ASSERT #define ASSERT(expr) @@ -101,38 +100,17 @@ #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \ if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ { \ - DbgPrint("[ODM-8723A] "); \ - RT_PRINTK fmt; \ - } - -#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \ - if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ - { \ + printk("[ODM-8723A] "); \ RT_PRINTK fmt; \ } #define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \ if(!(expr)) { \ - DbgPrint("Assertion failed! %s at ......\n", #expr); \ - DbgPrint(" ......%s,%s,line=%d\n", __FILE__, __func__, __LINE__);\ + printk("Assertion failed! %s at ......\n", #expr); \ + printk(" ......%s,%s,line=%d\n", __FILE__, __func__, __LINE__);\ RT_PRINTK fmt; \ ASSERT(false); \ } -#define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); } -#define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); } -#define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); } - -#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \ - if(((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel){ \ - int __i; \ - u8 * __ptr = (u8 *)ptr; \ - DbgPrint("[ODM] "); \ - DbgPrint(title_str); \ - DbgPrint(" "); \ - for (__i=0; __i < 6; __i++) \ - DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-"); \ - DbgPrint("\n"); \ - } void ODM_InitDebugSetting23a(struct dm_odm_t *pDM_Odm); diff --git a/drivers/staging/rtl8723au/include/rtl8723a_dm.h b/drivers/staging/rtl8723au/include/rtl8723a_dm.h index 18112225e53f..bf236e8e47a2 100644 --- a/drivers/staging/rtl8723au/include/rtl8723a_dm.h +++ b/drivers/staging/rtl8723au/include/rtl8723a_dm.h @@ -37,8 +37,7 @@ enum{ #define IQK_BB_REG_NUM 9 #define HP_THERMAL_NUM 8 /* duplicate code,will move to ODM ######### */ -struct dm_priv -{ +struct dm_priv { u32 InitODMFlag; /* Upper and Lower Signal threshold for Rate Adaptive*/ diff --git a/drivers/staging/rtl8723au/include/rtl8723a_hal.h b/drivers/staging/rtl8723au/include/rtl8723a_hal.h index ee203a572cb7..e14633678b52 100644 --- a/drivers/staging/rtl8723au/include/rtl8723a_hal.h +++ b/drivers/staging/rtl8723au/include/rtl8723a_hal.h @@ -372,16 +372,9 @@ struct hal_data_8723a { /* 2010/08/09 MH Add CU power down mode. */ u8 pwrdown; - /* Add for dual MAC 0--Mac0 1--Mac1 */ - u32 interfaceIndex; - u8 OutEpQueueSel; u8 OutEpNumber; - /* 2010/11/22 MH Add for slim combo debug mode selective. */ - /* This is used for fix the drawback of CU TSMC-A/UMC-A cut. HW auto suspend ability. Close BT clock. */ - bool SlimComboDbg; - /* */ /* Add For EEPROM Efuse switch and Efuse Shadow map Setting */ /* */ @@ -405,8 +398,6 @@ struct hal_data_8723a { * 2011/02/23 MH Add for 8723 mylti function definition. The define should be moved to an */ /* independent file in the future. */ - bool bMACFuncEnable; - /* Interrupt related register information. */ u32 IntArray[2]; u32 IntrMask[2]; @@ -518,8 +509,6 @@ void Hal_EfuseParseRateIndicationOption(struct rtw_adapter *padapter, u8 *hwinfo void Hal_EfuseParseXtal_8723A(struct rtw_adapter *pAdapter, u8 *hwinfo, u8 AutoLoadFail); void Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter, u8 *hwinfo, bool AutoLoadFail); -void Hal_InitChannelPlan23a(struct rtw_adapter *padapter); - /* register */ void SetBcnCtrlReg23a(struct rtw_adapter *padapter, u8 SetBits, u8 ClearBits); void rtl8723a_InitBeaconParameters(struct rtw_adapter *padapter); diff --git a/drivers/staging/rtl8723au/include/rtl8723a_led.h b/drivers/staging/rtl8723au/include/rtl8723a_led.h deleted file mode 100644 index 1623d186feb4..000000000000 --- a/drivers/staging/rtl8723au/include/rtl8723a_led.h +++ /dev/null @@ -1,30 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - ******************************************************************************/ -#ifndef __RTL8723A_LED_H__ -#define __RTL8723A_LED_H__ - -#include <osdep_service.h> -#include <drv_types.h> - - -/* */ -/* Interface to manipulate LED objects. */ -/* */ -void rtl8723au_InitSwLeds(struct rtw_adapter *padapter); -void rtl8723au_DeInitSwLeds(struct rtw_adapter *padapter); -void SwLedOn23a(struct rtw_adapter *padapter, struct led_8723a * pLed); -void SwLedOff23a(struct rtw_adapter *padapter, struct led_8723a * pLed); - -#endif diff --git a/drivers/staging/rtl8723au/include/rtl8723a_recv.h b/drivers/staging/rtl8723au/include/rtl8723a_recv.h index 885d4d3859f8..0177bbc1c1cf 100644 --- a/drivers/staging/rtl8723au/include/rtl8723a_recv.h +++ b/drivers/staging/rtl8723au/include/rtl8723a_recv.h @@ -28,15 +28,11 @@ #define MAX_RECVBUF_SZ 15360 /* 15k < 16k */ -#define RECV_BULK_IN_ADDR 0x80 -#define RECV_INT_IN_ADDR 0x81 - #define PHY_RSSI_SLID_WIN_MAX 100 #define PHY_LINKQUALITY_SLID_WIN_MAX 20 -struct phy_stat -{ +struct phy_stat { unsigned int phydw0; unsigned int phydw1; unsigned int phydw2; diff --git a/drivers/staging/rtl8723au/include/rtl8723a_xmit.h b/drivers/staging/rtl8723au/include/rtl8723a_xmit.h index 815560c6e1d7..7db29f40ab70 100644 --- a/drivers/staging/rtl8723au/include/rtl8723a_xmit.h +++ b/drivers/staging/rtl8723au/include/rtl8723a_xmit.h @@ -212,7 +212,6 @@ struct txrpt_ccx_8723a { #define txrpt_ccx_qtime_8723a(txrpt_ccx) ((txrpt_ccx)->ccx_qtime0+((txrpt_ccx)->ccx_qtime1<<8)) void handle_txrpt_ccx_8723a(struct rtw_adapter *adapter, void *buf); -void rtl8723a_update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem); void rtl8723a_fill_fake_txdesc(struct rtw_adapter *padapter, u8 *pDesc, u32 BufferLen, u8 IsPsPoll, u8 IsBTQosNull); int rtl8723au_hal_xmitframe_enqueue(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe); diff --git a/drivers/staging/rtl8723au/include/rtw_cmd.h b/drivers/staging/rtl8723au/include/rtw_cmd.h index ef67068a5fe3..71044107d13b 100644 --- a/drivers/staging/rtl8723au/include/rtw_cmd.h +++ b/drivers/staging/rtl8723au/include/rtw_cmd.h @@ -17,7 +17,6 @@ #include <wlan_bssdef.h> #include <rtw_rf.h> -#include <rtw_led.h> #define C2H_MEM_SZ (16*1024) @@ -450,8 +449,7 @@ struct getrfintfs_parm { u8 rfintfs; }; -struct Tx_Beacon_param -{ +struct Tx_Beacon_param { struct wlan_bssid_ex network; }; diff --git a/drivers/staging/rtl8723au/include/rtw_ht.h b/drivers/staging/rtl8723au/include/rtw_ht.h index cfc947daf08b..780eb8944118 100644 --- a/drivers/staging/rtl8723au/include/rtw_ht.h +++ b/drivers/staging/rtl8723au/include/rtw_ht.h @@ -19,8 +19,7 @@ #include "linux/ieee80211.h" #include "wifi.h" -struct ht_priv -{ +struct ht_priv { bool ht_option; bool ampdu_enable;/* for enable Tx A-MPDU */ /* u8 baddbareq_issued[16]; */ diff --git a/drivers/staging/rtl8723au/include/rtw_led.h b/drivers/staging/rtl8723au/include/rtw_led.h deleted file mode 100644 index c071da587efd..000000000000 --- a/drivers/staging/rtl8723au/include/rtw_led.h +++ /dev/null @@ -1,181 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - ******************************************************************************/ -#ifndef __RTW_LED_H_ -#define __RTW_LED_H_ - -#include <osdep_service.h> -#include <drv_types.h> - -#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) - -#define LED_BLINK_NORMAL_INTERVAL 100 -#define LED_BLINK_SLOWLY_INTERVAL 200 -#define LED_BLINK_LONG_INTERVAL 400 - -#define LED_BLINK_NO_LINK_INTERVAL_ALPHA 1000 -#define LED_BLINK_LINK_INTERVAL_ALPHA 500 /* 500 */ -#define LED_BLINK_SCAN_INTERVAL_ALPHA 180 /* 150 */ -#define LED_BLINK_FASTER_INTERVAL_ALPHA 50 -#define LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA 5000 - -#define LED_BLINK_NORMAL_INTERVAL_NETTRONIX 100 -#define LED_BLINK_SLOWLY_INTERVAL_NETTRONIX 2000 - -#define LED_BLINK_SLOWLY_INTERVAL_PORNET 1000 -#define LED_BLINK_NORMAL_INTERVAL_PORNET 100 - -#define LED_BLINK_FAST_INTERVAL_BITLAND 30 - -/* 060403, rcnjko: Customized for AzWave. */ -#define LED_CM2_BLINK_ON_INTERVAL 250 -#define LED_CM2_BLINK_OFF_INTERVAL 4750 - -#define LED_CM8_BLINK_INTERVAL 500 /* for QMI */ -#define LED_CM8_BLINK_OFF_INTERVAL 3750 /* for QMI */ - -/* 080124, lanhsin: Customized for RunTop */ -#define LED_RunTop_BLINK_INTERVAL 300 - -/* 060421, rcnjko: Customized for Sercomm Printer Server case. */ -#define LED_CM3_BLINK_INTERVAL 1500 - -enum led_ctl_mode { - LED_CTL_POWER_ON = 1, - LED_CTL_LINK = 2, - LED_CTL_NO_LINK = 3, - LED_CTL_TX = 4, - LED_CTL_RX = 5, - LED_CTL_SITE_SURVEY = 6, - LED_CTL_POWER_OFF = 7, - LED_CTL_START_TO_LINK = 8, - LED_CTL_START_WPS = 9, - LED_CTL_STOP_WPS = 10, - LED_CTL_START_WPS_BOTTON = 11, /* added for runtop */ - LED_CTL_STOP_WPS_FAIL = 12, /* added for ALPHA */ - LED_CTL_STOP_WPS_FAIL_OVERLAP = 13, /* added for BELKIN */ - LED_CTL_CONNECTION_NO_TRANSFER = 14, -}; - -enum led_state_872x { - LED_UNKNOWN = 0, - RTW_LED_ON = 1, - RTW_LED_OFF = 2, - LED_BLINK_NORMAL = 3, - LED_BLINK_SLOWLY = 4, - LED_BLINK_POWER_ON = 5, - LED_BLINK_SCAN = 6, /* LED is blinking during scanning period, the # of times to blink is depend on time for scanning. */ - LED_BLINK_NO_LINK = 7, /* LED is blinking during no link state. */ - LED_BLINK_StartToBlink = 8,/* Customzied for Sercomm Printer Server case */ - LED_BLINK_TXRX = 9, - LED_BLINK_WPS = 10, /* LED is blinkg during WPS communication */ - LED_BLINK_WPS_STOP = 11, /* for ALPHA */ - LED_BLINK_WPS_STOP_OVERLAP = 12, /* for BELKIN */ - LED_BLINK_RUNTOP = 13, /* Customized for RunTop */ - LED_BLINK_CAMEO = 14, - LED_BLINK_XAVI = 15, - LED_BLINK_ALWAYS_ON = 16, -}; - -enum led_pin_8723a { - LED_PIN_NULL = 0, - LED_PIN_LED0 = 1, - LED_PIN_LED1 = 2, - LED_PIN_LED2 = 3, - LED_PIN_GPIO0 = 4, -}; - -struct led_8723a { - struct rtw_adapter *padapter; - - enum led_pin_8723a LedPin; /* Identify how to implement this SW led. */ - enum led_state_872x CurrLedState; /* Current LED state. */ - enum led_state_872x BlinkingLedState; /* Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. */ - - u8 bLedOn; /* true if LED is ON, false if LED is OFF. */ - - u8 bLedBlinkInProgress; /* true if it is blinking, false o.w.. */ - - u8 bLedWPSBlinkInProgress; - - u32 BlinkTimes; /* Number of times to toggle led state for blinking. */ - - struct timer_list BlinkTimer; /* Timer object for led blinking. */ - - u8 bSWLedCtrl; - - /* ALPHA, added by chiyoko, 20090106 */ - u8 bLedNoLinkBlinkInProgress; - u8 bLedLinkBlinkInProgress; - u8 bLedStartToLinkBlinkInProgress; - u8 bLedScanBlinkInProgress; - - struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer to manipulate H/W to blink LED. */ -}; - -#define IS_LED_WPS_BLINKING(_LED_871x) (((struct led_8723a *)_LED_871x)->CurrLedState==LED_BLINK_WPS \ - || ((struct led_8723a *)_LED_871x)->CurrLedState==LED_BLINK_WPS_STOP \ - || ((struct led_8723a *)_LED_871x)->bLedWPSBlinkInProgress) - -#define IS_LED_BLINKING(_LED_871x) (((struct led_8723a *)_LED_871x)->bLedWPSBlinkInProgress \ - ||((struct led_8723a *)_LED_871x)->bLedScanBlinkInProgress) - -/* */ -/* LED customization. */ -/* */ - -enum led_strategy_8723a { - SW_LED_MODE0 = 0, /* SW control 1 LED via GPIO0. It is default option. */ - SW_LED_MODE1= 1, /* 2 LEDs, through LED0 and LED1. For ALPHA. */ - SW_LED_MODE2 = 2, /* SW control 1 LED via GPIO0, customized for AzWave 8187 minicard. */ - SW_LED_MODE3 = 3, /* SW control 1 LED via GPIO0, customized for Sercomm Printer Server case. */ - SW_LED_MODE4 = 4, /* for Edimax / Belkin */ - SW_LED_MODE5 = 5, /* for Sercomm / Belkin */ - SW_LED_MODE6 = 6, /* for 88CU minicard, porting from ce SW_LED_MODE7 */ - HW_LED = 50, /* HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes, see MAC.CONFIG1 for details.) */ - LED_ST_NONE = 99, -}; - -void LedControl871x23a(struct rtw_adapter *padapter, enum led_ctl_mode LedAction); - -struct led_priv{ - /* add for led controll */ - struct led_8723a SwLed0; - struct led_8723a SwLed1; - enum led_strategy_8723a LedStrategy; - u8 bRegUseLed; - void (*LedControlHandler)(struct rtw_adapter *padapter, enum led_ctl_mode LedAction); - /* add for led controll */ -}; - -#define rtw_led_control(adapter, LedAction) - -void BlinkWorkItemCallback23a(struct work_struct *work); - -void ResetLedStatus23a(struct led_8723a *pLed); - -void -InitLed871x23a( - struct rtw_adapter *padapter, - struct led_8723a *pLed, - enum led_pin_8723a LedPin -); - -void -DeInitLed871x23a(struct led_8723a *pLed); - -/* hal... */ -void BlinkHandler23a(struct led_8723a *pLed); - -#endif /* __RTW_LED_H_ */ diff --git a/drivers/staging/rtl8723au/include/rtw_mlme.h b/drivers/staging/rtl8723au/include/rtw_mlme.h index 2ff01eb8fc0c..a6751f138336 100644 --- a/drivers/staging/rtl8723au/include/rtw_mlme.h +++ b/drivers/staging/rtl8723au/include/rtw_mlme.h @@ -270,7 +270,7 @@ static inline void _clr_fwstate_(struct mlme_priv *pmlmepriv, int state) static inline void clr_fwstate(struct mlme_priv *pmlmepriv, int state) { spin_lock_bh(&pmlmepriv->lock); - if (check_fwstate(pmlmepriv, state) == true) + if (check_fwstate(pmlmepriv, state)) pmlmepriv->fw_state ^= state; spin_unlock_bh(&pmlmepriv->lock); } diff --git a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h index 97c3c4478f29..51dba1fa4c5d 100644 --- a/drivers/staging/rtl8723au/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8723au/include/rtw_mlme_ext.h @@ -270,8 +270,7 @@ struct action_handler { int (*func)(struct rtw_adapter *padapter, struct recv_frame *precv_frame); }; -struct ss_res -{ +struct ss_res { int state; int bss_cnt; int channel_idx; @@ -318,8 +317,7 @@ struct FW_Sta_Info { * 5. ... and so on, till survey done. */ -struct mlme_ext_info -{ +struct mlme_ext_info { u32 state; u32 reauth_count; u32 reassoc_count; diff --git a/drivers/staging/rtl8723au/include/rtw_recv.h b/drivers/staging/rtl8723au/include/rtw_recv.h index f846bb5e7ab7..dc784be3ddd9 100644 --- a/drivers/staging/rtl8723au/include/rtw_recv.h +++ b/drivers/staging/rtl8723au/include/rtw_recv.h @@ -200,9 +200,6 @@ struct recv_priv { u8 *precv_buf; /* For display the phy informatiom */ - u8 is_signal_dbg; /* for debug */ - u8 signal_strength_dbg; /* for debug */ - s8 rssi; s8 rxpwdb; u8 signal_strength; u8 signal_qual; diff --git a/drivers/staging/rtl8723au/include/rtw_xmit.h b/drivers/staging/rtl8723au/include/rtw_xmit.h index 32a844170327..2b7d6d08238b 100644 --- a/drivers/staging/rtl8723au/include/rtw_xmit.h +++ b/drivers/staging/rtl8723au/include/rtw_xmit.h @@ -196,7 +196,6 @@ enum { void rtw_sctx_init23a(struct submit_ctx *sctx, int timeout_ms); int rtw_sctx_wait23a(struct submit_ctx *sctx); void rtw23a_sctx_done_err(struct submit_ctx **sctx, int status); -void rtw_sctx_done23a(struct submit_ctx **sctx); struct xmit_buf { struct list_head list, list2; @@ -295,10 +294,6 @@ struct xmit_priv { struct rtw_adapter *adapter; - u8 vcs_setting; - u8 vcs; - u8 vcs_type; - u64 tx_bytes; u64 tx_pkts; u64 tx_drop; @@ -307,6 +302,8 @@ struct xmit_priv { struct hw_xmit *hwxmits; u8 hwxmit_entry; + u8 vcs; + u8 nqos_ssn; u8 wmm_para_seq[4];/* sequence for wmm ac parameter strength from * large to small. it's value is 0->vo, 1->vi, @@ -314,14 +311,8 @@ struct xmit_priv { */ struct semaphore tx_retevt;/* all tx return event; */ - u8 txirp_cnt;/* */ struct tasklet_struct xmit_tasklet; - /* per AC pending irp */ - int beq_cnt; - int bkq_cnt; - int viq_cnt; - int voq_cnt; struct rtw_queue free_xmitbuf_queue; struct list_head xmitbuf_list; /* track buffers for cleanup */ @@ -332,7 +323,6 @@ struct xmit_priv { struct list_head xmitextbuf_list; /* track buffers for cleanup */ uint free_xmit_extbuf_cnt; - u16 nqos_ssn; int ack_tx; struct mutex ack_tx_mutex; struct submit_ctx ack_tx_ops; @@ -349,7 +339,6 @@ s32 rtw_free_xmitbuf23a(struct xmit_priv *pxmitpriv, struct xmit_buf *pxmitbuf); void rtw_count_tx_stats23a(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe, int sz); void rtw_update_protection23a(struct rtw_adapter *padapter, u8 *ie, uint ie_len); -s32 rtw_put_snap23a(u8 *data, u16 h_proto); struct xmit_frame *rtw_alloc_xmitframe23a_ext(struct xmit_priv *pxmitpriv); struct xmit_frame *rtw_alloc_xmitframe23a_once(struct xmit_priv *pxmitpriv); s32 rtw_free_xmitframe23a(struct xmit_priv *pxmitpriv, @@ -363,8 +352,6 @@ struct xmit_frame *rtw_dequeue_xframe23a(struct xmit_priv *pxmitpriv, struct hw_xmit *phwxmit_i, int entry); s32 rtw_xmit23a_classifier(struct rtw_adapter *padapter, struct xmit_frame *pxmitframe); -u32 rtw_calculate_wlan_pkt_size_by_attribue23a(struct pkt_attrib *pattrib); -#define rtw_wlan_pkt_size(f) rtw_calculate_wlan_pkt_size_by_attribue23a(&f->attrib) s32 rtw_xmitframe_coalesce23a(struct rtw_adapter *padapter, struct sk_buff *pkt, struct xmit_frame *pxmitframe); s32 _rtw_init_hw_txqueue(struct hw_txqueue *phw_txqueue, u8 ac_tag); @@ -391,7 +378,6 @@ void xmit_delivery_enabled_frames23a(struct rtw_adapter *padapter, u8 qos_acm23a(u8 acm_mask, u8 priority); u32 rtw_get_ff_hwaddr23a(struct xmit_frame *pxmitframe); int rtw_ack_tx_wait23a(struct xmit_priv *pxmitpriv, u32 timeout_ms); -void rtw_ack_tx_done23a(struct xmit_priv *pxmitpriv, int status); /* include after declaring struct xmit_buf, in order to avoid warning */ #include <xmit_osdep.h> diff --git a/drivers/staging/rtl8723au/include/usb_ops.h b/drivers/staging/rtl8723au/include/usb_ops.h index ade8bc71572a..ff11e13b24a8 100644 --- a/drivers/staging/rtl8723au/include/usb_ops.h +++ b/drivers/staging/rtl8723au/include/usb_ops.h @@ -63,6 +63,6 @@ static inline void rtw_reset_continual_urb_error(struct dvobj_priv *dvobj) atomic_set(&dvobj->continual_urb_error, 0); } -void rtl8723au_chip_configure(struct rtw_adapter *padapter); +bool rtl8723au_chip_configure(struct rtw_adapter *padapter); #endif /* __USB_OPS_H_ */ diff --git a/drivers/staging/rtl8723au/include/usb_ops_linux.h b/drivers/staging/rtl8723au/include/usb_ops_linux.h index bf68bbb41f9c..af2f14b8b360 100644 --- a/drivers/staging/rtl8723au/include/usb_ops_linux.h +++ b/drivers/staging/rtl8723au/include/usb_ops_linux.h @@ -21,13 +21,13 @@ #define MAX_USBCTRL_VENDORREQ_TIMES 10 -int rtl8723au_read_port(struct rtw_adapter *adapter, u32 addr, u32 cnt, +int rtl8723au_read_port(struct rtw_adapter *adapter, u32 cnt, struct recv_buf *precvbuf); void rtl8723au_read_port_cancel(struct rtw_adapter *padapter); int rtl8723au_write_port(struct rtw_adapter *padapter, u32 addr, u32 cnt, struct xmit_buf *pxmitbuf); void rtl8723au_write_port_cancel(struct rtw_adapter *padapter); -int rtl8723au_read_interrupt(struct rtw_adapter *adapter, u32 addr); +int rtl8723au_read_interrupt(struct rtw_adapter *adapter); u8 rtl8723au_read8(struct rtw_adapter *padapter, u16 addr); u16 rtl8723au_read16(struct rtw_adapter *padapter, u16 addr); diff --git a/drivers/staging/rtl8723au/include/wlan_bssdef.h b/drivers/staging/rtl8723au/include/wlan_bssdef.h index 96e8074a7c18..95b32e15a4d0 100644 --- a/drivers/staging/rtl8723au/include/wlan_bssdef.h +++ b/drivers/staging/rtl8723au/include/wlan_bssdef.h @@ -57,23 +57,6 @@ enum { Ndis802_11Encryption3KeyAbsent, }; -/* Key mapping keys require a BSSID */ -struct ndis_802_11_key { - u32 Length; /* Length of this structure */ - u32 KeyIndex; - u32 KeyLength; /* length of key in bytes */ - unsigned char BSSID[6]; - unsigned long long KeyRSC; - u8 KeyMaterial[32]; /* variable length depending on above field */ -}; - -struct wlan_phy_info { - u8 SignalStrength;/* in percentage) */ - u8 SignalQuality;/* in percentage) */ - u8 Optimum_antenna; /* for Antenna diversity */ - u8 Reserved_0; -}; - struct wlan_bcn_info { /* these infor get from rtw_get_encrypt_info when * * translate scan to UI */ @@ -99,7 +82,8 @@ struct wlan_bssid_ex { u32 DSConfig; /* Frequency, units are kHz */ enum nl80211_iftype ifmode; unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX]; - struct wlan_phy_info PhyInfo; + u8 SignalStrength;/* in percentage */ + u8 SignalQuality;/* in percentage */ u32 IELength; u8 IEs[MAX_IE_SZ]; /* timestamp, beacon interval, and capability info*/ } __packed; @@ -115,7 +99,6 @@ struct wlan_network { /* set to fixed when not to be removed as site-surveying */ int fixed; unsigned long last_scanned; /* timestamp for the network */ - int aid; /* will only be valid when a BSS is joined. */ int join_res; struct wlan_bssid_ex network; /* must be the last item */ struct wlan_bcn_info BcnInfo; diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 3d26955da724..82a8c06ab347 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -275,7 +275,8 @@ static int rtw_cfg80211_inform_bss(struct rtw_adapter *padapter, &pnetwork->network)) { notify_signal = 100 * translate_percentage_to_dbm(padapter->recvpriv.signal_strength); /* dbm */ } else { - notify_signal = 100 * translate_percentage_to_dbm(pnetwork->network.PhyInfo.SignalStrength); /* dbm */ + notify_signal = 100 * translate_percentage_to_dbm( + pnetwork->network.SignalStrength); /* dbm */ } bss = cfg80211_inform_bss(wiphy, notify_channel, @@ -471,7 +472,6 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, int set_tx, const u8 *sta_addr, struct key_params *keyparms) { - int ret = 0; int key_len; struct sta_info *psta = NULL, *pbcmc_sta = NULL; struct rtw_adapter *padapter = netdev_priv(dev); @@ -708,7 +708,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, exit: - return ret; + return 0; } #endif @@ -850,7 +850,6 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, u8 key_index, dot11PrivacyAlgrthm; } } - } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { /* adhoc mode */ } } @@ -2364,7 +2363,6 @@ void rtw_cfg80211_indicate_sta_assoc(struct rtw_adapter *padapter, ie_offset = offsetof(struct ieee80211_mgmt, u.reassoc_req.variable); - sinfo.filled = 0; sinfo.filled = STATION_INFO_ASSOC_REQ_IES; sinfo.assoc_req_ies = pmgmt_frame + ie_offset; sinfo.assoc_req_ies_len = frame_len - ie_offset; @@ -2432,20 +2430,16 @@ void rtw_cfg80211_indicate_sta_disassoc(struct rtw_adapter *padapter, static int rtw_cfg80211_monitor_if_open(struct net_device *ndev) { - int ret = 0; - DBG_8723A("%s\n", __func__); - return ret; + return 0; } static int rtw_cfg80211_monitor_if_close(struct net_device *ndev) { - int ret = 0; - DBG_8723A("%s\n", __func__); - return ret; + return 0; } static int rtw_cfg80211_monitor_if_xmit_entry(struct sk_buff *skb, @@ -2574,11 +2568,9 @@ fail: static int rtw_cfg80211_monitor_if_set_mac_address(struct net_device *ndev, void *addr) { - int ret = 0; - DBG_8723A("%s\n", __func__); - return ret; + return 0; } static const struct net_device_ops rtw_cfg80211_monitor_if_ops = { diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index b34eaec9dd48..9966d16342b3 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c @@ -175,7 +175,6 @@ static int netdev_close(struct net_device *pnetdev); static int loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev) { struct registry_priv *registry_par = &padapter->registrypriv; - int status = _SUCCESS; GlobalDebugLevel23A = rtw_debug; registry_par->chip_version = (u8)rtw_chip_version; @@ -234,7 +233,7 @@ static int loadparam(struct rtw_adapter *padapter, struct net_device *pnetdev) snprintf(registry_par->if2name, 16, "%s", if2name); registry_par->notch_filter = (u8)rtw_notch_filter; registry_par->regulatory_tid = (u8)rtw_regulatory_id; - return status; + return _SUCCESS; } static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p) @@ -384,12 +383,9 @@ static int rtw_init_default_value(struct rtw_adapter *padapter) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - int ret = _SUCCESS; /* xmit_priv */ - pxmitpriv->vcs_setting = pregistrypriv->vrtl_carrier_sense; pxmitpriv->vcs = pregistrypriv->vcs_type; - pxmitpriv->vcs_type = pregistrypriv->vcs_type; /* pxmitpriv->rts_thresh = pregistrypriv->rts_thresh; */ pxmitpriv->frag_len = pregistrypriv->frag_thresh; @@ -425,7 +421,7 @@ static int rtw_init_default_value(struct rtw_adapter *padapter) /* misc. */ padapter->bReadPortCancel = false; padapter->bWritePortCancel = false; - return ret; + return _SUCCESS; } int rtw_reset_drv_sw23a(struct rtw_adapter *padapter) @@ -546,9 +542,6 @@ void rtw_cancel_all_timer23a(struct rtw_adapter *padapter) RT_TRACE(_module_os_intfs_c_, _drv_info_, ("%s:cancel dynamic_chk_timer!\n", __func__)); - RT_TRACE(_module_os_intfs_c_, _drv_info_, - ("%s:cancel DeInitSwLeds!\n", __func__)); - del_timer_sync(&padapter->pwrctrlpriv.pwr_state_check_timer); del_timer_sync(&padapter->mlmepriv.set_scan_deny_timer); @@ -685,8 +678,6 @@ int netdev_open23a(struct net_device *pnetdev) rtw_cfg80211_init_wiphy(padapter); - rtw_led_control(padapter, LED_CTL_NO_LINK); - padapter->bup = true; } padapter->net_closed = false; @@ -768,8 +759,6 @@ int rtw_ips_pwr_up23a(struct rtw_adapter *padapter) result = ips_netdrv_open(padapter); - rtw_led_control(padapter, LED_CTL_NO_LINK); - DBG_8723A("<=== rtw_ips_pwr_up23a.............. in %dms\n", jiffies_to_msecs(jiffies - start_time)); return result; @@ -784,8 +773,6 @@ void rtw_ips_pwr_down23a(struct rtw_adapter *padapter) padapter->bCardDisableWOHSM = true; padapter->net_closed = true; - rtw_led_control(padapter, LED_CTL_POWER_OFF); - rtw_ips_dev_unload23a(padapter); padapter->bCardDisableWOHSM = false; DBG_8723A("<=== rtw_ips_pwr_down23a..................... in %dms\n", @@ -844,8 +831,6 @@ static int netdev_close(struct net_device *pnetdev) rtw_free_assoc_resources23a(padapter, 1); /* s2-4. */ rtw_free_network_queue23a(padapter); - /* Close LED */ - rtw_led_control(padapter, LED_CTL_POWER_OFF); } rtw_scan_abort23a(padapter); diff --git a/drivers/staging/rtl8723au/os_dep/usb_intf.c b/drivers/staging/rtl8723au/os_dep/usb_intf.c index 865743ecd855..373a617ace54 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c @@ -59,21 +59,6 @@ static struct usb_driver rtl8723a_usb_drv = { static struct usb_driver *usb_drv = &rtl8723a_usb_drv; -static inline int RT_usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) -{ - return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd); -} - -static inline int RT_usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) -{ - return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd); -} - -static inline int RT_usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) -{ - return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd); -} - static int rtw_init_intf_priv(struct dvobj_priv *dvobj) { mutex_init(&dvobj->usb_vendor_req_mutex); @@ -143,21 +128,21 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf) le16_to_cpu(pendp_desc->wMaxPacketSize)); DBG_8723A("bInterval =%x\n", pendp_desc->bInterval); - if (RT_usb_endpoint_is_bulk_in(pendp_desc)) { - DBG_8723A("RT_usb_endpoint_is_bulk_in = %x\n", + if (usb_endpoint_is_bulk_in(pendp_desc)) { + DBG_8723A("usb_endpoint_is_bulk_in = %x\n", usb_endpoint_num(pendp_desc)); pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = usb_endpoint_num(pendp_desc); pdvobjpriv->RtNumInPipes++; - } else if (RT_usb_endpoint_is_int_in(pendp_desc)) { - DBG_8723A("RT_usb_endpoint_is_int_in = %x, Interval = %x\n", + } else if (usb_endpoint_is_int_in(pendp_desc)) { + DBG_8723A("usb_endpoint_is_int_in = %x, Interval = %x\n", usb_endpoint_num(pendp_desc), pendp_desc->bInterval); pdvobjpriv->RtInPipe[pdvobjpriv->RtNumInPipes] = usb_endpoint_num(pendp_desc); pdvobjpriv->RtNumInPipes++; - } else if (RT_usb_endpoint_is_bulk_out(pendp_desc)) { - DBG_8723A("RT_usb_endpoint_is_bulk_out = %x\n", + } else if (usb_endpoint_is_bulk_out(pendp_desc)) { + DBG_8723A("usb_endpoint_is_bulk_out = %x\n", usb_endpoint_num(pendp_desc)); pdvobjpriv->RtOutPipe[pdvobjpriv->RtNumOutPipes] = usb_endpoint_num(pendp_desc); @@ -257,6 +242,7 @@ void rtl8723a_usb_intf_stop(struct rtw_adapter *padapter) static void rtw_dev_unload(struct rtw_adapter *padapter) { + struct submit_ctx *pack_tx_ops = &padapter->xmitpriv.ack_tx_ops; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_dev_unload\n")); if (padapter->bup) { @@ -264,8 +250,8 @@ static void rtw_dev_unload(struct rtw_adapter *padapter) padapter->bDriverStopped = true; if (padapter->xmitpriv.ack_tx) - rtw_ack_tx_done23a(&padapter->xmitpriv, - RTW_SCTX_DONE_DRV_STOP); + rtw23a_sctx_done_err(&pack_tx_ops, + RTW_SCTX_DONE_DRV_STOP); /* s3. */ rtl8723a_usb_intf_stop(padapter); @@ -322,8 +308,6 @@ int rtw_hw_suspend23a(struct rtw_adapter *padapter) if (check_fwstate(pmlmepriv, _FW_LINKED)) { _clr_fwstate_(pmlmepriv, _FW_LINKED); - rtw_led_control(padapter, LED_CTL_NO_LINK); - rtw_os_indicate_disconnect23a(padapter); /* donnot enqueue cmd */ @@ -546,7 +530,8 @@ static struct rtw_adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj, rtl8723a_read_chip_version(padapter); /* step usb endpoint mapping */ - rtl8723au_chip_configure(padapter); + if (!rtl8723au_chip_configure(padapter)) + goto free_hal_data; /* step read efuse/eeprom data and get mac_addr */ rtl8723a_read_adapter_info(padapter); diff --git a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c index a3349ac57bae..3e19b3b2c1c2 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c +++ b/drivers/staging/rtl8723au/os_dep/usb_ops_linux.c @@ -18,13 +18,6 @@ #include <usb_ops_linux.h> #include <rtw_sreset.h> -struct zero_bulkout_context { - void *pbuf; - void *purb; - void *pirp; - void *padapter; -}; - void rtl8723au_read_port_cancel(struct rtw_adapter *padapter) { struct recv_buf *precvbuf; @@ -53,18 +46,6 @@ static void usb_write_port23a_complete(struct urb *purb) unsigned long irqL; switch (pxmitbuf->flags) { - case VO_QUEUE_INX: - pxmitpriv->voq_cnt--; - break; - case VI_QUEUE_INX: - pxmitpriv->viq_cnt--; - break; - case BE_QUEUE_INX: - pxmitpriv->beq_cnt--; - break; - case BK_QUEUE_INX: - pxmitpriv->bkq_cnt--; - break; case HIGH_QUEUE_INX: #ifdef CONFIG_8723AU_AP_MODE rtw_chk_hi_queue_cmd23a(padapter); @@ -166,19 +147,15 @@ int rtl8723au_write_port(struct rtw_adapter *padapter, u32 addr, u32 cnt, switch (addr) { case VO_QUEUE_INX: - pxmitpriv->voq_cnt++; pxmitbuf->flags = VO_QUEUE_INX; break; case VI_QUEUE_INX: - pxmitpriv->viq_cnt++; pxmitbuf->flags = VI_QUEUE_INX; break; case BE_QUEUE_INX: - pxmitpriv->beq_cnt++; pxmitbuf->flags = BE_QUEUE_INX; break; case BK_QUEUE_INX: - pxmitpriv->bkq_cnt++; pxmitbuf->flags = BK_QUEUE_INX; break; case HIGH_QUEUE_INX: |