• 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 
8 #include <osdep_service.h>
9 #include <drv_types.h>
10 #include <rtl8188e_hal.h>
11 #include <usb_ops_linux.h>
12 
sw_led_on(struct adapter * padapter,struct LED_871x * pLed)13 void sw_led_on(struct adapter *padapter, struct LED_871x *pLed)
14 {
15 	u8 led_cfg;
16 
17 	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
18 		return;
19 	led_cfg = usb_read8(padapter, REG_LEDCFG2);
20 	usb_write8(padapter, REG_LEDCFG2, (led_cfg & 0xf0) | BIT(5) | BIT(6));
21 	pLed->bLedOn = true;
22 }
23 
sw_led_off(struct adapter * padapter,struct LED_871x * pLed)24 void sw_led_off(struct adapter *padapter, struct LED_871x *pLed)
25 {
26 	u8 led_cfg;
27 
28 	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
29 		goto exit;
30 
31 	led_cfg = usb_read8(padapter, REG_LEDCFG2);/* 0x4E */
32 
33 	/*  Open-drain arrangement for controlling the LED) */
34 	led_cfg &= 0x90; /*  Set to software control. */
35 	usb_write8(padapter, REG_LEDCFG2, (led_cfg | BIT(3)));
36 	led_cfg = usb_read8(padapter, REG_MAC_PINMUX_CFG);
37 	led_cfg &= 0xFE;
38 	usb_write8(padapter, REG_MAC_PINMUX_CFG, led_cfg);
39 exit:
40 	pLed->bLedOn = false;
41 }
42 
rtw_hal_sw_led_init(struct adapter * padapter)43 void rtw_hal_sw_led_init(struct adapter *padapter)
44 {
45 	struct led_priv *pledpriv = &padapter->ledpriv;
46 
47 	InitLed871x(padapter, &pledpriv->sw_led);
48 }
49 
rtw_hal_sw_led_deinit(struct adapter * padapter)50 void rtw_hal_sw_led_deinit(struct adapter *padapter)
51 {
52 	struct led_priv *ledpriv = &padapter->ledpriv;
53 
54 	DeInitLed871x(&ledpriv->sw_led);
55 }
56