2018-06-25 15:41:56 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-08-21 21:33:59 -06:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#include <osdep_service.h>
|
|
|
|
#include <drv_types.h>
|
|
|
|
#include <rtl8188e_hal.h>
|
2014-06-11 11:21:40 -06:00
|
|
|
#include <usb_ops_linux.h>
|
2013-08-21 21:33:59 -06:00
|
|
|
|
2018-11-21 12:49:32 -07:00
|
|
|
void sw_led_on(struct adapter *padapter, struct LED_871x *pLed)
|
2013-08-21 21:33:59 -06:00
|
|
|
{
|
2018-11-21 12:49:31 -07:00
|
|
|
u8 led_cfg;
|
2013-08-21 21:33:59 -06:00
|
|
|
|
|
|
|
if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
|
|
|
|
return;
|
2018-11-21 12:49:31 -07:00
|
|
|
led_cfg = usb_read8(padapter, REG_LEDCFG2);
|
|
|
|
usb_write8(padapter, REG_LEDCFG2, (led_cfg & 0xf0) | BIT(5) | BIT(6));
|
2013-08-21 21:33:59 -06:00
|
|
|
pLed->bLedOn = true;
|
|
|
|
}
|
|
|
|
|
2018-11-21 12:49:33 -07:00
|
|
|
void sw_led_off(struct adapter *padapter, struct LED_871x *pLed)
|
2013-08-21 21:33:59 -06:00
|
|
|
{
|
2018-11-21 12:49:31 -07:00
|
|
|
u8 led_cfg;
|
2013-08-21 21:33:59 -06:00
|
|
|
|
|
|
|
if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
|
|
|
|
goto exit;
|
|
|
|
|
2018-11-21 12:49:31 -07:00
|
|
|
led_cfg = usb_read8(padapter, REG_LEDCFG2);/* 0x4E */
|
2013-08-21 21:33:59 -06:00
|
|
|
|
2016-10-07 12:01:11 -06:00
|
|
|
/* Open-drain arrangement for controlling the LED) */
|
2018-11-21 12:49:31 -07:00
|
|
|
led_cfg &= 0x90; /* Set to software control. */
|
|
|
|
usb_write8(padapter, REG_LEDCFG2, (led_cfg | BIT(3)));
|
|
|
|
led_cfg = usb_read8(padapter, REG_MAC_PINMUX_CFG);
|
|
|
|
led_cfg &= 0xFE;
|
|
|
|
usb_write8(padapter, REG_MAC_PINMUX_CFG, led_cfg);
|
2013-08-21 21:33:59 -06:00
|
|
|
exit:
|
|
|
|
pLed->bLedOn = false;
|
|
|
|
}
|
|
|
|
|
2016-09-03 09:32:20 -06:00
|
|
|
void rtw_hal_sw_led_init(struct adapter *padapter)
|
2013-08-21 21:33:59 -06:00
|
|
|
{
|
2018-11-21 12:49:28 -07:00
|
|
|
struct led_priv *pledpriv = &padapter->ledpriv;
|
2013-08-21 21:33:59 -06:00
|
|
|
|
2018-11-21 12:49:37 -07:00
|
|
|
InitLed871x(padapter, &pledpriv->sw_led);
|
2013-08-21 21:33:59 -06:00
|
|
|
}
|
|
|
|
|
2016-09-03 09:32:16 -06:00
|
|
|
void rtw_hal_sw_led_deinit(struct adapter *padapter)
|
2013-08-21 21:33:59 -06:00
|
|
|
{
|
2018-11-21 12:49:28 -07:00
|
|
|
struct led_priv *ledpriv = &padapter->ledpriv;
|
2013-08-21 21:33:59 -06:00
|
|
|
|
2018-11-21 12:49:37 -07:00
|
|
|
DeInitLed871x(&ledpriv->sw_led);
|
2013-08-21 21:33:59 -06:00
|
|
|
}
|