Beispiel #1
0
void recover_wireless_LED(struct net_device *dev)
{
	struct rtl8192cd_priv *priv;

#ifdef NETDEV_NO_PRIV
	if (dev == NULL || netdev_priv(dev) == NULL)
		return;
	
	priv = ((struct rtl8192cd_priv *)netdev_priv(dev))->wlan_priv;
#else
	if (dev == NULL || dev->priv == NULL)
		return;

	priv = (struct rtl8192cd_priv *)dev->priv;
#endif

	if (!priv->pshare->set_led_in_progress)
		return;

	// for HW/SW LED
	if ((LED_TYPE >= LEDTYPE_HW_TX_RX) && (LED_TYPE <= LEDTYPE_HW_LINKACT_INFRA)) {
		set_sw_LED0(priv, LED_OFF);
		set_sw_LED1(priv, LED_OFF);
		set_sw_LED2(priv, LED_OFF);
		enable_hw_LED(priv, LED_TYPE);
	}
	else if ((LED_TYPE >= LEDTYPE_SW_LINK_TXRX) && (LED_TYPE < LEDTYPE_SW_MAX)) {
		enable_sw_LED(priv, 0);
		mod_timer(&priv->pshare->LED_Timer, jiffies + priv->pshare->LED_Interval);
	}

	priv->pshare->set_led_in_progress = 0;
}
Beispiel #2
0
void control_wireless_led(struct rtl8192cd_priv *priv, int enable)
{
	if (enable == 0) {
		priv->pshare->set_led_in_progress = 1;
		set_sw_LED0(priv, LED_OFF);
		set_sw_LED1(priv, LED_OFF);
		set_sw_LED2(priv, LED_OFF);
	}
	else if (enable == 1) {
		priv->pshare->set_led_in_progress = 1;
		set_sw_LED0(priv, LED_ON);
		set_sw_LED1(priv, LED_ON);
		set_sw_LED2(priv, LED_ON);
	}
	else if (enable == 2) {
		set_sw_LED0(priv, priv->pshare->LED_ToggleStart);
		set_sw_LED1(priv, priv->pshare->LED_ToggleStart);
		set_sw_LED2(priv, priv->pshare->LED_ToggleStart);
		priv->pshare->set_led_in_progress = 0;
	}
}
Beispiel #3
0
void disable_sw_LED(struct rtl8192cd_priv *priv)
{
	if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA)) {
		set_sw_LED2(priv, LED_OFF);
	} else {
	set_sw_LED0(priv, LED_OFF);
	set_sw_LED1(priv, LED_OFF);
	set_sw_LED2(priv, LED_OFF);
	}
	if (timer_pending(&priv->pshare->LED_Timer))
		del_timer_sync(&priv->pshare->LED_Timer);
}
Beispiel #4
0
void set_wireless_LED_steady_on(int led_num, struct net_device *dev)
{
	struct rtl8192cd_priv *priv;

	if (led_num != LED_0 && led_num != LED_1 && led_num != LED_2)
		return;

#ifdef NETDEV_NO_PRIV
	if (dev == NULL || netdev_priv(dev) == NULL)
		return;

	priv = ((struct rtl8192cd_priv *)netdev_priv(dev))->wlan_priv;
#else
	if (dev == NULL || dev->priv == NULL)
		return;

	priv = (struct rtl8192cd_priv *)dev->priv;
#endif


	if (priv->pshare == NULL)
		return;

	priv->pshare->set_led_in_progress = 1;

	if ((LED_TYPE >= LEDTYPE_HW_TX_RX) && (LED_TYPE <= LEDTYPE_HW_LINKACT_INFRA)) {
		enable_sw_LED(priv, 0);
	}
	else if ((LED_TYPE >= LEDTYPE_SW_LINK_TXRX) && (LED_TYPE < LEDTYPE_SW_MAX)) {
		if (timer_pending(&priv->pshare->LED_Timer))
			del_timer_sync(&priv->pshare->LED_Timer);
	}

	if (led_num == LED_0)
		set_sw_LED0(priv, LED_ON);
	else if (led_num == LED_1)
		set_sw_LED1(priv, LED_ON);
	else
		set_sw_LED2(priv, LED_ON);
}
Beispiel #5
0
void calculate_sw_LED_interval(struct rtl8192cd_priv *priv)
{
	unsigned int delta = 0;
	int i, scale_num=0;

	if (priv->pshare->set_led_in_progress)
		return;

	if( (LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) && 
	    (!(OPMODE & WIFI_ASOC_STATE)))  //client not assco  , mark_led
      {        
      	 priv->pshare->LED_Interval = LED_NOBLINK_TIME; // force one second
      	 priv->pshare->LED_tx_cnt_log = priv->pshare->LED_tx_cnt; // sync tx/rx cnt
	 priv->pshare->LED_rx_cnt_log = priv->pshare->LED_rx_cnt;      
	 return ;
      }

	// calculate counter delta
	delta += UINT32_DIFF(priv->pshare->LED_tx_cnt, priv->pshare->LED_tx_cnt_log);
	delta += UINT32_DIFF(priv->pshare->LED_rx_cnt, priv->pshare->LED_rx_cnt_log);
	priv->pshare->LED_tx_cnt_log = priv->pshare->LED_tx_cnt;
	priv->pshare->LED_rx_cnt_log = priv->pshare->LED_rx_cnt;

	// update interval according to delta
	if (delta == 0) {
		if (LED_TYPE == LEDTYPE_SW_CUSTOM1) {
			if (priv->pshare->LED_Interval != RTL_SECONDS_TO_JIFFIES(1)) {
				priv->pshare->LED_Interval = RTL_SECONDS_TO_JIFFIES(1);
				mod_timer(&priv->pshare->LED_Timer, jiffies + priv->pshare->LED_Interval);
			}
		} else {
			if (priv->pshare->LED_Interval == LED_NOBLINK_TIME)
				mod_timer(&priv->pshare->LED_Timer, jiffies + priv->pshare->LED_Interval);
			else
				priv->pshare->LED_Interval = LED_NOBLINK_TIME;
		}
	} else {
		if ((priv->pmib->dot11BssType.net_work_type & WIRELESS_11G) ||
			(priv->pmib->dot11BssType.net_work_type & WIRELESS_11A))
			scale_num = LED_MAX_PACKET_CNT_AG / LED_MAX_SCALE;
		else
			scale_num = LED_MAX_PACKET_CNT_B / LED_MAX_SCALE;

		if ((LED_TYPE == LEDTYPE_SW_LINK_TXRX) ||
			(LED_TYPE == LEDTYPE_SW_LINKTXRX) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA) ||
			(LED_TYPE == LEDTYPE_SW_LED1_GPIO9_LINKTXRX_92D) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX_92D) ||
			(LED_TYPE == LEDTYPE_SW_CUSTOM1))
			scale_num = scale_num*2;

		for (i=1; i<=LED_MAX_SCALE; i++) {
			if (delta < i*scale_num)
				break;
		}

		if (priv->pshare->rf_ft_var.ledBlinkingFreq > 1) {
			i = i*priv->pshare->rf_ft_var.ledBlinkingFreq;
			if (i > LED_MAX_SCALE)
				i = LED_MAX_SCALE;
		}

		priv->pshare->LED_Interval = ((LED_MAX_SCALE-i+1)*LED_INTERVAL_TIME)/LED_MAX_SCALE;

		if (priv->pshare->LED_Interval < LED_ON_TIME)
			priv->pshare->LED_Interval = LED_ON_TIME;
	}

	if ((LED_TYPE == LEDTYPE_SW_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LINKTXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_LED1_GPIO9_LINKTXRX_92D) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX_92D)) {
		if (priv->link_status)
			priv->pshare->LED_ToggleStart = LED_ON;
		else
			priv->pshare->LED_ToggleStart = LED_OFF;
	} else {
		if (priv->pshare->set_led_in_progress)
			return;

		if ((LED_TYPE == LEDTYPE_SW_LINK_TXRX) ||
			(LED_TYPE == LEDTYPE_SW_LINK_TXRXDATA)) {
			if (priv->link_status)
				set_sw_LED0(priv, LED_ON);
			else
				set_sw_LED0(priv, LED_OFF);
		} else if (LED_TYPE == LEDTYPE_SW_ADATA_GDATA) {
			if (priv->pshare->curr_band == BAND_5G) {
				set_sw_LED0(priv, LED_ON);
				set_sw_LED1(priv, LED_OFF);
			} else {	// 11A
				set_sw_LED0(priv, LED_OFF);
				set_sw_LED1(priv, LED_ON);
			}
		}
	}
}
Beispiel #6
0
void enable_sw_LED(struct rtl8192cd_priv *priv, int init)
{
#if (defined(HW_ANT_SWITCH) || defined(SW_ANT_SWITCH))&&( defined(CONFIG_RTL_92C_SUPPORT) || defined(CONFIG_RTL_92D_SUPPORT))
		int b23 = RTL_R32(LEDCFG) & BIT(23);
#endif

	if (LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) 
		if (!(OPMODE & WIFI_STATION_STATE)) // if it is not Client mode , then run orignal 12 type
			LED_TYPE = LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA ;  
	     
	// configure mac to use SW LED
#if defined(CONFIG_RTL_88E_SUPPORT) || defined(CONFIG_WLAN_HAL_8192EE) //mark_ecos	
	if ((GET_CHIP_VER(priv) == VERSION_8188E)||(GET_CHIP_VER(priv) == VERSION_8192E))
	{
#ifdef RTLWIFINIC_GPIO_CONTROL
		RTLWIFINIC_GPIO_config(5, 0x10);
#endif
	}
	else 
#endif
	if (GET_CHIP_VER(priv) == VERSION_8812E)
		RTL_W32(LEDCFG, BIT(13) | LED1SV);
	else if (GET_CHIP_VER(priv) == VERSION_8881A) {
		writel(readl(0xb8000044) | BIT(15) | BIT(16), 0xb8000044);
		writel(readl(0xb8003500) & ~BIT(24), 0xb8003500);
		writel(readl(0xb8003508) | BIT(24), 0xb8003508);
		writel(readl(0xb800350c) | BIT(24), 0xb800350c);
	}
	else {
		if (LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX)
			RTL_W32(LEDCFG, (RTL_R32(LEDCFG)&0xFF00FFFF) | LED2EN | LED2SV);
	else if (LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA)
		RTL_W32(LEDCFG, (RTL_R32(LEDCFG)&0xFF00FFFF) | LED2EN | LED2SV);
#ifdef CONFIG_RTL_92D_SUPPORT
	else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX_92D) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA_92D))
			RTL_W32(LEDCFG,(RTL_R32(LEDCFG)&0xFF00FFFF)| LED2DIS_92D | LED2SV_92D);
		else if (LED_TYPE == LEDTYPE_SW_LED1_GPIO9_LINKTXRX_92D)
			RTL_W32(LEDCFG, (RTL_R32(LEDCFG)&0xFFFF00FF)|LED1DIS_92D | LED1SV_92D); 	
