From: Jes Sorensen Date: Mon, 10 Nov 2014 23:11:46 +0000 (-0500) Subject: staging: rtl8723au: Remove sw led handling X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b518cb97b84f56108bc42d69dce8fc3478880829;p=linux-beck.git staging: rtl8723au: Remove sw led handling The rtl8723au relies on hw led support, so no point carrying a large unused sw led infrastructure around. Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/Makefile b/drivers/staging/rtl8723au/Makefile index a9aae2163639..b184108680eb 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 \ @@ -34,7 +33,6 @@ r8723au-y := \ 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_cmd.c b/drivers/staging/rtl8723au/core/rtw_cmd.c index 44eae8e6bd9d..77d43a5960a1 100644 --- a/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -391,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); @@ -417,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", @@ -467,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")); diff --git a/drivers/staging/rtl8723au/core/rtw_led.c b/drivers/staging/rtl8723au/core/rtw_led.c deleted file mode 100644 index 92ab1f8ded96..000000000000 --- a/drivers/staging/rtl8723au/core/rtw_led.c +++ /dev/null @@ -1,1865 +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 -#include - -/* */ -/* 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 85d1eca5af8b..95bed7a98003 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme.c @@ -815,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); @@ -861,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); diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c index 9d6539325839..8dd35133be94 100644 --- a/drivers/staging/rtl8723au/core/rtw_recv.c +++ b/drivers/staging/rtl8723au/core/rtw_recv.c @@ -1495,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) { @@ -2206,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_, diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c b/drivers/staging/rtl8723au/core/rtw_xmit.c index 1f4ebb36f653..c79d5b900594 100644 --- a/drivers/staging/rtl8723au/core/rtw_xmit.c +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c @@ -1901,8 +1901,6 @@ 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); #ifdef CONFIG_8723AU_AP_MODE 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/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c index 1c7ce85e7838..ead676f8b684 100644 --- a/drivers/staging/rtl8723au/hal/usb_halinit.c +++ b/drivers/staging/rtl8723au/hal/usb_halinit.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -444,14 +443,6 @@ static void _InitEDCA(struct rtw_adapter *Adapter) 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) @@ -1209,14 +1200,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 +1246,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, 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 #include #include -#include #include #include @@ -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/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 -#include - - -/* */ -/* 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/rtw_cmd.h b/drivers/staging/rtl8723au/include/rtw_cmd.h index 8ffe5def3d4d..71044107d13b 100644 --- a/drivers/staging/rtl8723au/include/rtw_cmd.h +++ b/drivers/staging/rtl8723au/include/rtw_cmd.h @@ -17,7 +17,6 @@ #include #include -#include #define C2H_MEM_SZ (16*1024) 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 -#include - -#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/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c index d00100356630..9966d16342b3 100644 --- a/drivers/staging/rtl8723au/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c @@ -542,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); @@ -681,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; @@ -764,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; @@ -780,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", @@ -840,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 08424d478039..926129e5f0ae 100644 --- a/drivers/staging/rtl8723au/os_dep/usb_intf.c +++ b/drivers/staging/rtl8723au/os_dep/usb_intf.c @@ -307,8 +307,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 */