Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nu11secur1ty
GitHub Repository: nu11secur1ty/Kali-Linux
Path: blob/master/ALFA-W1F1/RTL8814AU/hal/rtl8814a/usb/rtl8814au_led.c
1308 views
1
/******************************************************************************
2
*
3
* Copyright(c) 2007 - 2017 Realtek Corporation.
4
*
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.
8
*
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
12
* more details.
13
*
14
*****************************************************************************/
15
#define _RTL8814AU_LED_C_
16
17
/* #include <drv_types.h> */
18
#include <rtl8814a_hal.h>
19
#ifdef CONFIG_RTW_SW_LED
20
21
/* ********************************************************************************
22
* LED object.
23
* ******************************************************************************** */
24
25
26
/* ********************************************************************************
27
* Prototype of protected function.
28
* ******************************************************************************** */
29
30
31
/* ********************************************************************************
32
* LED_819xUsb routines.
33
* ******************************************************************************** */
34
35
/*
36
* Description:
37
* Turn on LED according to LedPin specified.
38
* */
39
static void
40
SwLedOn_8814AU(
41
PADAPTER padapter,
42
PLED_USB pLed
43
)
44
{
45
u32 LedGpioCfg;
46
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
47
48
if (RTW_CANNOT_RUN(padapter))
49
return;
50
51
LedGpioCfg = rtw_read32(padapter , REG_GPIO_PIN_CTRL_2); /* 0x60. In 8814AU, the name should be REG_GPIO_EXT_CTRL */
52
switch (pLed->LedPin) {
53
case LED_PIN_LED0:
54
LedGpioCfg |= (BIT16 | BIT17 | BIT21 | BIT22); /* config as gpo */
55
LedGpioCfg &= ~(BIT8 | BIT9 | BIT13 | BIT14); /* set gpo value */
56
LedGpioCfg &= ~(BIT0 | BIT1 | BIT5 | BIT6); /* set gpi value. TBD: may not need this */
57
rtw_write32(padapter , REG_GPIO_PIN_CTRL_2 , LedGpioCfg);
58
break;
59
default:
60
break;
61
}
62
pLed->bLedOn = _TRUE;
63
}
64
65
66
/*
67
* Description:
68
* Turn off LED according to LedPin specified.
69
* */
70
static void
71
SwLedOff_8814AU(
72
PADAPTER padapter,
73
PLED_USB pLed
74
)
75
{
76
u32 LedGpioCfg;
77
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter);
78
79
if (RTW_CANNOT_RUN(padapter))
80
return;
81
LedGpioCfg = rtw_read32(padapter , REG_GPIO_PIN_CTRL_2); /* 0x60. In 8814AU, the name should be REG_GPIO_EXT_CTRL */
82
switch (pLed->LedPin) {
83
case LED_PIN_LED0:
84
LedGpioCfg |= (BIT16 | BIT17 | BIT21 | BIT22); /* config as gpo */
85
LedGpioCfg |= (BIT8 | BIT9 | BIT13 | BIT14); /* set gpo output value */
86
rtw_write32(padapter , REG_GPIO_PIN_CTRL_2 , LedGpioCfg);
87
break;
88
default:
89
break;
90
}
91
92
pLed->bLedOn = _FALSE;
93
}
94
95
/* ********************************************************************************
96
* Interface to manipulate LED objects.
97
* ******************************************************************************** */
98
99
100
/* ********************************************************************************
101
* Default LED behavior.
102
* ******************************************************************************** */
103
104
/*
105
* Description:
106
* Initialize all LED_871x objects.
107
* */
108
void
109
rtl8814au_InitSwLeds(
110
_adapter *padapter
111
)
112
{
113
struct led_priv *pledpriv = adapter_to_led(padapter);
114
115
pledpriv->LedControlHandler = LedControlUSB;
116
117
pledpriv->SwLedOn = SwLedOn_8814AU;
118
pledpriv->SwLedOff = SwLedOff_8814AU;
119
120
InitLed(padapter, &(pledpriv->SwLed0), LED_PIN_LED0);
121
122
InitLed(padapter, &(pledpriv->SwLed1), LED_PIN_LED1);
123
124
InitLed(padapter, &(pledpriv->SwLed2), LED_PIN_LED2);
125
}
126
127
128
/*
129
* Description:
130
* DeInitialize all LED_819xUsb objects.
131
* */
132
void
133
rtl8814au_DeInitSwLeds(
134
_adapter *padapter
135
)
136
{
137
struct led_priv *ledpriv = adapter_to_led(padapter);
138
139
DeInitLed(&(ledpriv->SwLed0));
140
DeInitLed(&(ledpriv->SwLed1));
141
DeInitLed(&(ledpriv->SwLed2));
142
}
143
#endif
144
145