2013-05-19 04:28:07 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#include <drv_types.h>
|
2013-05-29 19:26:48 +00:00
|
|
|
#include "rtw_led.h"
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
/* Description: */
|
|
|
|
/* Callback function of LED BlinkTimer, */
|
|
|
|
/* it just schedules to corresponding BlinkWorkItem/led_blink_hdl */
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-05-19 04:28:07 +00:00
|
|
|
void BlinkTimerCallback(void *data)
|
|
|
|
{
|
2014-11-28 17:08:37 +00:00
|
|
|
struct LED_871x *pLed = (struct LED_871x *)data;
|
2013-07-29 20:06:54 +00:00
|
|
|
struct adapter *padapter = pLed->padapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped))
|
2013-05-19 04:28:07 +00:00
|
|
|
return;
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
schedule_work(&(pLed->BlinkWorkItem));
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
/* Description: */
|
|
|
|
/* Callback function of LED BlinkWorkItem. */
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-05-19 04:28:07 +00:00
|
|
|
void BlinkWorkItemCallback(struct work_struct *work)
|
|
|
|
{
|
2013-07-29 20:06:54 +00:00
|
|
|
struct LED_871x *pLed = container_of(work, struct LED_871x, BlinkWorkItem);
|
2013-05-19 04:28:07 +00:00
|
|
|
BlinkHandler(pLed);
|
|
|
|
}
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
/* Description: */
|
|
|
|
/* Reset status of LED_871x object. */
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
void ResetLedStatus(struct LED_871x *pLed)
|
|
|
|
{
|
2013-07-09 22:38:46 +00:00
|
|
|
pLed->CurrLedState = RTW_LED_OFF; /* Current LED state. */
|
|
|
|
pLed->bLedOn = false; /* true if LED is ON, false if LED is OFF. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
pLed->bLedBlinkInProgress = false; /* true if it is blinking, false o.w.. */
|
2013-05-26 03:02:10 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
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. */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-05-26 03:02:10 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
pLed->bLedStartToLinkBlinkInProgress = false;
|
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
/*Description: */
|
|
|
|
/* Initialize an LED_871x object. */
|
2014-11-16 00:18:30 +00:00
|
|
|
void InitLed871x(struct adapter *padapter, struct LED_871x *pLed)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
|
|
|
pLed->padapter = padapter;
|
|
|
|
|
|
|
|
ResetLedStatus(pLed);
|
|
|
|
|
|
|
|
_init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed);
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
INIT_WORK(&(pLed->BlinkWorkItem), BlinkWorkItemCallback);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
/* Description: */
|
|
|
|
/* DeInitialize an LED_871x object. */
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
void DeInitLed871x(struct LED_871x *pLed)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2014-11-16 00:18:30 +00:00
|
|
|
cancel_work_sync(&(pLed->BlinkWorkItem));
|
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-05-19 04:28:07 +00:00
|
|
|
ResetLedStatus(pLed);
|
|
|
|
}
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
/* Description: */
|
|
|
|
/* Implementation of LED blinking behavior. */
|
|
|
|
/* It toggle off LED and schedule corresponding timer if necessary. */
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
static void SwLedBlink1(struct LED_871x *pLed)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-29 20:06:54 +00:00
|
|
|
struct adapter *padapter = pLed->padapter;
|
|
|
|
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
|
|
|
u8 bStopBlinking = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* Change LED according to BlinkingLedState specified. */
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->BlinkingLedState == RTW_LED_ON) {
|
2013-05-19 04:28:07 +00:00
|
|
|
SwLedOn(padapter, pLed);
|
2013-07-29 20:06:54 +00:00
|
|
|
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
|
|
|
|
} else {
|
2013-05-19 04:28:07 +00:00
|
|
|
SwLedOff(padapter, pLed);
|
2013-07-29 20:06:54 +00:00
|
|
|
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) {
|
2013-05-19 04:28:07 +00:00
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
ResetLedStatus(pLed);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
switch (pLed->CurrLedState) {
|
|
|
|
case LED_BLINK_SLOWLY:
|
|
|
|
if (pLed->bLedOn)
|
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), 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;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), 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)
|
2013-05-19 04:28:07 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2013-07-29 20:06:54 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
|
|
|
|
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
|
|
|
|
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2013-05-19 04:28:07 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2013-07-29 20:06:54 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
|
|
|
|
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
2013-05-19 04:28:07 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
|
2013-07-29 20:06:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_BLINK_TXRX:
|
|
|
|
pLed->BlinkTimes--;
|
|
|
|
if (pLed->BlinkTimes == 0)
|
|
|
|
bStopBlinking = true;
|
|
|
|
if (bStopBlinking) {
|
|
|
|
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
|
2013-05-26 03:02:10 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = true;
|
2013-05-19 04:28:07 +00:00
|
|
|
pLed->CurrLedState = LED_BLINK_NORMAL;
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedOn)
|
2013-05-19 04:28:07 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
|
2013-07-29 20:06:54 +00:00
|
|
|
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
|
|
|
|
} else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
|
|
|
|
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->BlinkTimes = 0;
|
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
if (pLed->bLedOn)
|
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
2013-05-19 04:28:07 +00:00
|
|
|
else
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS:
|
|
|
|
if (pLed->bLedOn)
|
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
|
|
|
|
break;
|
|
|
|
case LED_BLINK_WPS_STOP: /* WPS success */
|
|
|
|
if (pLed->BlinkingLedState == RTW_LED_ON)
|
|
|
|
bStopBlinking = false;
|
|
|
|
else
|
2014-11-16 00:18:30 +00:00
|
|
|
bStopBlinking = true;
|
|
|
|
|
|
|
|
if (bStopBlinking) {
|
|
|
|
pLed->bLedLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_NORMAL;
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedOn)
|
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2014-11-16 00:18:30 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
|
|
|
|
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
|
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
} else {
|
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
/* ALPHA, added by chiyoko, 20090106 */
|
|
|
|
static void SwLedControlMode1(struct adapter *padapter, enum LED_CTL_MODE LedAction)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-29 20:06:54 +00:00
|
|
|
struct led_priv *ledpriv = &(padapter->ledpriv);
|
2013-07-22 22:07:13 +00:00
|
|
|
struct LED_871x *pLed = &(ledpriv->SwLed0);
|
2014-11-16 00:18:30 +00:00
|
|
|
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
switch (LedAction) {
|
2014-11-16 00:18:30 +00:00
|
|
|
case LED_CTL_POWER_ON:
|
2013-07-29 20:06:54 +00:00
|
|
|
case LED_CTL_START_TO_LINK:
|
2014-11-16 00:18:30 +00:00
|
|
|
case LED_CTL_NO_LINK:
|
|
|
|
if (!pLed->bLedNoLinkBlinkInProgress) {
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2014-11-16 00:18:30 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SLOWLY;
|
|
|
|
if (pLed->bLedOn)
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
2014-11-16 00:18:30 +00:00
|
|
|
else
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2014-11-16 00:18:30 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
|
2013-07-29 20:06:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_LINK:
|
2014-11-16 00:18:30 +00:00
|
|
|
if (!pLed->bLedLinkBlinkInProgress) {
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
2014-11-16 00:18:30 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-11-16 00:18:30 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_NORMAL;
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedOn)
|
2013-05-19 04:28:07 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2014-11-16 00:18:30 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
|
2013-07-29 20:06:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_SITE_SURVEY:
|
|
|
|
if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED))) {
|
2014-11-16 00:18:30 +00:00
|
|
|
;
|
2013-07-29 20:06:54 +00:00
|
|
|
} else if (!pLed->bLedScanBlinkInProgress) {
|
|
|
|
if (IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-11-16 00:18:30 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
pLed->bLedScanBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_SCAN;
|
|
|
|
pLed->BlinkTimes = 24;
|
|
|
|
if (pLed->bLedOn)
|
2013-05-19 04:28:07 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2013-07-29 20:06:54 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
|
2014-11-16 00:18:30 +00:00
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
break;
|
|
|
|
case LED_CTL_TX:
|
|
|
|
case LED_CTL_RX:
|
|
|
|
if (!pLed->bLedBlinkInProgress) {
|
|
|
|
if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
|
|
|
|
return;
|
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-11-16 00:18:30 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_TXRX;
|
|
|
|
pLed->BlinkTimes = 2;
|
|
|
|
if (pLed->bLedOn)
|
2013-05-19 04:28:07 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
else
|
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2013-07-29 20:06:54 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case LED_CTL_START_WPS: /* wait until xinpin finish */
|
|
|
|
case LED_CTL_START_WPS_BOTTON:
|
2014-11-16 00:18:30 +00:00
|
|
|
if (!pLed->bLedWPSBlinkInProgress) {
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-05-26 03:02:10 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2014-11-16 00:18:30 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-05-26 03:02:10 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-05-26 03:02:10 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_WPS;
|
2014-11-16 00:18:30 +00:00
|
|
|
if (pLed->bLedOn)
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
2014-11-16 00:18:30 +00:00
|
|
|
else
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2014-11-16 00:18:30 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
|
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
break;
|
2014-11-16 00:18:30 +00:00
|
|
|
case LED_CTL_STOP_WPS:
|
|
|
|
if (pLed->bLedNoLinkBlinkInProgress) {
|
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
2013-07-29 20:06:54 +00:00
|
|
|
}
|
2014-11-16 00:18:30 +00:00
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
2013-07-29 20:06:54 +00:00
|
|
|
}
|
2014-11-16 00:18:30 +00:00
|
|
|
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));
|
2013-07-29 20:06:54 +00:00
|
|
|
else
|
2014-11-16 00:18:30 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = true;
|
|
|
|
pLed->CurrLedState = LED_BLINK_WPS_STOP;
|
|
|
|
if (pLed->bLedOn) {
|
|
|
|
pLed->BlinkingLedState = RTW_LED_OFF;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
|
|
|
|
} else {
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->BlinkingLedState = RTW_LED_ON;
|
2014-11-16 00:18:30 +00:00
|
|
|
_set_timer(&(pLed->BlinkTimer), 0);
|
|
|
|
}
|
2013-07-29 20:06:54 +00:00
|
|
|
break;
|
2014-11-16 00:18:30 +00:00
|
|
|
case LED_CTL_STOP_WPS_FAIL:
|
2013-07-29 20:06:54 +00:00
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
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;
|
|
|
|
_set_timer(&(pLed->BlinkTimer), 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) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedNoLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedLinkBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedLinkBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedWPSBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedWPSBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
if (pLed->bLedScanBlinkInProgress) {
|
2014-11-16 00:18:30 +00:00
|
|
|
del_timer_sync(&(pLed->BlinkTimer));
|
2013-07-29 20:06:54 +00:00
|
|
|
pLed->bLedScanBlinkInProgress = false;
|
|
|
|
}
|
|
|
|
SwLedOff(padapter, pLed);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("Led %d\n", pLed->CurrLedState));
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
/* Description: */
|
|
|
|
/* Handler function of LED Blinking. */
|
2013-07-09 22:38:46 +00:00
|
|
|
/* */
|
2013-07-29 20:06:54 +00:00
|
|
|
void BlinkHandler(struct LED_871x *pLed)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-29 20:06:54 +00:00
|
|
|
struct adapter *padapter = pLed->padapter;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped))
|
2013-05-19 04:28:07 +00:00
|
|
|
return;
|
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
SwLedBlink1(pLed);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|
|
|
|
|
2013-10-19 17:45:47 +00:00
|
|
|
void LedControl8188eu(struct adapter *padapter, enum LED_CTL_MODE LedAction)
|
2013-05-19 04:28:07 +00:00
|
|
|
{
|
2013-07-29 20:06:54 +00:00
|
|
|
struct led_priv *ledpriv = &(padapter->ledpriv);
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped) ||
|
|
|
|
(!padapter->hw_init_completed))
|
2013-05-19 04:28:07 +00:00
|
|
|
return;
|
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
if (!ledpriv->bRegUseLed)
|
2013-05-19 04:28:07 +00:00
|
|
|
return;
|
|
|
|
|
2013-07-29 20:06:54 +00:00
|
|
|
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;
|
2013-05-19 04:28:07 +00:00
|
|
|
|
2014-11-16 00:18:30 +00:00
|
|
|
SwLedControlMode1(padapter, LedAction);
|
2013-05-19 04:28:07 +00:00
|
|
|
}
|