1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#include <osdep_service.h>
22#include <drv_types.h>
23#include <rtl8188e_hal.h>
24#include <rtl8188e_led.h>
25#include <usb_ops_linux.h>
26
27
28
29
30
31
32void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
33{
34 u8 LedCfg;
35
36 if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
37 return;
38 LedCfg = usb_read8(padapter, REG_LEDCFG2);
39 usb_write8(padapter, REG_LEDCFG2, (LedCfg&0xf0) | BIT(5) | BIT(6));
40 pLed->bLedOn = true;
41}
42
43
44
45void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
46{
47 u8 LedCfg;
48 struct hal_data_8188e *pHalData = GET_HAL_DATA(padapter);
49
50 if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
51 goto exit;
52
53 LedCfg = usb_read8(padapter, REG_LEDCFG2);
54
55 if (pHalData->bLedOpenDrain) {
56
57 LedCfg &= 0x90;
58 usb_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
59 LedCfg = usb_read8(padapter, REG_MAC_PINMUX_CFG);
60 LedCfg &= 0xFE;
61 usb_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
62 } else {
63 usb_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3) | BIT(5) | BIT(6)));
64 }
65exit:
66 pLed->bLedOn = false;
67}
68
69
70
71
72
73
74void rtl8188eu_InitSwLeds(struct adapter *padapter)
75{
76 struct led_priv *pledpriv = &(padapter->ledpriv);
77 struct hal_data_8188e *haldata = GET_HAL_DATA(padapter);
78
79 pledpriv->bRegUseLed = true;
80 pledpriv->LedControlHandler = LedControl8188eu;
81 haldata->bLedOpenDrain = true;
82
83 InitLed871x(padapter, &(pledpriv->SwLed0));
84}
85
86
87
88void rtl8188eu_DeInitSwLeds(struct adapter *padapter)
89{
90 struct led_priv *ledpriv = &(padapter->ledpriv);
91
92 DeInitLed871x(&(ledpriv->SwLed0));
93}
94