#endif
		else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) || 	
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA))
			RTL_W32(LEDCFG, (RTL_R32(LEDCFG)&0xFF00FFFF) | GP8_LED | LED2EN | LED2SV);
		else
			RTL_W32(LEDCFG, LED2SV | LED1SV | LED0SV);
	}

	priv->pshare->LED_Interval = LED_INTERVAL_TIME;
	priv->pshare->LED_Toggle = 0;
	priv->pshare->LED_ToggleStart = LED_OFF;
	priv->pshare->LED_tx_cnt_log = 0;
	priv->pshare->LED_rx_cnt_log = 0;
	priv->pshare->LED_tx_cnt = 0;
	priv->pshare->LED_rx_cnt = 0;

	if ((LED_TYPE == LEDTYPE_SW_ENABLE_TXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_ENABLETXRXDATA)) {
		set_sw_LED0(priv, LED_ON);
		set_sw_LED1(priv, LED_OFF);

		if (LED_TYPE == LEDTYPE_SW_ENABLETXRXDATA)
			priv->pshare->LED_ToggleStart = LED_ON;
	} else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA_92D)) {
		set_sw_LED2(priv, LED_ON);
		priv->pshare->LED_ToggleStart = LED_ON;
	} else if (LED_TYPE == LEDTYPE_SW_ADATA_GDATA) {
		priv->pshare->LED_ToggleStart = LED_ON;
		if (priv->pshare->curr_band == BAND_5G) {
			set_sw_LED0(priv, LED_ON);
			set_sw_LED1(priv, LED_OFF);
		}
		else {	// 11G
			set_sw_LED0(priv, LED_OFF);
			set_sw_LED1(priv, LED_ON);
		}
	}
	else if (LED_TYPE == LEDTYPE_SW_ENABLETXRXDATA_1) {
		set_sw_LED0(priv, LED_OFF);
		set_sw_LED1(priv, LED_ON);
		priv->pshare->LED_ToggleStart = LED_ON;
	}
	else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) ) {
		set_sw_LED2(priv, LED_ON);
		priv->pshare->LED_ToggleStart = LED_ON;
	}
	else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA)) {
		set_sw_LED2(priv, LED_OFF);
	}
	else {
		set_sw_LED0(priv, LED_OFF);
		set_sw_LED1(priv, LED_OFF);
		set_sw_LED2(priv, LED_OFF);
	}

