1 /******************************************************************************
3 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * Modifications for inclusion into the Linux staging tree are
19 * Copyright(c) 2010 Larry Finger. All rights reserved.
21 * Contact information:
22 * WLAN FAE <wlanfae@realtek.com>
23 * Larry Finger <Larry.Finger@lwfinger.net>
25 ******************************************************************************/
26 #ifndef __RTL8712_LED_H
27 #define __RTL8712_LED_H
29 #include "osdep_service.h"
30 #include "drv_types.h"
32 /*===========================================================================
34 *===========================================================================
42 LED_CTL_SITE_SURVEY = 6,
43 LED_CTL_POWER_OFF = 7,
44 LED_CTL_START_TO_LINK = 8,
45 LED_CTL_START_WPS = 9,
46 LED_CTL_STOP_WPS = 10,
47 LED_CTL_START_WPS_BOTTON = 11,
48 LED_CTL_STOP_WPS_FAIL = 12,
49 LED_CTL_STOP_WPS_FAIL_OVERLAP = 13,
52 #define IS_LED_WPS_BLINKING(_LED_871x) \
53 (((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS \
54 || ((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP \
55 || ((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress)
57 #define IS_LED_BLINKING(_LED_871x) \
58 (((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress \
59 || ((struct LED_871x *)_LED_871x)->bLedScanBlinkInProgress)
67 /*===========================================================================
69 *===========================================================================
71 enum LED_STRATEGY_871x {
72 SW_LED_MODE0, /* SW control 1 LED via GPIO0. It is default option. */
73 SW_LED_MODE1, /* 2 LEDs, through LED0 and LED1. For ALPHA. */
74 SW_LED_MODE2, /* SW control 1 LED via GPIO0,
75 * custom for AzWave 8187 minicard.
77 SW_LED_MODE3, /* SW control 1 LED via GPIO0,
78 * customized for Sercomm Printer Server case.
80 SW_LED_MODE4, /*for Edimax / Belkin*/
81 SW_LED_MODE5, /*for Sercomm / Belkin*/
82 SW_LED_MODE6, /*for WNC / Corega*/
83 HW_LED, /* HW control 2 LEDs, LED0 and LED1 (there are 4 different
84 * control modes, see MAC.CONFIG1 for details.)
89 struct _adapter *padapter;
90 enum LED_PIN_871x LedPin; /* Implementation for this SW led. */
91 u32 CurrLedState; /* Current LED state. */
92 u8 bLedOn; /* true if LED is ON */
94 u8 bLedBlinkInProgress; /*true if blinking */
95 u8 bLedNoLinkBlinkInProgress;
96 u8 bLedLinkBlinkInProgress;
97 u8 bLedStartToLinkBlinkInProgress;
98 u8 bLedScanBlinkInProgress;
99 u8 bLedWPSBlinkInProgress;
100 u32 BlinkTimes; /* No. times to toggle for blink.*/
101 u32 BlinkingLedState; /* Next state for blinking,
102 * either LED_ON or OFF.
105 struct timer_list BlinkTimer; /* Timer object for led blinking.*/
106 struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer */
110 /* add for led control */
111 struct LED_871x SwLed0;
112 struct LED_871x SwLed1;
113 enum LED_STRATEGY_871x LedStrategy;
115 void (*LedControlHandler)(struct _adapter *padapter,
116 enum LED_CTL_MODE LedAction);
117 /* add for led control */
120 /*===========================================================================
121 * Interface to manipulate LED objects.
122 *===========================================================================
124 void r8712_InitSwLeds(struct _adapter *padapter);
125 void r8712_DeInitSwLeds(struct _adapter *padapter);
126 void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction);