• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /******************************************************************************
3  *
4  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #ifndef __RTW_LED_H_
8 #define __RTW_LED_H_
9 
10 #include <osdep_service.h>
11 #include <drv_types.h>
12 
13 #define LED_BLINK_NO_LINK_INTERVAL_ALPHA	1000
14 #define LED_BLINK_LINK_INTERVAL_ALPHA		500	/* 500 */
15 #define LED_BLINK_SCAN_INTERVAL_ALPHA		180	/* 150 */
16 #define LED_BLINK_FASTER_INTERVAL_ALPHA		50
17 #define LED_BLINK_WPS_SUCCESS_INTERVAL_ALPHA	5000
18 
19 enum LED_CTL_MODE {
20 	LED_CTL_POWER_ON,
21 	LED_CTL_LINK,
22 	LED_CTL_NO_LINK,
23 	LED_CTL_TX,
24 	LED_CTL_RX,
25 	LED_CTL_SITE_SURVEY,
26 	LED_CTL_POWER_OFF,
27 	LED_CTL_START_TO_LINK,
28 	LED_CTL_START_WPS,
29 	LED_CTL_STOP_WPS,
30 	LED_CTL_START_WPS_BOTTON,
31 	LED_CTL_STOP_WPS_FAIL
32 };
33 
34 enum LED_STATE_871x {
35 	LED_UNKNOWN,
36 	RTW_LED_ON,
37 	RTW_LED_OFF,
38 	LED_BLINK_NORMAL,
39 	LED_BLINK_SLOWLY,
40 	LED_BLINK_POWER_ON,
41 	LED_BLINK_SCAN,
42 	LED_BLINK_TXRX,
43 	LED_BLINK_WPS,
44 	LED_BLINK_WPS_STOP
45 };
46 
47 struct LED_871x {
48 	struct adapter *padapter;
49 
50 	enum LED_STATE_871x	CurrLedState; /*  Current LED state. */
51 	enum LED_STATE_871x	BlinkingLedState; /*  Next state for blinking,
52 						   * either RTW_LED_ON or RTW_LED_OFF are.
53 						   */
54 
55 	u8 bLedOn; /*  true if LED is ON, false if LED is OFF. */
56 
57 	u8 bLedBlinkInProgress; /*  true if it is blinking, false o.w.. */
58 
59 	u8 bLedWPSBlinkInProgress;
60 
61 	u32 BlinkTimes; /*  Number of times to toggle led state for blinking. */
62 
63 	struct timer_list BlinkTimer; /*  Timer object for led blinking. */
64 
65 	/*  ALPHA, added by chiyoko, 20090106 */
66 	u8 bLedNoLinkBlinkInProgress;
67 	u8 bLedLinkBlinkInProgress;
68 	u8 bLedScanBlinkInProgress;
69 	struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer to
70 					   * manipulate H/W to blink LED.
71 					   */
72 };
73 
74 #define IS_LED_WPS_BLINKING(_LED_871x)					\
75 	(((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS || \
76 	((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP || \
77 	((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress)
78 
79 void led_control_8188eu(struct adapter *padapter, enum LED_CTL_MODE LedAction);
80 
81 struct led_priv {
82 	struct LED_871x sw_led;
83 };
84 
85 void BlinkWorkItemCallback(struct work_struct *work);
86 
87 void ResetLedStatus(struct LED_871x *pLed);
88 
89 void InitLed871x(struct adapter *padapter, struct LED_871x *pLed);
90 
91 void DeInitLed871x(struct LED_871x *pLed);
92 
93 /* hal... */
94 void blink_handler(struct LED_871x *pLed);
95 void sw_led_on(struct adapter *padapter, struct LED_871x *pLed);
96 void sw_led_off(struct adapter *padapter, struct LED_871x *pLed);
97 
98 #endif /* __RTW_LED_H_ */
99