1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
6 * Modifications for inclusion into the Linux staging tree are
7 * Copyright(c) 2010 Larry Finger. All rights reserved.
10 * WLAN FAE <wlanfae@realtek.com>
11 * Larry Finger <Larry.Finger@lwfinger.net>
13 ******************************************************************************/
14 #ifndef __RTL8712_LED_H
15 #define __RTL8712_LED_H
17 #include "osdep_service.h"
18 #include "drv_types.h"
20 /*===========================================================================
22 *===========================================================================
30 LED_CTL_SITE_SURVEY = 6,
31 LED_CTL_POWER_OFF = 7,
32 LED_CTL_START_TO_LINK = 8,
33 LED_CTL_START_WPS = 9,
34 LED_CTL_STOP_WPS = 10,
35 LED_CTL_START_WPS_BOTTON = 11,
36 LED_CTL_STOP_WPS_FAIL = 12,
37 LED_CTL_STOP_WPS_FAIL_OVERLAP = 13,
40 #define IS_LED_WPS_BLINKING(_LED_871x) \
41 (((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS \
42 || ((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP \
43 || ((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress)
45 #define IS_LED_BLINKING(_LED_871x) \
46 (((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress \
47 || ((struct LED_871x *)_LED_871x)->bLedScanBlinkInProgress)
55 /*===========================================================================
57 *===========================================================================
59 enum LED_STRATEGY_871x {
60 SW_LED_MODE0, /* SW control 1 LED via GPIO0. It is default option. */
61 SW_LED_MODE1, /* 2 LEDs, through LED0 and LED1. For ALPHA. */
62 SW_LED_MODE2, /* SW control 1 LED via GPIO0,
63 * custom for AzWave 8187 minicard.
65 SW_LED_MODE3, /* SW control 1 LED via GPIO0,
66 * customized for Sercomm Printer Server case.
68 SW_LED_MODE4, /*for Edimax / Belkin*/
69 SW_LED_MODE5, /*for Sercomm / Belkin*/
70 SW_LED_MODE6, /*for WNC / Corega*/
71 HW_LED, /* HW control 2 LEDs, LED0 and LED1 (there are 4 different
72 * control modes, see MAC.CONFIG1 for details.)
77 struct _adapter *padapter;
78 enum LED_PIN_871x LedPin; /* Implementation for this SW led. */
79 u32 CurrLedState; /* Current LED state. */
80 u8 bLedOn; /* true if LED is ON */
82 u8 bLedBlinkInProgress; /*true if blinking */
83 u8 bLedNoLinkBlinkInProgress;
84 u8 bLedLinkBlinkInProgress;
85 u8 bLedStartToLinkBlinkInProgress;
86 u8 bLedScanBlinkInProgress;
87 u8 bLedWPSBlinkInProgress;
88 u32 BlinkTimes; /* No. times to toggle for blink.*/
89 u32 BlinkingLedState; /* Next state for blinking,
90 * either LED_ON or OFF.
93 struct timer_list BlinkTimer; /* Timer object for led blinking.*/
94 struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer */
98 /* add for led control */
99 struct LED_871x SwLed0;
100 struct LED_871x SwLed1;
101 enum LED_STRATEGY_871x LedStrategy;
103 void (*LedControlHandler)(struct _adapter *padapter,
104 enum LED_CTL_MODE LedAction);
105 /* add for led control */
108 /*===========================================================================
109 * Interface to manipulate LED objects.
110 *===========================================================================
112 void r8712_InitSwLeds(struct _adapter *padapter);
113 void r8712_DeInitSwLeds(struct _adapter *padapter);
114 void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction);
115 void r8712_flush_led_works(struct _adapter *padapter);