#if (defined(HW_ANT_SWITCH) || defined(SW_ANT_SWITCH))&&( defined(CONFIG_RTL_92C_SUPPORT) || defined(CONFIG_RTL_92D_SUPPORT))
	RTL_W32(LEDCFG, b23 | RTL_R32(LEDCFG));
#endif

	if (init) {
#ifdef __KERNEL__
		init_timer(&priv->pshare->LED_Timer);
		priv->pshare->LED_Timer.data = (unsigned long) priv;
		priv->pshare->LED_Timer.function = &LED_Interval_timeout;
#elif defined(__ECOS)
		init_timer(&priv->pshare->LED_Timer, (unsigned long)priv, LED_Interval_timeout);
#endif
		mod_timer(&priv->pshare->LED_Timer, jiffies + priv->pshare->LED_Interval);
	}
}
Beispiel #7
0
static void LED_Interval_timeout(void *task_priv)
#endif
{
	struct rtl8192cd_priv *priv = (struct rtl8192cd_priv *)task_priv;
	int led_on_time= LED_ON_TIME;

	if (!(priv->drv_state & DRV_STATE_OPEN))
		return;

#ifdef PCIE_POWER_SAVING
	if ((priv->pwr_state != L1) && (priv->pwr_state != L2))
#endif
	{
		if ((LED_TYPE == LEDTYPE_SW_LINKTXRX) ||
			(LED_TYPE == LEDTYPE_SW_LINKTXRXDATA) ||
			(LED_TYPE == LEDTYPE_SW_ENABLETXRXDATA) ||
			((LED_TYPE == LEDTYPE_SW_ADATA_GDATA) && (priv->pshare->curr_band == BAND_5G)) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA_92D) ||
			(LED_TYPE == LEDTYPE_SW_LED1_GPIO9_LINKTXRX_92D) ||
			(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX_92D))
		{
			if (!priv->pshare->set_led_in_progress) {
				if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
					(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA) ||
					(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX) ||
					(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA) ||
					(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) ||
					(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA) ||
					(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA_92D) ||
					(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX_92D))
					set_sw_LED2(priv, priv->pshare->LED_Toggle);
				else if (LED_TYPE == LEDTYPE_SW_LED1_GPIO9_LINKTXRX_92D)
					set_sw_LED1(priv, priv->pshare->LED_Toggle);
				else
					set_sw_LED0(priv, priv->pshare->LED_Toggle);
			}
		} else {
			if (!priv->pshare->set_led_in_progress)
				set_sw_LED1(priv, priv->pshare->LED_Toggle);
		}
	}

	if( (LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) && 
	    (!(OPMODE & WIFI_ASOC_STATE)))  //client not assco  , mark_led
	{		
		led_on_time = LED_NOBLINK_TIME;
	}

	if ( priv->pshare->LED_Toggle == priv->pshare->LED_ToggleStart) {
		mod_timer(&priv->pshare->LED_Timer, jiffies + priv->pshare->LED_Interval);
	} else {
		if 	(LED_TYPE == LEDTYPE_SW_CUSTOM1)
			mod_timer(&priv->pshare->LED_Timer, jiffies + priv->pshare->LED_Interval);
		else
			mod_timer(&priv->pshare->LED_Timer, jiffies + led_on_time); 
	}

	priv->pshare->LED_Toggle = (priv->pshare->LED_Toggle + 1) % 2;
}
void enable_sw_LED(struct rtl8192cd_priv *priv, int init)
{
#if defined(HW_ANT_SWITCH) || defined(SW_ANT_SWITCH)
		int b23 = RTL_R32(LEDCFG) & BIT(23);
#endif

	if (LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) 
		if (!(OPMODE & WIFI_STATION_STATE)) // if it is not Client mode , then run orignal 12 type
			LED_TYPE = LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA ;  
	     
	// configure mac to use SW LED
#if defined(CONFIG_RTL_92C_SUPPORT) || defined(CONFIG_RTL_92D_SUPPORT)
	if (LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX)
		RTL_W32(LEDCFG, (RTL_R32(LEDCFG)&0xFF00FFFF) | LED2EN | LED2SV);
#ifdef CONFIG_RTL_92D_SUPPORT
	else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX_92D) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA))
		RTL_W32(LEDCFG, LED2DIS_92D | LED2SV_92D);
	else if (LED_TYPE == LEDTYPE_SW_LED1_GPIO9_LINKTXRX_92D)
		RTL_W32(LEDCFG, LED1DIS_92D | LED1SV_92D);
