Skip to content

Commit

Permalink
new LED control
Browse files Browse the repository at this point in the history
  • Loading branch information
morrownr committed Feb 18, 2022
1 parent 268ace6 commit 2f4fa07
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
16 changes: 0 additions & 16 deletions hal/led/hal_usb_led.c
Original file line number Diff line number Diff line change
Expand Up @@ -1745,22 +1745,6 @@ void BlinkHandler(PLED_USB pLed)
return;
}

#ifdef CONFIG_SW_LED
// 1 is normal blinking
if (padapter->registrypriv.led_ctrl != 1) {
if (padapter->registrypriv.led_ctrl == 0)
{
// Set LED to be off
pLed->BlinkingLedState = RTW_LED_OFF;
} else {
// Set LED to be on solid for 2 or greater
pLed->BlinkingLedState = RTW_LED_ON;
}
// Skip various switch cases where SwLedBlink*() is called below
pLed->CurrLedState = LED_UNKNOWN;
}
#endif

switch (ledpriv->LedStrategy) {
#if CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY
case SW_LED_MODE_UC_TRX_ONLY:
Expand Down
24 changes: 20 additions & 4 deletions hal/rtl8822b/usb/rtl8822bu_led.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,19 @@ static void swledon(PADAPTER padapter, PLED_USB led)
case LED_PIN_LED1:
case LED_PIN_LED2:
default:
rtw_halmac_led_switch(adapter_to_dvobj(padapter), 1);
if (padapter->registrypriv.led_ctrl == 0) {
rtw_halmac_led_switch(adapter_to_dvobj(padapter), 0);
} else {
rtw_halmac_led_switch(adapter_to_dvobj(padapter), 1);
}
break;
}

led->bLedOn = _TRUE;
if (padapter->registrypriv.led_ctrl == 0) {
led->bLedOn = _FALSE;
} else {
led->bLedOn = _TRUE;
}
}


Expand All @@ -83,11 +91,19 @@ static void swledoff(PADAPTER padapter, PLED_USB led)
case LED_PIN_LED1:
case LED_PIN_LED2:
default:
rtw_halmac_led_switch(adapter_to_dvobj(padapter), 0);
if (padapter->registrypriv.led_ctrl <= 1) {
rtw_halmac_led_switch(adapter_to_dvobj(padapter), 0);
} else {
rtw_halmac_led_switch(adapter_to_dvobj(padapter), 1);
}
break;
}

led->bLedOn = _FALSE;
if (padapter->registrypriv.led_ctrl <= 1) {
led->bLedOn = _FALSE;
} else {
led->bLedOn = _TRUE;
}
}

/*
Expand Down
2 changes: 1 addition & 1 deletion include/autoconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@

#define CONFIG_RTW_LED
#ifdef CONFIG_RTW_LED
// #define CONFIG_RTW_SW_LED
#define CONFIG_RTW_SW_LED
#ifdef CONFIG_RTW_SW_LED
/* #define CONFIG_RTW_LED_HANDLED_BY_CMD_THREAD */
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/drv_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ struct registry_priv {
#ifdef CONFIG_TX_EARLY_MODE
u8 early_mode;
#endif
#ifdef CONFIG_SW_LED
#ifdef CONFIG_RTW_SW_LED
u8 led_ctrl;
#endif
#ifdef CONFIG_NARROWBAND_SUPPORTING
Expand Down
10 changes: 5 additions & 5 deletions os_dep/linux/os_intfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ int rtw_check_fw_ps = 1;
int rtw_early_mode = 1;
#endif

#ifdef CONFIG_SW_LED
int rtw_led_ctrl = 1; // default to normal blinking
#ifdef CONFIG_RTW_SW_LED
int rtw_led_ctrl = 1; /* default led blink */
#endif

int rtw_usb_rxagg_mode = 2;/* RX_AGG_DMA=1, RX_AGG_USB=2 */
Expand Down Expand Up @@ -617,9 +617,9 @@ module_param(rtw_pci_aspm_enable, int, 0644);
module_param(rtw_early_mode, int, 0644);
#endif

#ifdef CONFIG_SW_LED
#ifdef CONFIG_RTW_SW_LED
module_param(rtw_led_ctrl, int, 0644);
MODULE_PARM_DESC(rtw_led_ctrl,"Led Control: 0=Always off, 1=Normal blink, 2=Always on");
MODULE_PARM_DESC(rtw_led_ctrl,"led control, 0:led off, 1:led blink, 2:led on");
#endif

#ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
Expand Down Expand Up @@ -1318,7 +1318,7 @@ uint loadparam(_adapter *padapter)
#ifdef CONFIG_TX_EARLY_MODE
registry_par->early_mode = (u8)rtw_early_mode;
#endif
#ifdef CONFIG_SW_LED
#ifdef CONFIG_RTW_SW_LED
registry_par->led_ctrl = (u8)rtw_led_ctrl;
#endif
registry_par->trx_path_bmp = (u8)rtw_trx_path_bmp;
Expand Down

0 comments on commit 2f4fa07

Please sign in to comment.