Commit | Line | Data |
---|---|---|
2865d42c LF |
1 | #ifndef __RTL8712_LED_H |
2 | #define __RTL8712_LED_H | |
3 | ||
4 | #include "osdep_service.h" | |
5 | #include "drv_types.h" | |
6 | ||
7 | /*=========================================================================== | |
8 | * LED customization. | |
9 | *=========================================================================== | |
10 | */ | |
11 | enum LED_CTL_MODE { | |
12 | LED_CTL_POWER_ON = 1, | |
13 | LED_CTL_LINK = 2, | |
14 | LED_CTL_NO_LINK = 3, | |
15 | LED_CTL_TX = 4, | |
16 | LED_CTL_RX = 5, | |
17 | LED_CTL_SITE_SURVEY = 6, | |
18 | LED_CTL_POWER_OFF = 7, | |
19 | LED_CTL_START_TO_LINK = 8, | |
20 | LED_CTL_START_WPS = 9, | |
21 | LED_CTL_STOP_WPS = 10, | |
22 | LED_CTL_START_WPS_BOTTON = 11, | |
23 | LED_CTL_STOP_WPS_FAIL = 12, | |
24 | LED_CTL_STOP_WPS_FAIL_OVERLAP = 13, | |
25 | }; | |
26 | ||
27 | #define IS_LED_WPS_BLINKING(_LED_871x) \ | |
28 | (((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS \ | |
29 | || ((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP \ | |
30 | || ((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress) | |
31 | ||
32 | #define IS_LED_BLINKING(_LED_871x) \ | |
33 | (((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress \ | |
34 | || ((struct LED_871x *)_LED_871x)->bLedScanBlinkInProgress) | |
35 | ||
36 | enum LED_PIN_871x { | |
37 | LED_PIN_GPIO0, | |
38 | LED_PIN_LED0, | |
39 | LED_PIN_LED1 | |
40 | }; | |
41 | ||
42 | /*=========================================================================== | |
43 | * LED customization. | |
44 | *=========================================================================== | |
45 | */ | |
46 | enum LED_STRATEGY_871x { | |
47 | SW_LED_MODE0, /* SW control 1 LED via GPIO0. It is default option. */ | |
48 | SW_LED_MODE1, /* 2 LEDs, through LED0 and LED1. For ALPHA. */ | |
49 | SW_LED_MODE2, /* SW control 1 LED via GPIO0, | |
50 | * custom for AzWave 8187 minicard. */ | |
51 | SW_LED_MODE3, /* SW control 1 LED via GPIO0, | |
52 | * customized for Sercomm Printer Server case.*/ | |
53 | SW_LED_MODE4, /*for Edimax / Belkin*/ | |
54 | SW_LED_MODE5, /*for Sercomm / Belkin*/ | |
55 | SW_LED_MODE6, /*for WNC / Corega*/ | |
56 | HW_LED, /* HW control 2 LEDs, LED0 and LED1 (there are 4 different | |
57 | * control modes, see MAC.CONFIG1 for details.)*/ | |
58 | }; | |
59 | ||
60 | struct LED_871x { | |
61 | struct _adapter *padapter; | |
62 | enum LED_PIN_871x LedPin; /* Implementation for this SW led. */ | |
63 | u32 CurrLedState; /* Current LED state. */ | |
64 | u8 bLedOn; /* true if LED is ON */ | |
65 | u8 bSWLedCtrl; | |
66 | u8 bLedBlinkInProgress; /*true if blinking */ | |
67 | u8 bLedNoLinkBlinkInProgress; | |
68 | u8 bLedLinkBlinkInProgress; | |
69 | u8 bLedStartToLinkBlinkInProgress; | |
70 | u8 bLedScanBlinkInProgress; | |
71 | u8 bLedWPSBlinkInProgress; | |
72 | u32 BlinkTimes; /* No. times to toggle for blink.*/ | |
73 | u32 BlinkingLedState; /* Next state for blinking, | |
74 | * either LED_ON or OFF.*/ | |
75 | ||
76 | struct timer_list BlinkTimer; /* Timer object for led blinking.*/ | |
77 | _workitem BlinkWorkItem; /* Workitem used by BlinkTimer */ | |
78 | }; | |
79 | ||
80 | struct led_priv { | |
25985edc | 81 | /* add for led control */ |
2865d42c LF |
82 | struct LED_871x SwLed0; |
83 | struct LED_871x SwLed1; | |
84 | enum LED_STRATEGY_871x LedStrategy; | |
85 | u8 bRegUseLed; | |
86 | void (*LedControlHandler)(struct _adapter *padapter, | |
87 | enum LED_CTL_MODE LedAction); | |
25985edc | 88 | /* add for led control */ |
2865d42c LF |
89 | }; |
90 | ||
91 | /*=========================================================================== | |
92 | * Interface to manipulate LED objects. | |
93 | *===========================================================================*/ | |
94 | void r8712_InitSwLeds(struct _adapter *padapter); | |
95 | void r8712_DeInitSwLeds(struct _adapter *padapter); | |
96 | void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction); | |
97 | ||
98 | #endif | |
99 |