#endif
	else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) || 	
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA))
		RTL_W32(LEDCFG, (RTL_R32(LEDCFG)&0xFF00FFFF) | GP8_LED | LED2EN | LED2SV);
	else
		RTL_W32(LEDCFG, LED2SV | LED1SV | LED0SV);
#elif defined(CONFIG_RTL_88E_SUPPORT)
	RTLWIFINIC_GPIO_config(5, 0x10);
#endif

	priv->pshare->LED_Interval = LED_INTERVAL_TIME;
	priv->pshare->LED_Toggle = 0;
	priv->pshare->LED_ToggleStart = LED_OFF;
	priv->pshare->LED_tx_cnt_log = 0;
	priv->pshare->LED_rx_cnt_log = 0;
	priv->pshare->LED_tx_cnt = 0;
	priv->pshare->LED_rx_cnt = 0;

	if ((LED_TYPE == LEDTYPE_SW_ENABLE_TXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_ENABLETXRXDATA)) {
		set_sw_LED0(priv, LED_ON);
		set_sw_LED1(priv, LED_OFF);

		if (LED_TYPE == LEDTYPE_SW_ENABLETXRXDATA)
			priv->pshare->LED_ToggleStart = LED_ON;
	} else if (LED_TYPE == LEDTYPE_SW_LED2_GPIO10_ENABLETXRXDATA) {
		set_sw_LED2(priv, LED_ON);
		priv->pshare->LED_ToggleStart = LED_ON;
	} else if (LED_TYPE == LEDTYPE_SW_ADATA_GDATA) {
		priv->pshare->LED_ToggleStart = LED_ON;
		if (priv->pshare->curr_band == BAND_5G) {
			set_sw_LED0(priv, LED_ON);
			set_sw_LED1(priv, LED_OFF);
		}
		else {	// 11G
			set_sw_LED0(priv, LED_OFF);
			set_sw_LED1(priv, LED_ON);
		}
	}
	else if (LED_TYPE == LEDTYPE_SW_ENABLETXRXDATA_1) {
		set_sw_LED0(priv, LED_OFF);
		set_sw_LED1(priv, LED_ON);
		priv->pshare->LED_ToggleStart = LED_ON;
	}
	else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ENABLETXRXDATA) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_ASOCTXRXDATA) ) {
		set_sw_LED2(priv, LED_ON);
		priv->pshare->LED_ToggleStart = LED_ON;
	}
	else if ((LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO10_LINKTXRX) ||
		(LED_TYPE == LEDTYPE_SW_LED2_GPIO8_LINKTXRXDATA)) {
		set_sw_LED2(priv, LED_OFF);
	}
	else {
		set_sw_LED0(priv, LED_OFF);
		set_sw_LED1(priv, LED_OFF);
		set_sw_LED2(priv, LED_OFF);
	}

#if defined(HW_ANT_SWITCH) || defined(SW_ANT_SWITCH)
	RTL_W32(LEDCFG, b23 | RTL_R32(LEDCFG));
#endif

	if (init) {
#ifdef __KERNEL__
		init_timer(&priv->pshare->LED_Timer);
		priv->pshare->LED_Timer.expires = jiffies + priv->pshare->LED_Interval;
		priv->pshare->LED_Timer.data = (unsigned long) priv;
		priv->pshare->LED_Timer.function = &LED_Interval_timeout;
#elif defined(__ECOS)
		init_timer(&priv->pshare->LED_Timer, (unsigned long)priv, LED_Interval_timeout);
#endif
		mod_timer(&priv->pshare->LED_Timer, jiffies + priv->pshare->LED_Interval);
	}
}