1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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.
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
14 ******************************************************************************/
16 #include <osdep_service.h>
17 #include <drv_types.h>
18 #include <rtl8188e_hal.h>
19 #include <rtl8188e_led.h>
20 #include <usb_ops_linux.h>
24 /* LED_819xUsb routines. */
26 /* Turn on LED according to LedPin specified. */
27 void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
31 if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
33 LedCfg = usb_read8(padapter, REG_LEDCFG2);
34 usb_write8(padapter, REG_LEDCFG2, (LedCfg&0xf0) | BIT(5) | BIT(6)); /* SW control led0 on. */
39 /* Turn off LED according to LedPin specified. */
40 void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
44 if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
47 LedCfg = usb_read8(padapter, REG_LEDCFG2);/* 0x4E */
49 /* Open-drain arrangement for controlling the LED) */
50 LedCfg &= 0x90; /* Set to software control. */
51 usb_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
52 LedCfg = usb_read8(padapter, REG_MAC_PINMUX_CFG);
54 usb_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
59 /* Interface to manipulate LED objects. */
60 /* Default LED behavior. */
63 /* Initialize all LED_871x objects. */
64 void rtw_hal_sw_led_init(struct adapter *padapter)
66 struct led_priv *pledpriv = &(padapter->ledpriv);
68 InitLed871x(padapter, &(pledpriv->SwLed0));
72 /* DeInitialize all LED_819xUsb objects. */
73 void rtw_hal_sw_led_deinit(struct adapter *padapter)
75 struct led_priv *ledpriv = &(padapter->ledpriv);
77 DeInitLed871x(&(ledpriv->SwLed0));